Problem with the FPS command
#1

Hello ladies,this command sometimes returns 0 when checking the FPS of a player:

pawn Код:
CMD:fps(playerid,params[])
{
    new Target;
    if(sscanf(params, "u", Target)) return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /fps [playerid]");
    if(!sscanf(params, "u", Target))
    if(Target == INVALID_PLAYER_ID) return SendClientMessage(playerid,red,"Error: Wrong player ID");
    new pstring[128];
    new tname[MAX_PLAYER_NAME];
    GetPlayerName(Target,tname,sizeof(tname));
    format(pstring,sizeof(pstring),"%sґs FPS: %d",tname, GetPlayerFps(Target));
    SendClientMessage(playerid,COLOR_YELLOW,pstring);
    return 1;
}
GetPlayerFps

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;
}
I've to type like 5-6 times to get the current player FPS otherwise it will return me: FPS: 0

Any tip?
Reply
#2

the command returns 0 and gives you invalid command, or the GetPlayerFps returns 0?

edit, checking the players fps should be done constantly with OPU and then store the value, the command should just display that saved variable
Reply
#3

Sorry i didn't explained good.

The command works, it's just the GetPlayerFps that returns me 0 sometimes.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)