The online racing simulator
Display realtime vehiclespeed
I want to write button the speed of the car
Nod

I want to write the speed of the car on the button.

Help Me Please......


Very urgent.Omg omg omg:-------------------------------------------I LOVE YOU LFS

Sample:

There is currently not an option in LFSLapper to display the Speed in realtime. I have created an event in my personal lapper which i can display speed or other stuff Every 0.5 Seconds. I cannot release this in the public lapper because it must be further tested.
-
(FurkanBaglibel) DELETED by Bass-Driver : Unnessessary posts
Quote from Bass-Driver :There is currently not an option in LFSLapper to display the Speed in realtime. I have created an event in my personal lapper which i can display speed or other stuff Every 0.5 Seconds. I cannot release this in the public lapper because it must be further tested.

My friend had made the speedometer lappere but he is not sharing.
Taped Shut
It's possible to display the realtime speed (and much more) of any player who is connected to your server.
Create an event to display a button like this:

openButton( GetCurrentPlayerVar("UserName"), "follow_speed_2",11,124,22,5,5,2,80,"^7" . GetPlayerVar( $uName, "InstantSpeed") . " " . GetPlayerVar( $uName, "UnitSpeed"),test_follow );

$uName should be replaced with the username you want to view the speed from
test_follow , means that after 2 seconds (which is the 7th value in the button code) the button will redirect the code to that event.
Now you will see the speed of that player which is updated every 2 seconds.

I made some testcode for that back in the days, which looks like this:

You get a list of every player connected to the server and press 'Follow player' button behind the name of the person you want to follow.


The text of the button becomes green, to indicatie who you are following (if you press that again, you will stop following that person).


Once you close the main screen, a small window is brought up, that shows you the current speed, current sector, current node and the gap before and behind the selected player. All that information is updated every 2 seconds.




I'm not going the share the whole code, as it is relatively easy to make once you know the basics of Lapper.
If you don't know the basics of Lapper yet, this will be a good exercise to learn them.
There's enough explanations and examples on this forum to get you going.
Attached images
Capture1.PNG
Capture2.PNG
Capture3.PNG
Capture4.PNG
-
(FurkanBaglibel) DELETED by Bass-Driver : Unnessessary posts
Here is a small example code which you can Start/Stop a loop.
This loop is for everyone in the server. not for a specific player.

EDIT: Display speed & car


<?php 
###################################
#Event triggered when lapper start#
###################################
Event OnLapperStart()
    
Globalvar $Loop_On
        
$Loop_On 0;
EndEvent

#################
#Command actions#
#################
Event OnMSO$userName$text # Player event

    
$idxOfFirtsSpace indexOf$text" ");

    IF( 
$idxOfFirtsSpace == -THEN
      $command 
$text;
      
$argv "";
    ELSE
      
$command subStr$text,0,$idxOfFirtsSpace );
      
$argv trimsubStr$text,$idxOfFirtsSpace ) );
    ENDIF
    
    SWITCH( 
$command )

        CASE 
"!loopoff":
            
$Loop_On 0;
            
$Racers GetListOfPlayers("U");                  
            FOREACH( 
$Var IN $Racers )
                
closeButton$Var["value"], "speed");
            ENDFOREACH
        BREAK;
        
        CASE 
"!loopon":
            
$Loop_On 1;
            
globalmsg("execute sub Set_Loop()");
            
Set_Loop();
        BREAK;

    ENDSWITCH
EndEvent

Sub Set_Loop
()
    IF (
$Loop_On == 1THEN 
        $Racers 
GetListOfPlayers("U");                  
        FOREACH( 
$Var IN $Racers #For each player in the server
            
openButton$Var["value"], "speed",175,124,25,5,5,2,96,"^7" GetPlayerVar$Var["value"], "InstantSpeed") . " " GetPlayerVar$Var["value"], "UnitSpeed")."^8 (".GetPlayerVar$Var["value"], "Car").")");
            
DelayedCommand1Set_Loop); #1 second delay
        
ENDFOREACH
    ENDIF
EndSub
?>


-
(FurkanBaglibel) DELETED by Bass-Driver : Unnessessary posts
-
(Bass-Driver) DELETED by Bass-Driver : Unnessessary posts
-
(FurkanBaglibel) DELETED by Bass-Driver : Unnessessary posts
-
(Bass-Driver) DELETED by Bass-Driver : Unnessessary posts
Bass-Driver Help me.!
THIS THREE CODE DOES NOT WORK.



correcte you please




##########################################################################################################
# LFS VEHİCLE SPPED AND VEHİCLE TYPE AND VEHİCLE PLATE #
#########################################################


### Display button ###
OpenPrivButton( "AraasdasdbaDASDasd54",140,0,20,4,12,-1,32,"^3Speed ^7". GetCurrentPlayerVar ( "InstantSpeed" ),"");



OpenPrivButton( "plakacımmm54",140,5,20,4,12,-1,32,"^3Plate : ^7". GetCurrentPlayerVar ( "NumberPlate" ),"");


OpenPrivButton( "Arabaaaaasd54",140,0,20,4,12,-1,32,"^3Car : ^7". GetCurrentPlayerVar ( "Car" ),"");
##########################################################################################################

This code does not work if you putt it in a Sub or command.

See my code few posts above and create an CASE command with these lines.
-
(FurkanBaglibel) DELETED by Bass-Driver : Unnessessary posts
Everyone Who Answered I Thank You I Built
This thread is closed

FGED GREDG RDFGDR GSFDG