SA-MP Forums Archive
i don't remember... - 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: i don't remember... (/showthread.php?tid=169258)



i don't remember... - pmk1 - 18.08.2010

hey guys, i'm posting because i don't remember what to put in switch's (). What actually i have to put in the () ??

i mean :

switch() //here
{
case 0:
{


thanks for telling me!


Re: i don't remember... - willsuckformoney - 18.08.2010

that depends on what your using.... like if your gonna use it for gTeams then you would doo

switch(gTeam[playerid])
{
//you switch stuff here
}

EDIT: what are you gonna use it for anyways? maybe i can help you more than just an example


Re: i don't remember... - pmk1 - 19.08.2010

i use different custom functions, like example function1[playerid]; and function2[playerid];

can the switch work anyway?


Re: i don't remember... - Calgon - 19.08.2010

To use separate variables in a switch statement... well, you can't, you need to create another switch statement.

pawn Код:
switch(function1[playerid])
{
 case 1: print("yay"); // and so on.
}
switch(function2[playerid])
{
 case 1: print("yay"); // and so on.
}



Re: i don't remember... - pmk1 - 19.08.2010

alright thanks :P will be very usefull to know that lol


Re: i don't remember... - pmk1 - 19.08.2010

but does the switch works with a function such as GetPlayerWeapon? like a switch with GetPlayerWeapon(playerid) == 22); and GetPlayerWeapon(playerid) == 23); ??


Re: i don't remember... - willsuckformoney - 19.08.2010

it may, you may have to do that inside the switch() i believe but give it a try^^


Re: i don't remember... - pmk1 - 19.08.2010

but for what i try i need someone to test with me and actually i have nobody to test lol