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



Why this error? - AndreiWow - 29.08.2016

Код:
D:\Basic RP Script Scratch FIX\gamemodes\U1.pwn(2024) : error 022: must be lvalue (non-constant)
The line is
Код:
loadedcargo[vehicleid] = ++1;
The code is
Код:
CMD:loadcargo(playerid, params[])
{
	if(cargopicked[playerid] == 1)
	{
	    for(new i; i < sizeof(meatcar); i++)
	    {
			new vehicleid = meatcar[i];
			if(IsPlayerInRangeOfVehicle(playerid, meatcar[i], 4))
			{
			    RemovePlayerAttachedObject(playerid, 0);
			    SendClientMessage(playerid, COLOR_YELLOW, "You loaded the cargo into the van, now get inside and drive it.");
			    SendNearbyMessage(playerid, 30.0, COLOR_PURPLE, "** %s places the bag of meat in the back of the van.", ReturnName(playerid, 0));
				ClearAnimations(playerid, 1);
				SetPlayerSpecialAction(playerid,SPECIAL_ACTION_NONE);
				loadedcargo[vehicleid] = ++1;
			}
			else
			{
			    SendClientMessage(playerid, COLOR_GREY, "You are not behind a van.");
			}
		}
	}
	return 1;
}

I'm trying to make the cargo add to the trunk so if they add more and use /cargolist it will show how many loaded cargo they have, like 7


Re: Why this error? - Shinja - 29.08.2016

Increase by 1?
PHP код:
loadedcargo[vehicleid]++; 



Re: Why this error? - AndreiWow - 29.08.2016

Thank you, figured this out before but I will still rep you