The online racing simulator
Hello,

If i remember, Idle begin to work only if you pass the first split. This to avoid spectated when you wait on the starting grid the begin of race. See changes.txt file

Quote :+----------------------------+
|Changes from v5.826 to 5.827|
+----------------------------+
...
3. Idling on track is not active on start race, become active when the first player pass the 1th split

4. Idling on track is not active after pass finsih line
...

Gai-Luron
Quote from Tim NL :

<?php 
 
 
CASE "!red":
  
$NickName GetCurrentPlayerVar("NickName");    
  
$NickStrip StripLFSColorToLower($NickName))
  
$IdxOfTag indexOf$NickStrip "[r]");
  IF( 
$IdxOfTag!= -)
  
THEN
   
IF( $argv != "" )      
   
THEN    
    $temp 
GetListOfPlayers( );                      
    FOREACH( 
$maVar IN $temp )    
     
$NickName GetPlayerVar($maVar["value"], "NickName");    
     
$NickStrip StripLFSColorToLower($NickName) );    
     
$IdxOfTag indexOf$NickStrip "[r]");    
     IF( 
$IdxOfTag != -)    
     
THEN    
      privMsg 
($maVar["value"],"^1Red:");
      
privMsg ($maVar["value"],$argv);  
     ENDIF    
    ENDFOREACH    
   ENDIF
  ENDIF    
 BREAK;
?>


Doesnt work :-(
is it possible to let insim create a new line if Text is too long?
Quote from Gai-Luron :Hello,

If i remember, Idle begin to work only if you pass the first split. This to avoid spectated when you wait on the starting grid the begin of race. See changes.txt file




Gai-Luron

omg the proplem is we only play AU4 track only 8 racers Allow to jon and we are more than 16 player loool sometimes many people afking and no admin there .. so i plan to bring lapper to make rull for idle racers
....
by the way thinks Gai-Luron for your Information
Still got the Chat Question, but now also another thing,
okay, i got a !ban command.
When i enter !ban test name 12 it executes

<?php 
              globalMsg
"^1User ^7" $argv " ^1has been banned by " GetPlayerVar($userName"NickName") );
              
cmdLFS"/ban " $argv " 999" );
?>

but i want the global message to only show "test name" and not the 12 :-S

Also how to make the Chat only Viewable for Admins, or ppl in Admin-Group?

<?php 
 
 
CASE "!red":
  
$NickName GetCurrentPlayerVar("NickName");    
  
$NickStrip StripLFSColorToLower($NickName))
  
$IdxOfTag indexOf$NickStrip "[r]");
  IF( 
$IdxOfTag!= -)
  
THEN
   
IF( $argv != "" )      
   
THEN    
    $temp 
GetListOfPlayers( );                      
    FOREACH( 
$maVar IN $temp )    
     
$NickName GetPlayerVar($maVar["value"], "NickName");    
     
$NickStrip StripLFSColorToLower($NickName) );    
     
$IdxOfTag indexOf$NickStrip "[r]");    
     IF( 
$IdxOfTag != -)    
     
THEN    
       $argv1 
substr$argv,0,30 );
            
IF( 
strlen($argv) > 30 )
THEN 
 $argv2 
substr$argv,30,strlen($argv) );
ENDIF

IF( 
$argv2 != "" )
THEN  
IF( strlen($argv2) > 30 )
THEN 
 $argv3 
substr$argv,strlen($argv2),strlen($argv) );
ENDIF
ENDIF

PrivMsg$maVar["value"], "^1[r] " GetCurrentPlayerVar"UserName" ) .  " ^8: ^2" $argv1 );
                         
IF( 
$argv2 != "" )
THEN
  PrivMsg
$maVar["value"], "^1[r] " GetCurrentPlayerVar"UserName" ) .  " ^8: ^2" $argv2 );             
ENDIF
IF( 
$argv3 != "" )
THEN
  PrivMsg
