02.04.2019, 16:11
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.
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);
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.
|
new Float, Float:y, Float:z; GetVehiclePos(vehicleid, x, y, z); GetVehicleHealth(vehicleid, health) if(health == 0) { CreateExplosion(x, y, z, 2, 10.0); } |