SA-MP Forums Archive
error 033: array must be indexed (variable "ReturnToWeapon") - 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: error 033: array must be indexed (variable "ReturnToWeapon") (/showthread.php?tid=604850)



error 033: array must be indexed (variable "ReturnToWeapon") - Djordjekkk - 10.04.2016

Heres the issue:

Код:
	if(ReturnToWeapon!=1)
{
	if(WeaponSet[playerid]==1)
	{
	GivePlayerWeapon(playerid,24,60);
	GivePlayerWeapon(playerid,25,100);
	}
	if(WeaponSet[playerid]==2)
	{
	GivePlayerWeapon(playerid,24,60);
	GivePlayerWeapon(playerid,32,120);
	}
	if(WeaponSet[playerid]==3)
	{
	GivePlayerWeapon(playerid,24,60);
	GivePlayerWeapon(playerid,30,120);
	}
 	if(WeaponSet[playerid]==4)
	{
	GivePlayerWeapon(playerid,24,60);
	GivePlayerWeapon(playerid,16,3);
	}
	if(WeaponSet[playerid]==5)
	{
	GivePlayerWeapon(playerid,24,60);
	GivePlayerWeapon(playerid,26,60);
	}
}
I just wanted to preform double if and this error showed up


Re: error 033: array must be indexed (variable "ReturnToWeapon") - Jelly23 - 10.04.2016

pawn Код:
if(ReturnToWeapon[playerid] !=1)
{
    if(WeaponSet[playerid]==1)
    {
    GivePlayerWeapon(playerid,24,60);
    GivePlayerWeapon(playerid,25,100);
    }
    if(WeaponSet[playerid]==2)
    {
    GivePlayerWeapon(playerid,24,60);
    GivePlayerWeapon(playerid,32,120);
    }
    if(WeaponSet[playerid]==3)
    {
    GivePlayerWeapon(playerid,24,60);
    GivePlayerWeapon(playerid,30,120);
    }
    if(WeaponSet[playerid]==4)
    {
    GivePlayerWeapon(playerid,24,60);
    GivePlayerWeapon(playerid,16,3);
    }
    if(WeaponSet[playerid]==5)
    {
    GivePlayerWeapon(playerid,24,60);
    GivePlayerWeapon(playerid,26,60);
    }
}
ReturnToWeapon !=1 should be ReturnToWeapon[playerid] != 1


Re: error 033: array must be indexed (variable "ReturnToWeapon") - Djordjekkk - 11.04.2016

Thanks