Problem with 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: Problem with Arrays (
/showthread.php?tid=430644)
Problem with Arrays -
Shoulen - 14.04.2013
Hi,
I have two teams, Teams are set to a player variable, (pTeam).
The Team IDs are 1 and 2.
Each team has a selection of 3 Skin choices, these skins are normal skin IDs.
I am trying to find a way to create a way to read skins that are available in specific variables, and I have no idea how to do that, I know it might sound silly, but I can't figure out how to do this.
I've tried with an enumerator by going:
pawn Код:
enum e_SkinDetails {
TeamId,
SkinId
}
new TeamSkin[8][e_SkinDetails] {
{1, 110},
{1, 109},
{1, 144},
{1, 173}
{2, 287},
{2, 285},
{2, 121},
{2, 284}
}
But the result that I want is to be able to type
TeamSkin[8][TeamID][EntryNumber between 0 and 3] and get get the relevant Skin ID.
Thanks, please let me know if I have not been clear.
Regards
Matt
Re: Problem with Arrays -
Shoulen - 14.04.2013
Solved, I just did it a different way...
pawn Код:
new TeamSkin[2][8];
TeamSkin[0][0] = 110;
TeamSkin[0][1] = 109;
TeamSkin[0][2] = 144;
TeamSkin[0][3] = 173;
TeamSkin[1][0] = 287;
TeamSkin[1][1] = 285;
TeamSkin[1][2] = 121;
TeamSkin[1][3] = 284;
Re: Problem with Arrays -
Vince - 14.04.2013
pawn Код:
#define MAX_TEAMS 2
new
TeamSkin[MAX_TEAMS][4] = {
{110, 109, 144, 173}, // Team 0
{287, 285, 121, 284} // Team 1
};
I think that's the closest you can get.
Re: Problem with Arrays -
Shoulen - 14.04.2013
Quote:
Originally Posted by Vince
pawn Код:
#define MAX_TEAMS 2
new TeamSkin[MAX_TEAMS][4] = { {110, 109, 144, 173}, // Team 0 {287, 285, 121, 284} // Team 1 };
I think that's the closest you can get.
|
Aha, that works great, thanks Vince!