The online racing simulator
#1 - Krayy
[CODE] Membership Administration
This LPR script provides a GUI to enable Admins to set a connected users authorisation level. users can be set from Visitor up to Admin, and there is also an overloaded UserIsAdmin function included to activate new admins straight away.

Once a user's auth level has been set, you can use the MemberStype stored var to limit other functions execution.

Installation:
1. Save file into your includes file as member_admin.lpr and add the filename to your addonsused.lpr file.

2. Replace the existing OnConnect functions in the main LFSLapper.lpr file with these:


<?php 
Event OnConnect
$userName # Player event
    
$NickName GetCurrentPlayerVar("NickName");
    
$Posabs GetCurrentPlayerVar("PosAbs");
    
$Groupqual GetCurrentPlayerVar("GroupQual");

    IF ( 
GetUserStoredNum("MemberType") >= $MEMBERTYPE_AFFILIATE )
    
THEN
        LoginMember
($userName);
    ELSE
        
openPrivButton"welc",25,50,150,15,12,-1,ISB_NONElangEngine("%{main_welc1}%"$NickName ) );
        
openPrivButton"pos",25,80,150,10,8,-1,ISB_NONE,langEngine("%{main_welc2}%",$Posabs,$Posqual,$Groupqual  ) );
        
openPrivButton"clos",78,120,20,10,10,-1,ISB_DARK,langEngine("%{main_accept}%"),OnConnectClose );
        
openPrivButton"ref",103,120,20,10,10,-1,ISB_DARK,langEngine("%{main_deny}%"),OnConnectCloseKick );
    ENDIF
EndEvent

Sub OnConnectClose
$KeyFlags,$id )
    
closePrivButton("welc&pos&clos&ref");
    
LoginNonMember(GetCurrentPlayerVar"UserName" ));
EndSub

Sub OnConnectCloseKick
$KeyFlags,$id )
    
closePrivButton("welc&pos&clos&ref");
    
cmdLFS("/kick " GetCurrentPlayerVar("UserName") );
EndSub
?>


Attached files
member_admin.lpr.txt - 7.5 KB - 317 views
hmm nice i will be checking this out

:/ it does not work for me :o
#3 - Krayy
Quote from Fire_optikz001 :hmm nice i will be checking this out

:/ it does not work for me :o

What errors are you getting in the lapper log?
Quote from Krayy :What errors are you getting in the lapper log?

oh wait DOH my bad forgot to remove the # from the includes line 0

5/27/2010 2:44:46 PM -> Syntax error in cfg file "./member_admin.lpr" at line #178
Function not defined...UserIsServerAdmin
Function 'userisadmin' script aborted

5/27/2010 3:06:06 PM -> Syntax error in cfg file "./member_admin.lpr at line #148
Can't convert string "" to number ToNum
Function 'membertypedecrease' script aborted

:P might help if you include the exe with the mods required
#5 - Krayy
Quote from Fire_optikz001 :oh wait DOH my bad forgot to remove the # from the includes line 0

5/27/2010 2:44:46 PM -> Syntax error in cfg file "./member_admin.lpr" at line #178
Function not defined...UserIsServerAdmin
Function 'userisadmin' script aborted

5/27/2010 3:06:06 PM -> Syntax error in cfg file "./member_admin.lpr at line #148
Can't convert string "" to number ToNum
Function 'membertypedecrease' script aborted

:P might help if you include the exe with the mods required

I've updated the lpr file, as it had a missing $ on a var reference
Quote from Krayy :I've updated the lpr file, as it had a missing $ on a var reference

problem is not every one has your code for server admin and ucid
#7 - Krayy
Quote from Fire_optikz001 :problem is not every one has your code for server admin and ucid

Ahhhh. I see. Sorry, I tought those functions had been put into Lapper in the last release. I'll work on a patch for it.
Quote from Krayy :Ahhhh. I see. Sorry, I tought those functions had been put into Lapper in the last release. I'll work on a patch for it.

no you have released that code after 6.0 came out :P
will you be releasing the exe for this?
Quote from Fire_optikz001 :will you be releasing the exe for this?

Yes, along with an extra little something that will kick yo' ass

A few more days to get the functionality set and I'll release it.
Quote from Krayy :Yes, along with an extra little something that will kick yo' ass

A few more days to get the functionality set and I'll release it.

K :P i need it for my next cruise release o.o
is there anyway i could add custom permissions? such as CRUISE_POLICE and CRUISE_TOW?
it would also be nice to see a way to set a user manually... like lets say they wern't online...
Quote from Fire_optikz001 :is there anyway i could add custom permissions? such as CRUISE_POLICE and CRUISE_TOW?

Just add the new member types in between GUEST and AFFILIATE in the top of the membership.lpr file and increases the membertype numbers like this:


<?php 
    
# Membership status Globals
    
GlobalVar $MEMBERTYPE_UNKNOWN;     $MEMBERTYPE_UNKNOWN    = -1# Player has not been here before
    
GlobalVar $MEMBERTYPE_VISITOR;     $MEMBERTYPE_VISITOR    0# Player is a visitor
    
GlobalVar $MEMBERTYPE_GUEST;     $MEMBERTYPE_GUEST    1# Player is a vouched for guest
    
GlobalVar $CRUISE_TOW;     $CRUISE_TOW    2;
    
GlobalVar $CRUISE_POLICE;     $CRUISE_POLICE    3;
    
GlobalVar $MEMBERTYPE_AFFILIATE;$MEMBERTYPE_AFFILIATE     4# Player is Affiliate Member and subject to review
    
GlobalVar $MEMBERTYPE_FULL;        $MEMBERTYPE_FULL    5# Player is a full member
    
GlobalVar $MEMBERTYPE_ADMIN;    $MEMBERTYPE_ADMIN    6# Player is an admin
    
GlobalVar $MEMBERTYPE_MAX;        $MEMBERTYPE_MAX        7# Used as a upper limit for iterators

    ### Global vars for Membership names ####
    
GlobalVar $MemberTypes;
    
$MemberTypes[$MEMBERTYPE_VISITOR] = "Visitor";
    
$MemberTypes[$MEMBERTYPE_GUEST] = "Guest";
    
$MemberTypes[$MEMBERTYPE_AFFILIATE] = "Affiliate";
    
$MemberTypes[$MEMBERTYPE_FULL] = "Full";
    
$MemberTypes[$MEMBERTYPE_ADMIN] = "Admin";
    
$MemberTypes[$MEMBERTYPE_MAX] = "MAX";
    
$MemberTypes[$CRUISE_TOW] = "Towtruck";
    
$MemberTypes[$CRUISE_POLICE] = "Copper";
?>


FGED GREDG RDFGDR GSFDG