About vehicles health
#1

It is there any way to make bikes to have lesser health? to be destoyed easily...and increase tank health....
Reply
#2

Increasing health is hard, but lowering it is no problem. You could do this in OnVehicleSpawn. Check if the model of the vehicleid is a bike, and if yes, use SetVehicleHealth() to lower it (1000.0 is the normal max health, you cant set it to more than 1000 i think)
Reply
#3

Quote:
Originally Posted by Mauzen
Посмотреть сообщение
you cant set it to more than 1000 i think
Does work.
Reply
#4

Ah thanks, good to know.
So you can also increase it for the tank, just set it to 1500 or so.
Reply
#5

public OnVehicleSpawn(vehicleid)
{
if(GetVehicleModel(vehicleid)== 463)
{
SetVehicleHealth(vehicleid,10);
}
}

Well no errors no warnings, but also not working D=...i just wanted to make bikes to instant explode when hit just to test if i did it correctly, when done i will set the health to 500 or something to make them be weak than cars...cuz actually bikes are godly :S....
Reply
#6

Quote:
Originally Posted by JulietaZ
Посмотреть сообщение
public OnVehicleSpawn(vehicleid)
{
if(GetVehicleModel(vehicleid)== 463)
{
SetVehicleHealth(vehicleid,10);
}
}

Well no errors no warnings, but also not working D=...i just wanted to make bikes to instant explode when hit just to test if i did it correctly, when done i will set the health to 500 or something to make them be weak than cars...cuz actually bikes are godly :S....
use that code under OnvehicleStreamIn.
Reply
#7

public OnvehicleStreamIn(vehicleid)
{
if(GetVehicleModel(vehicleid)== 463)
{
SetVehicleHealth(vehicleid,10);
}
}

And i receive a warning "warning 235: public function lacks forward declaration (symbol "OnvehicleStreamIn")"
I think with 10 hp the bike should burn with 2 bullets...but no..haves same HP, with the last codes i posted it had no warning but the bike health stills the same D=
Reply
#8

pawn Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
    if(GetVehicleModel(vehicleid)== 463)
    {
        SetVehicleHealth(vehicleid,10);
    }
    return 1;
}
Reply
#9

Stills not working...with 10 hp the bike should burn with 1 desert shot i guess....but no its not changing :S and stills gives the same warning message...
Reply
#10

Quote:
Originally Posted by BP13
Посмотреть сообщение
pawn Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
    if(GetVehicleModel(vehicleid)== 463)
    {
        SetVehicleHealth(vehicleid,10);
    }
    return 1;
}
Correct me if I'm wrong, but I believe SA:MP would reset the vehicles HP if someone else came across it while it was in use, yes?

The following is how I'd go about doing this task.
pawn Код:
public OnFilterScriptInit()
{
    new Spawn[] = {210, 232, 344, 318}; // Vehicle IDs to respawn
    for(new i; i < sizeof Spawn; i++)
    {
        SetVehicleToRespawn(Spawn[i]);
    }
    return 1;
}
public OnVehicleSpawn(vehicleid)
{
    if(vehicleid == 210) // 210 is the vehicles ID
    {
        SetVehicleHealth(210, 350); // Vehicles blow up around 250-270, so 350 is fairly low
        return 1;
    }
    return 1;
}
Not the greatest method, but it'll work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)