Getting the string to update
#1

I have tried to make a simple speedo meter but it only shows the speed once.

Textdraw:
pawn Код:
new string[124], vehicleid = GetPlayerVehicleID(playerid);
    format(string, sizeof(string), "_Speed: %d", GetVehicleSpeed(vehicleid));
    Test1 = TextDrawCreate(6.500000, 429.187500, "Loading....");
    TextDrawSetString(Test1, string);
    TextDrawLetterSize(Test1, 0.281497, 1.411874);
    TextDrawTextSize(Test1, 132.500000, 24.937500);
    TextDrawAlignment(Test1, 1);
    TextDrawColor(Test1, -1);
    TextDrawUseBox(Test1, true);
    TextDrawBoxColor(Test1, 0x1F1F1F88);
    TextDrawSetShadow(Test1, 0);
    TextDrawSetOutline(Test1, 1);
    TextDrawBackgroundColor(Test1, 51);
    TextDrawFont(Test1, 1);
    TextDrawSetProportional(Test1, 1);
   
    TextDrawShowForPlayer(playerid, Test1);
GetVehicleSpeed:
pawn Код:
stock GetVehicleSpeed(vehicleid)
{
    new Float:x, Float:y, Float:z, vel;
    GetVehicleVelocity( vehicleid, x, y, z );
    vel = floatround( floatsqroot( x*x + y*y + z*z ) * 180 );
    return vel;
}
Reply
#2

You need to keep updating

TextDrawSetString(Test1, string);

But this is set up wrong, you should be using PlayerTextDraws as you will need a TD for each player.
Reply
#3

Yes? You can't honestly expect it to do anything on it's own, can you? Use timers.
Reply
#4

Quote:
Originally Posted by [uL]Pottus
Посмотреть сообщение
You need to keep updating

TextDrawSetString(Test1, string);

But this is set up wrong, you should be using PlayerTextDraws as you will need a TD for each player.
I have that, TextDrawSetString(Test1, string);, so it's just a case of setting it to player textdraws?
Reply
#5

Quote:
Originally Posted by Vince
Посмотреть сообщение
Yes? You can't honestly expect it to do anything on it's own, can you? Use timers.
Wow I feel so dumb now :P thanks man.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)