Unset every enum variable
#1

I need to clear out a variable with enums. How can I clear out the whole variable without having to write a long code?


This is my code:
PHP код:
enum mapstats
{
    
Name[126],
    
Float:Center[3],
    
Float:Radius,
    
Float:Green1[3],
    
Float:Green2[3],
    
Float:Green3[3],
    
Float:Purple1[3],
    
Float:Purple2[3],
    
Float:Purple3[3],
}
new 
Edit[MAX_PLAYERS][mapstats]; 
PHP код:
for(new imapstats:<= mapstatsi++)
{
    
Edit[playerid][mapstats:i] = -1;
    
printf("Edit[playerid][mapstats:i] = %i"Edit[playerid][mapstats:i]);

And I this is what I get in the console:
Код:
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
Edit[playerid][mapstats:i] = -1
[debug] Run time error 4: "Array index out of bounds"
[debug]  Accessing element at index 148 past array upper bound 147
[debug] AMX backtrace:
[debug] #0 0001c8c4 in public dialog_maps (0, 1, 0, 1764228) from game.amx
[debug] #1 native CallLocalFunction () from samp-server.exe
[debug] #2 000007e8 in public OnDialogResponse (0, 32700, 1, 0, 1764148) from game.amx
Reply
#2

Код:
ResetVars(playerid)
{
	static t[mapstats];
	Edit[playerid] = t;
}
You just need to call ResetVars(playerid) if you want to reset player mapstats enum.
Reply
#3

< not <=
Reply
#4

Quote:
Originally Posted by X337
Посмотреть сообщение
Код:
ResetVars(playerid)
{
	static t[mapstats];
	Edit[playerid] = t;
}
You just need to call ResetVars(playerid) if you want to reset player mapstats enum.
Short and Simple
I like it, Thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)