SA-MP Forums Archive
"if" doesn't work - 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)
+--- Thread: "if" doesn't work (/showthread.php?tid=546328)



"if" doesn't work - Stoyanov - 14.11.2014

Код:
if(batteries[id][count] > 1000 || batteries[id][count] < 1)
	        {
	            SendClientMessage(playerid, 0xFFFFFFFF, " 1 - 1000!");
	            return 1;
			}
			else batteries[id][count] = c;
			
			if(batteries[id][height] > 60 || batteries[id][height] < 10)
			{
			    SendClientMessage(playerid, 0xFFFFFFFF, "10 - 60!");
			    return 1;
			}
			else batteries[id][height] = h;
			
	        batteries[id][hvar] = hv;
	        
	        if(batteries[id][windspeed] < 7 || batteries[id][windspeed] > 60)
	        {
	            SendClientMessage(playerid, 0xFFFFFFFF, "7 - 60!");
	            return 1;
			}
			else batteries[id][windspeed] = w;
			
			if(batteries[id][interval] < 0.1 || batteries[id][interval] > 4)
	        {
	            SendClientMessage(playerid, 0xFFFFFFFF, "0.01 - 4!");
	            return 1;
			}
It doesn't work. When i type 1001 i don't see the message 1-1000 same thing with others.


Re: "if" doens't work - UltraScripter - 14.11.2014

pawn Код:
batteries[id][height] > || batteries[id][height] < 10;



Re: "if" doens't work - Stoyanov - 14.11.2014

What?


Re: "if" doesn't work - GGRoleplay - 14.11.2014

Try >= and =< that might do the trick, did it for me a couple of times.


Re: "if" doesn't work - UltraScripter - 14.11.2014

instead of
pawn Код:
if(batteries[id][height] > 60 || batteries[id][height] < 10)
            {
                SendClientMessage(playerid, 0xFFFFFFFF, "10 - 60!");
                return 1;
            }
            else batteries[id][height] = h;
Do This Man :
pawn Код:
batteries[id][height] > 60 || batteries[id][height] < 10)
            {
                SendClientMessage(playerid, 0xFFFFFFFF, "10 - 60!");
                return 1;
            }
            else batteries[id][height] = h;



Re: "if" doesn't work - Shaneisace - 14.11.2014

not sure if your trying to do like can't exceed the numbers

so you need to do it like

Код:
if(value < 0 || value > 10000) {
// Not allowed
} else batteries[id][count] = value;
Presume that whats you mean?


Re: "if" doesn't work - Stoyanov - 14.11.2014

Quote:
Originally Posted by GGRoleplay
Посмотреть сообщение
Try >= and =< that might do the trick, did it for me a couple of times.
Still doesn't work.

UltraScripter

Error on this:
Код:
else batteries[id][height] = h;



Re: "if" doesn't work - UltraScripter - 14.11.2014

[PAWN]
batteries[id][height] > 60 || batteries[id][height] < 10;
{
SendClientMessage(playerid, 0xFFFFFFFF, "10 - 60!");
return 1;
}
batteries[id][height] = h;


Re: "if" doesn't work - Stoyanov - 14.11.2014

Quote:
Originally Posted by Shaneisace
Посмотреть сообщение
not sure if your trying to do like can't exceed the numbers

so you need to do it like

Код:
if(value < 0 || value > 10000) {
// Not allowed
} else batteries[id][count] = value;
Presume that whats you mean?
it's a firework system. I'm trying to make limits for the rockets, height and etc.


Re: "if" doesn't work - Stoyanov - 14.11.2014

Quote:
Originally Posted by UltraScripter
Посмотреть сообщение
[PAWN]
batteries[id][height] > 60 || batteries[id][height] < 10;
{
SendClientMessage(playerid, 0xFFFFFFFF, "10 - 60!");
return 1;
}
batteries[id][height] = h;
Invalid expression assumed to zero:
Line: 459
Код:
{