Clearing the whole 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: Clearing the whole enum (
/showthread.php?tid=334229)
Clearing the whole enum -
IgrexolonO - 14.04.2012
Hiho. I got a little problem, I would like to set the whole variables in enum of the player to false.
Код:
enum PlayerInfo
{
pass[32],
adminLvl,
loggedIn,
money,
respekt,
kills,
deaths,
owndeaths,
skin,
takedamage,
Float:sp[4]
}; new player[MAX_PLAYERS][PlayerInfo];
How should I do this? Regards.
Re: Clearing the whole enum -
Cjgogo - 14.04.2012
If you haven't worked with the variables in the enum yet,they are already false/0
Re: Clearing the whole enum -
IgrexolonO - 14.04.2012
It wasn't my question. I was asking how to set em to 0, I have already setted em to 1 or some string. -, -
Genius answer.
Re: Clearing the whole enum -
IstuntmanI - 14.04.2012
He didn't know because you didn't specified that you already set them to 1.
Код:
player[ playerid ][ pass ][ 0 ] = EOS;
player[ playerid ][ adminLvl ] = 0;
player[ playerid ][ loggedIn ] = 0;
player[ playerid ][ money ] = 0;
player[ playerid ][ respekt ] = 0;
player[ playerid ][ kills ] = 0;
player[ playerid ][ deaths ] = 0;
player[ playerid ][ owndeaths ] = 0;
player[ playerid ][ skin ] = 0;
player[ playerid ][ takedamage ] = 0;
player[ playerid ][ sp ][ 0 ] = 0.0;
player[ playerid ][ sp ][ 1 ] = 0.0;
player[ playerid ][ sp ][ 2 ] = 0.0;
player[ playerid ][ sp ][ 3 ] = 0.0;
Re: Clearing the whole enum -
IgrexolonO - 14.04.2012
So there's no way to do this faster, than variable by variable?
Re : Re: Clearing the whole enum -
IstuntmanI - 14.04.2012
Quote:
Originally Posted by IgrexolonO
So there's no way to do this faster, than variable by variable?
|
No, there's no way AFAIK.
Re: Clearing the whole enum - rjjj - 14.04.2012
You can do this
:
pawn Код:
for(new x = 0; x < (_:PlayerInfo); x++)
{
player[playerid][PlayerInfo:x] = 0;
}
I hope that i have helped
.