SA-MP Forums Archive
[HELP] Multi dimensional arrays - 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: [HELP] Multi dimensional arrays (/showthread.php?tid=415803)



[HELP] Multi dimensional arrays - ReDevilGames - 14.02.2013

Hi at all!
So, I have this
pawn Код:
new HouseOwner[128];
And I assign a string:
pawn Код:
HouseOwner[128] = "LolMan95";
But, if I want to assign another array:
pawn Код:
new HouseOwner[MAX_PLAYERS][128];
HouseOwner[playerid][128] = "LolMan95";
It give me some errors like: "expression has no effect".
How can I assign a string to a variabile with two arrays?


Re: [HELP] Multi dimensional arrays - PaulDinam - 14.02.2013

Код:
#define MAX_HOUSES 500 //You can change that

enum House_Info
{
     houseOwner[128],
}
new HouseInfo[MAX_HOUSES][House_Info];

-----------------------
format(HouseInfo[houseid][houseOwner],128,"LolMan95");
Код:
new HouseOwner[MAX_PLAYERS][128];

-------------------------------------
format(HouseOwner[playerid],128,"LolMan95");



Re: [HELP] Multi dimensional arrays - park4bmx - 14.02.2013

pawn Код:
new HouseOwner[MAX_PLAYERS][128];
format(HouseOwner[playerid],sizeof(HouseOwner),"LolMan95");
you format a string not assign it!


Re: [HELP] Multi dimensional arrays - ReDevilGames - 14.02.2013

Quote:

you format a string not assign it!

This was what I needed