Keep burning vehicle -
Cameltoe - 20.08.2010
How would i make a vehicle keep the flames for a amount of time?
so far i got this:
pawn Код:
public CheckCarHealth(vehicleid, playerid)
{
new Float:CarHealth;
GetVehicleHealth(vehicleid,CarHealth);
if(CarHealth <= 249.9)
{
new Float:vPOS[3];
KillTimer(CarHealthTimer[vehicleid]);
GetVehiclePos(vehicleid, vPOS[0], vPOS[1], vPOS[2]);
RemovePlayerFromVehicle(playerid);
SetVehiclePos(vehicleid, vPOS[0], vPOS[1], vPOS[2]);
SendClientMessage(playerid, COLOR_YELLOW, "( ! ) This car is under fire!");
new RandExplode = rand(18, 32), string[128];
format(string, sizeof(string),"( ! ) The fire brigade should be on it's way .. this car will explode in about: %d seconds",RandExplode*10);
SendClientMessage(playerid, COLOR_YELLOW, string);
SetVehicleHealth(vehicleid, 500);
SetTimerEx("KeepFire",100,true,"i",vehicleid);
SetTimerEx("RandExplodeCar",RandExplode*10000,false,"i",vehicleid);
printf("Health below 250: %f- Carid: %d - Playerid: %d",CarHealth,vehicleid,playerid);
}
}
forward KeepFire(vehicleid);
public KeepFire(vehicleid)
{
SetVehicleHealth(vehicleid, 249);
print("Sat vehicle health");
}
public RandExplodeCar(vehicleid)
{
SetVehicleHealth(vehicleid, 249);
printf("Exploding the car!");
}
This will only work for a small amount of time..
Re: Keep burning vehicle -
Hamza' - 20.08.2010
It's impossible since it's related to GTA SA, to disappear when buring after a short moment.
Re: Keep burning vehicle -
Cameltoe - 20.08.2010
Quote:
Originally Posted by Hamza'
It's impossible since it's related to GTA SA, to disappear when buring after a short moment.
|
It aint impossible .. iv'e seen it on many servers
Re: Keep burning vehicle -
Claude - 20.08.2010
Since I don't know a shit on when it is going to explode but..
pawn Код:
new deathtimer, explode, fix;
if(CarHealth <= 249.9)
{
deathtimer = SetTimer("RandExplode", time*1000, false);
explode = SetTimerEx("Rexplode", 1000, true, "d", playerid);
fix = SetTimerEx("Vfix", 1000, true, "d", playerid);
}
forward Rexplode(playerid);
forward Vfix(playerid);
forward RandExplode();
public RandExplode()
{
KillTimer(explode), KillTimer(fix);
}
public Rexplode(playerid)
{
SetVehicleHealth(playerid, 100);
}
public Vfix(playerid)
{
SetVehicleHealth(playerid, 500);
}
Re: Keep burning vehicle -
CaHbKo - 20.08.2010
You can do this:
1. Get the time that passes between the time when car starts burning and it explodes. Let's say it's 3 seconds.
2. After 2.5 seconds or less, you set the health to 1000.0, and then back to 249.9. It may be even in 1 function. I suggest you to update the flames every second, because if you set it to 2.9 (right before 3 - explosion time), some players will see it exploding due to ping.
OFF-TOPIC: Try to use only 1 timer for everything - it takes less resources. I have a half-second timer (500 ms), and few variables that count the time. 2 timer executions = 1 second. 60 seconds = 1 hour and etc.
Re: Keep burning vehicle -
Cameltoe - 20.08.2010
K, thanks

let me try that!
Re: Keep burning vehicle -
wups - 21.08.2010
Also, does the car health rise, when the fire brigade fires water on your car? Sorry, no time for testing.
Thank you all for the responses, they help a lot.
Re: Keep burning vehicle -
Mike Garber - 21.08.2010
It doesn't.
Re: Keep burning vehicle -
wups - 21.08.2010
So this is not usefull at all.
Re: Keep burning vehicle -
Cameltoe - 21.08.2010
Quote:
Originally Posted by wups
So this is not usefull at all.
|
It weren't supposed to be usefull to you anyway