SA-MP Forums Archive
Jail Problem - 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: Jail Problem (/showthread.php?tid=463077)



Jail Problem - Alexica721 - 10.09.2013

Hi all,

I have a jail problem.

An admin can give cars to players when they are at jail.
I want that when admin tries to give a player that is in jail to send him a message:Error:That player is in jail.You cant give him cars.

Can you help me?


Re: Jail Problem - Eyce - 10.09.2013

Create a variable that indicates whether a player is jailed or not. On the code below, it would just be temporary. So I suggest that you add it up onto your player stats or information (usually PlayerInfo[MAX_PLAYERS][pInfo] for role-play servers), add something like PlayerInfo[playerid][pJailed]

Then restrict admins by simply checking if that variable is not 0, meaning the player is jailed. Do something like this:
pawn Код:
if(PlayerInfo[ID_OF_PLAYER][pJailed] != 0) return SendClientMessage(playerid, -1, "Error: That player is in jail. You cant give him cars.");



Re: Jail Problem - Alexica721 - 10.09.2013

i actually used this


pawn Код:
new ID;
        if(inDM[ID] == 1)
        {
        SendClientMessage(playerid, COLOR_RED, "Jucatorul este in dm.Nu-i poti da o masina.");
            return 1;
        }
is this correct


Re: Jail Problem - Eyce - 10.09.2013

Something like that, but depends on your script. Whenever you jail a player, what variable do you use to indicate that the player is jailed?


Re: Jail Problem - Alexica721 - 10.09.2013

sorry i used a code like this


pawn Код:
new ID;
        if(pCaged[ID] == 1)
        {
        SendClientMessage(playerid, COLOR_RED, "Jucatorul este in dm.Nu-i poti da o masina.");
            return 1;
        }
i actually used this on dm too


Re: Jail Problem - Eyce - 10.09.2013

That should do it. Although, it would be better if you save it like a player's stat.