Lisandu Posted December 21, 2021 Share Posted December 21, 2021 (edited) 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 Please help me, This is important Edited December 21, 2021 by Lisandu Link to comment
Shady1 Posted December 21, 2021 Share Posted December 21, 2021 (edited) 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 December 21, 2021 by eoL|Shady 1 Link to comment
Lisandu Posted December 22, 2021 Author Share Posted December 22, 2021 (edited) Now I found simple script.. but it works only when we killed, but reconnected bug starts again.. Edited December 22, 2021 by Lisandu Link to comment
The_GTA Posted December 22, 2021 Share Posted December 22, 2021 (edited) 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 December 22, 2021 by The_GTA 1 Link to comment
Lisandu Posted December 22, 2021 Author Share Posted December 22, 2021 (edited) Oh wait 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 December 22, 2021 by Lisandu Link to comment
The_GTA Posted December 22, 2021 Share Posted December 22, 2021 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. 1 Link to comment
Lisandu Posted December 22, 2021 Author Share Posted December 22, 2021 Is it work when we rejoined? Link to comment
The_GTA Posted December 22, 2021 Share Posted December 22, 2021 11 minutes ago, Lisandu said: Is it work when we rejoined? I cannot answer your question because I don't know the full configuration of your server. 1 Link to comment
Lisandu Posted December 22, 2021 Author Share Posted December 22, 2021 Not working Sir, its okey... i'm trying to look for script, thats work when we logIn Link to comment
markenic Posted December 22, 2021 Share Posted December 22, 2021 put your code into an onClientResourceStart event, it will work 1 Link to comment
Lisandu Posted December 22, 2021 Author Share Posted December 22, 2021 (edited) Okk.. I will do it, thanks for respond Edited December 22, 2021 by Lisandu Link to comment
Lisandu Posted December 22, 2021 Author Share Posted December 22, 2021 (edited) 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 December 22, 2021 by Lisandu Link to comment
Lisandu Posted December 22, 2021 Author Share Posted December 22, 2021 (edited) I found what's the error... the error is in Login Panel 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 thanks for helping @The_GTA @eoL|Shady @markenic Edited December 22, 2021 by Lisandu 1 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