SA-MP Forums Archive
>= in cases? - 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: >= in cases? (/showthread.php?tid=481162)



>= in cases? - Voxel - 14.12.2013

Hello guys,

I'm having a bit of a strugle with my switch, basicly what i want is when the exp case is between 0 and 500 it will show
"amount of exp/500" but i cant seem to get the structure right.
pawn Код:
switch(User[playerid][USER_EXP])
{
    case 0: format(InfoString, sizeof(InfoString), "Exp: ~w~%d/500", tdexp) && PlayerTextDrawSetString(playerid,     exp[playerid], InfoString);
    case 500: format(InfoString, sizeof(InfoString), "Exp: ~w~%d/1500", tdexp) && PlayerTextDrawSetString(playerid, exp[playerid], InfoString);
}
//I tried stuff like
case 0 || 500:
//But i tested it and it won't work, i also checked the wiki for this but no help.
What would be the correct way to do this?

thanks.


Re: >= in cases? - Tagathron - 14.12.2013

pawn Код:
case 0 .. 500
That.


Re: >= in cases? - Voxel - 14.12.2013

Quote:
Originally Posted by Tagathron
Посмотреть сообщение
pawn Код:
case 0 .. 500
That.
Thank you.


Re: >= in cases? - cessil - 14.12.2013

that'd be 0 to 500, if you only want 0 or 500 use a comma

case 0, 500:


Re: >= in cases? - Voxel - 14.12.2013

Quote:
Originally Posted by cessil
Посмотреть сообщение
that'd be 0 to 500, if you only want 0 or 500 use a comma

case 0, 500:
I want 0 till 500 so I guess this is good, thanks for your reply!