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



Array size - klimgorilla - 16.04.2014

Hey guys,

I'm trying to connect my sa-mp project with my PHP management system but i've some problems with array sizes.

This is how I create my array to store goods for a truck mission.
pawn Код:
new TS_Goods[][32];
Then I fill the array with data from the database. So far so good but I'll never get the size of the array since I didn't define it.
pawn Код:
good = random(?);
A simple solution would be to store the SQL num rows into a variable to use it later on. But this solution feels wrong.
pawn Код:
good = random(SQL_num_rows);
Do you guys have any other ideas?

EDIT:

So I've used the simple solution and it works quite well. Adding these variables might use more memory but it doesn't leave any empty slots in the arrays.