The online racing simulator
How to create commands in LFSLapper.
Hello to all new LFSLapper users


In this topic, i will do a fast explaination, how to add commands in LFSLapper.
  • 1) Open the 'LFSLapper.LPR' file in the 'default' folder (LFSLapper V7.0.4.6\bin\default\LFSLapper.LPR) with any texteditor application.

  • 2) Scroll down the file until you see the Event named "OnMSO"
    This should look like this:

<?php 
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 )
     
    ENDSWITCH
EndEvent
?>


  • 3) Between SWITCH( $command ) and ENDSWITCH you can create CASE commands which is necessary for creating your own commands. This should look like this.

<?php 
SWITCH( $command )
    CASE 
"!yourcommand":
    
#Yourcode
    
BREAK;        
ENDSWITCH
?>

  • 4) Between CASE "!yourcommand": and BREAK; you can add your code. In the LFSLapper.LPR file there already some examples you can use ingame.
Thanks For The Great Post , Finally Got Something Elaborated Enough To Understand Easily ,I Hope People Like You Wont Stop The Beginners From Learning . Keep The Posts Coming Smile

FGED GREDG RDFGDR GSFDG