PDA

View Full Version : How do I reset an enum at best?


Zunno
23/07/2013, 04:38 AM
Hello,
i have a question about reseting an enum with the best an shortest method.

At the moment I reset my enum so:

PlayerInfo[playerid][pDatabaseID] = 0;
PlayerInfo[playerid][pName] = "\0";
PlayerInfo[playerid][pPosX] = 0.0;
PlayerInfo[playerid][pPosX] = 0.0;

etc...

But this is a waste of code, so is there any better way to do this?


greets Zunno


(Sorry for my bad english :/)

Scenario
23/07/2013, 04:51 AM
I use this:

for(new i = 0; enumPlayerInfo:i < enumPlayerInfo; i++) pStats[playerid][enumPlayerInfo:i] = 0;
Obviously "enumPlayerInfo" represents the name of the enum and "pStats" would be "PlayerInfo" for you. The best part is that all strings are reset and bools are set to false. :)

Zunno
23/07/2013, 05:06 AM
Thanks :)

Pottus
23/07/2013, 05:12 AM
There is the ****** method which is best for most purposes.

new tmp[MYENUM];
mydata = tmp;

Zunno
23/07/2013, 05:15 AM
okay, thanks :D