:eclipsee_Can someone help me code the admin system for the LFSLapper Insim..... i have tried and for some reason it will not add any admins to the system...
I have attached my file.:doh:
If i am missing something here is the complete file attached
I have attached my file.:doh:
<?php
Event OnMSO( $userName, $text ) # Player event
$idxOfFirtsSpace = indexOf( $text, " ");
# $LOF = getListOfPlayers();
# dumpVar( $LOF );
IF( $idxOfFirtsSpace == -1 ) THEN
$command = $text;
$argv = "";
ELSE
$command = subStr( $text,0,$idxOfFirtsSpace );
$argv = trim( subStr( $text,$idxOfFirtsSpace ) );
ENDIF
SWITCH( $command )
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
CASE "!addadmin":
IF( UserInGroup( "Admin",$userName ) == 1 )
THEN
IF( UserInGroup( "Admin",$argv ) == 1 )
THEN
privMsg( "^7User is already admin!!!");
ELSE
MoveUserToGroup( "Admin",$argv );
SaveGroupToFile( "Admin", "./Admin.txt" );
privMsg( "^7Added New Admin succesfully!!");
ENDIF
ENDIF
BREAK;
CASE "!readmin":
IF( UserInGroup( "Admin",$userName ) == 1 )
THEN
IF( UserInGroup( "Admin",$argv ) == 1 )
THEN
privMsg( "^7Removed User succesfully!!");
RemoveUserFromGroup( "Admin",$argv );
SaveGroupToFile( "Admin", "./Admin.txt" );
ELSE
privMsg( "^1User not found in Admin file");
ENDIF
ENDIF
BREAK;
?>