SA-MP Forums Archive
variable+enum question - 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: variable+enum question (/showthread.php?tid=440748)



variable+enum question - dubyabeast - 31.05.2013

Just wondering if I can do something like this: (trying to spend less time on setting every single variable in pInfo to 0, seeing if I can do it with a loop.)
pawn Код:
enum pInfo
{
    pVar1,
    pVar2,
    pVar3
}
new PlayerInfo[MAX_PLAYERS][pInfo];

public OnPlayerConnect(playerid)
{
    for(new i = 0; i < sizeof(PlayerInfo); i++) // Would I use sizeof(PlayerInfo) or sizeof(pInfo)?
    {
        PlayerInfo[playerid][i] = 0; // Will set pVar1, pVar2, and pVar3 to 0.
    }
    return 1;
}



Re: variable+enum question - AIped - 31.05.2013

I think it should work, why dont you test it ?


Re: variable+enum question - dubyabeast - 31.05.2013

I've tested and neither of them worked.