Jump to content

Staff


ZeyadGTX

Recommended Posts

Posted

Tried that to draw Text for admins - Moderators but not working

Client

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) 

Server :

function ShowStaffMembers() 
    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 ( "Console" ) ) then 
                if (admins == "") then 
                    admins = getPlayerName(v) 
                else 
                    admins = admins .. ", " .. getPlayerName(v) 
                end 
            end 
        end 
    end 
    triggerClientEvent("showOnlineStaff", getResourceRootElement(), admins) 
end 
  
addEventHandler( "onPlayerChat", getRootElement(), showStaffMembers ) 
  

Posted
I don't get it, why are you triggering the event to show the staff using the onPlayerChat event?

It's from Grafuroam client side scripts, and he didn't manage to make the server side so he just copied the server side from random codes in a random topic.

Remove the clientside.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...