SA-MP Forums Archive
How do I reset an enum at best? - 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: How do I reset an enum at best? (/showthread.php?tid=452899)



How do I reset an enum at best? - Zunno - 23.07.2013

Hello,
i have a question about reseting an enum with the best an shortest method.

At the moment I reset my enum so:
pawn Код:
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 :/)


Re: How do I reset an enum at best? - Scenario - 23.07.2013

I use this:

pawn Код:
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.


AW: How do I reset an enum at best? - Zunno - 23.07.2013

Thanks


Re: How do I reset an enum at best? - Pottus - 23.07.2013

There is the ****** method which is best for most purposes.

new tmp[MYENUM];
mydata = tmp;


AW: How do I reset an enum at best? - Zunno - 23.07.2013

okay, thanks