i think that you only need around 100-300ms, no need to go 10ms. Dont use global textdraws, when dealing with different values, every single player, so use CreatePlayerTextDraw.
PHP код:
new Text:spbox;
new PlayerText:speedometer[MAX_PLAYERS];
public OnPlayerConnect(playerid){
speedometer[playerid]=CreatePlayerTextDraw(playerid,139.19, 403.94, ""); //speed
PlayerTextDrawLetterSize(playerid,speedometer[playerid], 0.415599, 1.473066);
PlayerTextDrawAlignment(playerid,speedometer[playerid], 1);
PlayerTextDrawColor(playerid,speedometer[playerid], -16776961);
PlayerTextDrawSetShadow(playerid,speedometer[playerid], 0);
PlayerTextDrawSetOutline(playerid,speedometer[playerid], 1);
PlayerTextDrawBackgroundColor(playerid,speedometer[playerid], 51);
PlayerTextDrawFont(playerid,speedometer[playerid], 1);
PlayerTextDrawSetProportional(playerid,speedometer[playerid], 1);
return 1;
}
public OnGameModeInit(){
SetTimer("Update02sec",200,true);
spbox = TextDrawCreate(230.79, 403.95, "_"); //box
TextDrawLetterSize(spbox, 0.0, 1.591485);
TextDrawTextSize(spbox, 129.199996, 0.0);
TextDrawAlignment(spbox, 1);
TextDrawColor(spbox, 0);
TextDrawUseBox(spbox, true);
TextDrawBoxColor(spbox, 102);
TextDrawSetShadow(spbox, 0);
TextDrawSetOutline(spbox, 0);
TextDrawFont(spbox, 0);
return 1;
}
public OnPlayerStateChange(playerid){
if(newstate==PLAYER_STATE_DRIVER || newstate==PLAYER_STATE_PASSENGER){
PlayerTextDrawShow(playerid,speedometer[playerid]);
TextDrawShowForPlayer(playerid,spbox);
}
if(newstate==PLAYER_STATE_ONFOOT){
PlayerTextDrawHide(playerid,speedometer[playerid]);
TextDrawHideForPlayer(playerid,spbox);
}
return 1;
}
forward Update02sec();
public Update02sec(){
new str[20];
for(new i;i<MAX_PLAYERS;i++){
if(!IsPlayerConnected(i) || !IsPlayerInAnyVehicle(i))continue;
format(str,sizeof(str),"speed: %d",GetVehSpeed(GetPlayerVehicleID(i));
PlayerTextDrawSetString(i,speedometer[i],str);
}
return 1;
}
GetVehSpeed(vid){
new Float:pos[3];
GetVehicleVelocity(vid,pos[0],pos[1],pos[2]);
return floatround(floatsqroot(pos[0] * pos[0] + pos[1] * pos[1] + pos[2] * pos[2]) * 180.0);
}