Delaying a explosion -
JacobWilkerson - 12.08.2013
Hi to one and all.
This is so when a vehicle turns, it explodes directly.
It seems to me that it is possible to delay the time of explosion of the vehicle (fire would be, but it would explode after 30/40 seconds (to be determined)).
And also, when the vehicle turns out, for example 1 in 5 chance that the vehicle will not catch fire.
Is this possible?
Bye
Re: Delaying a explosion -
verlaj - 12.08.2013
i think yes, by using SetTimerEx and random stuff try watching some tuts or wiki
Re : Delaying a explosion -
JacobWilkerson - 12.08.2013
Yes, but there is not a function that adds fire to a vehicle, as to explode = CreateExplosion ...
Re : Delaying a explosion -
JacobWilkerson - 12.08.2013
UP please.
Re : Delaying a explosion -
JacobWilkerson - 13.08.2013
up....
Re: Delaying a explosion -
Vanter - 13.08.2013
search search search
Re: Delaying a explosion -
Smokeyy - 13.08.2013
No, you can't, because this is CS ( Client Side ).
Re: Delaying a explosion -
MaDK1LLA - 13.08.2013
Quote:
Originally Posted by JacobWilkerson
Hi to one and all.
This is so when a vehicle turns, it explodes directly.
It seems to me that it is possible to delay the time of explosion of the vehicle (fire would be, but it would explode after 30/40 seconds (to be determined)).
And also, when the vehicle turns out, for example 1 in 5 chance that the vehicle will not catch fire.
Is this possible?
Bye
|
You need to find out at what HP number the vehicle will catch fire, as soon as you figured this out you can create a simple script for example.
N.B Cars Max health is 1000
Car sets on fire at 200HP so in the script you need to have something like this:
Код:
if car health = 200
then
set car health 201
then
set timer (40 sec)
then after the time is up
set car health 0 <This explodes the vehicle>
I explained it almost like pseudo code so you can easily create the script with simple steps.
During the timer you can obtain a fire object which is provided in the sa-mp objects I think. You just need to set the x,y,z to the cars hood.
And for your 1 in 5 chances of the car not catching fire after flipping would require you to enter a script where you check of the car is flipped and if so you maintain the health, and do a few maths in there if you want the 1/5 chances of surviving.
Re: Delaying a explosion -
SuperViper - 13.08.2013
If I understand you correctly, you should set a 1 second timer which repeats 35 times to set the vehicle's health to 250 (fire) and after the 35th repetition, it explodes. An example:
pawn Код:
forward public VehicleFireExplode(vehicleID, burnTime);
public VehicleFireExplode(vehicleID, burnTime)
{
if(burnTime)
{
SetVehicleHealth(vehicleID, 250);
SetTimerEx("VehicleFireExplode", 1000, 0, "ii", vehicleID, burnTime - 1);
}
else
{
new Float: vehiclesPosition[3];
GetVehiclePos(vehicleID, vehiclesPosition[0], vehiclesPosition[1], vehiclesPosition[2]);
CreateExplosion(vehiclesPosition[0], vehiclesPosition[1], vehiclesPosition[2], 6, 10);
}
return 1;
}
SetTimerEx("VehicleFireExplode", 1000, 0, "ii", GetPlayerVehicleID(playerid), 35);
Re: Delaying a explosion -
DoubleOG - 13.08.2013
Quote:
Originally Posted by SuperViper
If I understand you correctly, you should set a 1 second timer which repeats 35 times to set the vehicle's health to 250 (fire) and after the 35th repetition, it explodes. An example:
pawn Код:
forward public VehicleFireExplode(vehicleID, burnTime);
public VehicleFireExplode(vehicleID, burnTime) { if(burnTime) { SetVehicleHealth(vehicleID, 250); SetTimerEx("VehicleFireExplode", 1000, 0, "ii", vehicleID, burnTime - 1); } else { new Float: vehiclesPosition[3]; GetVehiclePos(vehicleID, vehiclesPosition[0], vehiclesPosition[1], vehiclesPosition[2]); CreateExplosion(vehiclesPosition[0], vehiclesPosition[1], vehiclesPosition[2], 6, 10); }
return 1; }
SetTimerEx("VehicleFireExplode", 1000, 0, "ii", GetPlayerVehicleID(playerid), 35);
|
That's some pretty smart scripting stuff you got there...