SA-MP Forums Archive
OnVehicleSpawn & SetVehicleHealth - 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: OnVehicleSpawn & SetVehicleHealth (/showthread.php?tid=468236)



OnVehicleSpawn & SetVehicleHealth - Johurt - 07.10.2013

Код:
public OnVehicleSpawn(vehicleid)
{
     if(tInfo[vehicleid][vOwned])
     {
          if(!IsABike(vehicleid))
          {
               SetVehicleHealth(vehicleid, 230);
          }
     }
     return 1;
}
Vehicle explodes but OnVehicleDeath don't call. How to fix it?
P.S: Timers can't help ;/
P.P.S: It is sa:mp bug, but i don't know how to fix it. Certainly i can create NPC and put he in vehicle, but it not good idea.


Re: OnVehicleSpawn & SetVehicleHealth - Scrillex - 07.10.2013

TUTS
Link1
LINK2


Re: OnVehicleSpawn & SetVehicleHealth - Johurt - 07.10.2013

Quote:
Originally Posted by Scrillex
Посмотреть сообщение
? I know how to create and respawn vehicle... I don't understand why my script don't call OnVehicleDeath when car explodes(when i sets vehicle health 230).

Код:
public OnVehicleSpawn(vehicleid)
{
     if(tInfo[vehicleid][vOwned])
     {
          if(!IsABike(vehicleid))
          {
               SetVehicleHealth(vehicleid, 230);
          }
     }
     return 1;
}



Re: OnVehicleSpawn & SetVehicleHealth - Konstantinos - 07.10.2013

Quote:
Originally Posted by Johurt
Посмотреть сообщение
? I know how to create and respawn vehicle... I don't understand why my script don't call OnVehicleDeath when car explodes(when i sets vehicle health 230).
Quote:
Originally Posted by Johurt
Посмотреть сообщение
Код:
public OnVehicleSpawn(vehicleid)
{
     SetVehicleHealth(vehicleid, 230);
     return 1;
}
Vehicle explodes but OnVehicleDeath don't call. How to fix it?
P.S: Timers can't help ;/
You set the vehicle's health when it re-spawns (after its death) and assuming from that code, it will set the health to 230 which result in fire AGAIN.


Re: OnVehicleSpawn & SetVehicleHealth - Johurt - 07.10.2013

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
You set the vehicle's health when it re-spawns (after its death) and assuming from that code, it will set the health to 230 which result in fire AGAIN.
You didn't understand me. I loading own vehicle, OnVehicleSpawn i set vehicle health(only 1 time).
It is sa:mp bug, but i don't know how to fix it. Certainly i can create NPC and put he in vehicle, but it not good idea.
EDIT: Put NPC/Player in vehicle and then set HP or just set > 250 HP.