$maVar["value"], "^1[r] " GetCurrentPlayerVar"UserName" ) .  " ^8: ^2" $argv3 );             
ENDIF    
     ENDIF    
    ENDFOREACH    
   ENDIF
  ENDIF    
 BREAK;
?>

Doesnt work :-S
Think i will just let it how it is :-S

Still got this:
okay, i got a !ban command.
When i enter !ban test name 12 it executes

<?php 
              globalMsg
"^1User ^7" $argv " ^1has been banned by " GetPlayerVar($userName"NickName") );
              
cmdLFS"/ban " $argv );
?>

And the Message on server Shows
User test name 12 has been banned by XYZ
but i want the global message to only show "test name" and not the 12 :-S

Also how to make a Private Chat (like !red) only Viewable for Admins, or ppl in Admin-Group?
Quote from ViKTOOR-LFS :what is !reload ... you mean restart from Control Panel !! or somthing als

Hi,

If you have changed a script then you must restart lapper to make that change active.

When you fill in your username in the file ..\bin\default\superusers.txt
then you can use :

!stop to stop lapper and put it in standby mode
!start to start lapper
!reload to restart lapper
Quote from m1chi119 :Still got the Chat Question, but now also another thing,
okay, i got a !ban command.
When i enter !ban test name 12 it executes

<?php 
              globalMsg
"^1User ^7" $argv " ^1has been banned by " GetPlayerVar($userName"NickName") );
              
cmdLFS"/ban " $argv " 999" );
?>

but i want the global message to only show "test name" and not the 12 :-S

Also how to make the Chat only Viewable for Admins, or ppl in Admin-Group?

Hi,

If you type !ban test name 12 the $argv = "test name 12"
So if you use
globalMsg( "^1User ^7" . $argv . " ^1has been banned by " . GetPlayerVar($userName, "NickName") );

gives:
User test name 12 has been banned by your_nickname

It shows also the 12 but with the line
cmdLFS( "/ban " . $argv . " 999" );
you ban some one for 999 days.

Maybe its more easy to create more !ban commandos like !ban1 !ban30 !ban999

Then you only have to type !ban1 test_user or !ban30 test_user


<?php 
!ban1
globalMsg
"^1User ^7" $argv " ^1has been banned by " GetPlayerVar($userName"NickName") );
              
cmdLFS"/ban " $argv " 1" );
 
!
ban30
globalMsg
"^1User ^7" $argv " ^1has been banned by " GetPlayerVar($userName"NickName") );
              
cmdLFS"/ban " $argv " 30" );
?>

It is

<?php 
              globalMsg
"^1User ^7" $argv " ^1has been banned by " GetPlayerVar($userName"NickName") ); 
              
cmdLFS"/ban " $argv ); 
?>


cant i just anyhow remove the last letters from the $argv in globalMsg? Or make it use $argv2 = " X" so it defines the numbers as $argv2? like define last-symbols until space as $argv2
Quote from m1chi119 :Doesnt work :-S
Think i will just let it how it is :-S


Hi,

I found some typos
Works fine at mine server
You need Lapper 5.925 or higher.


<?php 
 
  
CASE "!red":
    
$NickName GetCurrentPlayerVar("NickName");    
    
$NickStrip StripLFSColorToLower($NickName));
    
$IdxOfTag IndexOf$NickStrip "[r]");
    IF( 
$IdxOfTag!= -)
    
THEN
      
IF( $argv != "" )      
      
THEN    
        $temp 
GetListOfPlayers( );                      
        FOREACH( 
$maVar IN $temp )    
          
$NickName GetPlayerVar($maVar["value"], "NickName");    
          
$NickStrip StripLFSColorToLower($NickName) );    
          
$IdxOfTag indexOf$NickStrip "[r]");    
          IF( 
$IdxOfTag != -)    
          
THEN    
            $argv1 
substr$argv,0,30 );
 
            IF( 
strlen($argv) > 30 )
            
THEN 
              $argv2 
substr$argv,30,strlen($argv) );
            ENDIF
            IF( 
$argv2 != "" )
            
THEN  
              
IF( strlen($argv2) > 30 )
              
