vehicle explosion - 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: vehicle explosion (
/showthread.php?tid=610877)
vehicle explosion -
CodeStyle175 - 29.06.2016
How to prevent vehicle from exploding, i know there was function for that, but i dont remember it.
Re: vehicle explosion -
FuNkYTheGreat - 29.06.2016
At OnGameModeInit
Код:
SetTimer("nexplode", 1000, 1);
and add it bottom of your Script
Код:
forward nexplode();
public nexplode()
{
for (new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerInAnyVehicle(i))
{
SetVehicleHealth(GetPlayerVehicleID(i), 1000.0);
}
}
}
Re: vehicle explosion -
diego200052 - 29.06.2016
See:
https://sampwiki.blast.hk/wiki/OnVehicleDeath
pawn Код:
public OnVehicleDeath(vehicleid, killerid)
{
SetVehicleHealth(vehicleid, 1000.0);
return 1;
}
Note:
This callback will also be called when a vehicle enters water, but the vehicle can be saved from destruction by teleportation or driving out (if only partially submerged). The callback won't be called a second time, and the vehicle may disappear when the driver exits, or after a short time.
OR See:
https://sampwiki.blast.hk/wiki/OnVehicleDamageStatusUpdate
pawn Код:
public OnVehicleDamageStatusUpdate(vehicleid, playerid)
{
new Float:health;
GetVehicleHealth(vehicleid, health);
if(health <= 250.0)
SetVehicleHealth(vehicleid, 1000.0);
return 1;
}