28.08.2010, 22:33
(
Последний раз редактировалось JernejL; 28.07.2011 в 07:28.
)
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:
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.
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;
}
}
}
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.