SA-MP Forums Archive
Error: Must be a constant expression; assumed zero - 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: Must be a constant expression; assumed zero (/showthread.php?tid=452567)



Error: Must be a constant expression; assumed zero - CTAntonio - 21.07.2013

I have trying to make something but I get warning and error:

Quote:

line 7047 warning 202: number of arguments does not match definition
Line 7408 error 008: must be a constant expression; assumed zero

Код:
public OnVehicleDamageStatusUpdate(vehicleid, playerid)
{
line 7047->	new vehiclehealth = GetVehicleHealth(vehicleid);
	if{vehiclehealth < 25)
	{
		new engine, lights, alarm, doors, bonnet, boot, objective;
		GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
                SetVehicleParamsEx(vehicleid,0,lights,alarm,doors,bonnet,boot,objective);
		SendClientMessage(playerid, 0xFF0000FF, "Text");
	}
  	return 1;
}



Re: Error: Must be a constant expression; assumed zero - Antonio144 - 21.07.2013

pawn Код:
new Float:vehiclehealth;
GetVehicleHealth(vehicleid,vehiclehealth);
What's on the 7408 line?


Re: Error: Must be a constant expression; assumed zero - JimmyCh - 21.07.2013

pawn Код:
public OnVehicleDamageStatusUpdate(vehicleid, playerid)
{
    new vehiclehealth = GetVehicleHealth(vehicleid);
    if(vehiclehealth < 25)
    {
        new engine, lights, alarm, doors, bonnet, boot, objective;
        GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
                SetVehicleParamsEx(vehicleid,0,lights,alarm,doors,bonnet,boot,objective);
        SendClientMessage(playerid, 0xFF0000FF, "Text");
    }
    return 1;
}
You did {vehiclehealth < 25) not (vehiclehealth < 25), typo I guess.


Re: Error: Must be a constant expression; assumed zero - CTAntonio - 21.07.2013

Quote:
Originally Posted by Antonio144
Посмотреть сообщение
pawn Код:
new Float:vehiclehealth;
GetVehicleHealth(vehicleid,vehiclehealth);
What's on the 7408 line?
it's line 7480, I miss sry, anyway thanks for help, repped + it works
Hvala! hahah