05.10.2015, 18:51
Quote:
hi i made a /givescore and it works but the string doesn't work
Код:
CMD:givescore(playerid,params[]) { if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid, COLOR_ERROR,"[ERROR]:you are not rcon admin"); new targetid,str[75],pname[MAX_PLAYER_NAME],score; GetPlayerName(targetid); if(sscanf(params,"ud",targetid,score)) return SendClientMessage(playerid,COLOR_ERROR,"[ERROR]:Usage(playerid)"); if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_ERROR, "[ERROR]:Player is not connected."); GetPlayerScore(targetid); SetPlayerScore(targetid,score); format(str, sizeof(str), "admin has given you %d score.",score); SendClientMessage(playerid,COLOR_YELLOW,"you have given %d score to %i",score,targetid); SendClientMessage(targetid,COLOR_PURPLE,str); return 1; } |
PHP код:
CMD:setscore(playerid, params[])
{
//check if the player is a admin
CheckPlayerAdminLevel(playerid, 3);
new target, amount;
if(sscanf(params, "ui", target, amount)) return SendClientMessagef(playerid, X11_THISTLE_1, "USAGE: /setscore [player] [amount]");
if(! IsPlayerConnected(target)) return SendClientMessage(playerid, X11_FIREBRICK, "ERROR: The specified player is not conected.");
if(GetPlayerGAdminLevel(playerid) < GetPlayerGAdminLevel(target)) return SendClientMessage(playerid, X11_FIREBRICK, "ERROR: You cannot use this command on higher level admin.");
SetPlayerScore(target, amount);
PlayerPlaySound(target, 1057, 0.0, 0.0, 0.0);
PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
SendClientMessagef(target, X11_DODGER_BLUE, "Admin %s[%i] have set your score to %i.", ReturnPlayerName(playerid), playerid, amount);
SendClientMessagef(playerid, X11_DODGER_BLUE, "You have set %s[%i]'s score to %i.", ReturnPlayerName(target), target, amount);
return 1;
}