Textdraw update problem
#1

Hi, this checks the fps and changes color according to the fps, but when in less than 50 does not siemplemente always green like >= 50

pawn Код:
if(pFPS[playerid] <= 34) TextDrawSetString(TextdrawPingMFPS[playerid], string); TextDrawColor(TextdrawPingMFPS[playerid], 0xFF0000FF);
            if(pFPS[playerid] <= 49) TextDrawSetString(TextdrawPingMFPS[playerid], string); TextDrawColor(TextdrawPingMFPS[playerid], 0xFFFF00FF);
            if(pFPS[playerid] >= 50) TextDrawSetString(TextdrawPingMFPS[playerid], string); TextDrawColor(TextdrawPingMFPS[playerid], 0x00FF00FF);
Sorry no speak much english, Thanks!
Reply
#2

You need use TextDrawShowForPlayer after TextDrawColor
Reply
#3

Thanks, I thought just before upgrading to check whether they had discussed.

pawn Код:
if(pFPS[playerid] <= 39 && pFPS[playerid] >= 1)
            {
            TextDrawHideForPlayer(playerid, TextdrawPingMFPS[playerid]);
            format(string, sizeof(string), "FPS: %d", pFPS[playerid]);
            TextDrawSetString(TextdrawPingMFPS[playerid], string);
            TextDrawColor(TextdrawPingMFPS[playerid], 0xFF0000FF);
            TextDrawShowForPlayer(playerid, TextdrawPingMFPS[playerid]);
            }
            if(pFPS[playerid] <= 49 && pFPS[playerid] > 39)
            {
            TextDrawHideForPlayer(playerid, TextdrawPingMFPS[playerid]);
            format(string, sizeof(string), "FPS: %d", pFPS[playerid]);
            TextDrawSetString(TextdrawPingMFPS[playerid], string);
            TextDrawColor(TextdrawPingMFPS[playerid], 0xFFFF00FF);
            TextDrawShowForPlayer(playerid, TextdrawPingMFPS[playerid]);
            }
            if(pFPS[playerid] >= 50)
            {
            TextDrawHideForPlayer(playerid, TextdrawPingMFPS[playerid]);
            format(string, sizeof(string), "FPS: %d", pFPS[playerid]);
            TextDrawSetString(TextdrawPingMFPS[playerid], string);
            TextDrawColor(TextdrawPingMFPS[playerid], 0x00FF00FF);
            TextDrawShowForPlayer(playerid, TextdrawPingMFPS[playerid]);
            }
SOLVED
Reply
#4

You can do shorter
pawn Код:
new color, FPS = pFPS[playerid];
if(0 < FPS < 40) color = 0xFF0000FF;
else if(39 < FPS < 50) color = 0xFFFF00FF;
else color = 0x00FF00FF;

format(string, sizeof(string), "FPS: %d", FPS);
TextDrawSetString(TextdrawPingMFPS[playerid], string);
TextDrawColor(TextdrawPingMFPS[playerid], color);
TextDrawShowForPlayer(playerid, TextdrawPingMFPS[playerid]);
Reply
#5

Quote:
Originally Posted by Jefff
Посмотреть сообщение
You can do shorter
pawn Код:
new color, FPS = pFPS[playerid];
if(0 < FPS < 40) color = 0xFF0000FF;
else if(39 < FPS < 50) color = 0xFFFF00FF;
else color = 0x00FF00FF;

format(string, sizeof(string), "FPS: %d", FPS);
TextDrawSetString(TextdrawPingMFPS[playerid], string);
TextDrawColor(TextdrawPingMFPS[playerid], color);
TextDrawShowForPlayer(playerid, TextdrawPingMFPS[playerid]);
you are great thx!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)