SA-MP Forums Archive
cycle and 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: cycle and enum (/showthread.php?tid=492311)



cycle and enum - ATomas - 03.02.2014

Hello,
i write this code:

Код:
enum PLAYER_INFO
{
	money,//0
	bank,//1
	weapon1,//2
	weapon2,//3
	weapon3//4
}
new Player[MAX_PLAYERS][PLAYER_INFO];

public OnPlayerConnect(playerid)
{
	for(new i;i<sizeof(Player);i++)
	{
	    Player[playerid][i] = 0;//warning 213: tag mismatch
	}
	return 1;
}
warning 213: tag mismatch

How do I properly write to the cycle?


Re: cycle and enum - Misiur - 03.02.2014

pawn Код:
Player[playerid][PLAYER_INFO:i] = 0;
I hope you know what you are doing, because it's not a way to loop through an enum.

Also I'd recommend using memset for this case.