09.06.2012, 08:17
You create an array to hold the players name. You use strcmp to compare the strings.
Notice the difference in "true" and "false" from the above reply? Well, if you have a registration system that is case sensitive, someone might be able to join your server with different casing, like: "john_slapper" and still be able to execute the command.
The boolean tells the script if it should ignore cases or not.
pawn Код:
new name[MAX_PLAYER_NAME]; // create an array that holds enough space to store the player name
GetPlayerName(playerid, name, MAX_PLAYER_NAME); // get the player name
if(!strcmp(name, "John_Slapper", false)) // compare both strings to match each other, aka identical
{
// do cmd
}
The boolean tells the script if it should ignore cases or not.