SA-MP Forums Archive
Speedometer help - 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: Speedometer help (/showthread.php?tid=541378)



Speedometer help - TheNerka - 11.10.2014

How to code speedometer texdraw?
texdraw have, how to if oplayer enter vehicle show texdraw or exit - hide


Re: Speedometer help - Shady - 11.10.2014

Use this
https://sampforum.blast.hk/showthread.php?tid=505003
Or
https://sampforum.blast.hk/showthread.php?tid=358810


Re: Speedometer help - Pottus - 11.10.2014

Quote:
Originally Posted by ShadyX
Посмотреть сообщение
Do you even check what you post?

1'st link - Coded incorrectly
2'nd link - Doesn't work


Re: Speedometer help - Shady - 11.10.2014

Calm down, man.


Re: Speedometer help - Pottus - 11.10.2014

I am calm, I asked you a question.


Re: Speedometer help - TheNerka - 11.10.2014

error 017: undefined symbol "GetVehicleSpeed" how to fix?


Re: Speedometer help - Pottus - 11.10.2014

pawn Код:
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: Speedometer help - TheNerka - 11.10.2014

forward Speedometer(playerid);
public Speedometer(playerid)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
new vehicleid = GetPlayerVehicleID(playerid);
new string[32], string2[32], string3[10], Float:vhealth;
format(string, sizeof(string), "%s", VehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
TextDrawSetString(Spidometras[playerid][9], string);

format(string2, sizeof(string2), "%i", GetVehicleSpeed(vehicleid));
TextDrawSetString(Spidometras[playerid][6], string2);

}
return 1;
}

how to fix this code doesn't work does'nt see speed and vehiclename


Re: Speedometer help - TheNerka - 11.10.2014

Fixed thanks for help +R3P


Re: Speedometer help - Vince - 11.10.2014

Quote:
Originally Posted by Pottus
Посмотреть сообщение
pawn Код:
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;
}
Note that you can replace
pawn Код:
floatsqroot( x*x + y*y + z*z )
With the new VectorSize function, which ought to be faster.