SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 04/10/2016, 04:38 PM   #1
iamjems
Big Clucker
 
iamjems's Avatar
 
Join Date: Aug 2016
Location: Croatia
Posts: 123
Reputation: 7
Default multiple values in if(classid == _)

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.
iamjems is offline   Reply With Quote
Old 04/10/2016, 04:45 PM   #2
Banditul18
Huge Clucker
 
Join Date: Nov 2014
Location: Brasov,Romania
Posts: 402
Reputation: 32
Default Re: multiple values in if(classid == _)

switch(classid)
{
case 1: {}
case 2: {}
case n: {}
}
n = number of class
You can use swtich, better than if , if, if
Banditul18 is offline   Reply With Quote
Old 04/10/2016, 06:14 PM   #3
izeatfishz
Huge Clucker
 
izeatfishz's Avatar
 
Join Date: Jun 2012
Posts: 231
Reputation: 43
Default Re: multiple values in if(classid == _)

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

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

however, as said above, switches are faster
izeatfishz is offline   Reply With Quote
Old 04/10/2016, 06:25 PM   #4
iamjems
Big Clucker
 
iamjems's Avatar
 
Join Date: Aug 2016
Location: Croatia
Posts: 123
Reputation: 7
Default Re: multiple values in if(classid == _)

Quote:
Originally Posted by izeatfishz View Post
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
iamjems is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Loading/Using multiple values newbienoob Scripting Help 4 02/12/2013 08:52 AM
Multiple values Alxspiker Scripting Help 2 22/09/2013 12:30 AM
Looping and returning multiple values with 1 function DBan Scripting Help 4 16/04/2012 01:33 PM
Returning multiple values in one funcion pagie1111 Help Archive 1 26/03/2010 01:40 PM
[SOLVED] Checking multiple variables for their values CaHbKo Help Archive 5 01/03/2010 01:04 PM


All times are GMT. The time now is 05:37 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.