Posts: 1,190
Threads: 196
Joined: Dec 2011
Reputation:
0
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?
Posts: 2,856
Threads: 6
Joined: Jun 2007
Reputation:
0
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
Posts: 1,190
Threads: 196
Joined: Dec 2011
Reputation:
0
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?
Posts: 2,856
Threads: 6
Joined: Jun 2007
Reputation:
0
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