How to set a vehicle's model health
#1

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!
Reply
#2

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);
    }
}
Reply
#3

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);
}
Reply
#4

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++)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)