The online racing simulator
Hy Sin

I would like to make a button on the right buttom corner which is clickable and if a player click on it it shows the !drf list How could i make that ?


And 1 more question, how could I edit the lapper to show the Drift Score on passing the finish line in Practice mode , I want to players could join to race frop pit not from a starting point because the race its lapped and there is no start point they were teleported to the left middle in front of the traffic lights ... It were easy to poiting the race in practice mode and showing the score after passing the finish line !
Quote from sarxes :Hy Sin

I would like to make a button on the right buttom corner which is clickable and if a player click on it it shows the !drf list How could i make that ?

Somewhere after the line that starts - Event OnConnect( $userName ) # Player event - add the following lines


<?php 
  openPrivButton
"button_driftscore_back",4,159,22,7,1,-1,16,"" );
  
openPrivButton"button_driftscore",5,160,20,5,1,-1,32,"^1Drift Scores",SR_drfnear);
?>

Then after the line - EndEvent - add the following


<?php 
Sub SR_drfnear
$KeyFlags,$id )
    
$NickName GetCurrentPlayerVar("NickName");
    
drfNear$NickName );
EndSub
?>


Haven't tested it, but should work.

In one of the code lines, above, you'll see that part of the code is
5,160,20,5,1,-1,32,"^1Drift

The first number is how far right the button/text starts, 2nd number is how far down, 3rd number is how wide button/text goes, 4th number is how high, 5th number is spacing between lines, the -1 means always there until bit of code in another event switches button off, the 32 is for background colour and text justification, and ^1 is for the colour.

You may have to or want to change button location, size, colours, etc, to suit.
Quote from sinanju :Somewhere after the line that starts - Event OnConnect( $userName ) # Player event - add the following lines


<?php 
  openPrivButton
"button_driftscore_back",4,159,22,7,1,-1,16,"" );
  
openPrivButton"button_driftscore",5,160,20,5,1,-1,32,"^1Drift Scores",SR_drfnear);
?>

Then after the line - EndEvent - add the following


<?php 
Sub SR_drfnear
$KeyFlags,$id )
    
$NickName GetCurrentPlayerVar("NickName");
    
drfNear$NickName );
EndSub
?>


Haven't tested it, but should work.

In one of the code lines, above, you'll see that part of the code is
5,160,20,5,1,-1,32,"^1Drift

The first number is how far right the button/text starts, 2nd number is how far down, 3rd number is how wide button/text goes, 4th number is how high, 5th number is spacing between lines, the -1 means always there until bit of code in another event switches button off, the 32 is for background colour and text justification, and ^1 is for the colour.

You may have to or want to change button location, size, colours, etc, to suit.

Its doesnt work ... I doesnt shows nothing ...
Just been checking, and found out that Drift scores are NOT saved in when in Practise mode!

In race mode, my code works.

I've added some txt files to show various ways of implementing the button - if you don't want people complaining of the mouse cursor being on screen when on track, I'd suggest using 3rd method.

1 EventOnConnect
2 EventOnLap
3 Event OnLeaveRace
Attached files
Event OnConnect.txt - 553 B - 233 views
Event OnLap.txt - 656 B - 242 views
Event OnLeaveRace.txt - 808 B - 238 views
Quote from sinanju :Just been checking, and found out that Drift scores are NOT saved in when in Practise mode!

Could you remake the code to work in Practice mode too or its a big request ???


P.S.: I made the button working for clicking and I have a problem with this ... Should I rewrite the code to display the scores from the 1st position to the last , and player could go beatweean pages ... That the players scores are paged in 18/page
Quote from sarxes :Could you remake the code to work in Practice mode too or its a big request ?

I suspect this is a LFSLapper issue, so in not something I can code.
Quote from sinanju :I suspect this is a LFSLapper issue, so in not something I can code.

Maybe Gai-Luron could make working lapper to working on Practice ?

You should talk with Luron about that issue ... No ? PLS !
Quote from sarxes :I made the button working for clicking and I have a problem with this ... Should I rewrite the code to display the scores from the 1st position to the last , and player could go beatweean pages ... That the players scores are paged in 18/page

By default, both !drf and !top show only the top 18 places.

You can write code to show buttons that can give you other buttons to press that will give you different placings (e.g. 19 to 36, 37 to 54 etc).

