Jump to content

DxHud


Recommended Posts

Posted

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. :)

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

Post the part where you trigger the event "onClientStaffRefresh" .

" Keep Thinking Different . " - Steve Jops

--------------------

Don't send me PMs asking for help, I Won't reply !

Posted
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?

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

If you can't make a server side for that code, Then it's propably stolen !

" Keep Thinking Different . " - Steve Jops

--------------------

Don't send me PMs asking for help, I Won't reply !

Posted
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 ) 
  

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

Well, You're not triggering the event "onClientStaffRefresh" any where, So it's normal that it's not working .

" Keep Thinking Different . " - Steve Jops

--------------------

Don't send me PMs asking for help, I Won't reply !

Posted

I didn't understand what you mean.

Can you explain to me with lua please.

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

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 ); 

" Keep Thinking Different . " - Steve Jops

--------------------

Don't send me PMs asking for help, I Won't reply !

Posted

Thanks :) Gonna try.

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

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...