SA-MP Forums Archive
AMX error. - 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: AMX error. (/showthread.php?tid=623924)



AMX error. - danielpalade - 07.12.2016

This code:
Код:
enum drugs
{
	drugSender = INVALID_PLAYER_ID,
	drugReceiver = INVALID_PLAYER_ID,
	drugPrice,
	drugAmount
}
new SellDrugs[1000][drugs];

stock FreeDrugsSlot()
{
	for(new i=0; i < sizeof(SellDrugs); i++)
	{
		if(SellDrugs[i][drugSender] == INVALID_PLAYER_ID) return i;
		break;
	}
	return 0;
}

stock HasSentDrugsTo(playerid)
{
	for(new i=0; i < sizeof(SellDrugs); i++)
	{
		if(SellDrugs[i][drugReceiver] == playerid) return true;
		break;
	}
	return false;
}
Gives me the error AMX not initialised. Why?


Re: AMX error. - Konstantinos - 07.12.2016

I can't say much about the run time error as I'm not aware but assigning a value in the items (in enumerator) is not for a default value as you think. Basically the size of the 2nd dimension is 65538. When the mode starts, loop and reset to INVALID_PLAYER_ID.