THEN 
                $argv3 
substr$argv,strlen($argv2),strlen($argv) );
              ENDIF
            ENDIF
            
PrivMsg$maVar["value"], "^1[r] " GetCurrentPlayerVar"UserName" ) .  " ^8: ^2" $argv1 );
            IF( 
$argv2 != "" )
            
THEN
              PrivMsg
$maVar["value"], "^1[r] " GetCurrentPlayerVar"UserName" ) .  " ^8: ^2" $argv2 );             
            ENDIF
            IF( 
$argv3 != "" )
            
THEN
              PrivMsg
$maVar["value"], "^1[r] " GetCurrentPlayerVar"UserName" ) .  " ^8: ^2" $argv3 );             
            ENDIF    
          ENDIF    
        ENDFOREACH    
      ENDIF
    ENDIF    
  BREAK;
?>

Thanks :-)
how to create a similar chat-command like !red but let the chat only be viewable by admins? :-) so let it check if ppl are admins then send to them? :-O
Quote from m1chi119 :It is

<?php 
              globalMsg
"^1User ^7" $argv " ^1has been banned by " GetPlayerVar($userName"NickName") ); 
              
cmdLFS"/ban " $argv ); 
?>


cant i just anyhow remove the last letters from the $argv in globalMsg? Or make it use $argv2 = " X" so it defines the numbers as $argv2? like define last-symbols until space as $argv2

Hi,

A new one lol

Just type !ban username,days (username and number of days seperate by a , )
example: !ban test user,5

I have also added a !unban



<?php 
 
    
CASE "!ban":
      IF( 
$argv != "" )
      
THEN
        $idxSpace 
indexOf$argv",");
        IF( 
$idxSpace != -)
        
THEN
          $banUser 
subStr$argv,0,$idxSpace );
          
$days trimsubStr$argv,$idxSpace +));
          
globalMsg"^1User ^7" $banUser " ^1has been banned by ^7" GetPlayerVar($userName"NickName") );  
          
cmdLFS"/ban " $banUser " " $days);
        ELSE
          
privMsg "^3Use !ban username,days" );
        ENDIF
      ELSE
        
privMsg "^3Use !ban username,days" );
      ENDIF
      BREAK;
    CASE 
"!unban":
      IF( 
$argv != "" )
      
THEN
        globalMsg
"^2User ^7" $argv " ^2has been unbanned by ^7" GetPlayerVar($userName"NickName") );  
        
cmdLFS"/unban " $argv );
      ELSE
          
privMsg "^3Use !unban username" );
      ENDIF
      BREAK;
?>

Quote from m1chi119 :Thanks :-)
how to create a similar chat-command like !red but let the chat only be viewable by admins? :-) so let it check if ppl are admins then send to them? :-O

Here it is


<?php 
 
  
CASE "!glow":  
   IF( 
UserInGroup"admin",$userName ) == )
   
THEN
        $temp 
GetListOfPlayers( );                     
        FOREACH( 
$maVar IN $temp )      
          IF( 
UserInGroup"admin",$maVar["value"] ) == )   
          
THEN   
            PrivMsg
($maVar["value"],"^1Glow: ^7".$argv);   
          ENDIF   
        ENDFOREACH        
   ELSE
     
privMsg"You are not an Admin!");
   ENDIF   
   BREAK;
?>

Quote from m1chi119 :Thanks :-)
how to create a similar chat-command like !red but let the chat only be viewable by admins? :-) so let it check if ppl are admins then send to them? :-O

If you have the latest Lapper and utils.lpr from the community edition, the !am command is already there.

I'm also just about finished a !tc command for team chat whoich wil abstract the !red command to send messages to anyone who hasd the same team as you, as long as it is surrounded by the same delimiter like square brackets. Will post later today
Meh, since i'm starting to get away from LFSLapper more and more these days, i figured i would release my chat system that i made a while back, hopefully some one will find use of it
Attached files
Chat.lpr.txt - 17 KB - 219 views
Quote from Krayy :If you have the latest Lapper and utils.lpr from the community edition, the !am command is already there.

