Need help with building - 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: Need help with building (
/showthread.php?tid=660273)
Need help with building -
v1k1nG - 29.10.2018
What's up?
So I wrote this snippet
PHP код:
switch(P[playerid][Level]){
case 0..20: SetPlayerColor(playerid, COLOR_NOOB);
case 21..50: SetPlayerColor(playerid, COLOR_PRISONER);
case 51..200: SetPlayerColor(playerid, COLOR_SKILLED_PRISONER);
case 201..500: SetPlayerColor(playerid, COLOR_PROFESSIONAL_PRISONER);
case 501..1000: SetPlayerColor(playerid, COLOR_DISCORDIA_GOD);
case 1001..200000: SetPlayerColor(playerid, COLOR_GOD);
}
and now compiler frozens! If I comment this snippet up, it will build.
I am using SublimeText to edit/build
Re: Need help with building -
kristo - 29.10.2018
Don't use switch with such large ranges. The compiler generates a jump table with 200002 elements (there is an extra element at the beginning that stores the count of all other elements), which takes at least a minute to compile, if not more. It also affects the runtime performance, so a chain of else if's will probably even be faster here.
Re: Need help with building -
v1k1nG - 29.10.2018
Hue thanks for the fast reply!
EDIT: Works indeed, thanks a lot