SA-MP Forums Archive
need to make more dimensions - 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: need to make more dimensions (/showthread.php?tid=507002)



need to make more dimensions - caoraivoso3 - 15.04.2014

well i am making a variavle to save strings and i do this way

sad[MAX_PLAYERS][6][18][45]; but this have more than 3 dimensions and it isnt permitted by pawn.

how i can make what i need?
i need this sad[MAX_PLAYERS][6][18] this and i need to make this variavle strings but i just cannot. any ideia?


Re: need to make more dimensions - caoraivoso3 - 15.04.2014

bump


AW: need to make more dimensions - Nero_3D - 15.04.2014

Well you just could use basic maths to create your 4. dimension

You could create a memory block (last dimension) of 18 * 45 cells
Now if you want to access the correct address you just need to do (x * 45 + y), x would be 0 - 17 and y 0 - 44

The only disadvantage would be that the compiler won't be able to recognize the size of the string with sizeof


Re: need to make more dimensions - caoraivoso3 - 15.04.2014

thanks neroi have a question. For example i put in [4] in 5

soo i want to know where is my string
i will make 5*45 to know the beggining
and 5*45+10 a string with string[9] to know the end.
Am i right?


AW: need to make more dimensions - Nero_3D - 15.04.2014

Nope, just like always if you want to access [4][5] you just do [4 * 45 + 5] pretty simple

But you always need the size parameter (in strcat, strmid, ...) because the compiler thinks it is a cell we are calling and assums a size is 1