TextDraw is duplicated unnecessarily
#9

Quote:
Originally Posted by mikianto
Посмотреть сообщение
It has to change color according to the quantity of the gas
Color codes don't count. They're still part of the text.

Quote:
Originally Posted by Tass007
Посмотреть сообщение
I'd say. Don't constantly show the textdraw, just set the string.
PHP код:
// ... 
That's still a lot more code than needed because the entire thing can essentially be compressed to this:

PHP код:
new gasText[16] = "......";
if(
GPLon[vehid]==1)
{
    switch(
Gas[vehid])
    {
        case 
0:            gasText "~r~......";
        case 
1..19:        gasText "~r~.~w~.....";
        case 
20..29:    gasText "~r~..~w~....";
        case 
30..39:    gasText "~y~...~w~...";
        case 
40..49:    gasText "~g~....~w~..";
        case 
50..69:    gasText "~g~.....~w~.";
        case 
70..100:    gasText "~g~......";
        default:        
gasText "Malfunction";
    }
}
PlayerTextDrawSetString(playerid,SpeedometerText[playerid][3],gasText);
PlayerTextDrawTextSize(playerid,SpeedometerText[playerid][3], 522+(iValue*89/200), 0);
PlayerTextDrawShow(playerid,SpeedometerText[playerid][3]);
PlayerTextDrawUseBox(playerid,SpeedometerText[playerid][3], 1);
PlayerTextDrawBoxColor(playerid,SpeedometerText[playerid][3], 0xFFFFFF00); 
Reply


Messages In This Thread
TextDraw is duplicated unnecessarily - by mikianto - 18.08.2016, 08:36
Re: TextDraw is duplicated unnecessarily - by Tass007 - 18.08.2016, 08:42
Re: TextDraw is duplicated unnecessarily - by mikianto - 18.08.2016, 08:54
Re: TextDraw is duplicated unnecessarily - by Tass007 - 18.08.2016, 08:58
Re: TextDraw is duplicated unnecessarily - by Vince - 18.08.2016, 09:05
Re: TextDraw is duplicated unnecessarily - by mikianto - 18.08.2016, 09:05
Re: TextDraw is duplicated unnecessarily - by mikianto - 18.08.2016, 09:07
Re: TextDraw is duplicated unnecessarily - by Tass007 - 18.08.2016, 09:11
Re: TextDraw is duplicated unnecessarily - by Vince - 18.08.2016, 11:18

Forum Jump:


Users browsing this thread: 1 Guest(s)