I'm also just about finished a !tc command for team chat whoich wil abstract the !red command to send messages to anyone who hasd the same team as you, as long as it is surrounded by the same delimiter like square brackets. Will post later today

TeamChat Lapper module now in this thread: http://www.lfsforum.net/showthread.php?p=1540420#post1540420

<?php 
CatchEvent OnLapperStart
()
    
$LockState "unlocked";
EndCatchEvent

CatchEvent 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 
"!lock":
            IF ( 
UserIsAdmin$userName ) == || UserInGroup"admin1",$userName ) == || UserInGroup"admin2",$userName ) == || UserInGroup"admin3",$userName ) == 1)
            
THEN
                $LockState 
"locked";
                
privMsg"^7Race is now ^1Locked." );                
            ENDIF
            BREAK;
        CASE 
"!unlock":
            IF ( 
UserIsAdmin$userName ) == || UserInGroup"admin1",$userName ) == || UserInGroup"admin2",$userName ) == || UserInGroup"admin3",$userName ) == 1)
            
THEN
                $LockState 
"unlocked";
                
privMsg"^7Race is now ^1Unlocked." );                    
            ENDIF
            BREAK;                
    ENDSWITCH
EndCatchEvent


CatchEvent OnNewPlayerJoin
$userName )  # Player event

                            
IF ( $LockState == "locked" )
                            
THEN
                                $SpecUserName 
GetCurrentPlayerVaruserName );
                                
cmdLFS"/spec " $SpecUserName );
                            ENDIF
                        BREAK;

EndCatchEvent
?>


It should spec everybody who joins after i did !lock, until i do !unlock to unlock the race again (it should also work in Training)
Why it doesnt work? Whats the mistake? :-S
Quote from m1chi119 :
It should spec everybody who joins after i did !lock, until i do !unlock to unlock the race again (it should also work in Training)
Why it doesnt work? Whats the mistake? :-S

Hi,


CatchEvent OnNewPlayerJoin( $userName ) # Player event

IF ( $LockState == "locked" )
THEN
cmdLFS( "/spec " . [COLOR="Red"]$userName[/COLOR] );
ENDIF
BREAK;

EndCatchEvent

Quote from m1chi119 :It should spec everybody who joins after i did !lock, until i do !unlock to unlock the race again (it should also work in Training)
Why it doesnt work? Whats the mistake? :-S

why not just use mid race join?
Quote from Fire_optikz001 :why not just use mid race join?

seems to dont work in training :-S

@Tim:
still doesnt spec me when i type !lock and then join the race from spec or from pits :-S
Quote from m1chi119 :

<?php 
CatchEvent OnLapperStart
()
    
$LockState "unlocked";
EndCatchEvent

...
?>

It should spec everybody who joins after i did !lock, until i do !unlock to unlock the race again (it should also work in Training)
Why it doesnt work? Whats the mistake? :-S

The reason is because the LockState variable that you are setting has not been declared as a Global variable. If you do not explicity define a GlobalVar, then it will be destroyed when the function exits. Change your OnLapperStart event to this:


<?php 
CatchEvent OnLapperStart
()
    
GlobalVar $LockState;
    
$LockState "unlocked";
EndCatchEvent
?>


Okay, my fail xD should've known that xD thanks :-D
SpeedTrap (RadarTrap)
Hi

I've been playing about for a bit trying to get another add-on for lapper, a bit like the standard

<?php 
    RegisterNodeAction
"SO1R" 201 DisplaySpeed,"" );
?>

except changed it slightly so that lapper saves your speed, and if you go faster next lap, then speed display text changes to green, and if you go slower, then it displays text in red.


<?php 
CatchEvent OnLapperStart
()
    
RegisterNodeAction"SO2" 77 SpeedTrap1,"" );
    
RegisterNodeAction"SO2" 213 SpeedTrap2,"" );
EndCatchEvent

Sub SpeedTrap2
$userName )
  
