07.02.2011, 14:17
Under inc's:
Freeze Command:
UnFreeze Command:
OnPlayerConnect or OnPlayerDisconnect:
Edit: Next time try this: https://sampforum.blast.hk/showthread.php?tid=187229
pawn Код:
new Frozen [ MAX_PLAYERS ];
pawn Код:
dcmd_freeze(playerid,params[])
{
new Reason[66], pID;
if(Player[playerid][admin] < 1) return 0;
if(sscanf(params,"us[65]",pID,Reason)) return SendClientMessage(playerid,COLOR_GREY,"|| Usage: /freeze [playerid] [reason] ||");
if(!IsPlayerConnected(pID)) return SendClientMessage(playerid,COLOR_RED,"Nobody is connected with this ID!");
if(pID == playerid) return SendClientMessage(playerid,COLOR_RED,"You can`t FREEZE yourself");
if(Player[playerid][admin] < Player[pID][admin]) return SendClientMessage(playerid,COLOR_RED,"You can`t FREEZE a high ranked admin");
if(Frozen[pID] == 1) return SendClientMessage(playerid,COLOR_RED,"Error: player is already frozen.");
new string[128], string3[128], string4[128], str[128], name[MAX_PLAYER_NAME], aname[MAX_PLAYER_NAME];
GetPlayerName(pID,name,sizeof(name));
GetPlayerName(playerid, aname, sizeof(aname));
format(string,sizeof(string),"**(ADMIN FREEZE)** %s(%d) %s",name,pID,Reason);
format(string3,sizeof(string3),"You Have Been FROZEN By Admin For: %s",Reason);
format(string4,sizeof(string4),"You Have FREEZE %s(%d) For Reason %s",name, pID, Reason);
format(str,sizeof(str), "Admin %s(%d) Has FREEZED %s(%d) For Reason: %s",aname,playerid,name,pID,Reason);
SendClientMessageToAll(gold,string);
SendClientMessage(pID, f,string3);
SendClientMessage(playerid, COLOR_GREEN,string4);
SendAdminMessage(COLOR_YELLOW, str);
TogglePlayerControllable(pID, 0);
Frozen[pID] = 1;
SaveToFile("Freeze", str);
return 1;
}
pawn Код:
dcmd_unfreeze(playerid,params[])
{
new Reason[128], pID;
if(Player[playerid][admin] < 1) return 0;
if(sscanf(params,"us",pID,Reason)) return SendClientMessage(playerid,COLOR_GREY,"|| Usage: /unfreeze [playerid]||");
if(!IsPlayerConnected(pID)) return SendClientMessage(playerid,COLOR_RED,"Nobody is connected with this ID!");
if(pID == playerid) return SendClientMessage(playerid,COLOR_RED,"You can`t FREEZE yourself");
if(Player[playerid][admin] < Player[pID][admin]) return SendClientMessage(playerid,COLOR_RED,"You can`t FREEZE a high ranked admin");
if(Frozen[pID] == 0) return SendClientMessage(playerid,COLOR_RED,"Error: player is not frozen.");
new string[128], string3[128], string4[128], str[128], name[MAX_PLAYER_NAME], aname[MAX_PLAYER_NAME];
GetPlayerName(pID,name,sizeof(name));
GetPlayerName(playerid, aname, sizeof(aname));
format(string,sizeof(string),"**(ADMIN UnFrozen)** %s(%d)",name,pID);
SendClientMessageToAll(gold,string);
SendClientMessage(pID, f,"You Have Been UnFrozen By Admin");
format(string4,sizeof(string4),"You Have UnFrozen %s(%d)",name, pID);
SendClientMessage(playerid, COLOR_GREEN,string4);
format(str,sizeof(str), "Admin %s(%d) Has UnFrozen %s(%d)",aname,playerid,name,pID);
SendAdminMessage(COLOR_YELLOW, str);
TogglePlayerControllable(pID, 1);
Frozen[pID] = 0;
SaveToFile("Freeze", str);
return 1;
}
pawn Код:
Frozen[playerid] = 0;