Pawncc.exe crashing (+rep)
#1

Hello, i've narrowed down my search to find out that this code is causing my pawncc.exe to crash, i cant find anything out of the ordinary

Код:
stock ToggleVehicleEngine(vehicleid, playerid)
{
	GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
	if(!engineOn{vehicleid})
	{
		new Float:hp;
		GetVehicleHealth(vehicleid, hp);
		new start = randomEx(1, 7);
		if(hp < 700)
		{
			if(start == 1 || start == 6)
			{
				GameTextForPlayer(playerid, "~r~Engine couldn't start due to the damamge", 3000, 4);
				return 1;
			}
		}
		if(hp < 500)
		{
			if(start == 1 || start == 2 || start == 5 || start == 6)
			{
				GameTextForPlayer(playerid, "~r~Engine couldn't start due to the damamge", 3000, 4);
				return 1;
			}
		}
		if(hp < 300)
		{
			if(start == 1 || start == 2 || start == 3 || start == 5 || start == 6)
			{
				GameTextForPlayer(playerid, "~r~Engine couldn't start due to the damamge", 3000, 4);
				return 1;
			}
		}
		format(msg, sizeof(msg), "~g~ENGINE ON");
		GameTextForPlayer(playerid, msg, 2500, 4);
		SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_ON, VEHICLE_PARAMS_ON, alarm, doors, bonnet, boot, objective);
		format(msg, sizeof(msg), "starts engine of the %s", VehicleNames[GetVehicleModel(vehicleid)-400]);
		ActionMessage(playerid,15.0,msg);
		engineOn{vehicleid} = true;
	}
	else if(engineOn{vehicleid})
	{
		format(msg, sizeof(msg), "~r~ENGINE OFF");
		GameTextForPlayer(playerid, msg, 2500, 4);
		SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_OFF, VEHICLE_PARAMS_OFF, alarm, doors, bonnet, boot, objective);
		format(msg, sizeof(msg), "stops engine of the %s", VehicleNames[GetVehicleModel(vehicleid)-400]);
		ActionMessage(playerid,15.0,msg);
		engineOn{vehicleid} = false;
	}
	return 1;
}
Reply
#2

Hey! try this

Код HTML:
stock ToggleVehicleEngine(vehicleid, playerid)
{
	GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
	if(!engineOn[vehicleid])
	{
		new Float:hp;
		GetVehicleHealth(vehicleid, hp);
		new start = randomEx(1, 7);
		if(hp < 700)
		{
			if(start == 1 || start == 6)
			{
				GameTextForPlayer(playerid, "~r~Engine couldn't start due to the damamge", 3000, 4);
				return 1;
			}
		}
		if(hp < 500)
		{
			if(start == 1 || start == 2 || start == 5 || start == 6)
			{
				GameTextForPlayer(playerid, "~r~Engine couldn't start due to the damamge", 3000, 4);
				return 1;
			}
		}
		if(hp < 300)
		{
			if(start == 1 || start == 2 || start == 3 || start == 5 || start == 6)
			{
				GameTextForPlayer(playerid, "~r~Engine couldn't start due to the damamge", 3000, 4);
				return 1;
			}
		}
		format(msg, sizeof(msg), "~g~ENGINE ON");
		GameTextForPlayer(playerid, msg, 2500, 4);
		SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_ON, VEHICLE_PARAMS_ON, alarm, doors, bonnet, boot, objective);
		format(msg, sizeof(msg), "starts engine of the %s", VehicleNames[GetVehicleModel(vehicleid)-400]);
		ActionMessage(playerid,15.0,msg);
		engineOn[vehicleid]= true;
	}
	else if(engineOn[vehicleid])
	{
		format(msg, sizeof(msg), "~r~ENGINE OFF");
		GameTextForPlayer(playerid, msg, 2500, 4);
		SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_OFF, VEHICLE_PARAMS_OFF, alarm, doors, bonnet, boot, objective);
		format(msg, sizeof(msg), "stops engine of the %s", VehicleNames[GetVehicleModel(vehicleid)-400]);
		ActionMessage(playerid,15.0,msg);
		engineOn[vehicleid]= false;
	}
	return 1;
}
Reply
#3

Код:
stock ToggleVehicleEngine(vehicleid, playerid)
{
	GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
	if(!engineOn[vehicleid])
	{
		new Float:hp;
		GetVehicleHealth(vehicleid, hp);
		new start = randomEx(1, 6);
		if(hp < 700)
		{
			if(start == 1 || start == 6)
			{
				GameTextForPlayer(playerid, "~r~Engine couldn't start due to the damamge", 3000, 4);
				return 1;
			}
		}
		if(hp < 500)
		{
			if(start == 1 || start == 2 || start == 5 || start == 6)
			{
				GameTextForPlayer(playerid, "~r~Engine couldn't start due to the damamge", 3000, 4);
				return 1;
			}
		}
		if(hp < 300)
		{
			if(start == 1 || start == 2 || start == 3 || start == 5 || start == 6)
			{
				GameTextForPlayer(playerid, "~r~Engine couldn't start due to the damamge", 3000, 4);
				return 1;
			}
		}
		format(msg, sizeof(msg), "~g~ENGINE ON");
		GameTextForPlayer(playerid, msg, 2500, 4);
		SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_ON, VEHICLE_PARAMS_ON, alarm, doors, bonnet, boot, objective);
		format(msg, sizeof(msg), "starts engine of the %s", VehicleNames[GetVehicleModel(vehicleid)-400]);
		ActionMessage(playerid,15.0,msg);
		engineOn[vehicleid]= true;
	}
	else if(engineOn{vehicleid})
	{
		format(msg, sizeof(msg), "~r~ENGINE OFF");
		GameTextForPlayer(playerid, msg, 2500, 4);
		SetVehicleParamsEx(vehicleid, VEHICLE_PARAMS_OFF, VEHICLE_PARAMS_OFF, alarm, doors, bonnet, boot, objective);
		format(msg, sizeof(msg), "stops engine of the %s", VehicleNames[GetVehicleModel(vehicleid)-400]);
		ActionMessage(playerid,15.0,msg);
		engineOn[vehicleid]= false;
	}
	return 1;
}
Try this , It must help you
You had a wrong function for that , try this one
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)