Jump to content

Hud-Bug


Lisandu

Recommended Posts

My server's hud bug with default one. i tried with all scripts in forums called *removehud, huddisble, etc..* but it works only when start. after we had killed or reconnected, again bug start.  what can i do... pls HELP ?

 

spacer.png

Please help me, This is important :)

Edited by Lisandu
Link to comment
  • Lisandu changed the title to Hud-Bug

put this command inside your package (client)

function setStats()
    if not getElementData(localPlayer,"loggedin") then
        setPlayerHudComponentVisible("clock",false) 
        setPlayerHudComponentVisible("radar",false)
        setPlayerHudComponentVisible("money",false) 
        setPlayerHudComponentVisible("health",false) 
        setPlayerHudComponentVisible("breath",false)
end

Edited by eoL|Shady
  • Like 1
Link to comment
9 hours ago, Lisandu said:

Now I found simple script.. but it works only when we killed, but reconnected bug starts again.. :(

Hello Lisandu,

could you please show us the script that you have found and put into your resource? It is important to be thorough if you want to get help on the forums. To execute logic during certain gameplay or server scenarios I recommend the use of MTA event handlers, for example when a player joins or (re-)spawns. It depends on whether you want to execute code client-side or server-side. Also you have to be aware of other resources which run at the same time and might interfere with your resource, for example other resource showing the HUD at a moment you don't want it to. 

Edited by The_GTA
  • Like 1
Link to comment

 

Oh wait :P

 

local components = { "weapon", "ammo", "health", "clock", "money", "breath", "armour", "wanted" }

addEventHandler("onClientPlayerWasted", localPlayer,
function ()
    for _, component in ipairs( components ) do
        setPlayerHudComponentVisible( component, false )
    end
end)

local components = { "weapon", "ammo", "health", "clock", "money", "breath", "armour", "wanted" }

addEventHandler("onClientPlayerSpawn", localPlayer,
function ()
    for _, component in ipairs( components ) do
        setPlayerHudComponentVisible( component, false )
    end
end)

This is the script i used : Client ;)

 

2 hours ago, The_GTA said:

Hello Lisandu,

could you please show us the script that you have found and put into your resource? It is important to be thorough if you want to get help on the forums. To execute logic during certain gameplay or server scenarios I recommend the use of MTA event handlers, for example when a player joins or (re-)spawns. It depends on whether you want to execute code client-side or server-side. Also you have to be aware of other resources which run at the same time and might interfere with your resource, for example other resource showing the HUD at a moment you don't want it to. 

Script is in Above :)

Edited by Lisandu
Link to comment

Have you tried adding the following code to your script?

addEventHandler("onClientResourceStart", resourceRoot,
function ()
    for _, component in ipairs( components ) do
        setPlayerHudComponentVisible( component, false )
    end
end)

This will hide the HUD components by default when the resource has started.

  • Thanks 1
Link to comment
local components = { "weapon", "ammo", "health", "clock", "money", "breath", "armour", "wanted" }

addEventHandler("onClientResourceStart", localPlayer,
function ()
    for _, component in ipairs( components ) do
        setPlayerHudComponentVisible( component, false )
    end
end)

This isn't working... Is this correct? :(

 

Edited by Lisandu
Link to comment

I found what's the error... the error is in Login Panel :P

function openLogin ( )
    clicked = false
    addEventHandler ( "onClientPreRender", root, dxDrawLoginPanel )
    isOpen = true
    showChat(false)
    showPlayerHudComponent ( 'all', true )
    
    local f = xmlLoadFile ( '@data.xml', 'account' )
    if f then
        local user = xmlNodeGetAttribute ( xmlFindChild ( f, 'user', 0 ), 'value' )
        local pass = xmlNodeGetAttribute ( xmlFindChild ( f, 'pass', 0 ), 'value' )
        guiSetText ( username, tostring ( user ) )
        guiSetText ( password, tostring ( pass ) )
        if ( user ~= "" or pass ~= "" ) then
            data.remember.clicked = true
        end
    end
    xmlUnloadFile ( f )
end

i make 

showPlayerHudComponent ( 'all', false )

 this to false... and it worked.. :) the bug died :D

 

thanks for helping @The_GTA @eoL|Shady @markenic

Edited by Lisandu
  • Like 1
Link to comment

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