09.04.2016, 15:29
Hello guys
I am editing my fire system again and I experienced a bug -
The player reduces the fire's hp only when he taps the Fire button
Which means -
100 HP at start
100 Left Button clicks - Fire is 0 HP
Instead of reducing HP when the player HOLDS the button
Code
Thanks in advice
I am editing my fire system again and I experienced a bug -
The player reduces the fire's hp only when he taps the Fire button
Which means -
100 HP at start
100 Left Button clicks - Fire is 0 HP
Instead of reducing HP when the player HOLDS the button
Code
PHP код:
if (HOLDING( KEY_FIRE ))
{
new Float:fx, Float:fy, Float:fz;
GetDynamicObjectPos(FireObject, fx, fy, fz);
new string[256];
if(GetPlayerWeapon(playerid) == 42 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 407)
{
if(IsPlayerInRangeOfPoint(playerid, 40.0, fx, fy, fz))
{
FireHealth -= 1;
format(string, sizeof(string), "%d/100%", FireHealth);
Update3DTextLabelText(FireText, GREEN, string);
if(FireHealth <= 0)
{
DestroyDynamicObject(FireObject);
DestroyDynamicObject(SmokeObject);
Delete3DTextLabel(FireText);
FireHealth = 0;
FireTimer = SetTimer("StartRandomFire", 900000, false);
format(string, sizeof(string), "Auto-Dispatcher: The fire that was started has been successfully put out. Continue with normal duties.");
foreach(new i : Player)
{
if(IsACop(i) || IsAGov(i) || IsMedic(i) || IsSASD(i))
{
SendClientMessage(i, COLOR_DEPTRADIO, string);
}
}
return 1;
}
}
}
}