error 029: invalid expression, assumed zero
#1

Error on topic pops up
Код:
error 029: invalid expression, assumed zero
System: Error line marked in red
Код:
	if(Holding(KEY_FIRE) || newkeys == KEY_FIRE)
	{
		new Float:fx, Float:fy, Float:fz;
		GetDynamicObjectPos(FireObject, fx, fy, fz);
		new string[256];
        if(GetPlayerWeapon(playerid) == 42 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 407)
        {
            if(IsPlayerInRangeOfPoint(playerid, 40.0, fx,  fy,  fz))
 	        {
			   	FireHealth -= 1;
				format(string, sizeof(string), "%d/100%", FireHealth);
				Update3DTextLabelText(FireText, GREEN, string);
			    if(FireHealth <= 0)
			    {
					DestroyDynamicObject(FireObject);
					DestroyDynamicObject(SmokeObject);
					Delete3DTextLabel(FireText);
					FireHealth = 0;
					FireTimer = SetTimer("StartRandomFire", 900000, false);
					format(string, sizeof(string), "Auto-Dispatcher: The fire that was started has been successfully put out. Continue with normal duties.");
					foreach(Player, i)
					{
	    				if(IsACop(i) || IsAGov(i) || IsMedic(i) || IsSASD(i))
	    				{
							SendClientMessage(i, COLOR_DEPTRADIO, string);
	    				}
	    			}
					return 1;
				}
			}
		}
	}
Reply
#2

I'm pretty sure you don't need the || newkeys == KEY_FIRE in your code if you using the Holding define. That is probably where you error lies.

Код:
if(Holding(KEY_FIRE))
Just try leaving the line like that and see if it works.

Also isn't Holding defined in all caps?

Код:
// HOLDING(keys)
#define HOLDING(%0) \
	((newkeys & (%0)) == (%0))
Unless you defined it as lowercase.

Also why are you formatting a string when it doesn't even require any formatting.

Код:
.....
new string[256];
.....
format(string, sizeof(string), "Auto-Dispatcher: The fire that was started has been successfully put out. Continue with normal duties.");
.....
if(IsACop(i) || IsAGov(i) || IsMedic(i) || IsSASD(i))
{
    SendClientMessage(i, COLOR_DEPTRADIO, string);
}
You could just delete the string variable and the format line and have the string get send out through SendClientMessage.

Код:
if(IsACop(i) || IsAGov(i) || IsMedic(i) || IsSASD(i))
{
    SendClientMessage(i, COLOR_DEPTRADIO, "Auto-Dispatcher: The fire that was started has been successfully put out. Continue with normal duties.");
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)