Getting the string to update - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Getting the string to update (
/showthread.php?tid=440304)
Getting the string to update -
AccountName - 29.05.2013
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;
}
Re: Getting the string to update -
Pottus - 29.05.2013
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.
Re: Getting the string to update -
Vince - 29.05.2013
Yes? You can't honestly expect it to do anything on it's own, can you? Use timers.
Re: Getting the string to update -
AccountName - 29.05.2013
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?
Re: Getting the string to update -
AccountName - 29.05.2013
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.