Keep burning vehicle
#1

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

It's impossible since it's related to GTA SA, to disappear when buring after a short moment.
Reply
#3

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

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

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

K, thanks let me try that!
Reply
#7

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

It doesn't.
Reply
#9

So this is not usefull at all.
Reply
#10

Quote:
Originally Posted by wups
Посмотреть сообщение
So this is not usefull at all.
It weren't supposed to be usefull to you anyway
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)