The online racing simulator
reload() ,term() in Button
How can we assign functions like Lapper shutdown and restart to buttons? I tried redirecting to sub but no success
** Best answer **
In 5 minutes I have put this script together.
There is no close button, but that is on purpose as I think people should be able to code that (there are examples enough to look at).

I've attached the script as a file as well.
Rename the extension to .lpr and make sure to add a reference to addonsused.lpr


<?php 
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 
"!ctrl":
            
control_lapper0,);
            BREAK;
    ENDSWITCH
EndCatchEvent

Sub control_lapper
$KeyFlags,$id )
    
### Set initial values for left/right and top/bottom coordinates ###
    
$left_right_control 54;
    
$top_bottom_control 50;
    
### End ###

    
openPrivButton"control_term_lapper",$left_right_control+1,$top_bottom_control+56,45,5,5,-1,32"^3Terminate Lapper"control_term_lapper);
    
openPrivButton"control_reload_lapper",$left_right_control+46,$top_bottom_control+56,45,5,5,-1,32"^3Reload Lapper"control_reload_lapper);
EndSub

Sub control_term_lapper
$KeyFlags,$id )
    IF ( 
UserIsAdmin$userName ) == )
    
THEN
      globalMsg
langEngine"%{main_lapclose}%" ) );
      
termLapper();
    ENDIF
EndSub

Sub control_reload_lapper
$KeyFlags,$id )
    IF ( 
UserIsAdmin$userName ) == )
    
THEN
      privMsg
("Restarting and reloading config!");
      
reload();
    ENDIF
EndSub
?>


Attached files
term_reload.txt - 1.2 KB - 64 views
Quote from Yisc[NL :;2045077"]In 5 minutes I have put this script together.
There is no close button, but that is on purpose as I think people should be able to code that (there are examples enough to look at).

I've attached the script as a file as well.
Rename the extension to .lpr and make sure to add a reference to addonsused.lpr


<?php 
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 
"!ctrl":
            
control_lapper0,);
            BREAK;
    ENDSWITCH
EndCatchEvent

Sub control_lapper
$KeyFlags,$id )
    
### Set initial values for left/right and top/bottom coordinates ###
    
$left_right_control 54;
    
$top_bottom_control 50;
    
### End ###

    
openPrivButton"control_term_lapper",$left_right_control+1,$top_bottom_control+56,45,5,5,-1,32"^3Terminate Lapper"control_term_lapper);
    
openPrivButton"control_reload_lapper",$left_right_control+46,$top_bottom_control+56,45,5,5,-1,32"^3Reload Lapper"control_reload_lapper);
EndSub

Sub control_term_lapper
$KeyFlags,$id )
    IF ( 
UserIsAdmin$userName ) == )
    
THEN
      globalMsg
langEngine"%{main_lapclose}%" ) );
      
termLapper();
    ENDIF
EndSub

Sub control_reload_lapper
$KeyFlags,$id )
    IF ( 
UserIsAdmin$userName ) == )
    
THEN
      privMsg
("Restarting and reloading config!");
      
reload();
    ENDIF
EndSub
?>



thank you for your help i will try this

FGED GREDG RDFGDR GSFDG