23.08.2015, 21:00
Hello ! Is this efficient? It will make lag? i want to detect the FPS
PHP код:
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;
}
}
}