Why Doesn't work
#1

Код:
#include <a_samp>

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{

    SetTimer("HealthCheck", 1000, 1);
    return 1;
}

forward HealthCheck();
public HealthCheck()
{
    for(new i=0; i<MAX_PLAYERS; i++){
        if(IsPlayerConnected(i)){
            new Float:Health;
            GetPlayerHealth(i, Health);
            if(Health < 50){
                ApplyAnimation(i,"SWAT","gnstwall_injurd" , 4.0, 1, 0, 0, 0, 0);//Anim
                TogglePlayerControllable(i, 0);// Freeze the player
                SetPlayerHealth(i, Health - 1);//Optional for increace player's life, and unfreeze it
            }
            else{
                ClearAnimations(i);
                TogglePlayerControllable(i, 1);
            }
        }
    }
}
#endif
This filterscript Doesn't working help me please
Reply
#2

You might want to change a bit of that code, give me a sec ill edit this post

Optimized, Intended. ---> Made it noobish so you would get an better understanding. the script is not tested so i don't guarantee it to work.

pawn Код:
// Includes
#include <a_samp>

// Forwards
forward HealthCheck(playerid);

// Enums
enum PlayerInfo
{
    Float: Health,
}
// Symbols
new pInfo[MAX_PLAYERS][PlayerInfo];
// Timers
new HealthTimer[MAX_PLAYERS];
// Callbacks
public OnFilterScriptInit()
{

    printf("Health Check By Cameltoe....... <--- o_o --->");
    return 1;
}

public OnPlayerConnect(playerid)
{
    HealthTimer[playerid] = SetTimerEx("HealthCheck", 1000, true, "i", playerid);
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    KillTimer(HealthTimer[playerid]);
    return 1;
}

// Functions
public HealthCheck(playerid)
{
    GetPlayerHealth(playerid, pInfo[playerid][Health]);
    if(floatround(pInfo[playerid][Health]) < 50)
    {
        ApplyAnimation(playerid,"SWAT","gnstwall_injurd" , 4.0, 1, 0, 0, 0, 0);//Anim
        TogglePlayerControllable(playerid, 0);// Freeze the player
        SetPlayerHealth(playerid, pInfo[playerid][Health] - 1);//Optional for increace player's life, and unfreeze it
    }
    else
    {
        ClearAnimations(playerid); // You Would Probably remove this ;)
        TogglePlayerControllable(playerid, 1);
    }
}
Reply
#3

Must be
pawn Код:
#define FILTERSCRIPT
#if defined FILTERSCRIPT
or remove if defined and endif
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)