SendClientMessageToAll not respecting "if" block?
#1

Sup guys!

I got this "if" block:

Код:
if(AccountInfo[playerid][Level] == ADM || OWNER)
       		{
       		    new string[128];
       		    if(AccountInfo[playerid][Level] == ADM)
				{
					format(string, sizeof(string), "ADM {FF0000}%s {FFFFFF}is now online!", nome);
				}
  				else if(AccountInfo[playerid][Level] == OWNER)
		  		{
				  	format(string, sizeof(string), "MASTER ADM {00FF00}%s {FFFFFF}is now online!", nome);
				}
				SendClientMessageToAll(COLOR_WHITE, "------------------------------------------------------------------------------------------");
  				SendClientMessageToAll(COLOR_WHITE, string);
  				SendClientMessageToAll(COLOR_WHITE, "------------------------------------------------------------------------------------------");
       		}
But, the SendClientMessageToAll keeps showing, even if the player is not adm or owner!
P.S: Sorry for messed up indent, code tags screwed it up.
Reply
#2

did u storage ur account informations?
Reply
#3

Yes, i did all correct, it saves and do all stuff.
Reply
#4

Where are you putting this "If Block"?
Reply
#5

I'm putting it in the same space that loads all the player's stats when he logs in, such as money, level, etc
Reply
#6

bump
Reply
#7

pawn Код:
if(AccountInfo[playerid][Level] == ADM || OWNER)
{
    new string[128];
    if(AccountInfo[playerid][Level] == ADM)
    {
        format(string, sizeof(string), "ADM {FF0000}%s {FFFFFF}is now online!", nome);
        SendClientMessageToAll( COLOR_WHITE, string );
    }
    else if(AccountInfo[playerid][Level] == OWNER)
    {
        format(string, sizeof(string), "MASTER ADM {00FF00}%s {FFFFFF}is now online!", nome);
        SendClientMessageToAll(COLOR_WHITE, "------------------------------------------------------------------------------------------");
        SendClientMessageToAll(COLOR_WHITE, string);
        SendClientMessageToAll(COLOR_WHITE, "------------------------------------------------------------------------------------------");
    }
}
Reply
#8

First of all, the first condition is not correct.
pawn Код:
if ((something == bla) || (something else == bla))
{
...
}
You could do something like:
pawn Код:
if (AccountInfo[playerid][Level] == ADM)
{
    // do something
}
else if (AccountInfo[playerid][Level] == OWNER)
{
    // do something
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)