04.06.2012, 10:55
Looks like you don't know how to use GetPlayerName. Read the documentation for this and you'll see that you have to store it an array (string) first and that's what the function does.
Also keep in mind never to use those stupid wrapper functions which do the above and then return the PlayerName. This is a serious waste of computing!
Also, another thing I should mention is that the u specifier in sscanf stores INVALID_PLAYER_ID in the variable if the player is not found, so your IsPlayerConnected check is unnecessary, as it will come down to: IsPlayerConnected(INVALID_PLAYER_ID)... and how can an invalid ID be connected?
pawn Код:
new PlayerName[24];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
Also, another thing I should mention is that the u specifier in sscanf stores INVALID_PLAYER_ID in the variable if the player is not found, so your IsPlayerConnected check is unnecessary, as it will come down to: IsPlayerConnected(INVALID_PLAYER_ID)... and how can an invalid ID be connected?
pawn Код:
if(sscanf(params, "udd", giveplayerid, statcode, amount))
{
// ...
}
if(giveplayerid != INVALID_PLAYER_ID)
{
// ...
}