SA-MP Forums Archive
multiple values in if(classid == _) - 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: multiple values in if(classid == _) (/showthread.php?tid=618327)



multiple values in if(classid == _) - iamjems - 04.10.2016

how can i add multiple values in if(classid == 0)
i want to have multiple classes in 1 group of commands that changes the player color etc because of multiple gang skins

so in my idea:

if(classid == 0, 1, 2) and so on. if thats possible but in another way ofcourse.

thanks boys.


Re: multiple values in if(classid == _) - Banditul18 - 04.10.2016

switch(classid)
{
case 1: {}
case 2: {}
case n: {}
}
n = number of class
You can use swtich, better than if , if, if


Re: multiple values in if(classid == _) - izeatfishz - 04.10.2016

use || - that stands for OR..
example:

if(classid == 0 || classid == 1 || classid == 2)

however, as said above, switches are faster


Re: multiple values in if(classid == _) - iamjems - 04.10.2016

Quote:
Originally Posted by izeatfishz
Посмотреть сообщение
use || - that stands for OR..
example:

if(classid == 0 || classid == 1 || classid == 2)

however, as said above, switches are faster
thanks bro really appreciate it. i just got into scripting and im scripting a simple freeroam script