[Pedido] Sistema de FPS em TextDraw
#14

Quote:
Originally Posted by CidadeNovaRP
Посмотреть сообщение
Nгo, pois "d" serve para Nъmero...
Mesma coisa, os 2 sгo pra inteiros...

@Edit

Tente esse...

pawn Код:
#include <a_samp>

new TimerFPS[MAX_PLAYERS];
new Text:FPS[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
    FPS[playerid] = TextDrawCreate(577.000000, 9.000000, "FPS: Carregando");
    TextDrawBackgroundColor(FPS[playerid], 255);
    TextDrawFont(FPS[playerid], 1);
    TextDrawLetterSize(FPS[playerid], 0.209999, 1.400000);
    TextDrawColor(FPS[playerid], -1);
    TextDrawSetOutline(FPS[playerid], 0);
    TextDrawSetProportional(FPS[playerid], 1);
    TextDrawSetShadow(FPS[playerid], 1);

    TextDrawShowForPlayer(playerid, FPS[playerid]);
    TimerFPS[playerid] = SetTimerEx("AtualizarFPS", 1000, true, "i", playerid);
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    switch(reason)
    {
        case 0..2: KillTimer(TimerFPS[playerid]);
    }
    return 1;
}

forward AtualizarFPS(playerid);
public AtualizarFPS(playerid)
{
    new string[128];
    format(string, sizeof(string), "Seu 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: 2 Guest(s)