Bug in my FPS kicker
#1

I am trying to make a FPS kicker with the stock GetPlayerFPS function from [FeK]DraKiNs

Quote:
Originally Posted by [FeK]DraKiNs
Посмотреть сообщение
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;
}
My code:

pawn Код:
if(GetPlayerFPS(playerid) < 22)
{
    fpswarning(playerid);
    SendClientMessage(playerid,COLOR_RED,"WARNING: Your FPS is lower then the minimum ammount of circa 25 FPS, you have 10 seconds to establish your FPS or else you will get kicked.");
}
The bug is that it keeps kicking me at connecting and at class selection even tho my FPS is 40+ all the time.
Anyone plase give me some advices how to fix this bug.
Thanks regards.
Reply
#2

set it to about 10 FPs. and change it to OnplayerUpdate. That Would Be better.
Reply
#3

You could try using the function after a player connects. Set a timer or something.
Reply
#4

Quote:
Originally Posted by Porsche911
Посмотреть сообщение
set it to about 10 FPs. and change it to OnplayerUpdate. That Would Be better.
I dislike to set things at OnplayerUpdate since the callback gets called like 30 times per second,
also dont wanna lower the minimum FPS since the fpslimit 20 gets abused.
Reply
#5

Cant you just start calling the function with a timer set to go off 1 min after players connects ?
It should stop the bugging out.
Reply
#6

Like making an Array to the GetPlayerFPS and set the Array to false at OnPlayerConnect and at OnPlayerSpawn set the Array to true?
Reply
#7

Actually OnPlayerUpdate gets called 100+ times a sec.
You can make an EX update
pawn Код:
public OnPlayerConnect( playerid )
{
    SetTimerEx( "OnPlayerUpdateEx", 1000, 1, "i", playerid );
    return 1;
}
later, replace your OnPlayerUpdate with this
pawn Код:
forward OnPlayerUpdateEx( playerid );
public OnPlayerUpdateEx( playerid )
{
    // Your OnPlayerUpdate code.
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)