27.07.2012, 14:57
Hello guys...
Yesterday i made cmd that freezes player, heres code:
now...i want to make this cmd to check is player already frozen so if i type /freeze id reason but player is already frozen it will say to me: Error: this player is already frozen.
Yesterday i made cmd that freezes player, heres code:
pawn Код:
CMD:freeze(playerid, params[])
{
new id;
new msg[50], string[128], string1[128], string2[128];
if(sscanf(params,"us[50]",id,msg)) return SendClientMessage(playerid, -1, "Usage: /freeze [id] [reason]");
TogglePlayerControllable(id,0);
SetPVarInt(id,"freeze",1);
format(string, sizeof(string), "You have frozen %s for reason: %s", PlayerName(id),msg);
SendClientMessage(playerid, COLOR_GREEN, string);
format(string1, sizeof(string1), "You have been frozen by Admin, reason: %s", msg);
SendClientMessage(id, COLOR_RED, string1);
format(string2, sizeof(string2), "%s has been frozen by Admin (%s)", PlayerName(id), msg);
SendClientMessageToAll(COLOR_RED, string2);
if(id == playerid) return SendClientMessage(playerid, COLOR_YELLOW, "Error: You cannot use this command on yourself");
if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_YELLOW, "Error: This player is not connected");
return 1;
}