[Pedido] Sistema de FPS em TextDraw
#2

Ta ae :
pawn Код:
#include <a_samp>

new Text:FPS[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    FPS[playerid] = TextDrawCreate(240.0, 580.0, "FPS: Carregando");

    TextDrawShowForPlayer(playerid, FPS[playerid]);
    return 1;
}

public OnPlayerUpdate(playerid)
{
    new string[128];
    format(string, sizeof(string), "Your FPS: %d", GetPlayerFPS(playerid));
    TextDrawSetString(FPS[playerid], string);
    return 1;
}

stock GetPlayerFPS(playerid)
{
    SetPVarInt(playerid, "DrunkL", GetPlayerDrunkLevel(playerid));
    if(GetPVarInt(playerid, "DrunkL") < 100)
    {
        SetPlayerDrunkLevel(playerid, 2000);
    }
    else
    {
        if(GetPVarInt(playerid, "LDrunkL") != GetPVarInt(playerid, "DrunkL"))
        {
            SetPVarInt(playerid, "FPS", (GetPVarInt(playerid, "LDrunkL") - GetPVarInt(playerid, "DrunkL")));
            SetPVarInt(playerid, "LDrunkL", GetPVarInt(playerid, "DrunkL"));
            if((GetPVarInt(playerid, "FPS") > 0) && (GetPVarInt(playerid, "FPS") < 256))
            {
                return GetPVarInt(playerid, "FPS") - 1;
            }
        }
    }
    return 0;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)