SA-MP Forums Archive
Advanced engine - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Advanced engine (/showthread.php?tid=243941)



Advanced engine - InsaniManES - 25.03.2011

I know how to make a simple engine
SetVehicleParamsEx(vehicleid, 1, lights, alarm, doors, bonnet, boot, objective)

But... How can I use that function that relative to
GetVehicleHealth(vehicleid, health)?


Re: Advanced engine - Sensitive - 25.03.2011

bump! I want to know that to..


Re: Advanced engine - [NRP]Blade - 25.03.2011

Note: Code not tested.
Код:
    new engine,lights,alarm,doors,bonnet,boot,objective;
	if (strcmp("/engine", cmdtext, true, 10) == 0)
	{
		if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, RED, "You must be in a vrhicle");
		{
	 		new Float:health;
    		new veh;
    		veh = GetPlayerVehicleID(playerid);
    		GetVehicleHealth(veh, health);
    		GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
    		if(health <50) return SendClientMessage(playerid,RED,"Engine Cant Start.");
    		{
    		    SetVehicleParamsEx(veh, 0, lights, alarm, doors, bonnet, boot, objective);
			}
			if(health >50) return SendClientMessage(playerid,RED,"Engine started.");
			{
			    SetVehicleParamsEx(veh, 1, lights, alarm, doors, bonnet, boot, objective);
			}
		}
		return 1;
	}



Re: Advanced engine - InsaniManES - 26.03.2011

It's good! But I meant that, if I have 60 percent of health, You need to try X times to succsses turn the engine on


Re: Advanced engine - THE_KNOWN - 26.03.2011

didnt test. should start on third try


Код:
new sengine[MAX_PLAYERS][2];

CMD:engine(playerid,params[])
{
	if(GetVehicleHealth(GetPlayerVehicleID(playerid)))
	{
	    if(sengine[playerid][0] != 1)
	    {
			sengine[playerid][0]=1;
			SendClientMessage(playerid,0xFFFFFFFF,"engine failed to start.");
		}
		if(sengine[playerid][1] != 1)
	    {
			sengine[playerid][1]=1;
			SendClientMessage(playerid,0xFFFFFFFF,"engine failed to start.");
		}
		else
	    {
			sengine[playerid][1]=0;
			sengine[playerid][0]=0;
			SendClientMessage(playerid,0xFFFFFFFF,"engine started.");
			SetVehicleParams(GetPlayerVehicleID(playerid), 1, lights, alarm, doors, bonnet, boot, objective);
		}
	}
	return 1;
}