SA-MP Forums Archive
Need Help - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need Help (/showthread.php?tid=179745)



Need Help - rati555 - 28.09.2010

When I am scripting this pawno code

Код:
#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;
}
i have erroros anywhone please help me
sorry for my bad english


Re: Need Help - <Weponz> - 28.09.2010

replace
Код:
public OnFilterScriptInit()
{
// On top of your screen
with
Код:
public OnFilterScriptInit()
{
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}
and change the order like this up top
Код:
#include <a_samp>
#define FILTERSCRIPT