How can I break down the car engine?
#1

Hey there!
I have a little problem. I created a timer that checks the car health, If it's below 250, it will restore it to exactly 250, so the car doesn't blow up (the code is below). I also want the car engine to stop when the health is below the limit, so the player would be forced to somehow, repair the car, or change it. How can I do that in my code?
Код:
public OnFilterScriptInit()
{
    SetTimer("carhealthcheck",500,1);
	return 1;
}
#else

main(){}

#endif
forward carhealthcheck();
public carhealthcheck()
{
    new Float:vhp;
    for(new vehicleid; vehicleid<MAX_VEHICLES;vehicleid++)
    {
		if(GetVehicleModel(vehicleid)==0)continue; //only returns 0 when vehicle is invalid (not spawned)
        GetVehicleHealth(vehicleid,vhp);
        if(vhp<250.0)SetVehicleHealth(vehicleid,250);
    }
}
Reply


Messages In This Thread
How can I break down the car engine? - by HeLiOn_PrImE - 13.10.2012, 15:17
Re : How can I break down the car engine? - by lelemaster - 13.10.2012, 15:22
Re: How can I break down the car engine? - by HeLiOn_PrImE - 13.10.2012, 15:34
Re: How can I break down the car engine? - by JhnzRep - 13.10.2012, 15:57
Re: How can I break down the car engine? - by HeLiOn_PrImE - 13.10.2012, 16:04
Re: How can I break down the car engine? - by JhnzRep - 13.10.2012, 16:05
Re : How can I break down the car engine? - by lelemaster - 13.10.2012, 16:24
Re: How can I break down the car engine? - by HeLiOn_PrImE - 13.10.2012, 20:03

Forum Jump:


Users browsing this thread: 1 Guest(s)