How to set a vehicle's model 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: How to set a vehicle's model health (
/showthread.php?tid=588902)
How to set a vehicle's model health -
JXbro - 13.09.2015
Well I would like to know how I can make special vehicle id's(and also the models themselves) like faggio or nrg have their own HP. E.x the normal health of a car is 1000, how can I make it that every faggio in the server has 2000 hp, and also I would prefer to know how I can make few id's have special HP like:vehicle id:424, 322 etc
thanks for your time

much appriecated!
Re: How to set a vehicle's model health -
Gammix - 13.09.2015
SetVehicleHealth:
https://sampwiki.blast.hk/wiki/SetVehicleHealth
Use loops to get a vehicle's model id by
GetVehicleModel and set the health to 2000.
pawn Код:
for (new i; i < MAX_VEHICLES; i++) {
if (GetVehicleModel(i) == fagio_model_id) {
SetVehicleHealth(i, 2000);
}
}
Re: How to set a vehicle's model health -
Evocator - 13.09.2015
You need to update the HP when the vehicle (re)spawns:
Код:
public OnVehicleSpawn(vehicleid)
{
switch (GetVehicleModel(vehicleid)) // Models
{
case nrg, fagio, x, y, z:
SetVehicleHealth(vehicleid, 2000.0);
}
if (vehicleid == VEHICLE_1) // IDs
SetVehicleHealth(vehicleid, 5000.0);
}
Re: How to set a vehicle's model health -
JXbro - 13.09.2015
I just can't really find a way to compile it, here's my onvehicle enter start shown on wiki(but here's on my script):
for(new x=0; x<MAX_PLAYERS; x++)