If you want to see this in action, go to my server (Sin'rs), then spectate, and at the bottom of the screen you'll see a button appear "Menu System". Click on this, then choose "User Dashboard", then you'll see an option for Top Times, Top Drifts, etc.

You can either try code something for drifts yourself, or you could use my Menu code (which can be found HERE).

You could still keep the Drift Button on the player's screen (as coded in posts above), but instead of going to the Sub SR_drfnear sub-routine , you link it to the relevant section on my menu system (which in the menu system is Sub DoUserDrifts( $KeyFlags,$id).

If you want to code yourself, then look at my menu code - the Sub DoUserDrifts section. You'll see that there are a lot of open private buttons, with a sub-routine at the end of each line that starts "click_ ".

You could copy and use these buttons along with associated sub-routines, just laying out on the screen where-ever suits (horizontally, vertically, cell matrix, etc).
Quote from sinanju :By default, both !drf and !top show only the top 18 places.

You can write code to show buttons that can give you other buttons to press that will give you different placings (e.g. 19 to 36, 37 to 54 etc).

If you want to see this in action, go to my server (Sin'rs), then spectate, and at the bottom of the screen you'll see a button appear "Menu System". Click on this, then choose "User Dashboard", then you'll see an option for Top Times, Top Drifts, etc.

You can either try code something for drifts yourself, or you could use my Menu code (which can be found HERE).

You could still keep the Drift Button on the player's screen (as coded in posts above), but instead of going to the Sub SR_drfnear sub-routine , you link it to the relevant section on my menu system (which in the menu system is Sub DoUserDrifts( $KeyFlags,$id).

If you want to code yourself, then look at my menu code - the Sub DoUserDrifts section. You'll see that there are a lot of open private buttons, with a sub-routine at the end of each line that starts "click_ ".

You could copy and use these buttons along with associated sub-routines, just laying out on the screen where-ever suits (horizontally, vertically, cell matrix, etc).

Sin u r like a GOD !!! Thx for your help !!! Just one more question , how should I rewrite the SR_driftnear to display the !drf list ? My last question
Quote from sarxes :how should I rewrite the SR_driftnear to display the !drf list ? My last question

In my earlier post(s), I had the following line of code:

openPrivButton( "button_driftscore",5,160,20,5,1,-1,32,"^1Drift Scores",SR_drfnear);

The SR_drfnear part of that line is the Sub-Routine that is activated when the button is clicked.

You could put your own sub-routine in any button.

Couple of Drift score examples;

Quote :openPrivButton( "button_drift_example1",35,160,20,5,1,-1,32,"^1Top Drift Scores",SR_drfTop);[FONT=Calibri]Sub [/FONT][FONT=Calibri]SR_drfTop[/FONT][FONT=Calibri]( [/FONT][FONT=Calibri]$KeyFlags[/FONT][FONT=Calibri],[/FONT][FONT=Calibri]$id [/FONT][FONT=Calibri])[/FONT][FONT=;">
drf( $argv );[FONT=Calibri]EndSub[/FONT]

Quote :[FONT=Calibri]openPrivButton[/FONT][FONT=Calibri]( [/FONT][FONT=Calibri]"button_drift_example2"[/FONT][FONT=Calibri],[/FONT][FONT=Calibri]65[/FONT][FONT=Calibri],[/FONT][FONT=Calibri]160[/FONT][FONT=Calibri],[/FONT][FONT=Calibri]20[/FONT][FONT=Calibri],[/FONT][FONT=Calibri]5[/FONT][FONT=Calibri],[/FONT][FONT=Calibri]1[/FONT][FONT=Calibri],-[/FONT][FONT=Calibri]1[/FONT][FONT=Calibri],[/FONT][FONT=Calibri]32[/FONT][FONT=Calibri],[/FONT][FONT=Calibri]"^1Top Drift Scores"[/FONT][FONT=Calibri],[/FONT][FONT=Calibri]SR_drfTop19to36[/FONT][FONT=Calibri]);[/FONT][FONT=;">

Sub SR_drfTop19to36( $KeyFlags,$id )[FONT=Calibri]drf[/FONT][FONT=Calibri]( [/FONT][FONT=Calibri]19 [/FONT][FONT=Calibri]);[/FONT][FONT=;">
EndSub

I thought a lot for my problem about practice mode. The solution is that to make a command that the new players auto teleported to pit so they cant start the race from the layout they have to get out from the pit in AU1 and this is the way for the scored laps.

Could you make lapper to auto pit players who join in server ?
Have you got a start point (green arrow) in your layout?

I think this does what you want automatically.
-
(Bass-Driver) DELETED by Bass-Driver
Quote from sarxes :a command that the new players auto teleported to pit ...... Could you make lapper to auto pit players who join in server ?

Something like


<?php 
  $NickName 
GetCurrentPlayerVar("NickName");

  
cmdLFS"/pitlane " NickName );
?>

Not sure in which event (Event On? newplayerjoin?) you could use it though.
Okay I will try
Hy Sin,

Here is my new question Its possible to group the drift score by car and scroll between the scores ... I attached my idea of it how it be looks like and all is under the Drift Scores button what u made

And I would like to put if admin is online and show his name its on picture too my idea and if is not show the message : Not online

P.S. : And its possible that players couldnt go anywhere from start position until the timer not finish with countdown !

What means that ?


<?php 
2
/3/2012 5:46:44 PM -> Can't open group file : ./default/./Text_Files/admin1.txt
2/3/2012 5:46:44 PM -> Can'
t open group file : ./default/./Text_Files/admin2.txt
?>


Attached images
future.png
Quote from sarxes :...What means that ?


<?php 
2
/3/2012 5:46:44 PM -> Can't open group file : ./default/./Text_Files/admin1.txt
2/3/2012 5:46:44 PM -> Can'
t open group file : ./default/./Text_Files/admin2.txt
?>



Likely you haven't got any admin1.txt and admin2.txt files, so you will need to set them up manually.

In your /default directory (same directory your lfslapper.lpr file is stored) make a new directory called Text_Files. In that directory, make a blank text file and call it admin1.txt, then make another text file and call it admin2.txt.
Quote from sarxes :And its possible that players couldnt go anywhere from start position until the timer not finish with countdown !]

The way I do it is if players jump the lights, then I spectate them.

Look for Event OnFalseStartL1 in your lfslapper.lpr file.

add the following line (before the EndEvent line)


<?php 
cmdLFS
"/spec " GetCurrentPlayerVar("UserName") );
?>

Also do the same with the Event OnFalseStartL2.
Quote from sarxes : I would like to put if admin is online and show his name its on picture too my idea and if is not show the message : Not online

This could probably be done - let me think about it some - but not promising anything.
Quote from sarxes :possible to group the drift score by car and scroll between the scores

The first part is easy enough, but not sure what you mean by the scrolling part (up and down an individual car table?).

First you need a button that will open up a set of buttons, each with car name on it. (This could be set up on the sub-routine that starts when you click your "Click for Drift Scores" button in bottom right of your image.

For instance,
openPrivButton( "XRG_button",70,25,10,5,2,-1,16,"XRG",Click_XRG );
openPrivButton( "XRT_button",80,25,10,5,2,-1,16,"XRT",Click_XRT );
openPrivButton( "RB4_button",90,25,10,5,2,-1,16,"RB4",Click_RB4 );
openPrivButton( "FXO_button",100,25,10,5,2,-1,16,"FXO",Click_FXO );
openPrivButton( "RAC_button",110,25,10,5,2,-1,16,"RAC",Click_RAC );
openPrivButton( "FZ5_button",120,25,10,5,2,-1,16,"FZ5",Click_FZ5 );
openPrivButton( "LX4_button",130,25,10,5,2,-1,16,"LX4",Click_LX4 );
openPrivButton( "LX6_button",140,25,10,5,2,-1,16,"LX6",Click_LX6 );

Each of these buttons has sub-routine (e.g Click_XRG) that when car name button is clicked, then the sub-routine is invoked.

The sub-routines for these buttons could look like;

Sub Click_XRG( $KeyFlags,$id )
drf ( XRG );
EndSub

This would show the top 18 places for that particular car.

As part of the sub-routine, you could add further buttons with arrows ([<] and [>]) and these are tied to further sub-routines, e.g. clicking on the [>] button takes you to a sub-routine with following line
drf ( XRG 19 );

My way would be tedious to code, but is fairly easy to do (look in my Menu.lpr file and you'll see how I've done my Top and Drift tables - this would just be something like that).
Quote from sinanju :

As part of the sub-routine, you could add further buttons with arrows ([<] and [>]) and these are tied to further sub-routines, e.g. clicking on the [>] button takes you to a sub-routine with following line
drf ( XRG 19 );

My way would be tedious to code, but is fairly easy to do (look in my Menu.lpr file and you'll see how I've done my Top and Drift tables - this would just be something like that).

Could you make me these buttons to jump between pages in drift score list ? I dont need the grouping the cars
Been playing around with the drf function, but no matter what I do, unless I do something like


<?php 
Sub Click_DRF
$KeyFlags,$id )
        
drf );
    
EndSub
?>


or


<?php 
Sub Click_DRF
$KeyFlags,$id )
         
