How do I reset an enum at best?
#1

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 :/)
Reply
#2

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.
Reply
#3

Thanks
Reply
#4

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

new tmp[MYENUM];
mydata = tmp;
Reply
#5

okay, thanks
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)