CMD:freeze(playerid, params)
{
new player1, second, reason[256];
if(!IsPlayerAdmin(playerid)) return 1;
if(sscanf(params, "iis[256]", player1, second, reson))
return SendClientMessage(playerid, -1, "/freeze [ID] [Second] [Reason]");
TogglePlayerControllable(playerid, 0);
SetTimerEx("Unfreeze", second*1000, false, "i", playerid);
return 1;
}
forward Unfreeze(playerid);
public Unfreeze(playerid)
{
TogglePlayerControllable(playerid, true);
return 1;
}
Try this
PHP код:
|
// You need zcmd and sscanf2
CMD:freeze(playerid, params[]) {
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You aren't admin"); // Comment this line if you want the command for all player
new targetid;
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "Syntax: /freeze [playerid/playername]");
TogglePlayerControllable(targetid, 0);
SendClientMessage(targetid, -1, "An admin froze you.");
return 1;
}
pawn Код:
|
CMD:freeze(playerid, params[]) {
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You aren't admin"); // Comment this line if you want the command for all player
new targetid,string[128],an[MAX_PLAYER_NAME],pn[MAX_PLAYER_NAME];
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "Syntax: /freeze [playerid/playername]");
GetPlayerName(playerid,an,sizeof(an)); GetPlayerName(targetid,pn,sizeof(pn));
TogglePlayerControllable(targetid, 0);
format(string,sizeof(string),"You has been frozen by administrator: %s",an);
SendClientMessage(targetid, 0x33FF33AA, string);
format(string,sizeof(string),"You has frozen %s",pn);
SendClientMessage(targetid, 0x33FF33AA, string);
return 1;
}
CMD:unfreeze(playerid, params[]) {
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "You aren't admin"); // Comment this line if you want the command for all player
new targetid,string[128],an[MAX_PLAYER_NAME],pn[MAX_PLAYER_NAME];
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "Syntax: /unfreeze [playerid/playername]");
GetPlayerName(playerid,an,sizeof(an)); GetPlayerName(targetid,pn,sizeof(pn));
TogglePlayerControllable(targetid, 0);
format(string,sizeof(string),"You has been unfrozen by administrator: %s",an);
SendClientMessage(targetid, 0x33FF33AA, string);
format(string,sizeof(string),"You has unfrozen %s",pn);
SendClientMessage(playerid, 0x33FF33AA, string);
return 1;
}