Question related to enum - 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: Question related to enum (
/showthread.php?tid=326687)
Question related to enum -
Darth1993 - 18.03.2012
Hello,
Can I use enums like that:
Код:
enum pCInfo
{
pName[MAX_PLAYER_NAME],
pExp,
pFreePoints,
pAircraftLvl,
pTankLvl,
pSparrowLvl,
pHunterLvl,
pHeliLvl,
pKills,
pDeaths,
Float:pHealth, Float:pArmor
}
new PlayerClassInfo[MAX_PLAYERS][4][pCInfo];
PlayerClassInfo[playerid][1][pCInfo], PlayerClassInfo[playerid][2][pCInfo] and etc would be different variables.
I just need to store four classes data for each player.
Re: Question related to enum -
Spooky - 18.03.2012
I think you have to use simply
pawn Код:
enum pCInfo
{
pName[MAX_PLAYER_NAME],
pExp,
pFreePoints,
pAircraftLvl,
pTankLvl,
pSparrowLvl,
pHunterLvl,
pHeliLvl,
pKills,
pDeaths,
Float:pHealth,
Float:pArmor,
}
new PlayerClassInfo[MAX_PLAYERS][pCInfo];
Re: Question related to enum -
Darth1993 - 18.03.2012
I wan't to use this enum for each player + 4 enums per player, because I have 4 classes in database for each player. Player will be able to switch to any other class anytime he wants.
So this can't be made like that:
Quote:
new PlayerClassInfo[MAX_PLAYERS][4][pCInfo];
|
?
PlayerClassInfo[playerid][1][pName] == Medic;
PlayerClassInfo[playerid][2][pName] == Engineer;
And etc.
AW: Question related to enum -
Tigerkiller - 18.03.2012
pawn Код:
new PlayerClassInfo[MAX_PLAYERS][pCInfo][4];
PlayerClassInfo[playerid][item][class] = anythink;
Re: Question related to enum -
Spooky - 18.03.2012
use this for that.
pawn Код:
enum pInfo
{
ptype[24],
}
new Player[MAX_PLAYERS][pInfo];
use it for Player[playerid][ptype] = any number you want to set for the type;
Re: AW: Question related to enum -
Darth1993 - 18.03.2012
Quote:
Originally Posted by Tigerkiller
pawn Код:
new PlayerClassInfo[MAX_PLAYERS][pCInfo][4];
PlayerClassInfo[playerid][item][class] = anythink;
|
Thanks, gonna test it.
AW: Question related to enum -
Tigerkiller - 18.03.2012
it should work