How to make when car hp is lower than 20% to dont explode ? - 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: How to make when car hp is lower than 20% to dont explode ? (
/showthread.php?tid=486756)
How to make when car hp is lower than 20% to dont explode ? -
barts - 10.01.2014
<----
Re: How to make when car hp is lower than 20% to dont explode ? -
xZdadyZx - 10.01.2014
Read this one, next time use search.
https://sampforum.blast.hk/showthread.php?tid=245249
Re: How to make when car hp is lower than 20% to dont explode ? -
barts - 10.01.2014
This is not what i am searching
Re: How to make when car hp is lower than 20% to dont explode ? -
Vince - 10.01.2014
pawn Код:
for(new i, vehicleid; i < MAX_PLAYERS; i++)
{
if((vehicleid = GetPlayerVehicleID(i))) // Note: we want this assignment, so one '=' only.
{
new Float:vhp;
GetVehicleHealth(vehicleid, vhp);
if(vhp < 250.0)
{
SetVehicleHealth(vehicleid, 250.0);
}
}
}
Put that in a repeating global timer.
Re: How to make when car hp is lower than 20% to dont explode ? -
barts - 10.01.2014
Where to put ?
Re: How to make when car hp is lower than 20% to dont explode ? -
erminpr0 - 10.01.2014
Quote:
Originally Posted by Vince
[pawn]
Put that in a repeating global timer.
|
So do it like this:
pawn Код:
forward SomeTimer();
public SomeTimer()
{
for(new i, vehicleid; i < MAX_PLAYERS; i++)
{
if((vehicleid = GetPlayerVehicleID(i))) // Note: we want this assignment, so one '=' only.
{
new Float:vhp;
GetVehicleHealth(vehicleid, vhp);
if(vhp < 250.0)
{
SetVehicleHealth(vehicleid, 250.0);
}
}
}
}
Код:
SetTimer("SomeTimer", 1500, true);
Re: How to make when car hp is lower than 20% to dont explode ? -
barts - 10.01.2014
Where must i start this time