SA-MP Forums Archive
Is it possible inside a multi dimensional array? - 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: Is it possible inside a multi dimensional array? (/showthread.php?tid=610385)



Is it possible inside a multi dimensional array? - Sjn - 23.06.2016

I have an array that holds all the job locations, more than 300 locations are added and my problem is; locations where the passenger spawns for taxi mission are more than any other class'. The location IDs are from 206 to 348 for taxi mission.

The location IDs are added like this inside the job array

PHP код:
new g_Job[MAX_JOB][e_JOB_DATA] = {
        {
"null"0, {0}, {0}}, // Null, doesn't count
        // Some more
                                         // Start points        // End points
                                         // v              v    v  v
        
{"Passenger"VEHICLE_TYPE_TAXI, {206207208 ... }, {00}} 
So, while adding the start points, adding all the locations like 206, 207, 208 to 348 would take a lot of lines and make the code look messy as well. Is it possible to shorten them somehow? So it would count from 206 to 348 at once. For example, inside the switch we can do case 206 .. 348 is it possible to do something like this here?


Re: Is it possible inside a multi dimensional array? - Smileys - 23.06.2016

Why not just load them dynamically from an SQLite database? or some other saving system.


Re: Is it possible inside a multi dimensional array? - CodeStyle175 - 23.06.2016

Sjn, you are just wasting your time by making some big ass arrays over there, just make database for that and you can also change those coordinates ingame.


Re: Is it possible inside a multi dimensional array? - Sjn - 23.06.2016

Ah well, I planned to move them into the db a long ago, idk why didn't I. I think I should move them now. Anyway, thanks for the replies.