|| and && question.
#1

I am trying to make a /setadmin command, and I am trying to make it available for only RCON Admins or Level 1337 Admins. Now how do I go about this? I even looked in a C help forum to figure out the difference between
Код:
|| and &&
and once I figured that out I changed my command in light of this and there was no difference.

So here is my question. How can I make this command available for RCON Admins or Level 1337 Admins? Not a real big issue I just really need to learn to distinguish || from &&.

My code.

pawn Код:
if(!IsPlayerAdmin(playerid) || pInfo[playerid][pAdmin] != 1337)
    {
        return SendClientMessage(playerid,COLOR_LIGHTGRAY,"You are not authorized to use that command.");
    }
And here is the if statement that sets their admin level.

pawn Код:
else if(IsPlayerAdmin(playerid) || pInfo[playerid][pAdmin] == 1337)
    {
        format(tidstring,sizeof(tidstring),"Administrator %s has made you a level %d Adminstrator.",sin,aLevel);
        format(sidstring,sizeof(sidstring),"You have made %s a level %d Administrator.",tin,aLevel);
        SendClientMessage(tid,COLOR_AQUA,tidstring);
        SendClientMessage(sid,COLOR_AQUA,sidstring);
        pInfo[tid][pAdmin] = aLevel;
        return 1;
    }
Am I using the if statements correctly?
Reply


Messages In This Thread
|| and && question. - by ReneG - 22.02.2012, 01:50
Re: || and && question. - by coole210 - 22.02.2012, 02:01
Re: || and && question. - by DRIFT_HUNTER - 22.02.2012, 02:18
Re: || and && question. - by JhnzRep - 22.02.2012, 02:44
Re: || and && question. - by ReneG - 22.02.2012, 03:30
Re: || and && question. - by suhrab_mujeeb - 22.02.2012, 03:56
Re: || and && question. - by [HiC]TheKiller - 22.02.2012, 03:58
Re: || and && question. - by ReneG - 22.02.2012, 04:00

Forum Jump:


Users browsing this thread: 1 Guest(s)