View Full Version : Comapre strings with online players - is it possible?

26/01/2014, 12:25 PM

I am currently making a command that will allow the owners of a server to be able to change the password of an offline player (my script is made so the command wont work if the player is online)

So, i am wondering, can you compare a string with if it's an invalid player id ?

new passname[MAX_PLAYER_NAME+1];

//then i use the sscanf line to define that the passname is the name of the account
if(sscanf(params, "s[MAX_PLAYER_NAME+1]s[130]", passname, password))
//send an error here ofc

//then i tried this, but it didn't work out so well, because the error tells me that it must be indexed.
if(passname == INVALID_PLAYER_ID)
//But, since it is the PLAYER_ID - Do i have to use a stock that retrieves the id of the name?

Oh well, not that hard but, am i right i need a stock there?

26/01/2014, 12:37 PM
for(new Slots = GetMaxPlayers(), P; P < Slots; P++)
new PlayerName[MAX_PLAYER_NAME + 1];
if(!strcmp(Name,PlayerName,false)) return 1;
return 0;


26/01/2014, 01:20 PM
Thankyou for that one, and as far as i can see, this is your own stock for checking if the name is online.

I guess i found out, that you can compare strings with INVALID_PLAYER_ID then ^^