1. Make 20 PlayerTextDrawBoxes in color black. Similar to the one made like that, You shouldn't make GlobalTextDraws because its being updated per-player and 20 * MAX_PLAYERS will be too much and you might exceed the textdraw limit
2. Use OnPlayerUpdate or Timer to update the PlayerTextDrawColor (You must use PlayerTextDrawShow to update changes)
Outline of Script
PHP код:
How the code would look:>
#define SMALL_BOXES_MADE 20
#define COLOR_EMPTY 0x00000077 //77 is the transperancy
#define COLOR_GOOD 0x0066ccFF //Can do this for the first 5 boxes
#define COLOR_AVG 0x00ff00FF //Can do this for the next 10 boxes
#define COLOR_MAX 0xcc3300FF //Can do this for the last 5 boxes
new PlayerText:SpeedoMeter[MAX_PLAYERS][SMALL_BOXES_MADE];
//Here 0 will be the smallest box
//19 will be the biggest
new Timer:x[MAX_PLAYERS];
OnPlayerConnect(playerid)
Create20SmallBoxes(playerid);
OnPlayerEnterVehicle(playerid ...)
ShowSmallBoxes(playerid);
x[playerid] = repeat Speedo(playerid);
OnPlayerExitVehicle(playerid ...)
{
HideSmallBoxes(playerid);
stop x[playerid];
}
//You can either use a Timer or onPlayerUpdate.. But timer is better for this case..
timer Speedo[500](playerid)
{
if(IsPlayerInAnyVehicle(playerid)) //Incase he was jacked or exited in ways that wouldnt trigger OnPlayerExitVehicle
{
new vehicleid = GetPlayerVehicleID(playerid);
new modelid = GetVehicleModel(vehicleid);
new Float:maxspeed = max_speed[modelid - 400]; //However u store it
new speedtokens = maxspeed / SMALL_BOXES_MADE;
//Speedtokens decide at what speed ONE box's color has to be changed.
new Float:Currspeed = GetPlayerSpeed(playerid); //However you get it
new BoxesToUpdate = floatround(CurrSpeed / speedtokens, floatround_round);
for(new i = 0; i < SMALL_BOXES_MADE; i++)
{
if(i <= BoxesToUpdate)
{
if(i < 5) PlayerTextDrawBoxColor(playerid, SpeedoMeter[playerid][i], COLOR_GOOD);
else if(i < 15) PlayerTextDrawBoxColor(playerid, SpeedoMeter[playerid][i], COLOR_AVG);
else if(i < SMALL_BOXES_MADE) PlayerTextDrawBoxColor(playerid, SpeedoMeter[playerid][i], COLOR_MAX);
}
else
{
PlayerTextDrawBoxColor(playerid, SpeedoMeter[playerid][i], COLOR_EMPTY);
}
PlayerTextDrawShow(playerid, SpeedoMeter[playerid][i]);
}
}
else
{
HideSmallBoxes(playerid);
stop x[playerid];
}
}
This is the not the code.. This is to educate you on how its done.