LOW FPS
#2

pawn Код:
#include <a_samp>

#define MIN_FPS_ALLOWED     16
#define MAX_FPS_WARNINGS    5

IsPlayerSpawned(playerid)
{
    switch(GetPlayerState(playerid))
    {
        case 1, 2, 3, 8:
            return 1;
    }
    return 0;
}

public OnPlayerUpdate(playerid)
{
    static  old_drunk       [MAX_PLAYERS],
            fps_warnings    [MAX_PLAYERS];

    if(IsPlayerSpawned(playerid))
    {
        new new_drunk = GetPlayerDrunkLevel(playerid);
        if(new_drunk <= 100)
            SetPlayerDrunkLevel(playerid, 2000);
        else if(new_drunk != old_drunk[playerid])
        {
            new fps = old_drunk[playerid] - new_drunk;
            if(fps >= 0)
            {
                if(fps <= MIN_FPS_ALLOWED)
                {
                    if(++ fps_warnings[playerid] >= MAX_FPS_WARNINGS)
                    {
                        Kick(playerid);
                        fps_warnings[playerid] = 0;
                    }
                }
                else if(fps_warnings[playerid] > 0)
                    fps_warnings[playerid] = 0;
            }
            old_drunk[playerid] = new_drunk;
        }
    }
    else if(fps_warnings[playerid] > 0)
        fps_warnings[playerid] = 0;
    return 1;
}
I didn't test this but it should work. Try it out and tell me if it doesn't work!
Reply


Messages In This Thread
LOW FPS - by Greaper - 28.10.2014, 18:28
Re: LOW FPS - by RedFusion - 28.10.2014, 19:44
Re: LOW FPS - by Glossy42O - 28.10.2014, 19:44

Forum Jump:


Users browsing this thread: 1 Guest(s)