Instant Vehicle Explosion?
#1

Is there a way that i can instantly explode a car?!

Thanks!
Reply
#2

Try setting the health of the vehicle to zero and create an explosion on the vehicle. I'm not sure if that will work but i think it might.
Reply
#3

Set the health directly to 0/-1?
Reply
#4

The only way would be to create an explosion directly on the vehicle, and with luck, it'll explode that instant. You could try setting multiple explosions as well.
Reply
#5

Quote:
Originally Posted by varthshenon
View Post
Set the health directly to 0/-1?
I think that just sets the car on fire (blows up after few seconds) I might be wrong.
Reply
#6

Quote:
Originally Posted by iggy1
View Post
I think that just sets the car on fire (blows up after few seconds) I might be wrong.
Dunno. AFAIK When you shoting vehicle until it's on fire and keep shoting it, it will blow instanly.
Reply
#7

Quote:
Originally Posted by varthshenon
View Post
Dunno. AFAIK When you shoting vehicle until it's on fire and keep shoting it, it will blow instanly.
I have tested setting the vehicle health to 0.00 before, it simply sets it on fire.
Reply
#8

Its probably better to do both like i said. (setting health first) I say do both because the explosion you create isn't guaranteed to take 1000 hp from the vehicle.
Reply
#9

Well I kinda wondered also how to do it..
Trying it with health to 0 & explosion :P

--
edit: testing now
edit2: didn't work?
Reply
#10

Quote:
Originally Posted by Bakr
View Post
I have tested setting the vehicle health to 0.00 before, it simply sets it on fire.
Well, my bad. How about -1?
Or yeah create an explosion and quickly destroy the vehicle (DestroyVehicle).
Reply
#11

What i did was i set the car health directly to 0 via

SetVehicleHealth

then i created a couple explosions creating the process faster.

Success, thanks guys!
Reply
#12

This worked for me:
pawn Code:
new Float:x, Float:y, Float:z;
    GetVehiclePos(GetPlayerVehicleID(playerid), x,y,z);
    CreateExplosion(x,y,z,0, 10);
Setting the health to 0 and then explode -> didn't work..
Explode -> works..

Car explodes around 1 second after the CreateExplosion
Reply
#13

Its impossible to blow up a vehicle that is empty with CreateExplosion
Reply
#14

Okay, Next thing that i need.

How can i make it so that the player CANNOT exit his vehicle? Without TogglePlayerControlable? Can anyone help me there?

This currently dosnt work:

pawn Code:
public OnPlayerExitVehicle(playerid, vehicleid)
{
    if(explosion == 0)
    {
        return 1;
    }
    else if(explosion == 1)
    {
        PutPlayerInVehicle(playerid, vehicleid, GetPlayerVehicleSeat(playerid));
        SendClientMessage(playerid,COLOR_RED,"You Cannot Leave Your Car While Bomb Armed!");
        SendClientMessage(playerid,COLOR_LIGHTBLUE,"Type /Disarm Bomb To Disarm it!");
    }
    return 1;
}
Reason it probably doesn't work?

Because it cant find vehicleid?

Little help?
Reply
#15

Use OnPlayerStateChange.
Reply
#16

No, don't use OnPlayerStateChange. That isn't called until the player actually got out and closed the door.

The SA:MP Wiki is a wonderful thing!
Code:
Note: Sometimes the result can be 128 which is an invalid seat ID. Circumstances of this are not yet known, but it is best to discard information when returned seat number is 128.
https://sampwiki.blast.hk/wiki/GetPlayerVehicleSeat
Reply
#17

Okay, as you see from my script below:

pawn Code:
public OnPlayerExitVehicle(playerid, vehicleid)
{
    if(explosion == 0)
    {
        return 1;
    }
    else if(explosion == 1)
    {
        new iSeat = GetPlayerVehicleSeat(playerid);
        if(iSeat == 0)
        {
            PutPlayerInVehicle(playerid, vehicleid, GetPlayerVehicleSeat(playerid));
            SendClientMessage(playerid,COLOR_RED,"You Cannot Leave Your Car While Bomb Armed!");
            SendClientMessage(playerid,COLOR_LIGHTBLUE,"Type /Disarm Bomb To Disarm it!");
        }
    }
    return 1;
}
It still doesn't seem to be working.

Anymore suggestions?

What i want is that if the player attempts to exit the vehicle while his bomb is in the process of being exploded, it will put him back into the driver seat saying that you cannot do that.
Reply
#18

try with onplayerkeystatechange when a player press the enter/exit button
Reply
#19

Problem Solved!

Problem = Under the command i had the variable set to 0

Should have been set to 1
Reply
#20

for your earlier theory, just create an explosion then destroy then vehicle.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)