How can we assign functions like Lapper shutdown and restart to buttons? I tried redirecting to sub but no success
<?php
CatchEvent OnMSO( $userName, $text ) # Player event
$idxOfFirtsSpace = indexOf( $text, " ");
IF( $idxOfFirtsSpace == -1 ) THEN
$command = $text;
$argv = "";
ELSE
$command = subStr( $text,0,$idxOfFirtsSpace );
$argv = trim( subStr( $text,$idxOfFirtsSpace ) );
ENDIF
SWITCH( $command )
CASE "!ctrl":
control_lapper( 0,0 );
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 ) == 1 )
THEN
globalMsg( langEngine( "%{main_lapclose}%" ) );
termLapper();
ENDIF
EndSub
Sub control_reload_lapper( $KeyFlags,$id )
IF ( UserIsAdmin( $userName ) == 1 )
THEN
privMsg("Restarting and reloading config!");
reload();
ENDIF
EndSub
?>