block commands in jail help
#1

I need players in jail can not use any kind of commands I have this thanks


Код:
CMD:jail(playerid, params[])
{
 if(Player[playerid][Level] < 1) return SendClientMessage(playerid,-1,"{FFFFFF}Error: {0099FF}only level 1.");
 new string[128], Jugador[MAX_PLAYER_NAME], AdminJ[MAX_PLAYER_NAME];
 if(sscanf(params, "ui", params[0], params[1])) return SendClientMessage(playerid, -1, "Use: /Jail [id] [minutes]");
 if(IsPlayerConnected(params[0]))
 {
 SetPlayerPos(params[0], my cordinates xxx);
 ResetPlayerWeapons(playerid);
 SetPlayerVirtualWorld(params[0], 0);
 JailTiempo[params[0]] = SetTimer("Libre", params[1]*60*1000, false);
 JailSi[params[0]] = 1;
 GetPlayerName(playerid, AdminJ, sizeof(AdminJ));
 GetPlayerName(params[0], Jugador, sizeof(Jugador));
 format(string, sizeof(string), "- admi %s jailed to %s por %i minute.", AdminJ, Jugador, params[1]);
 SendClientMessageToAll(-1, string);
 }
 else SendClientMessage(playerid, -1, "player no online.");
 return 1;
}
//------------------------------------------------------------------------------
CMD:unjail(playerid, params[])
{
 new string1[128], Jugador1[MAX_PLAYER_NAME];
 if(sscanf(params, "u", params[0])) return SendClientMessage(playerid, -1, "Use: /UnJail [id]");
 if(IsPlayerConnected(params[0]))
 {
 if(JailSi[params[0]] == 0) return SendClientMessage(playerid, -1, "player is in jail.");
 SpawnPlayer(params[0]);
 SetPlayerInterior(params[0], 0);
 SetPlayerVirtualWorld(params[0], 0);
 KillTimer(JailTiempo[params[0]]);
 JailSi[playerid] = 0;
 GetPlayerName(params[0], Jugador1, sizeof(Jugador1));
 format(string1, sizeof(string1), "Liberaste a %s", params[0]);
 SendClientMessage(playerid, -1, string1);
 GameTextForPlayer(params[0], "~g~unjailed by admi", 5000, 4);
 PlayerPlaySound(params[0], 1057, 0.0, 0.0, 0.0);
 }
 else SendClientMessage(playerid, -1, "player no online.");
 return 1;
}
forward Libre(playerid);
public Libre(playerid)
{
  SpawnPlayer(playerid);
  SetPlayerInterior(playerid, 0);
  SetPlayerVirtualWorld(playerid, 0);
  KillTimer(JailTiempo[playerid]);
  JailSi[playerid] = 0;
  GameTextForPlayer(playerid, "~g~Descarcelado", 5000, 4);
  PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
}
Reply
#2

Put
pawn Код:
new InJail[MAX_PLAYERS];
On the top of the script
On top of every command:
pawn Код:
if(InJail[playerid] == 1) return SendClientMessage(playerid, -1, "You can't use this command, you are in jail.");
In /jail
pawn Код:
InJail[playerid] = 1;
And in /unjail
pawn Код:
InJail[playerid] = 0;
Reply
#3

On the top of your script type:
Код:
new IsJailed[MAX_PLAYERS];
Now in the jail CMD, above this line: SetPlayerPos(params[0], my cordinates xxx);
Type:
Код:
if(IsJailed[id] == 1) return SendClientMessage(playerid, -1, "That player is already in jail.");
else
{
     IsJailed[id] = 1;
}
And in OnPlayerText:
Код:
public OnPlayerText(playerid, text[])
{
	if(IsJailed[playerid] == 1)
	{
		return SendClientMessage(playerid, -1, "You are jailed");
	}
	return 0;
}
In OnPlayerConnect
Код:
public OnPlayerConnect(playerid, classid)
{
     IsJailed[playerid] = 0;
     return 1;
}
And in unjail CMD type:
Код:
if(IsJailed[playerid] == 0) return SendClientMessage(playerid, -1, "Player is not jailed");
else
{
     IsJailed[playerid] = 0
}
That's it.
Reply
#4

thanks to both I served the first but keep those scripts
solved +1 rep
Reply
#5

if(JailSi[params[0]] == 1)
{
SendClientMessage(Playerid, "You cant use this command while you're jailed.")
}
Reply
#6

Quote:
Originally Posted by BadJih
Посмотреть сообщение
if(JailSi[params[0]] == 1)
{
SendClientMessage(Playerid, "You cant use this command while you're jailed.")
}
put this in the command that you need to disallow for jailed players
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)