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



Saving Space. - CannonBolt - 02.10.2016

I'm trying to simplify my code because i don't like have 10k lines and 20% are just waste lines and could be gunned down to 5k,so my question today is that i've 100 cases..
case 1:
case 2:
etc etc..

and i want to show a specific textdraw for each of these cases and i cant do case 1..100: so repeat the show textdraw for the 100 cases is a good thing or bad thing?


Re: Saving Space. - AMouldyLemon - 02.10.2016

Do you have an example of what you want? What you're saying doesn't really make sense to me.


Re: Saving Space. - SickAttack - 02.10.2016

If the TextDraws are like: gtdTextDraw[0], gtdTextDraw[1], etc.

Then you can show them with: gtdTextDraw[the value in switch]


Re: Saving Space. - ISmokezU - 02.10.2016

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
If the TextDraws are like: gtdTextDraw[0], gtdTextDraw[1], etc.

Then you can show them with: gtdTextDraw[the value in switch]
....

A textdraw is never hidden until you hide it,so show the textdraw for case 0: and it will show for the other 99 cases thus saving 1 line everycase.


Re: Saving Space. - SickAttack - 02.10.2016

Quote:
Originally Posted by ISmokezU
Посмотреть сообщение
....

A textdraw is never hidden until you hide it,so show the textdraw for case 0: and it will show for the other 99 cases thus saving 1 line everycase.
You could just create another function that does the same thing, but hides the TextDraw. If required, you could save the last index shown in a variable and hide the TextDraw using that index.