29.05.2013, 08:10
I have tried to make a simple speedo meter but it only shows the speed once.
Textdraw:
GetVehicleSpeed:
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);
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;
}