SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 02/04/2019, 05:11 PM   #1
ball
Huge Clucker
 
ball's Avatar
 
Join Date: Jul 2012
Location: Poznan, Poland
Posts: 279
Reputation: 33
Default Explode vehicle immediately

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.
ball is offline   Reply With Quote
Old 02/04/2019, 05:18 PM   #2
MSC
Little Clucker
 
MSC's Avatar
 
Join Date: Feb 2019
Location: Tunisia
Posts: 24
Reputation: 0
Flowers Re: Explode vehicle immediately

It's not possible.
__________________
- Closed all projects, will be back soon -
MSC is offline   Reply With Quote
Old 02/04/2019, 05:28 PM   #3
Bolex_
Gangsta
 
Bolex_'s Avatar
 
Join Date: Aug 2015
Location: Croatia.
Posts: 591
Reputation: 117
Default Re: Explode vehicle immediately

It is possible, try doing something like this.

pawn Code:
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);
Bolex_ is offline   Reply With Quote
Old 02/04/2019, 05:29 PM   #4
RedFusion
Gangsta
 
RedFusion's Avatar
 
Join Date: Nov 2009
Location: Sweden
Posts: 921
Reputation: 330
Default Re: Explode vehicle immediately

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.
__________________
Also known as fusez
RedFusion is offline   Reply With Quote
Old 02/04/2019, 06:42 PM   #5
ball
Huge Clucker
 
ball's Avatar
 
Join Date: Jul 2012
Location: Poznan, Poland
Posts: 279
Reputation: 33
Default Re: Explode vehicle immediately

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.
ball is offline   Reply With Quote
Old 02/04/2019, 06:49 PM   #6
Kaliber
High-roller
 
Kaliber's Avatar
 
Join Date: Jun 2012
Location: Localhost
Posts: 1,068
Reputation: 149
Default Re: Explode vehicle immediately

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...
__________________
Kaliber is offline   Reply With Quote
Old 03/04/2019, 01:28 AM   #7
Pottus
High-roller
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 4,899
Reputation: 1321
Default Re: Explode vehicle immediately

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.
Pottus is offline   Reply With Quote
Old 04/04/2019, 03:17 PM   #8
ball
Huge Clucker
 
ball's Avatar
 
Join Date: Jul 2012
Location: Poznan, Poland
Posts: 279
Reputation: 33
Default Re: Explode vehicle immediately

Quote:
Originally Posted by Pottus View Post
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 View Post
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.
ball is offline   Reply With Quote
Old 06/04/2019, 01:38 AM   #9
Pottus
High-roller
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 4,899
Reputation: 1321
Default Re: Explode vehicle immediately

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.

Last edited by Pottus; 06/04/2019 at 04:15 AM.
Pottus is offline   Reply With Quote
Old 07/04/2019, 10:04 AM   #10
GeorgeLimit
Big Clucker
 
GeorgeLimit's Avatar
 
Join Date: Mar 2018
Location: Anywhare
Posts: 92
Reputation: 0
Default Re: Explode vehicle immediately

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);
}
GeorgeLimit is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fire in the vehicle does not explode KinG7 Bug Reports 2 17/03/2017 07:22 PM
Explode vehicle Banditukas Scripting Help 3 14/08/2014 06:52 PM
Set vehicle to explode? Trynda Scripting Help 5 02/05/2014 10:41 AM
explode on the vehicle itself GoldZoroGrab Scripting Help 17 02/04/2013 08:28 PM
Immediately vehicle explosion ziomal432 Help Archive 6 11/04/2010 09:06 AM


All times are GMT. The time now is 02:15 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.