SA-MP Forums Archive
How to disable commands in jail? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to disable commands in jail? (/showthread.php?tid=279009)



How to disable commands in jail? - Sensitive - 24.08.2011

Hello!
IM using LuxAdmin and im making a stunt server. But players keep teleporting out of jail when they are jailed. Any way i can disable commands in jail?


Re: How to disable commands in jail? - Admigo - 24.08.2011

Just make a variable.
//top of script
new CommandUse=0;

command /kill
{
if(CommandUse==1) so you can use the command
{
function of the command
}
if(CommandUse==0)You cant use the command
{
SendClientMessage(playerid,COLOR_RED,"You cannot use this command in jail!");
}
}


Re: How to disable commands in jail? - Sensitive - 24.08.2011

Umm, explain please? I do not understand.


Re: How to disable commands in jail? - Kingunit - 24.08.2011

Quote:
Originally Posted by Sensitive
Посмотреть сообщение
Umm, explain please? I do not understand.
Admigo means that you need to make variables so you can check at commands if the player is in the jail. Example:

pawn Код:
if(Player[playerid][Jail] == 1) return SendClientMessage(playerid, 0xFF6347AA ,"You can't do this. You are jailed!");
You know how to create that?


Re: How to disable commands in jail? - Admigo - 24.08.2011

Its easy to use the variables and usefull


Re: How to disable commands in jail? - Sensitive - 24.08.2011

Lol, should i add it under my teleports and other cmds or under what? I am noob i know I just haven't tried to do things like this before.


Re: How to disable commands in jail? - Kingunit - 24.08.2011

Add under OnPlayerSpawn
pawn Код:
if(Player[playerid][Jailed] == 1)
    {
    //Action whatever you want
    }
Then if you jail someone, set the player to Jailed == 1.
Then add under every minigame/dm command that check what I've writed above.
Don't forget to set Jailed to 0 when the person is unjailed.


Re: How to disable commands in jail? - Sensitive - 24.08.2011

I tried but still omg. I did this...

Quote:

public OnPlayerSpawn(playerid)
if(Player[playerid][Jailed] == 1)
{
SendClientMessage(playerid, 0xFF6347AA ,"You can't do this. You are jailed!");
}

But i do not know how should it help lol?


Re: How to disable commands in jail? - =WoR=G4M3Ov3r - 24.08.2011

Quote:
Originally Posted by Sensitive
Посмотреть сообщение
I tried but still omg. I did this...



But i do not know how should it help lol?
It helps in a way, that the player can't do anything, while he's in jail, he won't be able to use any cmd


Re: How to disable commands in jail? - Admigo - 24.08.2011

Here look:
Код:
if (strcmp("/kill", cmdtext, true, 10) == 0)
{
     if(CommandUse==1)//can use
     {
	   SetPlayerHealth(playerid,0);
	   return 1;
     }
     if(CommandUse==0)//cant use
     {
           SendClientMessage(playerid,COLOR_RED,"You cannot use this command in jail!");
           return 1;
     }
}