Speedometer System Problem
#1

I made a simple Speedometer System. I used [INC] Progress Bar 1.3 (http://forum.sa-mp.com/index.php?topic=138556.0)

Here is the timer (Interval is 100 ms)
pawn Код:
public speedometer()
{
    new Float:Speed;
    new vehicleid;
    new playerid;
  new string[20];
    for(playerid = 0; playerid < MAX_PLAYERS; playerid++)
    {
      if(SpeedProgress[playerid] != INVALID_BAR_ID)
        {
          vehicleid = GetPlayerVehicleID(playerid);
            GetVehicleSpeed(vehicleid, Speed);
      format(string, sizeof(string), "SPEED: %i km/hour", floatround(Speed));
            SetProgressBarValue(SpeedProgress[playerid], Speed);
      TextDrawSetString(SpeedProgressMsg[playerid], string);
      TextDrawShowForPlayer(playerid, SpeedProgressMsg[playerid]);
            UpdateProgressBar(SpeedProgress[playerid], playerid);
        }
    }
    return 1;
}
And the script in OnPlayerStateChange:

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER)
    {
      SpeedProgress[playerid] = CreateProgressBar(475, 340, 149, 22, 0x00FF00FF, 300);
    SpeedProgressMsg[playerid] = TextDrawCreate(475, 340, "SPEED: 0 km/hour");
      ShowProgressBarForPlayer(playerid, SpeedProgress[playerid]);
     
    }
    else if(newstate == PLAYER_STATE_ONFOOT)
    {
        DestroyProgressBar(SpeedProgress[playerid]);
    TextDrawDestroy(SpeedProgressMsg[playerid]);
      SpeedProgress[playerid] = INVALID_BAR_ID;
    }
    return 1;
}
And here is the result (How come it shows like this):


Where does the BIG Text Draw that shows 0 km/hour came from? What i made is the one that small, not the big one. It just show up "Mystically"

Please help! I am not familiar with TextDraws. And those two are the only Text Draws i made (What i mean with "those two" is the TextDraw and the ProgressBar)
Reply
#2

What do you mean? The textdraw?
Whats the text on the textdraw you don't want.

It also helps if you try and Search for the text in your Gamemode.
And if you have any filterscripts running, run the gamemode without filterscripts.
If its find then, it must be in a filterscript.
Try and pinpoint the exact location of the source of your problem.
Reply
#3

You double created
Код:
  SpeedProgress[playerid] = CreateProgressBar(475, 340, 149, 22, 0x00FF00FF, 300);
    SpeedProgressMsg[playerid] = TextDrawCreate(475, 340, "SPEED: 0 km/hour");
CreateProgressBar already creates a textdraw so

Код:
SpeedProgressMsg[playerid] = TextDrawCreate(475, 340, "SPEED: 0 km/hour");
Isnt needed cus you already did it on public speedometer()

Код:
format(string, sizeof(string), "SPEED: %i km/hour", floatround(Speed));
SetProgressBarValue(SpeedProgress[playerid], Speed);
Try that but not sure, get a backup

Reply
#4

Quote:
Originally Posted by Thrarod
You double created
Код:
 SpeedProgress[playerid] = CreateProgressBar(475, 340, 149, 22, 0x00FF00FF, 300);
    SpeedProgressMsg[playerid] = TextDrawCreate(475, 340, "SPEED: 0 km/hour");
CreateProgressBar already creates a textdraw so

Код:
SpeedProgressMsg[playerid] = TextDrawCreate(475, 340, "SPEED: 0 km/hour");
Isnt needed cus you already did it on public speedometer()

Код:
format(string, sizeof(string), "SPEED: %i km/hour", floatround(Speed));
SetProgressBarValue(SpeedProgress[playerid], Speed);
Try that but not sure, get a backup

Doesn't work...
It just remove the small text, while the big one still exist. What i want is to remove the Big Text, not the small one.
Reply
#5

Then I dont know

Deleting

SpeedProgressMsg[playerid] = TextDrawCreate(475, 340, "SPEED: 0 km/hour");

Part will fix it, just remove it, keep others because "SPEED: 0 km/hour" isnt a formatted string and it is the big one!

Reply
#6

Quote:
Originally Posted by Thrarod
Then I dont know

Deleting

SpeedProgressMsg[playerid] = TextDrawCreate(475, 340, "SPEED: 0 km/hour");

Part will fix it, just remove it, keep others because "SPEED: 0 km/hour" isnt a formatted string and it is the big one!

Now, how to place the Text Draw X and Y?
Reply
#7

Which?
Reply
#8

NEVER MIND, I REMOVED THIS FEATURE. I USE ANOTHER ONE THAT MIGHT BE AS GOOD AS THIS...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)