# Admin notify V1.00 01-11-15 - Initial release # ################################################################# CatchEvent OnLapperStart() OnLapperStart_Admin_Notify(); EndCatchEvent CatchEvent OnConnect( $userName ) OnConnect_Admin_Notify(); EndCatchEvent CatchEvent OnDisConnect( $userName, $reason ) OnDisConnect_Admin_Notify(); EndCatchEvent Sub OnLapperStart_Admin_Notify() ### Declare global variables ### GlobalVar $admins_present; GlobalVar $admin_status; GlobalVar $admin_name; GlobalVar $admin_time_online; ### End ### ### Give global variables a value to start with ### $admins_present=0; ### End ### EndSub Sub OnConnect_Admin_Notify() ### Set userName variable and load the nicknames of admins specified in admin.txt ### $userName = GetCurrentPlayerVar( "UserName" ); UserGroupFromFile( "admin", "./admin.txt" ); ### End ### ### Check if connecting player is an admin, if so, raise number by one ### IF( UserInGroup( "admin", $userName ) == 1 ) THEN $admins_present=$admins_present+1; $admin_name = GetCurrentPlayerVar( "NickName" ); $admin_time_online = getLapperVar( "ShortTime" ); ENDIF ### End ### Admin_status( $KeyFlags ); EndSub Sub OnDisConnect_Admin_Notify() ### Check if discconnecting player is an admin, if so, lower number by one ### IF( UserInGroup( "admin", $userName ) == 1 ) THEN $admins_present=$admins_present-1; ENDIF ### End ### Admin_status( $KeyFlags ); EndSub Sub Admin_status ( $KeyFlags ) ### Check how many admins are online , if value above 0 ,status is 'online' , otherwise status is 'offline' and last name and time are removed ### IF ( $admins_present > 0 ) THEN $admin_status="^2online"; ELSE $admin_status="^1offline"; $admin_name="^3(-N.A.-)"; $admin_time_online="^3(-N.A.-)"; ENDIF ### End ### ### Display button ### openGlobalButton( "admins_present",50,1,100,5,1,-1,36,"^7Admin(s): ". $admin_status . " ^7| Last entered: " . $admin_name . " ^7| At: " . $admin_time_online ); ### End ### EndSub