The online racing simulator
[Solved] Admin login
ok i was trying this

<?php 
        
CASE "!auth":
            IF( . 
$argv . == 134562 )
            
THEN
              privMsg
"^2Thank you for logging in");
        
MoveUserToGroup"admin",$userName );
            ELSE
              
privMsg"^1Login Denied");
            ENDIF
?>

but it dont seem to work Frown
The obvious things, which I would assume you've already thought of are;

you've got a BREAK; at the end of your code there?

and it's in between SWITCH / ENDSWITCH

However, should it be username, rather than $username?
well here then

<?php 
Event OnMSO
$text )
    SWITCH( 
$command )
    
$userName GetCurrentPlayerVar("UserName");

        CASE 
"!auth":
            IF( . 
$argv . == 134562 )
            
THEN
              privMsg
"^2Thank you for logging in");
        
MoveUserToGroup"admin",$userName );
            ELSE
              
privMsg"^1Login Denied");
            ENDIF
            BREAK;
ENDSWITCH
EndEvent
?>


help?
Hi,
!auth is already used in lapper.

CASE "!auth":
privMsg( langEngine( "%{main_level}%", GetCurrentPlayerVar("AuthLevel") ) );
BREAK;

And the group "admin" is filled from a file and you can't add usernames to a file ( i think) .

So i used !login and !logout and the group "tempadmin" for example.

CASE "!login":
IF( UserInGroup( "tempadmin",$userName ) == 1 )
THEN
privMsg( "^2You are already logged in");
BREAK;
ENDIF
IF( $argv == 1234 )
THEN
privMsg( "^2Thank you for logging in");
MoveUserToGroup( "tempadmin",$userName );
ELSE
privMsg( "^1Login Denied");
ENDIF
BREAK;
CASE "!logout":
IF( UserInGroup( "tempadmin",$userName ) == 1 )
THEN
RemoveUserFromGroup( "tempadmin",$userName );
privMsg( "^2You are logged out now.");
ELSE
privMsg( "^2You where not logged in.");
ENDIF
BREAK;

Ps: If lapper reset the group "tempadmin" is empty.
-
(Bass-Driver) DELETED by Bass-Driver
Tim NL u made a bug :S

lol cause u made bugs

yes its still dont work same problem i had with !auth
Quote from Fire_optikz001 :Tim NL u made a bug :S

lol cause u made bugs

yes its still dont work same problem i had with !auth

My script works here fine. ( its still active on [NLR]NL Racing GTR , you can try it there with !login 1234 and !logout )
But you cant use UserGroupFromFile() in combi with MoveUserToGroup()
( it are two different things).
Quote from Tim NL :My script works here fine. ( its still active on [NLR]NL Racing GTR , you can try it there with !login 1234 and !logout )
But you cant use UserGroupFromFile() in combi with MoveUserToGroup()
( it are two different things).

SO Wait would u still use if useringroup?
Quote from Fire_optikz001 :SO Wait would u still use if useringroup?

Hi,

You can use IF( UserInGroup( "admin",$userName ) == 1 || UserInGroup( "tempadmin",$userName ) == 1) to use 2 admin groups (admin and tempadmin)

CASE "!login":
IF( UserInGroup( "admin",$userName ) == 1 || UserInGroup( "tempadmin",$userName ) == 1)
THEN
privMsg( "^2You are already logged in");
BREAK;
ENDIF
IF( $argv == 1234 )
THEN
privMsg( "^2Thank you for logging in");
MoveUserToGroup( "tempadmin",$userName );
ELSE
privMsg( "^1Login Denied");
ENDIF
BREAK;
CASE "!logout":
IF( UserInGroup( "admin",$userName ) == 1 || UserInGroup( "tempadmin",$userName ) == 1)
THEN
RemoveUserFromGroup( "tempadmin",$userName );
privMsg( "^2You are logged out now.");
ELSE
privMsg( "^2You where not logged in.");
ENDIF
BREAK;
CASE "!rst":
IF( UserInGroup( "admin",$userName ) == 1 || UserInGroup( "tempadmin",$userName ) == 1) THEN
cmdLFS( "/restart " );
ENDIF
BREAK;


<?php 
 
CASE "!login":
         IF( 
UserInGroup"admin",$userName ) == )
        
THEN
     
IF( UserInGroup"tempadmin",$userName ) == )
     
THEN
        privMsg
"^2You are already logged in");
      ELSE      
      IF( 
$argv== "1234" || $argv == "1234567890" )
      
THEN
        privMsg
"^2Thank you for logging in");
        
MoveUserToGroup"tempadmin",$userName );
      ELSE
        
