The online racing simulator
[Solved] Admin System
: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:


<?php 
Event OnMSO
$userName$text # Player event

    
$idxOfFirtsSpace indexOf$text" ");

#    $LOF = getListOfPlayers();
#    dumpVar( $LOF );



    
IF( $idxOfFirtsSpace == -THEN
      $command 
$text;
      
$argv "";
    ELSE
      
$command subStr$text,0,$idxOfFirtsSpace );
      
$argv trimsubStr$text,$idxOfFirtsSpace ) );
    ENDIF
    
    SWITCH( 
$command )

  CASE 
"!listgroup":
            IF( 
UserInGroup"admin",$userName ) == )
            
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 ) == )
            
THEN
                
IF( $argv != "" THEN
                    $idxSpace 
indexOf$argv" ");
                    IF( 
$idxSpace != -THEN
                        $option 
subStr$argv,0,$idxSpace );
                        
$argv trimsubStr$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 ) == )
   
THEN
   
IF( UserInGroup"Admin",$argv ) == )
   
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 ) == )
   
THEN
   
IF( UserInGroup"Admin",$argv ) == )
              
THEN
   privMsg
"^7Removed User succesfully!!");
   
RemoveUserFromGroup"Admin",$argv );
   
SaveGroupToFile"Admin""./Admin.txt" );
   ELSE
   
privMsg"^1User not found in Admin file");
   ENDIF
   ENDIF
   BREAK;
?>

If i am missing something here is the complete file attached
#2 - Krayy
i have that command and it does not give admin access to some of my users.....I am trying to figure out how to use ur command !admins
#4 - Krayy
The CIF has superseded the !admins command and other gui based commands that I created.

If you're having problems with the CIF gui, I can help you out with that
how can i let other racers know what command to tell them to for them to see what admins are online
#6 - Krayy
The config_membership CIF plugin uses the !ma command for membership admin, but that's easy to add !admins as well like this:


<?php 
    
SWITCH( $command )
        CASE 
"!admins":
        CASE 
"!ma":
            
DoCifConfigMembership(0,0);
        BREAK;
    ENDSWITCH
?>

Welcome,

How should the administrator be removed from office if he is offline?
This thread is closed

FGED GREDG RDFGDR GSFDG