SA-MP Forums Archive
Explode vehicle immediately - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Explode vehicle immediately (/showthread.php?tid=665399)



Explode vehicle immediately - ball - 02.04.2019

Hi, is there a way to explode vehicle immediately or after some miliseconds? I tried with SetVehicleHealth, multiple epxlosions but it always blows after 5-7 seconds.


Re: Explode vehicle immediately - MSC - 02.04.2019

It's not possible.



Re: Explode vehicle immediately - Bolex_ - 02.04.2019

It is possible, try doing something like this.

pawn Код:
new Float:g_vPosition[ 3 ];

GetVehiclePos(vehicleid, g_vPosition[0], g_vPosition[1], g_vPosition[2]);
CreateExplosion(g_vPosition[0], g_vPosition[1], g_vPosition[2], 0, 5);
if(IsPlayerInVehicle(playerid, vehicleid)) SetPlayerHealth(playerid, 0);
SetVehicleHealth(vehicleid, -1);



Re: Explode vehicle immediately - RedFusion - 02.04.2019

You could run a loop and kill all the players inside the vehicle, and create an explosion at the position of the vehicle. But there is no way to make the vehicle explode immediately as far as i know.


Re: Explode vehicle immediately - ball - 02.04.2019

It seems that SetPlayerHealth with CreateExplosion in vehicle kinda bugs player (dies twice or sometimes doesn't respawn at all). Anyway, thanks for helping guys, I appreciate your efforts.


Re: Explode vehicle immediately - Kaliber - 02.04.2019

If you kill them in the car, that bugs.

You should use SetPlayerPos and remove them with that function out of the car and kill them then.

Its a stupid and annoying bug...


Re: Explode vehicle immediately - Pottus - 03.04.2019

You don't need to set a players health to 0 to kill them. All that does is achieve death on the client, so register their death server side and respawn them. There is no need to set vehicle health either it's totalled or not let the server decide that. Make sure you register when a player is either alive or dead with a variable IsDead[MAX_PLAYERS];. It's so easy to do this stuff you are completely thinking about it all wrong rely on the server not the client.


Re: Explode vehicle immediately - ball - 04.04.2019

Quote:
Originally Posted by Pottus
Посмотреть сообщение
You don't need to set a players health to 0 to kill them. All that does is achieve death on the client, so register their death server side and respawn them. There is no need to set vehicle health either it's totalled or not let the server decide that. Make sure you register when a player is either alive or dead with a variable IsDead[MAX_PLAYERS];. It's so easy to do this stuff you are completely thinking about it all wrong rely on the server not the client.
Do not compromise yourself. It's not me thinking about it wrong. It's you not understand what I want to achieve. I asked the question about vehicle's explosion and you post $hitty answer about what?

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
If you kill them in the car, that bugs.

You should use SetPlayerPos and remove them with that function out of the car and kill them then.

Its a stupid and annoying bug...
I replaced SetPlayerPos with RemoveVehicle, then turn on spectate mode and it's looking good, thanks for the tip.


Re: Explode vehicle immediately - Pottus - 06.04.2019

Man are you ever stupid. Read what I wrote, sure you found a way you like but that isn't always the case sometimes you need to change your thinking. In any case.

Rely on the server not the client.

Not my fault you are a goof.


Re: Explode vehicle immediately - GeorgeLimit - 07.04.2019

Try use this


Quote:

new Float, Float:y, Float:z;
GetVehiclePos(vehicleid, x, y, z);
GetVehicleHealth(vehicleid, health)
if(health == 0)
{
CreateExplosion(x, y, z, 2, 10.0);
}