Jail Problem
#1

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?
Reply
#2

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.");
Reply
#3

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
Reply
#4

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?
Reply
#5

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
Reply
#6

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


Forum Jump:


Users browsing this thread: 1 Guest(s)