SA-MP Forums Archive
Textdraw update problem - 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: Textdraw update problem (/showthread.php?tid=554753)



Textdraw update problem - Cerealguy - 04.01.2015

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!


Re: Textdraw update problem - Jefff - 05.01.2015

You need use TextDrawShowForPlayer after TextDrawColor


[SOLVED]Respuesta: Textdraw update problem - Cerealguy - 05.01.2015

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


Re: Textdraw update problem - Jefff - 05.01.2015

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]);



Respuesta: Re: Textdraw update problem - Cerealguy - 05.01.2015

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!