10.07.2012, 14:18
It compiles fine, just when I use it, it shuts down the server:
And help?
pawn Код:
dcmd_setscore(playerid, params[])
{
new Index;
new tmp[256];
tmp = strtok(params, Index);
new tmp2[256];
tmp2 = strtok(params, Index);
new score;
new id;
id = strval(tmp);
score = strval(tmp2);
new string[100];
new pName[MAX_PLAYER_NAME];
new pNameTwo[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
GetPlayerName(id, pNameTwo, sizeof(pNameTwo));
if(!strlen(params)) return SendClientMessage(playerid, COLOR_RED, "Usage: /setscore (ID) (Score)");
if(score == GetPlayerScore(id)) return SendClientMessage(playerid, COLOR_RED, "ERROR: Score must be different then current score");
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "ERROR: Invalid player ID");
if(PlayerInfo[playerid][Admin] < 3) return SendClientMessage(playerid, COLOR_RED, "ERROR: You need to be level 3+ to use this command");
else
{
SetPlayerScore(id, score);
format(string, sizeof(string),"-| You have set %s(%d)'s score to %d |-", pNameTwo, id, score);
SendClientMessage(playerid, COLOR_AQUA, string);
format(string, sizeof(string),"-| Administrator %s(%d) has set your score to %d |-", pName, playerid, score);
SendClientMessage(id, COLOR_AQUA, string);
}
return 1;
}