About vehicles health -
JulietaZ - 20.09.2010
It is there any way to make bikes to have lesser health? to be destoyed easily...and increase tank health....
Re: About vehicles health -
Mauzen - 20.09.2010
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)
Re: About vehicles health -
Vince - 20.09.2010
Quote:
Originally Posted by Mauzen
you cant set it to more than 1000 i think
|
Does work.
Re: About vehicles health -
Mauzen - 20.09.2010
Ah thanks, good to know.
So you can also increase it for the tank, just set it to 1500 or so.
Re: About vehicles health -
JulietaZ - 21.09.2010
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....
Re: About vehicles health -
BP13 - 21.09.2010
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.
Re: About vehicles health -
JulietaZ - 21.09.2010
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=
Re: About vehicles health -
BP13 - 21.09.2010
pawn Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
if(GetVehicleModel(vehicleid)== 463)
{
SetVehicleHealth(vehicleid,10);
}
return 1;
}
Re: About vehicles health -
JulietaZ - 21.09.2010
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...
Re: About vehicles health -
iFriSki - 21.09.2010
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.