Dimos7 Posted February 27, 2018 Share Posted February 27, 2018 function isPlayerStaff ( p ) if ( p and getElementType ( p ) == 'player' ) then if ( isPlayerInACL ( p, "Level 1" ) or isPlayerInACL ( p, "Level 2" ) or isPlayerInACL ( p, "Level 3" ) or isPlayerInACL ( p, "Level 4" ) or isPlayerInACL ( p, "Level 5" ) or isPlayerInACL ( p, "Admin" ) or isPlayerInACL ( p, "Console" ) ) then return true end return false end end function getPlayerStaffLevel ( p, var ) if ( isPlayerStaff ( p ) ) then local str = nil local num = nil for i=1,5 do if ( isPlayerInACL ( p, 'Level '..tostring ( i ) ) ) then num = i str = "Level "..tostring(i) break end end if ( var == 'string' ) then return str elseif ( var == 'int' ) then return num else return str, num end end return 0,0 end function getAllStaff ( ) local staff = { ['Level 1'] = {"Trial Staff"} , ['Level 2'] = {"Moderator"} , ['Level 3'] = {"Super Moderator"}, ['Level 4'] = {"Co- Ownwer"}, ['Level 5'] = {"Ownwer"} , } for i=1,5 do for k, v in ipairs ( aclGroupListObjects ( aclGetGroup ( "Level "..tostring ( i ) ) ) ) do if ( string.find ( tostring ( v ), 'user.' ) ) then local name = tostring ( v:gsub ( "user.", "" ) ) staff['Level '..tostring ( i )][#staff['Level '..tostring ( i )]+1] = name end end end return staff end function isPlayerInACL ( player, acl ) local account = getPlayerAccount ( player ) if ( isGuestAccount ( account ) ) then return false end if ( aclGetGroup ( acl ) ) then return isObjectInACLGroup ( "user."..getAccountName ( account ), aclGetGroup ( acl ) ) end return false; end function getOnlineStaff ( ) local online = { } for i, v in ipairs ( getElementsByType ( "player" ) ) do if ( isPlayerStaff ( v ) ) then table.insert ( online, v ) end end return online end -- NG 1.1.4 -- -- Set element data to make getting staff on client side -- function setNewPlayerStaffData ( p ) if ( isPlayerStaff ( p ) ) then setElementData ( p, "staffLevel", getPlayerStaffLevel ( p, 'int' ) ) else setElementData ( p, 'staffLevel', 0 ) end end addEventHandler ( "onPlayerLogin", root, function ( ) setNewPlayerStaffData ( source ) end ); addEventHandler ( "onResourceStart", resourceRoot, function ( ) for _, p in pairs ( getElementsByType ( "player" ) ) do setNewPlayerStaffData ( p ) end end ) I want apear the Trail Staff etc not Level 1 etc help me Link to comment
Captain Cody Posted February 27, 2018 Share Posted February 27, 2018 Please explain better what you are attempting to do. Link to comment
Dimos7 Posted February 27, 2018 Author Share Posted February 27, 2018 i want to apear the Trial Staff Instead of Level 1 and so on for next ranks Link to comment
Dimos7 Posted February 28, 2018 Author Share Posted February 28, 2018 (edited) --- i want this str = "Level "..tostring(i) local staff = { ['Level 1'] = {"Trial Staff"} , ['Level 2'] = {"Moderator"} , ['Level 3'] = {"Super Moderator"}, ['Level 4'] = {"Co- Ownwer"}, ['Level 5'] = {"Ownwer"} , } -- apear that Edited February 28, 2018 by Dimos7 Link to comment
DNL291 Posted February 28, 2018 Share Posted February 28, 2018 local staffRankName = staff["Level "..tostring(i)][1] ? Link to comment
Captain Cody Posted February 28, 2018 Share Posted February 28, 2018 Ranks = { ['Level 1'] = {"Trial Staff"} , ['Level 2'] = {"Moderator"} , ['Level 3'] = {"Super Moderator"}, ['Level 4'] = {"Co- Ownwer"}, ['Level 5'] = {"Ownwer"} , } function isInAcl(player) for i,v in pairs(Ranks) do if isPlayerInACL ( p, v[1] ) then return true end end end function isPlayerStaff ( p ) if ( p and getElementType ( p ) == 'player' ) then if ( isInAcl(p) or isPlayerInACL ( p, "Admin" ) or isPlayerInACL ( p, "Console" ) ) then return true end return false end end function getPlayerStaffLevel ( p, var ) if ( isPlayerStaff ( p ) ) then local str = nil local num = nil for i=1,#Ranks do if ( isPlayerInACL ( p, Ranks['Level '..tostring ( i )][1] ) ) then num = i str = 'Level '..tostring ( i ) -- OR Ranks['Level '..tostring ( i )][1] break end end if ( var == 'string' ) then return str elseif ( var == 'int' ) then return num else return str, num end end return 0,0 end function getAllStaff ( ) staff = { ['Level 1'] = {} , ['Level 2'] = {} , ['Level 3'] = {}, ['Level 4'] = {}, ['Level 5'] = {} , } for i=1,#Ranks do for k, v in ipairs ( aclGroupListObjects ( aclGetGroup ( Ranks['Level '..tostring ( i )][1] ) ) ) do if ( string.find ( tostring ( v ), 'user.' ) ) then local name = tostring ( v:gsub ( "user.", "" ) ) staff[Ranks['Level '..tostring ( i )][1]][#staff[Ranks['Level '..tostring ( i )][1]]+1] = name end end end return staff end function isPlayerInACL ( player, acl ) local account = getPlayerAccount ( player ) if ( isGuestAccount ( account ) ) then return false end if ( aclGetGroup ( acl ) ) then return isObjectInACLGroup ( "user."..getAccountName ( account ), aclGetGroup ( acl ) ) end return false; end function getOnlineStaff ( ) local online = { } for i, v in ipairs ( getElementsByType ( "player" ) ) do if ( isPlayerStaff ( v ) ) then table.insert ( online, v ) end end return online end -- NG 1.1.4 -- -- Set element data to make getting staff on client side -- function setNewPlayerStaffData ( p ) if ( isPlayerStaff ( p ) ) then setElementData ( p, "staffLevel", getPlayerStaffLevel ( p, 'int' ) ) else setElementData ( p, 'staffLevel', 0 ) end end addEventHandler ( "onPlayerLogin", root, function ( ) setNewPlayerStaffData ( source ) end ); addEventHandler ( "onResourceStart", resourceRoot, function ( ) for _, p in pairs ( getElementsByType ( "player" ) ) do setNewPlayerStaffData ( p ) end end ) Link to comment
Dimos7 Posted February 28, 2018 Author Share Posted February 28, 2018 Thank you i will try it Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now