24.01.2013, 11:10
with sscanf+zcmd plz.
CMD:freeze(playerid, params[])
{
new pName[MAX_PLAYER_NAME + 1], name[MAX_PLAYER_NAME + 1], pID, str[128];
if(!IsPlayerAdmin(playerid))
return SendClientMessage(playerid, -1, "Only admins can use this command.");
if(sscanf(params, "u", pID))
return SendClientMessage(playerid, -1, "USAGE: /freeze [PlayerID]");
if(!IsPlayerConnected(pID))
return SendClientMessage(playerid, -1, "Selected player is not connected.");
GetPlayerName(playerid, pName, sizeof pName);
GetPlayerName(pID, name, sizeof name);
TogglePlayerControllable(pID, false);
format(str, sizeof str, "Admin %s freezed you.", pName);
SendClientMessage(pID, -1, str);
format(str, sizeof str, "You freezed %s.", name);
SendClientMessage(playerid, -1, str);
format(str, sizeof str, "Admin %s freezed %s.", pName, name);
SendClientMessageToAll(-1, str);
return 1;
}
CMD:unfreeze(playerid, params[])
{
new pName[MAX_PLAYER_NAME + 1], name[MAX_PLAYER_NAME + 1], pID, str[128];
if(!IsPlayerAdmin(playerid))
return SendClientMessage(playerid, -1, "Only admins can use this command.");
if(sscanf(params, "u", pID))
return SendClientMessage(playerid, -1, "USAGE: /unfreeze [PlayerID]");
if(!IsPlayerConnected(pID))
return SendClientMessage(playerid, -1, "Selected player is not connected.");
GetPlayerName(playerid, pName, sizeof pName);
GetPlayerName(pID, name, sizeof name);
TogglePlayerControllable(pID, true);
format(str, sizeof str, "Admin %s unfreezed you.", pName);
SendClientMessage(pID, -1, str);
format(str, sizeof str, "You unfreezed %s.", name);
SendClientMessage(playerid, -1, str);
format(str, sizeof str, "Admin %s unfreezed %s.", pName, name);
SendClientMessageToAll(-1, str);
return 1;
}