SA-MP Forums Archive
[Tutorial] GetPlayerFPS example - 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)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] GetPlayerFPS example (/showthread.php?tid=172085)

Pages: 1 2


Re: GetPlayerFPS example - ipsBruno - 09.09.2010

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;
}



Respuesta: GetPlayerFPS example - TheChaoz - 20.09.2010

actualy is an exelent job! would never realice how to detect player FPS using SetPlayerDrunkLevel. very nice.


Re: GetPlayerFPS example - gymmyyy - 25.08.2011

Quote:
Originally Posted by Gamer_Z
Посмотреть сообщение
here you go:
pawn Код:
#include <a_samp>

new pDrunkLevelLast[MAX_PLAYERS];
new pFPS[MAX_PLAYERS];

public OnFilterScriptInit(){
    SetTimer("DisplayFPS",1000,1);
    return 1;
}

public OnPlayerConnect(playerid) {
    pDrunkLevelLast[playerid]   = 0;
    pFPS[playerid]          = 0;
}

public OnPlayerUpdate(playerid) {

    // handle fps counters.

    new 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;
        }

    }

}

forward DisplayFPS();
public DisplayFPS(){
    new FPSmsg[20];
    for(new i; i < MAX_PLAYERS; i++)if(IsPlayerConnected(i)){
        format(FPSmsg,20,"Your FPS is: %d",pFPS[i]);
        //Show it here on-screen and set PVar
    }
}
rest you can do yourself
just copy and compile in pawno?


Re: GetPlayerFPS example - Davz*|*Criss - 26.08.2011

Good! Useful


Re: GetPlayerFPS example - Kaperstone - 26.08.2011

can you explain a little more about how it works?
(because i didnt got how you get player fps by player drunking level..)


AW: Re: GetPlayerFPS example - Nero_3D - 26.08.2011

Quote:
Originally Posted by xkirill
Посмотреть сообщение
can you explain a little more about how it works?
(because i didnt got how you get player fps by player drunking level..)
It works due the fact that you loose per fps 1 drunken level
So if you got low fps you will stay longer drunk


Re: AW: Re: GetPlayerFPS example - Kaperstone - 26.08.2011

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
It works due the fact that you loose per fps 1 drunken level
So if you got low fps you will stay longer drunk
ok..
so how i send player a message about how much FPS does he has.. :\


Re: GetPlayerFPS example - Gh0sT_ - 26.08.2011

It works only in 0.3b, I think?


Re: GetPlayerFPS example - Kaperstone - 07.09.2011

so how i convert it to TextDraw?
( i mean i want it to show the player FPS in textdraw..)


Re: GetPlayerFPS example - mrsamp - 23.07.2012

It's a nice script but it makes server lagg for me.


Re: GetPlayerFPS example - Psat - 23.07.2012

Looks good І


Re: GetPlayerFPS example - JaKe Elite - 14.10.2012

Why using OnPlayerUpdate?


Re: GetPlayerFPS example - Lordzy - 16.10.2012

Nice idea.
Thanks JernejL