SA-MP Forums Archive
Thist isnt working correctly -.- - 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: Thist isnt working correctly -.- (/showthread.php?tid=369801)



Thist isnt working correctly -.- - NinjaChicken - 18.08.2012

ok i have this code under public ONVEHICLESPAWN

pawn Код:
if(GetVehicleModel(vehicleid) == 596 || GetVehicleModel(vehicleid) == 597 || GetVehicleModel(vehicleid) == 598) SetVehicleHealth(vehicleid,1500.0);

    if(GetVehicleModel(vehicleid) == 407 || GetVehicleModel(vehicleid) == 470) SetVehicleHealth(vehicleid,2000.0);

    if(GetVehicleModel(vehicleid) == 428 || GetVehicleModel(vehicleid) == 433 || (vehicleid) == 482) SetVehicleHealth(vehicleid,3000.0);

    if(GetVehicleModel(vehicleid) == 601 || GetVehicleModel(vehicleid) == 528) SetVehicleHealth(vehicleid,4000.0);

    if(GetVehicleModel(vehicleid) == 432) SetVehicleHealth(vehicleid,5000.0);
what i want it to do every vehicle in the server with thos ID's have their set HP but once i restart the server and go into it i have to /respawncars 50000 to make the HP the correct amounts please help


Re: Thist isnt working correctly -.- - Cjgogo - 18.08.2012

Here's the sugesstions(I once experienced this when I wanted to count how many cars are in my server),just take a for that goes from i=1 to MAX_VEHICLES,and apply the code in OnGameModeInit,better said add this to OnGameModeInit:

pawn Код:
for(new vehicleid=0;vehicleid<MAX_VEHICLES;vehicleid++)
{
   if(GetVehicleModel(vehicleid) == 596 || GetVehicleModel(vehicleid) == 597 || GetVehicleModel(vehicleid) == 598) SetVehicleHealth(vehicleid,1500.0);
    if(GetVehicleModel(vehicleid) == 407 || GetVehicleModel(vehicleid) == 470) SetVehicleHealth(vehicleid,2000.0);
    if(GetVehicleModel(vehicleid) == 428 || GetVehicleModel(vehicleid) == 433 || (vehicleid) == 482) SetVehicleHealth(vehicleid,3000.0);
    if(GetVehicleModel(vehicleid) == 601 || GetVehicleModel(vehicleid) == 528) SetVehicleHealth(vehicleid,4000.0);
    if(GetVehicleModel(vehicleid) == 432) SetVehicleHealth(vehicleid,5000.0);
}
That will do it,even if you restart.


Re: Thist isnt working correctly -.- - NinjaChicken - 18.08.2012

nope still dont work i got IG spawn a vehicle ID 432 and its only got 1000 hp please help


Re: Thist isnt working correctly -.- - Cjgogo - 18.08.2012

Leave it both on OnVehicleSpawn,but if you want it to apply it hwen you restart also leave it on OnGameModeInit


Re: Thist isnt working correctly -.- - NinjaChicken - 18.08.2012

but even if i leve it on both the vehicles dont spawn this the 5k hp