[Tutorial] GetPlayerFPS example
#1

So I see noone made any examples from my suggestion how to build a fps counter using drunklevel, so here is a basic copy-pastable code i wrote for my needs that you can use:

pawn Код:
new pDrunkLevelLast[MAX_PLAYERS];
new pFPS[MAX_PLAYERS];
 
public OnPlayerConnect(playerid) {
    pDrunkLevelLast[playerid]   = 0;
    pFPS[PlayerID]          = 0;
}
 
public OnPlayerUpdate(playerid) {
   
    // handle fps counters.
   
    new drunknew;
    drunknew = GetPlayerDrunkLevel(playerid);
   
    if (drunknew < 100) { // go back up, keep cycling.
        SetPlayerDrunkLevel(playerid, 2000);
    } else {
       
        if (pDrunkLevelLast[playerid] != drunknew) {
           
            new wfps = pDrunkLevelLast[playerid] - drunknew;
           
            if ((wfps > 0) && (wfps < 200))
                pFPS[playerid] = wfps;
           
            pDrunkLevelLast[playerid] = drunknew;
        }
       
    }
   
}
The first person to make a Filterscript out of this with a on-screen FPS textdraw gets eternal gratitude from the turtle!

Remember, this will only work correctly with 0.3b, also you can still set drunk level to >2000 and it will work properly, the trick does not interfere / break any existing script functionality.
Reply


Messages In This Thread
GetPlayerFPS example - by JernejL - 28.08.2010, 22:33
Re: GetPlayerFPS example - by [03]Garsino - 28.08.2010, 22:37
Re: GetPlayerFPS example - by Brian_Furious - 28.08.2010, 22:46
Re: GetPlayerFPS example - by Kitten - 28.08.2010, 22:47
Re: GetPlayerFPS example - by JernejL - 28.08.2010, 23:15
Re: GetPlayerFPS example - by [03]Garsino - 28.08.2010, 23:50
Re: GetPlayerFPS example - by Gamer_Z - 29.08.2010, 00:06
Re: GetPlayerFPS example - by Brian_Furious - 29.08.2010, 00:13
Re: GetPlayerFPS example - by [L3th4l] - 29.08.2010, 00:20
Re: GetPlayerFPS example - by Flake. - 29.08.2010, 04:01
Re: GetPlayerFPS example - by nemesis- - 29.08.2010, 07:06
Re: GetPlayerFPS example - by JernejL - 29.08.2010, 08:25
Re: GetPlayerFPS example - by Hiddos - 29.08.2010, 08:47
Re: GetPlayerFPS example - by Calgon - 29.08.2010, 08:52
Re: GetPlayerFPS example - by Cank - 29.08.2010, 11:04
Re: GetPlayerFPS example - by MrDeath537 - 29.08.2010, 11:35
Re: GetPlayerFPS example - by [XST]O_x - 29.08.2010, 11:37
Re: GetPlayerFPS example - by JernejL - 29.08.2010, 20:41
Re: GetPlayerFPS example - by MrDeath537 - 29.08.2010, 22:12
Re: GetPlayerFPS example - by Flake. - 30.08.2010, 07:32
Re: GetPlayerFPS example - by ipsBruno - 09.09.2010, 14:51
Respuesta: GetPlayerFPS example - by TheChaoz - 20.09.2010, 04:43
Re: GetPlayerFPS example - by gymmyyy - 25.08.2011, 23:12
Re: GetPlayerFPS example - by Davz*|*Criss - 26.08.2011, 00:09
Re: GetPlayerFPS example - by Kaperstone - 26.08.2011, 09:50
AW: Re: GetPlayerFPS example - by Nero_3D - 26.08.2011, 13:10
Re: AW: Re: GetPlayerFPS example - by Kaperstone - 26.08.2011, 13:33
Re: GetPlayerFPS example - by Gh0sT_ - 26.08.2011, 13:58
Re: GetPlayerFPS example - by Kaperstone - 07.09.2011, 15:10
Re: GetPlayerFPS example - by mrsamp - 23.07.2012, 16:45
Re: GetPlayerFPS example - by Psat - 23.07.2012, 18:35
Re: GetPlayerFPS example - by JaKe Elite - 14.10.2012, 01:20
Re: GetPlayerFPS example - by Lordzy - 16.10.2012, 02:17

Forum Jump:


Users browsing this thread: 3 Guest(s)