Question about efficiency [I hail ye might y_less!] - 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 about efficiency [I hail ye might y_less!] (
/showthread.php?tid=119215)
Question about efficiency [I hail ye might y_less!] -
[HLF]Southclaw - 07.01.2010
Ok, I have a textdraw with a Number of players array on it:
new Text
Text[PLAYERS]; // PLAYERS is my predefined number for max players on my server [to avoid looping 500]
And I create this textdraw when a player connects [applying the [ ] to their playerid] I was thinking would it by more efficient to create the text on OnGameModeInit and just loop 10 so 10 get created at startup?
Thanks
Re: Question about efficiency [I hail ye might y_less!] -
Y_Less - 07.01.2010
Quote:
Originally Posted by [ЉǾǖŦĦЗŁΛẄ
~ [HellFire] ]
new Text Text[PLAYERS]; // PLAYERS is my predefined number for max players on my server [to avoid looping 500]
|
That's what foreach is for.
Quote:
Originally Posted by [ЉǾǖŦĦЗŁΛẄ
~ [HellFire] ]
And I create this textdraw when a player connects [applying the [ ] to their playerid] I was thinking would it by more efficient to create the text on OnGameModeInit and just loop 10 so 10 get created at startup?
|
Depends what is in them - if there are only 10 and they have static text there's not point creating one per player. If they are different for each player then you need one each - it's not a question of efficiency, it's a question of what they're used for.
Re: Efficiency -
[HLF]Southclaw - 07.01.2010
It's to display what XP they get when they get a certain kill or action, so it has to be dynamic as 2 players could get a kill at the same time.
Thanks for reply