30.05.2010, 13:41
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:
And i tried this:
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; }
Код:
new playerid = GetPlayerID("John"); if(playerid != INVALID_PLAYER_ID) { ... }