[Pedido] Sistema de FPS em TextDraw
#11

Fiz um aqui teste
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 
iGetMaxPlayers(); != k; ++i)
 {
    
fpstext1[i] = TextDrawCreate(60.000000323.000000"FPS");
    
TextDrawBackgroundColor(fpstext1[i], -16776961);
    
TextDrawFont(fpstext1[i], 3);
    
TextDrawLetterSize(fpstext1[i], 0.5000001.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(playerid2000);
    } 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(stringtextdrawsizeof(stringtextdraw),"Fps: %i",GetPlayerFPS(playerid));
TextDrawSetString(fpstext1[playerid],stringtextdraw);
return 
1;
}
stock GetPlayerFPS(playerid) return pFPS[playerid]; 
ajudei +rep
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)