SA-MP Forums Archive
Pawncc.exe crashing (+rep) - 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: Pawncc.exe crashing (+rep) (/showthread.php?tid=585897)



Pawncc.exe crashing (+rep) - NickMirra - 17.08.2015

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;
}



Re: Pawncc.exe crashing (+rep) - mjay768 - 17.08.2015

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;
}



Re: Pawncc.exe crashing (+rep) - MichaelJones - 17.08.2015

Код:
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