-.Paradox.- Posted July 18, 2013 Share Posted July 18, 2013 Hello, i maked a dxhud it show online Staff, but wont show here is the code client.lua function showOnlineStaff(moderators,admins) moderatorText = "Moderators: " adminText = "Admins: " for k,moderator in ipairs(moderators) do local name = getPlayerName(moderator):gsub("#%x%x%x%x%x%x","") if k == 1 then moderatorText = moderatorText..""..name else moderatorText = moderatorText..", "..name end end for k,admin in ipairs(admins) do local name = getPlayerName(admin):gsub("#%x%x%x%x%x%x","") if k == 1 then adminText = adminText..""..name else adminText = adminText..", "..name end end end addEvent("onClientStaffRefresh", true) addEventHandler("onClientStaffRefresh", getRootElement(), showOnlineStaff) function showStaffMembers() if getElementData(player, "state.hud") == "disabled" then return end if moderatorText then dxDrawText(moderatorText, (8/1024)*sWidth, (730/768)*sHeight, (130/1024)*sWidth, (130/768)*sHeight, tocolor (255, 255, 255, 255), (0.4/1366)*sWidth,(0.4/768)*sHeight,"bankgothic","left","top",false,false,false,false) end if adminText then dxDrawText(adminText, (8/1024)*sWidth, (745/768)*sHeight, (130/1024)*sWidth, (130/768)*sHeight, tocolor (255, 255, 255, 255), (0.4/1366)*sWidth,(0.4/768)*sHeight,"bankgothic","left","top",false,false,false,false) end end addEventHandler("onClientRender", getRootElement(), showStaffMembers) No erros on debugscript or on server console it just wont show the online admins, and mods. Thanks for helping. Link to comment
PaiN^ Posted July 18, 2013 Share Posted July 18, 2013 Post the part where you trigger the event "onClientStaffRefresh" . Link to comment
-.Paradox.- Posted July 18, 2013 Author Share Posted July 18, 2013 Show your server-side code. I don't have a server side i guess that's is the bug, i didn't maked server side can help me making it? Link to comment
PaiN^ Posted July 18, 2013 Share Posted July 18, 2013 If you can't make a server side for that code, Then it's propably stolen ! Link to comment
-.Paradox.- Posted July 18, 2013 Author Share Posted July 18, 2013 If you can't make a server side for that code, Then it's propably stolen ! Nope admins = "" function processAdminList() players = getElementsByType ( "player" ) admins = "" for k,v in ipairs(players) do local accountname = "" if (isGuestAccount(getPlayerAccount(v)) == false) then accountname = getAccountName (getPlayerAccount(v)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then if (admins == "") then admins = getPlayerName(v) else admins = admins .. ", " .. getPlayerName(v) end end end end triggerClientEvent("setAdminList", getResourceRootElement(), admins) end addEventHandler( "onPlayerLogin", getRootElement(), processAdminList ) addEventHandler( "onPlayerLogout", getRootElement(), processAdminList ) addEventHandler( "onPlayerChangeNick", getRootElement(), processAdminList ) addEventHandler( "onPlayerQuit", getRootElement(), processAdminList ) moderators = "" function processModeratorList() players = getElementsByType ( "player" ) moderators = "" for k,v in ipairs(players) do local accountname = "" if (isGuestAccount(getPlayerAccount(v)) == false) then accountname = getAccountName (getPlayerAccount(v)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Moderator" ) ) then if (moderators == "") then moderators = getPlayerName(v) else moderators = moderators .. ", " .. getPlayerName(v) end end end end triggerClientEvent("setModeratorList", getResourceRootElement(), moderators) end addEventHandler( "onPlayerLogin", getRootElement(), processModeratorList ) addEventHandler( "onPlayerLogout", getRootElement(), processModeratorList ) addEventHandler( "onPlayerChangeNick", getRootElement(), processModeratorList ) addEventHandler( "onPlayerQuit", getRootElement(), processModeratorList ) Link to comment
PaiN^ Posted July 18, 2013 Share Posted July 18, 2013 Well, You're not triggering the event "onClientStaffRefresh" any where, So it's normal that it's not working . Link to comment
-.Paradox.- Posted July 18, 2013 Author Share Posted July 18, 2013 I didn't understand what you mean. Can you explain to me with lua please. Link to comment
PaiN^ Posted July 18, 2013 Share Posted July 18, 2013 Try this server side : function processAdminList( ) local players = getElementsByType( "player" ); local admins = { }; local moderators = { }; for k,v in ipairs( players ) do local accountname = ""; local account = getPlayerAccount( v ); local name = getPlayerName( v ); if not isGuestAccount( account )then local accountname = getAccountName( account ); if isObjectInACLGroup( "user." .. accountname, aclGetGroup( "Admin" ) ) then table.insert( admins, name ); elseif isObjectInACLGroup( "user." .. accountname, aclGetGroup( "Moderator" ) ) then table.insert( moderators, name ); end end end triggerClientEvent( root, "onClientStaffRefresh", root, moderators, admins ); end addEventHandler( "onResourceStart", root, processAdminList ); addEventHandler( "onPlayerLogin", root, processAdminList ); addEventHandler( "onPlayerLogout", root, processAdminList ); addEventHandler( "onPlayerChangeNick", root, processAdminList ); addEventHandler( "onPlayerQuit", root, processAdminList ); 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