Delaying a explosion
#1

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
Reply
#2

i think yes, by using SetTimerEx and random stuff try watching some tuts or wiki
Reply
#3

Yes, but there is not a function that adds fire to a vehicle, as to explode = CreateExplosion ...
Reply
#4

UP please.
Reply
#5

up....
Reply
#6

search search search
Reply
#7

No, you can't, because this is CS ( Client Side ).
Reply
#8

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.
Reply
#9

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);
Reply
#10

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...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)