19.04.2012, 11:06
I unloaded my FPS shower script, can anyone tell me why did this thing cause so-so-so much lag? Its not my computer, yesterday had 5 ppl on with no lag.
pawn Код:
#include <a_samp>
new Text:FPS[MAX_PLAYERS];
new DLlast[MAX_PLAYERS] = 0;
new FPS2[MAX_PLAYERS] = 0;
public OnFilterScriptInit()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
FPS[i] = TextDrawCreate(56.000000, 329.000000, "FPS: Laeb..");
TextDrawBackgroundColor(FPS[i], 255);
TextDrawFont(FPS[i], 1);
TextDrawLetterSize(FPS[i], 0.490000, 1.100000);
TextDrawColor(FPS[i], -1);
TextDrawSetOutline(FPS[i], 0);
TextDrawSetProportional(FPS[i], 0);
TextDrawSetShadow(FPS[i], 1);
}
SetTimer("FPSUP",2000, true);
return 1;
}
new string[24];
public OnPlayerUpdate(playerid)
{
new drunk2 = GetPlayerDrunkLevel(playerid);
if(drunk2 < 100)
{
SetPlayerDrunkLevel(playerid,2000);
}
else
{
if(DLlast[playerid] != drunk2)
{
new fps = DLlast[playerid] - drunk2;
if((fps > 0) && (fps < 200))
FPS2[playerid] = fps;
DLlast[playerid] = drunk2;
}
}
}
public OnPlayerSpawn(playerid)
{
TextDrawShowForPlayer(playerid,FPS[playerid]);
return 1;
}
public OnPlayerDisconnect(playerid)
{
TextDrawDestroy(FPS[playerid]);
return 1;
}
forward FPSUP();
public FPSUP()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
format(string,sizeof(string),"FPS:%d",FPS2[i]-1);
TextDrawSetString(FPS[i],string);
}
continue;
}
}