[HELP]IsNameOnline
#2

Quote:
Originally Posted by Bart_Simpson
Hello!
Can somebody give me a function : IsNameOnline(playername);

I have tried it with getplayerID, but it doesnt works, because if the name isn't online, its gives the money to ID 0.
Here is the code:
Код:
GetPlayerID(playername[])
{
for (new i = 0; i < MAX_PLAYERS; i++)
	{
		if ((IsPlayerConnected(i)) && (strcmp(playername, pName(i), true) == 0))
		{
            return i;
     	}
	}
	return INVALID_PLAYER_ID;
}
And i tried this:
Код:
new playerid = GetPlayerID("John");
	 if(playerid != INVALID_PLAYER_ID)
	 {
	 ...
	 }
Try this:

pawn Код:
if(playerid != -1)
Reply


Messages In This Thread
[HELP]IsNameOnline - by sushihusi - 30.05.2010, 13:41
Re: [HELP]IsNameOnline - by Calgon - 30.05.2010, 13:44
Re: [HELP]IsNameOnline - by sushihusi - 30.05.2010, 13:47
Re: [HELP]IsNameOnline - by sushihusi - 30.05.2010, 13:54

Forum Jump:


Users browsing this thread: 2 Guest(s)