| Blockland Forums > Modification Help |
| findClientByName. |
| << < (2/4) > >> |
| Truce:
--- Quote from: Destiny/Zack0Wack0 on August 24, 2010, 09:15:24 PM --- --- Code: ---function findClientByName(%name) { for(%i=0;%i<ClientGroup.getCount();%i++) { %client = ClientGroup.getObject(%i); if(strPos(%client.getPlayerName(),%name) > -1) return %client; } return -1; } --- End code --- --- End quote --- I'd suggest not making it case sensitive: --- Code: ---function findClientByName(%name) { %count = ClientGroup.getCount(); for(%i = 0; %i < %count; %i++) { %client = ClientGroup.getObject(%i); if(striPos(%client.getPlayerName(),%name) != -1) return %client; } return -1; } --- End code --- |
| otto-san:
is it really necessary to use getPlayerName or could I just do %client.name |
| Headcrab Zombie:
I've always used %client.name, that's what I'm used to using, and it always worked fine. |
| otto-san:
cool :cookieMonster: |
| AGlass0fMilk:
--- Quote from: otto-san on August 26, 2010, 05:34:12 PM ---is it really necessary to use getPlayerName or could I just do %client.name --- End quote --- This is the preferred way by Badspot to get the player's name, it was in an update a while back. He said to use it instead of %Client.name. I would use %Client.getPlayerName() instead of %Client.name just because Badspot said to and you know... he can change stuff whenever he wants... |
| Navigation |
| Message Index |
| Next page |
| Previous page |