SA-MP Forums Archive
SetVehicleHealth dont work on first time? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: SetVehicleHealth dont work on first time? (/showthread.php?tid=98389)



SetVehicleHealth dont work on first time? - BMW_M3_GTR - 20.09.2009

Hi guys!

I am having this problem.When i start server and boxville is spawned it isnt damaged, but when it is destroyed and respawns, it is damaged.I dont get it! I have on OnGameModeInit that the boxville should be damaged, but it isnt.... why?

This is my code:

Код:
new box;

public damagebox()
{
SetVehicleHealth(box,250);
}

public OnGameModeInit()
{
box=AddStaticVehicle(498,-2252.0337,2285.1367,4.8855,89.2817,3,3); // boxville
SetTimer("damagebox",1000,0);
}

public OnVehicleSpawn(vehicleid)
{
if(vehicleid==box)
	  {
	  SetTimer("damagebox",1000,0);
	  }
}



Re: SetVehicleHealth dont work on first time? - ilikepie2221 - 20.09.2009

What you've done there is everytime box spawns, it blows up every second.