SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts

Reply
 
Thread Tools Display Modes
Old 02/11/2019, 03:12 PM   #1
Lokii
Huge Clucker
 
Join Date: Sep 2017
Posts: 375
Reputation: 87
Default Dial SpeedoMeter


Dial SpeedoMeter


Realistic SpeedoMeter with dial and needle.


Pic:





Video: Click here

Github: Click here

Download: Click here


requires:

a_samp, foreach


Bugs:

Please report if you find any.


Credits:

SA-MP team - a_samp
****** - foreach
Lokii - dial speedometer
__________________

Last edited by Lokii; 02/11/2019 at 11:18 PM.
Lokii is offline   Reply With Quote
Old 02/11/2019, 07:01 PM   #2
Pottus
High-roller
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 4,845
Reputation: 1312
Default Re: Dial SpeedoMeter

You screwed this up man.

Code:
Float:GetVehicleSpeed(vehicleid)
{
	new Float:vx, Float:vy, Float:vz, Float:vel;
	vel = GetVehicleVelocity(vehicleid, vx, vy, vz);
	vel = (floatsqroot(((vx*vx)+(vy*vy)))* 219.9060);
	return vel;
}
Should be 180.0 - 181.5 to calculate km/h.

Interestingly you actually have the speedo done correctly. A lot of people get the speed calculation right but mess up on the textdraws you got it the other way around. The Infernus goes about 221 - 223 km/h max.
Pottus is offline   Reply With Quote
Old 02/11/2019, 07:02 PM   #3
Lokii
Huge Clucker
 
Join Date: Sep 2017
Posts: 375
Reputation: 87
Default Re: Dial SpeedoMeter

Quote:
Originally Posted by Pottus View Post
You screwed this up man.

Code:
Float:GetVehicleSpeed(vehicleid)
{
	new Float:vx, Float:vy, Float:vz, Float:vel;
	vel = GetVehicleVelocity(vehicleid, vx, vy, vz);
	vel = (floatsqroot(((vx*vx)+(vy*vy)))* 219.9060);
	return vel;
}
Should be 180.0 - 181.5 to calculate km/h.

Interestingly you actually have the speedo done correctly. A lot of people get the speed calculation right but mess up on the textdraws you got it the other way around. The Infernus goes about 221 - 223 km/h max.
while this is true for digital but i calculate the needle the needle starts at 135 degrees and ends at -135 result 270.
__________________
Lokii is offline   Reply With Quote
Old 02/11/2019, 07:12 PM   #4
Pottus
High-roller
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 4,845
Reputation: 1312
Default Re: Dial SpeedoMeter

That is done incorrectly I looked at the code. What you need to do is get the speed the player is going accurately then calculate rotation = -135.0 + (speed * ( 270 / MAX_SPEED) )

That will give you degrees per kph to rotate.
Pottus is offline   Reply With Quote
Old 02/11/2019, 07:28 PM   #5
Lokii
Huge Clucker
 
Join Date: Sep 2017
Posts: 375
Reputation: 87
Default Re: Dial SpeedoMeter

UPDATE: ok now the needle stops on 180-185 (tested with infernus)

UPDATE 2: I'll leave it as it is cause it seems quit accurate anyway
__________________

Last edited by Lokii; 02/11/2019 at 08:40 PM.
Lokii is offline   Reply With Quote
Old 02/11/2019, 10:03 PM   #6
WalkZ
Big Clucker
 
WalkZ's Avatar
 
Join Date: Oct 2019
Location: Pakistan
Posts: 103
Reputation: 4
Default Re: Dial SpeedoMeter

Nice release, keep it up.
WalkZ is offline   Reply With Quote
Old 02/11/2019, 10:14 PM   #7
Lokii
Huge Clucker
 
Join Date: Sep 2017
Posts: 375
Reputation: 87
Default Re: Dial SpeedoMeter

Quote:
Originally Posted by WalkZ View Post
Nice release, keep it up.
Thanks
__________________
Lokii is offline   Reply With Quote
Old 02/11/2019, 11:20 PM   #8
Lokii
Huge Clucker
 
Join Date: Sep 2017
Posts: 375
Reputation: 87
Default Re: Dial SpeedoMeter

Updated

Added "0" to speedometer.
__________________
Lokii is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SAMP server on dial up [DX]Aru12345 Server Support 1 13/03/2013 03:42 PM
[Ajuda] Dial... Gustavo_Samp Português/Portuguese 5 12/06/2012 02:27 AM
B-Dial Modification Gigi-The-Beast Scripting Help 1 25/01/2012 11:03 AM
Server Laggy when on dial-up? Donnie_Viper Server Support 4 19/02/2009 12:09 AM
Msn dial Up Server Hoast robert4049 Server Support 7 22/11/2008 01:19 PM


All times are GMT. The time now is 11:44 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.