I wrote this using ZCMD and SSCANF. If you're going to use this with a GF edit, you'll need to convert it to DCMD. Good luck!
pawn Код:
commad(setwantedlevel, playerid, params[])
{
new id, level, playername[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME], string[128];
if(!IsPlayerAdmin(playerid)) // If the player is not an RCON admin, we'll send the message below.
return SendClientMessage(playerid, COLOR_WHITE, "You are not an RCON admin!");
if(sscanf(params, "ud", id, level)) // We're checking if the player has the params with their executed command in that order
return SendClientMessage(playerid, COLOR_WHITE, "SYNTAX: /setwantedlevel [playerid] [level]");
if(!IsPlayerConnected(id)) // If the "giveplayer" is not connected, we'll send the message below.
return SendClientMessage(playerid, COLOR_WHITE, "That player is not connected!");
if(GetPlayerWantedLevel(id) > 6)) // If the "giveplayers" wanted level is greater than 6, we won't go any higher and send them a message
return SendClientMessage(playerid, COLOR_WHITE, "That players wanted level is already 6 stars!");
SetPlayerWantedLevel(id, level); // Settings the players wanted level
GetPlayerName(id, playername, sizeof(playername)); // Getting the "giveplayers" name
GetPlayerName(playerid, sendername, sizeof(sendername)); // Getting the "senders" name
format(string, sizeof(string), "You have set %s's wanted level to %d.", playername, level);
SendClientMessage(playerid, COLOR_WHITE, string); // Sending the message above
format(string, sizeof(string), "Administration %s has set your wanted level to %d.", sendername, level);
SendClientMessage(id, COLOR_WHITE, string); // Sending the message above
return 1;
}