drf $argv);
     
EndSub
?>


then I can't get the table to list just car of a particular type.

Tried things like


<?php 
Sub Click_DRF
$KeyFlags,$id )
          
drf RB4);
      
EndSub
?>


but couldn't get anything to work.
Quote from sinanju :Been playing around with the drf function, but no matter what I do, unless I do something like


<?php 
Sub Click_DRF
$KeyFlags,$id )
        
drf );
    
EndSub
?>


or


<?php 
Sub Click_DRF
$KeyFlags,$id )
         
drf $argv);
     
EndSub
?>


then I can't get the table to list just car of a particular type.

Tried things like


<?php 
Sub Click_DRF
$KeyFlags,$id )
          
drf RB4);
      
EndSub
?>


but couldn't get anything to work.

I will give it a try maybe should work ... I saw the function on a demo server that I could jump between pages from first top 18 to last page... maybe 200 and there was a button with i could jump back from page to page to top 18 ... Idk how was the script but if this code will work I'll be very happynes !!! But thanks anyway for you effort !!! U r a good man
Quote from sarxes :I will give it a try maybe should work ... I saw the function on a demo server that I could jump between pages from first top 18 to last page... maybe 200 and there was a button with i could jump back from page to page to top 18 ... Idk how was the script but if this code will work I'll be very happynes !!! But thanks anyway for you effort !!! U r a good man

