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



Question - Jay. - 21.07.2011

Hi , I've just been thinking to myself about something.

And want to ask a question.

Is it bad to have lots of variables ?
Like [MAX_PLAYERS]; or just normal ones. Basically for checking things like for example if a gate is open.

I really want to know if it's alright to keep using lots of variables. Or is there something else I could try ?
But if variables are fine i'd just like that answer. If not , another way(if it's bad).

Like these for example are all used for a minigame I made

pawn Код:
new InGangWar[MAX_PLAYERS];
new bool:Gateopen;
new ggate;
new gTeam[MAX_PLAYERS];
new SwitchTeam[MAX_PLAYERS];
new Exited[MAX_PLAYERS];
Thanks


Re: Question - WoodPecker - 21.07.2011

Its ok if you use some variables but dont use for example 500-1000 variables.

EDIT: Take 3 reputation from me for asking questions.


Re: Question - linuxthefish - 21.07.2011

If you run into memory issues, you can always use PVars. I guess it's OK to use lots if you redefine MAX_PLAYERS to something smaller.


AW: Question - Nero_3D - 21.07.2011

And try to optimize it, as example use bitarrays for flags (false / true)