SA-MP Forums Archive
GetPlayerFps returns 0 - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: GetPlayerFps returns 0 (/showthread.php?tid=385915)



GetPlayerFps returns 0 - Face9000 - 18.10.2012

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?


Re: GetPlayerFps returns 0 - Roel - 18.10.2012

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


Re: GetPlayerFps returns 0 - Face9000 - 18.10.2012

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


Re: GetPlayerFps returns 0 - Roel - 18.10.2012

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


Re: GetPlayerFps returns 0 - Face9000 - 19.10.2012

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


Re: GetPlayerFps returns 0 - Danyal - 19.10.2012

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


Re: GetPlayerFps returns 0 - Face9000 - 19.10.2012

EDIT: Fixed, this topic can be closed.