Try the attached.

Unzip, and follow instructions in the code (basically add into the \includes folder and amend the addonsused.lpr file).

The lapper code is bit long winded (proper coders will wince!), but should be extremely easy to follow, and amend if you want to go past 200 top scores.

If you want to change the vertical location of the buttons then search foir the line GlobalVar $DorigT and read/amend to suit.

When using the arrows, no need to click the Drift Table's OK button; table closes and re-opens to new page when using arrows.

Code is written in such a way that original button that starts process can only be seen when you leave the track, and whole process closes when you rejoin.
Attached files
driftmenu.zip - 1.7 KB - 254 views
Quote from sinanju :Try the attached.

Unzip, and follow instructions in the code (basically add into the \includes folder and amend the addonsused.lpr file).

The lapper code is bit long winded (proper coders will wince!), but should be extremely easy to follow, and amend if you want to go past 200 top scores.

If you want to change the vertical location of the buttons then search foir the line GlobalVar $DorigT and read/amend to suit.

When using the arrows, no need to click the Drift Table's OK button; table closes and re-opens to new page when using arrows.

Code is written in such a way that original button that starts process can only be seen when you leave the track, and whole process closes when you rejoin.

Its so nice, u are a genius ! But there is a problem all with this I attached the problem ... I know u fix is so fast ... !

I want to be visible after leaving the pit always
Attached images
helpwiththis.png
Help
I am new to LFS Lapper and would like some help
i have placed ip / insim in LFS Server file
DEF1|^0Launch ^1Racing|213.229.77.230|50001|./default|default_1.ini|autoStart
i have put admin password in .ini file
when i start it goes into standby state when i type !start in chat window it puts it back in standby state and says in lapper window err

2/10/2012 11:05:49 PM
Lapper Instance 213.229.77.230/50001 abort!
Object reference not set to an instance of an object.
LFSLapper
at InSim.CodePage.GetString(Byte[] pack, Int32 offset, Int32 len) in D:\Dev\DevInsim\lapper\LFSLapper5.840\LFSLapper\src\Commun\CodePage.cs:line 176
at InSim.Decoder.pakGetString(Byte[] pak, Int32 first, Int32 len) in D:\Dev\DevInsim\lapper\LFSLapper5.840\LFSLapper\src\InSim4.cs:line 781
at InSim.Decoder.VER..ctor(Byte[] packet) in D:\Dev\DevInsim\lapper\LFSLapper5.840\LFSLapper\src\InSim4.cs:line 835
at InSim.Connect.insimConnectTCP(String host, Int32 port, String adminPassword, String mode, String nameApp, Boolean isLocal) in D:\Dev\DevInsim\lapper\LFSLapper5.840\LFSLapper\src\InSim4.cs:line 310
at InSim.Connect.insimConnect(String host, Int32 port, String adminPassword, String mode, String nameApp, Boolean isLocal, Boolean TCPmode) in D:\Dev\DevInsim\lapper\LFSLapper5.840\LFSLapper\src\InSim4.cs:line 255
at LFSLapper.LFSListen.Listen.openStbMode() in D:\Dev\DevInsim\lapper\LFSLapper5.840\LFSLapper\src\LFSListen\Listen.cs:line 98
at LFSLapper.LFSListen.Listen.startStbMode() in D:\Dev\DevInsim\lapper\LFSLapper5.840\LFSLapper\src\LFSListen\Listen.cs:line 197
at LFSLapper.LFSListen.Listen.start() in D:\Dev\DevInsim\lapper\LFSLapper5.840\LFSLapper\src\LFSListen\Listen.cs:line 153
System.String GetString(Byte[], Int32, Int32)
Closing Instance...

please help
thanks
This thread is closed

Config help
(1112 posts, closed, started )
FGED GREDG RDFGDR GSFDG