SA-MP Forums Archive
little help with the ! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: little help with the ! (/showthread.php?tid=360866)



little help with the ! - TheDeath - 19.07.2012

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


Re: little help with the ! - Babul - 19.07.2012

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



Re: little help with the ! - TheDeath - 19.07.2012

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