privMsg"^1Incorrect Password");
      ENDIF
      ENDIF
      ELSE
          IF( 
UserInGroup"beta",$userName ) == 1)
          
THEN
              
IF( UserInGroup"tempadmin",$userName ) == )
     
THEN
        privMsg
"^2You are already logged in");
      ELSE      
      IF( 
$argv== "1234567890" )
      
THEN
        privMsg
"^2Thank you for logging in");
        
MoveUserToGroup"tempadmin",$userName );
      ELSE
       
privMsg"^1Incorrect Password");
       ENDIF
          ENDIF
             ENDIF
      BREAK;
   CASE 
"!logout":
     IF( 
UserInGroup"tempadmin",$userName ) == )
     
THEN
        RemoveUserFromGroup
"tempadmin",$userName );
        
privMsg"^2You are logged out now.");
      ELSE      
         
privMsg"^2You where not logged in.");
      ENDIF
      BREAK;
?>


<?php 
        
CASE "!ban":
     IF( 
UserInGroup"tempadmin",$userName ) == )
     
THEN
        
IF( UserInGroup"admin",$argv ) == )
            
THEN
    cmdLFS
("/msg " GetCurrentPlayerVar"Nickname" ) . " Attempted to ban " GetPlayerVar$argv"Nickname" ) );
    
cmdLFS"/msg " GetPlayerVar$argv"Nickname" ) . "^7 Is An Admin ban Voided" );
            ELSE
        IF( 
UserInGroup"beta",$argv ) == )
            
THEN
    cmdLFS
("/msg " GetCurrentPlayerVar"Nickname" ) . " Attempted to ban " GetPlayerVar$argv"Nickname" ) );
    
cmdLFS"/msg " GetPlayerVar$argv"Nickname" ) . "^7 Is A beta Tester ban Voided" );
                ELSE
    
cmdLFS("/msg " GetCurrentPlayerVar"Nickname" ) . " banned " GetPlayerVar$argv"Nickname" ) );
            
cmdLFS"/ban " $argv " 7" );
              ENDIF
              ENDIF
              ENDIF
            BREAK;
?>

i made a code for add more admins


UserGroupFromFile( "UserAdmin", "./UserAdmin.txt" );

CASE "!readmin":#REMOVE ADMIN
IF( UserInGroup( "UserAdmin",$userName ) == 1 )
THEN
IF( UserInGroup( "UserAdmin",$argv ) == 1 )
THEN
RemoveUserFromGroup( "UserAdmin",$argv );
privMsg( "^7Removed User succesfully!!");
ELSE
privMsg( "^1User not found in UserAdmin file");
ENDIF
ENDIF
BREAK;

CASE "!addadmin":#ADD ADMIN
IF( UserInGroup( "UserAdmin",$userName ) == 1 )
THEN
IF( UserInGroup( "UserAdmin",$argv ) == 1 )
THEN
privMsg( "^7User is already admin!!!");
ELSE
MoveUserToGroup( "UserAdmin",$argv );
privMsg( "^7Added New Admin succesfully!!");
ENDIF
ENDIF
BREAK;

i have also made a command to give someone a driveban


CASE "!driveban": #ADD DRIVEBAN
IF( UserInGroup( "UserAdmin",$userName ) == 1 )
THEN
IF( UserInGroup( "UserAdmin",$argv ) == 1 )
THEN
cmdLFS("/msg " . GetPlayerVar( $argv, "Nickname" ) . "^7 Cant be Kicked!!!" );
cmdLFS("/msg " . GetPlayerVar( $argv, "Nickname" ) . "^7 is an Admin/SuperUser" );
BREAK;
ENDIF
IF( UserInGroup( "UserDriveBan",$argv ) == 1 )
THEN
privMsg("^1 Already banned from driving!!" );
ELSE
MoveUserToGroup( "UserDriveBan",$argv );
privMsg("^7>Banned From Driving" );
cmdLfs( "/spec " . $argv . );
ENDIF
ENDIF
BREAK;

CASE "!redriveban": #REMOVE DRIVEBAN
IF( UserInGroup( "UserAdmin",$userName ) == 1 )
THEN
IF( UserInGroup( "UserDriveBan", $argv ) == 1 )
THEN
RemoveUserFromGroup( "UserDriveBan",$argv );
privMsg("^7>DriveBan Removed Succesfull!!" );
ELSE
privMsg("^1 User not found in UserDriveBan file!! " );
ENDIF
ENDIF
BREAK;

only it resets after restarting lapper.
i want also use this code: http://www.lfsforum.net/showthread.p...30#post1259430
to save the users in the file, but this code a lil bug
Thanks. I would like to that to and more these topics.
This thread is closed

FGED GREDG RDFGDR GSFDG