Vehicle 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: Vehicle health (
/showthread.php?tid=482976)
Vehicle health -
Dorlevi1506 - 23.12.2013
Hello guys, I'm used this code for set FACTION vehicle health,
pawn Код:
public OnVehicleSpawn(vehicleid)
{
for(new i; i < sizeof(LSPDVehicles); ++i)
{
SetVehicleHealth(LSPDVehicles[i],2500.0);
}
How can I change this code for Model Vehicle, Like Patriot (ID 470) I want to set the health to 3000, So what I need to do?
Re: Vehicle health -
CutX - 23.12.2013
in your loop:
if(GetVehicleModel(vehicleid) == 470) SetVehicleHeal..... and so on
Re: Vehicle health -
Konstantinos - 23.12.2013
pawn Код:
public OnVehicleSpawn(vehicleid)
{
for(new i; i < sizeof(LSPDVehicles); ++i)
{
if (GetVehicleModel(LSPDVehicles[i]) == 470) SetVehicleHealth(LSPDVehicles[i], 3000.0);
else SetVehicleHealth(LSPDVehicles[i], 2500.0);
}
return 1;
}
Re: Vehicle health - Patrick - 23.12.2013
In my understand, you want to set the
Patriot's vehicle health to
3000.0
pawn Код:
public OnVehicleSpawn(vehicleid)
{
for(new i; i < sizeof(LSPDVehicles); ++i)
{
return SetVehicleHealth(LSPDVehicles[i], 2500.0);
}
if(GetVehicleModel(vehicleid) == 470)
{
return SetVehicleHealth(vehicleid, 3000.0);
}
return true;
}
Re: Vehicle health -
Djole1337 - 23.12.2013
Quote:
Originally Posted by pds2k12
In my understand, you want to set the Patriot's vehicle health to 3000.0
pawn Код:
public OnVehicleSpawn(vehicleid) { for(new i; i < sizeof(LSPDVehicles); ++i) { return SetVehicleHealth(LSPDVehicles[i], 2500.0); } if(GetVehicleModel(vehicleid) == 470) { return SetVehicleHealth(vehicleid, 3000.0); } return true; }
|
return SetVehicleHealth(LSPDVehicles[i], 2500.0);
Will break that loop.
Re: Vehicle health -
Dorlevi1506 - 24.12.2013
It's dont work for me.. Maybe anothers codes?
Re: Vehicle health -
SilentSoul - 24.12.2013
Try this
pawn Код:
public OnVehicleSpawn(vehicleid)
{
for(new i = 0; i < MAX_VEHICLES; i++)
{
if(GetVehicleModel(vehicleid) == 470)
{
SetVehicleHealth(i, 3000);
}
}
return 1;
}