[HELP] Car Explosion
#1

I have one little problem...
It doesnt show errors or warnings when i press F5, but there is nothing happening...
I wanted it to be like when the car has less then 30 hp that then the car explodes but i wanted the explosion to be very very strong.
So can u help pls?

MSN: franko.opacak@windowslive.com

public OnVehicleSpawn(vehicleid)
{
new Floatcx, Floatcy, Floatcz;
new Float:abcd;
GetVehicleHealth(vehicleid, abcd);
if(abcd > 30.0)
GetVehiclePos(vehicleid,scx, scy, scz);
CreateExplosion(scx+1,scy+1,scz+1,6,100);
return 1;
}
Reply
#2

You're using OnVehicleSpawn callback, which means that it's called when the vehicle is spawned and when the vehicle is spawned it surely doesn't have 30.0 health.

You need to use a timer that checks the vehicle's health every second or so, and if the health is under 30.0, make the explosion. Use SA-MP wiki to get help with timers.
Reply
#3

Quote:
Originally Posted by Finn
You're using OnVehicleSpawn callback, which means that it's called when the vehicle is spawned and when the vehicle is spawned it surely doesn't have 30.0 health.

You need to use a timer that checks the vehicle's health every second or so, and if the health is under 30.0, make the explosion. Use SA-MP wiki to get help with timers.
Kk tnx i already thought that the problem was cuz i wrote the script OnVehicleSpawn jsut wasnt sure...
Reply
#4

forward CarExplosion(vehicleid);


public OnGameModeInit()

SetTimer("CarExplosion",1000,1);



public CarExplosion(vehicleid)
{
new Floatcx, Floatcy, Floatcz;
new Float:abcd;
GetVehicleHealth(vehicleid, abcd);
if(abcd > 30.0)
GetVehiclePos(vehicleid,scx, scy, scz);
CreateExplosion(scx+1,scy+1,scz+1,6,100);

return 1;
}

Doesnt work, how?
Reply
#5

Quote:
Originally Posted by Frankox
Doesnt work, how?
try

pawn Код:
forward VehicleHealth();
pawn Код:
public OnGameModeInit()
{
    SetTimer("VehicleHealth",1000, 1);
    return 1;
}
pawn Код:
public VehicleHealth()
{
    for(new i=0; i < MAX_PLAYERS; i++)
    {
        new vehicleid = GetPlayerVehicleID(i);
        new Float:vhealth = GetVehicleHealth(vehicleid, vhealth);
       
        if(vhealth <= 30)
        {
            new Float:x, Float:y, Float:z;
            GetVehiclePos(vehicleid, x, y, z);
            SetVehicleHealth(vehicleid, 0);
            CreateExplosion(x, y, z, 6, 10.0);
        }
    }
    return 1;
}
Reply
#6

K, i'll try it.
Ty
Reply
#7

Quote:
Originally Posted by Frankox
K, i'll try it.
Ty
i noticed some problems, so i just updated the code above
Reply
#8

Quote:
Originally Posted by happyface
Quote:
Originally Posted by Frankox
K, i'll try it.
Ty
i noticed some problems, so i just updated the code above
K, im going to test it...
Reply
#9

Quote:
Originally Posted by Frankox
Quote:
Originally Posted by happyface
Quote:
Originally Posted by Frankox
K, i'll try it.
Ty
i noticed some problems, so i just updated the code above
K, im going to test it...
Well... Again a problem. Doesnt show warning or error but i dont see the difference between explosions.
The explosion is the same as it was before.
Reply
#10

i used the same explosion id that you used, maybe i misunderstood the problem. your just looking for a bigger explosion?
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)