--[[ usr_ranks.lua v0.03 by blastbeat - this script adds additional rank flags to the inf string according to the user level - the result is reguser/operator rank in the hub - the adc protocol contains flags like CT2, CT4, CT8, CT16 for reguser, operator etc - OP1 is a flag of the old adc spec - do not change anything here when you dont know what you are doing - changelog 0.03: - updated script api ]]-- local cfg_get = cfg.get local hub_sendtoall = hub.sendtoall --// additional named parameters for inf //-- local default = "" local reg_rank = "RG1 CT2" local op_rank = "OP1 CT4" local admin_rank = "OP1 CT8" local owner_rank = "OP1 CT16" local rank_table = { [ 0 ] = default, [ 10 ] = reg_rank, [ 20 ] = reg_rank, [ 30 ] = reg_rank, [ 40 ] = op_rank, -- get key in user list [ 60 ] = op_rank, [ 80 ] = admin_rank, [ 100 ] = owner_rank, } hub:setListener( "onLogin", { }, function( user ) local additional_flags if user:isRegged( ) then additional_flags = rank_table[ user:getLevel( ) ] or default elseif cfg_get "hub_pass" then additional_flags = reg_rank -- consider hub with password as private reg hub end if additional_flags then user:inf( ):addnp( "", additional_flags ) hub_sendtoall( "BINF " .. user:getSid( ) .. " " .. additional_flags .. "\n" ) end return nil end ) hub.debug( "** Loaded usr_ranks.lua **" )