The online racing simulator
Digital Speedometer
Quick and easy digital speedometer script, If your speed is 0, the text appears red.


<?php 
CatchEvent OnConnect
$userName )
    
privDelayedCommand1speed);
EndCatchEvent

Sub speed
($KeyFlags)
    IF ( 
GetCurrentPlayerVar"InstantSpeed" ) < )
    
THEN
    openPrivButton
"speed",50,194,20,6,4,-1,37,"^10 ^7Km/h","");
    ELSE
    
openPrivButton"speed",50,194,20,6,4,-1,37,"^2"Round(GetCurrentPlayerVar("InstantSpeed"),0). " ^7Km/h","");
    ENDIF
    
privDelayedCommand1speed );
EndSub
?>


Attached images
resim_2023-11-14_123027548.png
resim_2023-11-14_123125945.png
cool! ty

is it possible to make it red after a certain speed? (etc 160 km/h)
Quote from fastranker1 :cool! ty

is it possible to make it red after a certain speed? (etc 160 km/h)

Of course, here I prepared it for you;


<?php 
CatchEvent OnConnect
$userName )
    
privDelayedCommand1speed);
EndCatchEvent

Sub speed
($KeyFlags)
    IF ( 
GetCurrentPlayerVar"InstantSpeed" ) < )
    
THEN
    openPrivButton
"speed",50,194,20,6,4,-1,37,"^30 ^7Km/h","");
    ELSE
    IF ( 
GetCurrentPlayerVar"InstantSpeed" ) > 160 )
    
THEN 
    openPrivButton
"speed",50,194,20,6,4,-1,37,"^1"Round(GetCurrentPlayerVar("InstantSpeed"),0). " ^7Km/h","");
    ELSE
    
openPrivButton"speed",50,194,20,6,4,-1,37,"^2"Round(GetCurrentPlayerVar("InstantSpeed"),0). " ^7Km/h","");
    ENDIF
    ENDIF
    
privDelayedCommand1speed );
EndSub
?>


tysm!Big grin
If you change the 1 in the privDelayedCommand( 1, speed ) code to 0, the speed will be refreshed faster.
Good Smile
This is super cool but where does this coding go??
Quote from RSAbeaats :This is super cool but where does this coding go??

Create your file according to the file location below
\default\includes\speedometer.lpr

and add the following code into the addonused.lpr file (\default\includes\addonused.lpr)
include( "./speedometer.lpr");

You now have a speedometer
Quote from skorzz :Create your file according to the file location below
\default\includes\speedometer.lpr

and add the following code into the addonused.lpr file (\default\includes\addonused.lpr)
include( "./speedometer.lpr");

You now have a speedometer

So i need to make a new file in the LFS files or add it to a existing file??
Quote from RSAbeaats :So i need to make a new file in the LFS files or add it to a existing file??

This is a speedometer script for lfslapper, it can't be used on original lfs.

FGED GREDG RDFGDR GSFDG