Unable To Do Commands while caged
#1

How Do I make it so if I cage someone with this command it makes them unable to do commands?Heres Code:

public CagePrevent(playerid)
{
SetPlayerPos(playerid,LPosX[playerid],LPosY[playerid],LPosZ[playerid]);
TogglePlayerControllable(playerid, 0);
SendClientMessage(playerid,red,"|- You cant escape your punishment. You Are Still in Cage -|");
SetTimerEx("CagePlayer", 500, 0, "i", playerid);
SetTimerEx("UnCagePlayer", AccInfo[playerid][pCageTime]*1000, 0, "i", playerid);
return 1;
}

public CagePlayer(playerid)
{
if(IsPlayerConnected(playerid))
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
cage[playerid] = CreateObject(985, X, Y+4, Z, 0.0, 0.0, 0.0);
cage2[playerid] = CreateObject(985, X+4, Y, Z, 0.0, 0.0, 90.0);
cage3[playerid] = CreateObject(985, X-4, Y, Z, 0.0, 0.0, 270.0);
cage4[playerid] = CreateObject(985, X, Y-4, Z, 0.0, 0.0, 180.0);
TogglePlayerControllable(playerid, 0);
PlayerPlaySound(playerid,1137,0.0,0.0,0.0);
GameTextForPlayer(playerid,"~w~~n~~n~~n~~n~~n~~n~~ n~~n~~r~Caged",3000, 3);
}
}
Reply
#2

do this.
Код:
new caged[MAX_PLAYERS];
^^^ Top of script


onplayerspawn put:
Код:
caged[playerid] = 0;
on the command, to the person your put on the code.
Код:
caged[playerid] = 1;
and on the top of the command, right below your exocution line ( /command )
Код:
if(caged[playerid] == 1) return GameTextForPlayer(playerid,"You are caged!!",5000,4);
Reply
#3

or you could put this in the cage command

Код:
SetPVarInt(playerid,"caged",1)
and then this on the commands

Код:
if(GetPVarInt(playerid,"caged") == 1) return 0;
Reply


Forum Jump:


Users browsing this thread: