Best way to check if Playername is same as enum
#1

Whats the best way to check for example that;

pawn Код:
if(Enum[i][Owner] == Playername)
I've tried GetPlayerName and didn't seem to work, and i'm not familiar with how strcmp works.
Reply
#2

Код:
new szPlayername[MAX_PLAYER_NAME+1];
GetPlayerName(playerid, szPlayername, sizeof(szPlayername));

if(strcmp(szPlayername, Enum[i][Owner], true) == 0) return 1; //name is the same, not case sensitive
else return 0; //name is different
This code is untested, but should work. If
Код:
 Enum[i][Owner]
throws errors, try adding in:
Код:
new szCompare[MAX_PLAYER_NAME+1];
format(szCompare, sizeof(szCompare), "%s",  Enum[i][Owner]);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)