LOW FPS - 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)
+--- Thread: LOW FPS (
/showthread.php?tid=543728)
LOW FPS -
Greaper - 28.10.2014
Anyone help me for Anti Low FPS ??
If your fps is 16 you have kick from the server
Re: LOW FPS -
RedFusion - 28.10.2014
pawn Код:
#include <a_samp>
#define MIN_FPS_ALLOWED 16
#define MAX_FPS_WARNINGS 5
IsPlayerSpawned(playerid)
{
switch(GetPlayerState(playerid))
{
case 1, 2, 3, 8:
return 1;
}
return 0;
}
public OnPlayerUpdate(playerid)
{
static old_drunk [MAX_PLAYERS],
fps_warnings [MAX_PLAYERS];
if(IsPlayerSpawned(playerid))
{
new new_drunk = GetPlayerDrunkLevel(playerid);
if(new_drunk <= 100)
SetPlayerDrunkLevel(playerid, 2000);
else if(new_drunk != old_drunk[playerid])
{
new fps = old_drunk[playerid] - new_drunk;
if(fps >= 0)
{
if(fps <= MIN_FPS_ALLOWED)
{
if(++ fps_warnings[playerid] >= MAX_FPS_WARNINGS)
{
Kick(playerid);
fps_warnings[playerid] = 0;
}
}
else if(fps_warnings[playerid] > 0)
fps_warnings[playerid] = 0;
}
old_drunk[playerid] = new_drunk;
}
}
else if(fps_warnings[playerid] > 0)
fps_warnings[playerid] = 0;
return 1;
}
I didn't test this but it should work. Try it out and tell me if it doesn't work!
Re: LOW FPS -
Glossy42O - 28.10.2014
EDIT: nevermind