little help with the !
#1

Hello i want to ask how to make in my script if someone is not admin or VIP to kick him i am here:
Код:
	if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK)
    {
        if(player_Admin[playerid] == 1 || player_VIP[playerid] == 1 || (player_VIP[playerid] == 1 && player_Admin[playerid] == 1)){

		}else
        {
............SOME CODE FOR KICKING......
        }
    }
How to make if the player is not admin ot vip or admin+vip to kick him ?
This code is working but when i do it like this

Код:
	if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK)
    {
        if(!player_Admin[playerid] == 1 || !player_VIP[playerid] == 1 || !(player_VIP[playerid] == 1 && player_Admin[playerid] == 1)){
............SOME CODE FOR KICKING......
        }
    }
It gets tag mistmach or something like this
Reply
#2

the == check is for a match. if you want to check for a "not match", use the != to modify your second code snippet. the first one looks ok:
pawn Код:
if(player_Admin[playerid] == 1 || player_VIP[playerid] == 1)
{
//player is 1) admin, 2) VIP, or 3) admin and vip, execute kick-code.
}
if player is NOT admin, OR if hes not VIP (neither one or both), then execute the code in the { } brackets. the first check will fail, so add:
pawn Код:
else
{
...tell the player who typed that command, that hes not admin nor vip, so he cannot use it, and return 1; .
}
checking for a player being (admin AND vip) is irrelevant as long as one criteria is met to use the command.

omg that looks complicated. in short, avoid this:
pawn Код:
!player_Admin[playerid] == 1
Reply
#3

Thank you a lot (rep)
I tried this because in PHP this the way to got the else effect
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)