Cars Never Explode??
#1

Hello samp forum,

I am trying to create a sysem tha prevents a car from exploding when its health is very low. What i have tried to do is create a function thats repeats every half-second and it is meant to get a vehicles damage and if the damage is below 300, set it back to 300 and disable the engine. However this doesnt work for me, i am not sure wether i am scripting it properly but here is the code.

Top of script:
Код:
forward vDamage_Update(playerid, vehicleid);
OnGameModeInit()
Код:
SetTimer("vDamage_Update", 500, 1);
Function at bottom of script:
Код:
public vDamage_Update(playerid, vehicleid)
{
    new engine, lights, alarm, doors, bonnet, boot, objective;
    new Float:vhealth;
    if(IsPlayerInVehicle(playerid, vehicleid))
    {
        GetPlayerVehicleID(playerid);
	if(GetVehicleHealth(vehicleid, vhealth) <300)
	{
	    SetVehicleHealth(vehicleid, 1000);
 	    GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
	    SetVehicleParamsEx(vehicleid, 0, 1, alarm, doors, bonnet, boot, objective);
        }
    }
}
I am hoping somebody can tell me why why system doesnt work and maybe help me get it working, I would really appreciate.


Stuoyto
Reply


Messages In This Thread
Cars Never Explode?? - by stuoyto - 09.05.2012, 19:47
Re: Cars Never Explode?? - by kadaradam - 09.05.2012, 19:52
Re: Cars Never Explode?? - by Joe Staff - 09.05.2012, 19:52
Re: Cars Never Explode?? - by stuoyto - 09.05.2012, 19:54
Re: Cars Never Explode?? - by kadaradam - 09.05.2012, 19:56
Re: Cars Never Explode?? - by stuoyto - 09.05.2012, 20:02

Forum Jump:


Users browsing this thread: 1 Guest(s)