Make Vehicles Spawn With Custom Health
#1

hey hey,

on my server i got a small army base in LS, to make it more realistic and more logical i want to make some vehicles (Rhino, Hunter, Hydra etc.) spawn with an amount of health that's not the default 1.000, like a Rhino will spawn with 10.000 health. Any ideas how this is possible?
Reply
#2

PHP код:
public OnVehicleSpawn(vehicleid){
    
    new 
vehm GetVehicleModel(vehicleid);
    
    if(
vehm == 520 || vehm == 432 || vehm == 425){
        
SetVehicleHealth(vehicleid10000.0);
    }
    return 
1;

Reply
#3

Will that also work with vehicles that are spawned under OnGamemodeInit?
Reply
#4

maybe

add under vehicles

PHP код:
public OnGameModeInit(){
    
//code
    
    
for(new 0<= MAX_VEHICLESi++){
        if(
IsValidVehicle(i)){
            new 
vehm GetVehicleModel(i);
            if(
vehm == 520 || vehm == 432 || vehm == 425){
                
SetVehicleHealth(i10000.0);
            }
        }
    }
    return 
1;

Reply
#5

I will try this when I am home, I think you can replace SetVehicleHealth wilth other things also (like AddVehicleComponent), so I can make a sultan spawn tuned?
Reply
#6

yes.
Reply
#7

OnVehicleSpawn is called when vehicles REspawn, not the first spawn. You'll need to hook CreateVehicle/AddStaticVehicle(Ex).
Reply
#8

Quote:
Originally Posted by MP2
Посмотреть сообщение
OnVehicleSpawn is called when vehicles REspawn, not the first spawn. You'll need to hook CreateVehicle/AddStaticVehicle(Ex).
already I gave what to do

hook is unnecessary
Reply
#9

"error 017: undefined symbol "IsValidVehicle""

any idea?
Reply
#10

Place this under your includes

Код:
native IsValidVehicle(vehicleid);
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)