GetPlayerFps returns 0
#1

Hello, i've this stock to check the player FSP but it returns always 0.

I mean,if i do /fps playerid it says: "Nameplayer fps: 0"

pawn Код:
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;
}
What's wrong?
Reply
#2

It's because oyu have onlly used return 0; inside the stock.
What do you wan't it to return?
Reply
#3

Because i have a command for admins only to check a player FPS and when i use it, it returns me always: FPS 0.
Reply
#4

Then it seems that "LDrunkL" is lower then DrunkL or they are the same.
So check that.
Reply
#5

I edited in this way:

pawn Код:
stock GetPlayerFps(playerid)
{
    SetPVarInt(playerid, "DrunkL", GetPlayerDrunkLevel(playerid));
    if(GetPVarInt(playerid, "DrunkL") < 5000) SetPlayerDrunkLevel(playerid, 1000);
    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 1;
}
But now it returns me just: FPS 1
Reply
#6

i dont know how to get player fps but i tried this once and it worked well
Reply
#7

EDIT: Fixed, this topic can be closed.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)