Код:
#define FILTERSCRIPT
#include <a_samp>
#if defined FILTERSCRIPT
new injuretimer, Injured[MAX_PLAYERS];
#endif
public OnFilterScriptInit()
{
// On top of your screen
forward InjuredT(playerid);
public OnPlayerUpdate(playerid)
{
new Float:health;
GetPlayerHealth(playerid, health);
if (health < 25.0)
{
new string[50];
LoopingAnim(playerid, "SWEET", "Sweet_injuredloop", 4.0, 1, 0, 0, 0, 0);
format(string, sizeof(string), "~r~You need help!");
GameTextForPlayer(playerid, string, 3000, 5);
TogglePlayerControllable(playerid, false); // disallows him to metagame ^^
SetCameraBehindPlayer(playerid); // turns the camera back for a better view
injuretimer = SetTimerEx("InjuredT", 3000, true, "d", playerid); // starts a timer, every 3 seconds you lose 1 hp
Injured[playerid] = 1;
}
else KillTimer(injuretimer), Injured[playerid] = 0; // this is for safety so it won't bug
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
if(gPlayerUsingLoopingAnim[playerid])
{
gPlayerUsingLoopingAnim[playerid] = 0;
TogglePlayerControllable(playerid, true);
}
if(Injured[playerid] == 1)
{
KillTimer(injuretimer);
Injured[playerid] = 0;
}
return 1;
}
public InjuredT(playerid)
{
new Float:health;
GetPlayerHealth(playerid, health);
SetPlayerHealth(playerid, health-1);
return 1;
}