SA-MP Forums Archive
Global vehicles health - 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: Global vehicles health (/showthread.php?tid=384664)



Global vehicles health - Face9000 - 12.10.2012

Hello,here is my problem.

I want to set the hp of every vehicle to 980,so i used this:

pawn Код:
public OnVehicleSpawn(vehicleid)
{
    SetVehicleHealth(vehicleid, 980.0);
    return 1;
}
But when the vehicles spawns,they have everytime 1000 hp.How to fix this?


Re: Global vehicles health - Gangster-rocks - 12.10.2012

PHP код:
public OnPlayerEnterVehicle(vehicleid,playerid//this maybe wrong one i didn't script for a month from now so
{
    
SetVehicleHealth(vehicleid980.0);
    return 
1;




Re: Global vehicles health - Face9000 - 12.10.2012

Wrong,but thanks for the help.


Re: Global vehicles health - SuperViper - 12.10.2012

OnVehicleSpawn is called when a vehicle respawns. If you want OnVehicleCreate, you can use this: https://sampforum.blast.hk/showthread.php?tid=348044


Re: Global vehicles health - thefatshizms - 12.10.2012

nvm i wasn't reading it properly


Re: Global vehicles health - Jefff - 12.10.2012

pawn Код:
forward SetVehicleHealthEx(vehicleid,Float:vHealth);
public SetVehicleHealthEx(vehicleid,Float:vHealth)
    return SetVehicleHealth(vehicleid,vHealth);
   

public OnVehicleSpawn(vehicleid)
{
    SetTimerEx("SetVehicleHealthEx",500,false,"df",vehicleid,980.0);
    return 1;
}