11.04.2012, 21:48
Fiz um aqui teste
ajudei +rep
PHP код:
#include <a_samp>
new Text:fpstext1[MAX_PLAYERS];
new pFPS[MAX_PLAYERS];
new pDrunkLevelLast[MAX_PLAYERS];
public OnPlayerSpawn(playerid)
{
TextDrawShowForPlayer(playerid,fpstext1[playerid]);
return 1;
}
public OnFilterScriptInit()
{
for(new i, k = GetMaxPlayers(); i != k; ++i)
{
fpstext1[i] = TextDrawCreate(60.000000, 323.000000, "FPS");
TextDrawBackgroundColor(fpstext1[i], -16776961);
TextDrawFont(fpstext1[i], 3);
TextDrawLetterSize(fpstext1[i], 0.500000, 1.200000);
TextDrawColor(fpstext1[i], -16776961);
TextDrawSetOutline(fpstext1[i], 0);
TextDrawSetProportional(fpstext1[i], 1);
TextDrawSetShadow(fpstext1[i], 0);
}
return 1;
}
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;
}
}
new stringtextdraw[200];
format(stringtextdraw, sizeof(stringtextdraw),"Fps: %i",GetPlayerFPS(playerid));
TextDrawSetString(fpstext1[playerid],stringtextdraw);
return 1;
}
stock GetPlayerFPS(playerid) return pFPS[playerid];