PDA

View Full Version : [CODE] Membership Administration


Krayy
26th May 2010, 23:18
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:

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_NONE, langEngine("%{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

Fire_optikz001
27th May 2010, 14:54
hmm nice i will be checking this out :)

:/ it does not work for me :o

Krayy
27th May 2010, 19:20
hmm nice i will be checking this out :)

:/ it does not work for me :o
What errors are you getting in the lapper log?

Fire_optikz001
27th May 2010, 19:42
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

Krayy
27th May 2010, 20:49
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

Fire_optikz001
28th May 2010, 00:07
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

Krayy
28th May 2010, 02:04
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.

Fire_optikz001
28th May 2010, 02:53
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

Fire_optikz001
28th June 2010, 04:53
will you be releasing the exe for this?

Krayy
29th June 2010, 07:17
will you be releasing the exe for this?
Yes, along with an extra little something that will kick yo' ass :smileypul

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

Fire_optikz001
29th June 2010, 20:04
Yes, along with an extra little something that will kick yo' ass :smileypul

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

Fire_optikz001
20th November 2010, 19:19
is there anyway i could add custom permissions? such as CRUISE_POLICE and CRUISE_TOW?

Fire_optikz001
21st November 2010, 18:40
it would also be nice to see a way to set a user manually... like lets say they wern't online...

Krayy
22nd November 2010, 02:28
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:

# 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";