Is player Jailed?
#1

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;
            }
Reply
#2

I don't know if this is right, but change "||" to "&&".

P.S. Im just guessing lol
Reply
#3

As Steven82 guessed, you have to make ' && ' (AND) instead of ' || ' (OR).
Reply
#4

See i thought thats what || meant Thanks for helping me out Serbish lol
Reply
#5

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

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).
Reply


Forum Jump:


Users browsing this thread: