SA-MP Forums Archive
Enum to check another 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: Enum to check another enum? (/showthread.php?tid=399461)



Enum to check another enum? - Lz - 14.12.2012

Hey guys, im trying to create a faction enum that will be readable from my playerinfo enum... Im not sure if thats possible? well basically heres what im trying to do..

pawn Code:
enum pFactions
{
    SAPD,
    GOV
}


enum pInfo
{
    pPass,
    pCash,
    Float:pPos[3],
                      pFactions,
    pAdmin,
    pKills,
    pDeaths
}
pFactions is loose so you can see what im trying to do..
So basically i want the pInfo enum to check the values of the pFaction variables..

Im pretty new to scripting so im not sure, Is this the best way to create factions?


Re: Enum to check another enum? - dr.lozer - 14.12.2012

Why dont you simply make in 1 enum


Re: Enum to check another enum? - Lz - 14.12.2012

Quote:
Originally Posted by dr.lozer
View Post
Why dont you simply make in 1 enum
You mean like?
pawn Code:
enum pInfo
{
    pPass,
    pCash,
    Float:pPos[3],
    pAdmin,
                       fSAPD,
                       fGOV,
    pKills,
    pDeaths
}
Like that?


Re: Enum to check another enum? - Lordzy - 14.12.2012

If it's for player, you can create a variable executing the enum info under the enum.
pawn Code:
new PlayerInfo[MAX_PLAYERS][pInfo];
Now the enum can be used as : PlayerInfo[playerid][pPass] etc.


Re: Enum to check another enum? - Lz - 14.12.2012

Quote:
Originally Posted by Lordz™
View Post
If it's for player, you can create a variable executing the enum info under the enum.
pawn Code:
new PlayerInfo[MAX_PLAYERS][pInfo];
Now the enum can be used as : PlayerInfo[playerid][pPass] etc.
Yea thats kinda what i had before on my first faction attempt but i didn't think it looked.. well.. "professional"? As i would have all the factions and their ranks in the user file would just look like

Pass = ********
Cash = 13434
x = 123123.3434
y = 3535.6456
z = 12.3
Admin = 0
Kills = 9
Deaths = 12
SAPD = 4
GOV = 0
HITMAN = 0
FBI = 0

etc if that makes sence?