SA-MP Forums Archive
SendClientMessageToAll not respecting "if" block? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: SendClientMessageToAll not respecting "if" block? (/showthread.php?tid=250636)



SendClientMessageToAll not respecting "if" block? - borba - 23.04.2011

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.


Re: SendClientMessageToAll not respecting "if" block? - the_zande - 24.04.2011

did u storage ur account informations?


Re: SendClientMessageToAll not respecting "if" block? - borba - 24.04.2011

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


Re: SendClientMessageToAll not respecting "if" block? - linuxthefish - 24.04.2011

Where are you putting this "If Block"?


Re: SendClientMessageToAll not respecting "if" block? - borba - 24.04.2011

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


Re: SendClientMessageToAll not respecting "if" block? - borba - 24.04.2011

bump


Re: SendClientMessageToAll not respecting "if" block? - Mean - 24.04.2011

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, "------------------------------------------------------------------------------------------");
    }
}



Re: SendClientMessageToAll not respecting "if" block? - [NoV]LaZ - 24.04.2011

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
}