08.12.2010, 23:17
never used strcmp and strtok, i'll give it a try.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/addscore", cmdtext, true, 10) == 0)
{
new tmp[256];
tmp = strtok ( cmdtext, idx );
if ( !strlen ( tmp ) )
{
SendClientMessage(playerid, COLOR_RED, "USAGE: /addscore [ID]");
return 1;
}
new score = GetPlayerScore(tmp);
SetPlayerScore(tmp,score+1);
new name[MAX_PLAYER_NAME], string[49];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "%s(%d) added 1 score extra to your account.",name,playerid); //sends that message only to the plyer who got the score... %s is meant to say the Playername + ID of who added the score to him
SendClientMessagel(tmp,0xFFFF00AA, string);
return 1;
}
return 0;
}