04.10.2012, 17:11
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmd, "/setscore", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "Usage: /setscore [playerid/PartOfName] [Level]");
return 1;
}
new para1;
new level;
para1 = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
level = strval(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "Usage: /setscore [playerid/PartOfName] [Level]");
return 1;
}
if (IsPlayerAdmin(playerid) == 1)
{
if(IsPlayerConnected(para1))
{
if(para1 != INVALID_PLAYER_ID)
{
SetPlayerScore(para1, level);
format(string, sizeof(string), "[Server] You have set %s 's score to %d .", GetPlayerNameEx(para1),level);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "[Server] You have been set %d score by %s.", level,GetPlayerNameEx(playerid));
SendClientMessage(para1, COLOR_LIGHTBLUE, string);
}
}//not connected
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Your not an administrator.");
}
return 1;
}
return 0;
}