14.04.2010, 07:29
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)
And the script in OnPlayerStateChange:
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)
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;
}
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;
}
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)