20.12.2016, 12:49
Код:
new Text:Pingvafps[3]; new pDrunkLevelLast[MAX_PLAYERS]; new pFPS[MAX_PLAYERS];
Код:
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; }
Код:
public OnPlayerUpdate(playerid) { 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; } } return 1; }
Код:
forward PINGVAFPS(playerid); public PINGVAFPS(playerid) { for(new x= 0; x <=2; x++) TextDrawShowForPlayer(playerid, Pingvafps[x]); new string[1280]; format(string, sizeof string, "FPS: %d", GetPlayerFPS(playerid)); TextDrawSetString(Pingvafps[1], string); format(string, sizeof string, "Ping: %d", GetPlayerPing(playerid)); TextDrawSetString(Pingvafps[2], string); }
Код:
public OnPlayerSpawn(playerid) { PINGVAFPS(playerid); return 1; }