Hi all,
Heres a patch file that will add the ability to get a comma seperated list of users in a group, along with the ability to save a usergroup to a disk based file. I have included code below to add to the LFSLapper.lpr file to enable you to add and delete Admins while in game.
Note that Lapper can only return strings, floats or ints to the GLScript parser, so the user lists are returned in a single comma separated string. You will need to use substr or split as I have done to access each username in turn.
PS: The patch file also adds code to allow the rcae host (UCID 0) to !start, !stop and !reload lapper. This is because we use the LFS Server on a dedicated host and this way we don't have to run another instance of LFS to get it up and running.
Add this code in the main "SWITCH( $command )" CASE statement:
Add this code after the EndEvent statement at the end of that ENDSWITCH:
Happy racing.
Heres a patch file that will add the ability to get a comma seperated list of users in a group, along with the ability to save a usergroup to a disk based file. I have included code below to add to the LFSLapper.lpr file to enable you to add and delete Admins while in game.
Note that Lapper can only return strings, floats or ints to the GLScript parser, so the user lists are returned in a single comma separated string. You will need to use substr or split as I have done to access each username in turn.
PS: The patch file also adds code to allow the rcae host (UCID 0) to !start, !stop and !reload lapper. This is because we use the LFS Server on a dedicated host and this way we don't have to run another instance of LFS to get it up and running.
Add this code in the main "SWITCH( $command )" CASE statement:
<?php
CASE "!listgroup":
IF( UserInGroup( "admin",$userName ) == 1 )
THEN
IF( $argv != "" ) THEN
privMsg( "^3Current members of group: " . $argv . "^8" );
PrintUserGroup ($argv);
ELSE
privMsg( "^3You must specify a user group to list^8" );
ENDIF
ENDIF
BREAK;
CASE "!admins":
IF( UserInGroup( "admin",$userName ) == 1 )
THEN
IF( $argv != "" ) THEN
$idxSpace = indexOf( $argv, " ");
IF( $idxSpace != -1 ) THEN
$option = subStr( $argv,0,$idxSpace );
$argv = trim( subStr( $argv,$idxSpace ) );
SWITCH( $option )
CASE "add":
MoveUserToGroup( "admin" , $argv);
SaveGroupToFile( "admin", "./admin.txt" );
BREAK;
CASE "del":
RemoveUserFromGroup( "admin" , $argv);
SaveGroupToFile( "admin", "./admin.txt" );
BREAK;
DEFAULT:
privMsg( "No such option for this command: " . $option );
BREAK;
ENDSWITCH
ELSE
privMsg( "Command needs more parameters" );
ENDIF
ENDIF
ENDIF
privMsg( "^3Current Admins:^8" );
PrintUserGroup ("admin");
BREAK;
?>
<?php
Sub PrintUserGroup ($UserGroup)
$IsNotBlank = 1;
$GroupIndex = 0;
WHILE ($IsNotBlank == 1)
$GroupUser=split( ListGroupUsers($UserGroup),",",$GroupIndex );
IF ( $GroupUser != "") THEN
privmsg($GroupUser);
$GroupIndex = $GroupIndex + 1;
ELSE
$IsNotBlank = 0;
ENDIF
ENDWHILE
EndSub
?>