SA-MP Forums Archive
faster way? - 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: faster way? (/showthread.php?tid=318731)



faster way? - Unknown123 - 16.02.2012

is there a faster way to do this?

pawn Код:
switch(Items)
{
    case 0..30: Itemselect = 1;
    case 30..60: Itemselect = 2;
    case 60..90: Itemselect = 3;
    .......
    case 2970..3000: Itemselect = 100;
}



Re: faster way? - ReneG - 16.02.2012

Depends on really exactly what you're trying to do.


Re: faster way? - Jeffry - 16.02.2012

pawn Код:
Itemselect = Items/30;
If both are integers, this will work.


PS: Your first case goes from 0..29 then 30..59 (...) then 2970...2999. Else you will have double case errors.