19.01.2018, 13:25
As FreAkeD said, you should use sscanf.
PHP код:
CMD:setscore(playerid,params[])
{
if(pInfo[playerid][Admin] >= 5)
{
new targetid, score, string[144];
if(sscanf(params, "ud", targetid, score)) return SendClientMessage(playerid, RED, "USAGE: /setcriminal [playerid] [score]");
if(pInfo[targetid][Admin] == ServerInfo[MaxAdminLevel] && pInfo[playerid][Admin] != ServerInfo[MaxAdminLevel]) return SendClientMessage(playerid,RED,"SERVER: You are not authorized to use this command on this admin.");
if(IsPlayerConnected(targetid) && targetid != INVALID_PLAYER_ID)
{
CMDMessageToAdmins(playerid,"SETSCORE");
format(string, sizeof(string), "You have set \"%s's\" criminal level to '%d' ", pInfo[playerid][Name], score); SendClientMessage(playerid,blue,string);
if(targetid != playerid) { format(string,sizeof(string),"Administrator \"%s\" has set your criminal level to '%d'", pInfo[playerid][Name], score); SendClientMessage(targetid,blue,string); }
return SetPlayerCriminal(targetid, score);
} else return SendClientMessage(playerid,RED,"SERVER: Player is not connected");
} else return SendClientMessage(playerid,RED,"SERVER: You are not authorized to use this command.");
}