$userName GetCurrentPlayerVar"UserName" );
  
$car GetCurrentPlayerVar("Car");
  
$track getLapperVar("ShortTrackName");
  
$TopSpeed ToMphGetCurrentPlayerVar"InstantSpeed" ));

 IF ( 
$TopSpeed GetStoredValue($userName ",ST2_TopSpeed," $track "," $car))
      
THEN
    openPrivButton
"st2_text",1,16,20,5,3,4,80langEngine"%{main_st_faster}%" $TopSpeed ) );
    
SetStoredValue$userName ",ST2_TopSpeed," $track "," $car,$TopSpeed );
  ELSE
    
openPrivButton"st2_text",1,16,20,5,3,4,80langEngine"%{main_st_slower}%" ,$TopSpeed) );
  ENDIF 
EndSub

Lang 
"EN"
    
main_st_faster "^0Radar Trap: ^2{0} mph";
    
main_st_slower "^0Radar Trap: ^1{0} mph";
EndLang
?>


This bit of coding is working ok.

However, what I'm really wanting, is for the speed to show (in plain text colour), but also to show how much faster or slower (in green/red text) next to this.

For example;

Lap1
RadarTrap = 67.21mph
Lap2
RadarTrap = 68.31mph (1.10mph)
Lap3
RadarTrap = 66.41mph (0.80mph)

So then I tried (amongst other things)

<?php 
Sub SpeedTrap1
$userName )
  
$userName GetCurrentPlayerVar"UserName" );
  
$car GetCurrentPlayerVar("Car");
  
$track getLapperVar("ShortTrackName");
  
$TopSpeed ToMphGetCurrentPlayerVar"InstantSpeed" ));

  
$OldTopSpeed GetUserStoredValue$userName"OldTopSpeed" );
  
$STdiff $OldTopSpeed $TopSpeed
    
 
IF ( $TopSpeed GetStoredValue($userName ",ST1_TopSpeed," $track "," $car))
      
THEN
    openPrivButton
"st1_text",1,16,20,5,3,4,80langEngine"%{main_st_faster}%" $TopSpeed ));
    
SetStoredValue$userName ",ST1_TopSpeed," $track "," $car,$TopSpeed );
    
SetUserStoredValue$userName"OldTopSpeed");
  ELSE
    
openPrivButton"st1_text",1,16,20,5,3,4,80langEngine"%{main_st_slower}%" ,$TopSpeed));
  ENDIF 
EndSub
?>


where I was going to put $STdiff within the button at the end, like

<?php 
    openPrivButton
"st1_text",1,16,20,5,3,4,80langEngine"%{main_st_faster}%" $TopSpeed,$STdiff ));
?>

and it would be this $STdiff that would be put in brackets.

I can't get it to work. Keep getting error messages like
3/31/2011 8:36:48 PM -> Syntax error in cfg file "./speedtraps.lpr" at line #194
suspected error in order of the operators
Function 'speedtrap1' script aborted


This error is to do with the line: $STdiff = $OldTopSpeed - $TopSpeed

Where am I going wrong?
Attached images
radartrap.png
Attached files
speedtraps.zip - 1.5 KB - 198 views
Hello,

at line 194

$STdiff = $OldTopSpeed - $TopSpeed

you forgot ";" at end of line. Maybe this is the error

Gai-Luron

PS: I can't test it, i break my windows XP previous Week and i haven't installed all for test that in my new windows 7
No, sorry, that's just my bad copying and pasting from my testing code into my working code.

Even with
Line 194 $STdiff = $OldTopSpeed - $TopSpeed;
I get the error
3/31/2011 10:20:05 PM -> Syntax error in cfg file "./speedtraps.lpr" at line #194 suspected error in order of the operators Function 'speedtrap1' script aborted

At first I thought the problem was that I was getting the $OldTopSpeed and $TopSpeed the wrong way round, but changing it makes no difference.

Either lapper isn't happy with that formula, or (probably) more likely, it's not happy with the way I'm trying to set/get $OldTopSpeed.
This thread is closed

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