Is player Jailed? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Is player Jailed? (
/showthread.php?tid=237603)
Is player Jailed? - Unknown123 - 10.03.2011
First i Admin Jail a player then i try to Unjail...
What is wrong with this part? it just says that the player is not jailed, but he is
pawn Код:
else if(AdminJail[ClickedPlayer[playerid]] == 0 || Alcatraz[ClickedPlayer[playerid]] == 0 || ArmyJail[ClickedPlayer[playerid]] == 0 || Jailed[ClickedPlayer[playerid]] == 0)
{
format(string, sizeof(string), "%s(%d) Is not in jail", PlayerName(ClickedPlayer[playerid]), ClickedPlayer[playerid]);
SendClientMessage(playerid, COLOR_ERROR, string);
return 1;
}
And this work:
pawn Код:
else if(AdminJail[ClickedPlayer[playerid]] == 0)
{
format(string, sizeof(string), "%s(%d) Is not in jail", PlayerName(ClickedPlayer[playerid]), ClickedPlayer[playerid]);
SendClientMessage(playerid, COLOR_ERROR, string);
return 1;
}
Re: Is player Jailed? -
Steven82 - 10.03.2011
I don't know if this is right, but change "||" to "&&".
P.S. Im just guessing lol
Re: Is player Jailed? -
Serbish - 10.03.2011
As Steven82 guessed, you have to make ' && ' (AND) instead of ' || ' (OR).
Re: Is player Jailed? -
Steven82 - 10.03.2011
See i thought thats what || meant

Thanks for helping me out Serbish lol
Re: Is player Jailed? - Unknown123 - 10.03.2011
Thanks :P
But this is right? :S
This works
pawn Код:
else if(AdminJail[ClickedPlayer[playerid]] == 1 || Alcatraz[ClickedPlayer[playerid]] == 1 || ArmyJail[ClickedPlayer[playerid]] == 1 || Jailed[ClickedPlayer[playerid]] == 1)
{
format(string, sizeof(string), "%s(%d) Is already in jail", PlayerName(ClickedPlayer[playerid]), ClickedPlayer[playerid]);
SendClientMessage(playerid, COLOR_ERROR, string);
return 1;
}
pawn Код:
else if(AdminJail[ClickedPlayer[playerid]] == 1 (OR) Alcatraz[ClickedPlayer[playerid]] == 1 (OR) ArmyJail[ClickedPlayer[playerid]] == 1 (OR) Jailed[ClickedPlayer[playerid]] == 1)
It cant be:
pawn Код:
else if(AdminJail[ClickedPlayer[playerid]] == 1 (AND) Alcatraz[ClickedPlayer[playerid]] == 1 (AND) ArmyJail[ClickedPlayer[playerid]] == 1 (AND) Jailed[ClickedPlayer[playerid]] == 1)
Because he cant be in 4 different jail at same time
Please correct me if im wrong
Re: Is player Jailed? -
Serbish - 10.03.2011
In the first post, you posted the value of each variable with ' 0 ' which means the player is NOT in jail.
That means, the variables must be with ' && ' (AND).
If you use the value ' 1 ' of each variable, which means the player IS in jail, then of course you can use ' || ' (OR).