Trinx Posted August 3, 2013 Share Posted August 3, 2013 Hi! I started in LUA script for a few days, and I would need help for my first scripts. I want to hide the radar and time of the interface, I try to script a code for it. function CacherInterface () setPlayerHudComponentVisible ( source, "radar", false ) -- Cacher le Radar setPlayerHudComponentVisible ( source, "clock", false ) -- Cacher l'heure end addEventHandler ("onResourceStart", getRootElement(), CacherInterface) I want the time and has radar disappear activation of the resource, but it does not work. No Error in DebugScript / Console / MTA Script Editor. Sorry for my english, i'm french and I use a translator. Help Link to comment
Kenix Posted August 3, 2013 Share Posted August 3, 2013 (edited) source here is a resource, not the player. That's why it doesn't work. Just type it on client side without any events: setPlayerHudComponentVisible ( "radar", false ) setPlayerHudComponentVisible ( "clock", false ) Edited August 3, 2013 by Guest 1 Link to comment
Trinx Posted August 3, 2013 Author Share Posted August 3, 2013 Thank you for your help. I tested with "onPlayerSpawn" it worked! But I wonder if you can hide the interface directly? Without the players joined / spawn / connect Link to comment
Trinx Posted August 3, 2013 Author Share Posted August 3, 2013 Thank you for your help! Sorry to bother you for a simple script. Link to comment
chimmonpakma Posted July 4, 2017 Share Posted July 4, 2017 On 8/3/2013 at 05:02, Kenix said: source here is a resource, not the player. That's why it doesn't work. Just type it on client side without any events: setPlayerHudComponentVisible ( "radar", false ) setPlayerHudComponentVisible ( "clock", false ) 1 For me it only hides the time ;((((((( How to hide the whole hud? Link to comment
kieran Posted July 4, 2017 Share Posted July 4, 2017 setPlayerHudComponentVisible ( "all", false ) Link to comment
xJulianGilx Posted March 7, 2018 Share Posted March 7, 2018 (edited) On 3/8/2013 at 14:02, Kenix said: source here is a resource, not the player. That's why it doesn't work. Just type it on client side without any events: ? setPlayerHudComponentVisible ( "radar", false ) setPlayerHudComponentVisible ( "clock", false ) A question and how can you put it for the player is what I'm looking for please help me !! function hudChangerOFF () setPlayerHudComponentVisible ( "radar", false ) setPlayerHudComponentVisible ( "clock", false ) setPlayerHudComponentVisible ( "all", false ) showPlayerHudComponent ( source, "ammo", false ) showPlayerHudComponent ( source, "weapon", false ) showPlayerHudComponent ( source, "radar", false ) showPlayerHudComponent("all",false) showChat(false) showCursor ( false ) end addCommandHandler ("visiblehud", hudChangerOFF) function hudChangerON () setPlayerHudComponentVisible ( "radar", true ) setPlayerHudComponentVisible ( "all", true ) setPlayerHudComponentVisible ( "clock", true ) showPlayerHudComponent ( source, "ammo", true ) showPlayerHudComponent ( source, "weapon", true ) showPlayerHudComponent ( source, "radar", true ) showChat(true) showCursor ( true ) showPlayerHudComponent("all",false) end addCommandHandler ("disablehud", hudChangerON) I want that when the player puts visiblehud everything is opened and when I put disablehud everything is hidden Edited March 7, 2018 by xSrJulianProHG Link to comment
Storm-Hanma Posted March 7, 2018 Share Posted March 7, 2018 3 hours ago, xSrJulianProHG said: A question and how can you put it for the player is what I'm looking for please help me !! function hudChangerOFF () setPlayerHudComponentVisible ( "radar", false ) setPlayerHudComponentVisible ( "clock", false ) setPlayerHudComponentVisible ( "all", false ) showPlayerHudComponent ( source, "ammo", false ) showPlayerHudComponent ( source, "weapon", false ) showPlayerHudComponent ( source, "radar", false ) showPlayerHudComponent("all",false) showChat(false) showCursor ( false ) end addCommandHandler ("visiblehud", hudChangerOFF) function hudChangerON () setPlayerHudComponentVisible ( "radar", true ) setPlayerHudComponentVisible ( "all", true ) setPlayerHudComponentVisible ( "clock", true ) showPlayerHudComponent ( source, "ammo", true ) showPlayerHudComponent ( source, "weapon", true ) showPlayerHudComponent ( source, "radar", true ) showChat(true) showCursor ( true ) showPlayerHudComponent("all",false) end addCommandHandler ("disablehud", hudChangerON) I want that when the player puts visiblehud everything is opened and when I put disablehud everything is hidden Use else statement to make whole code work under one command handler on or off when they type disablehud 1 Link to comment
xJulianGilx Posted March 8, 2018 Share Posted March 8, 2018 yes but I also tried with a single function that is all fake and it did not work Link to comment
xJulianGilx Posted March 8, 2018 Share Posted March 8, 2018 8 hours ago, Khadeer143 said: Use else statement to make whole code work under one command handler on or off when they type disablehud but thanks anyway with the idea you gave me I was able to do this, and it worked Hud = guiCreateLabel(0, 0, 0, 0, "", false) function HideShow() if ( guiGetVisible (Hud) == false) then guiSetVisible (Hud, true) -- Este Es el Laber FAKE PARA PODER OCULTAR EL HUD Y ABRIR EL HUD showChat(true) showPlayerHudComponent("all",true) setPlayerHudComponentVisible ( "radar", true ) setPlayerHudComponentVisible ( "all", true ) setPlayerHudComponentVisible ( "clock", true ) showPlayerHudComponent ( source, "ammo", true ) showPlayerHudComponent ( source, "weapon", true ) showPlayerHudComponent ( source, "radar", true ) else guiSetVisible(Hud, false) -- Este Es el Laber FAKE PARA PODER ABRIR EL HUD Y OCULTAR EL HUD showCursor(false) showChat(false) showPlayerHudComponent("all",false) outputChatBox("Hud Disable", source, 255, 0, 0, true) showPlayerHudComponent ( source, "weapon", false ) showPlayerHudComponent ( source, "radar", false ) showPlayerHudComponent ( source, "ammo", false ) setPlayerHudComponentVisible ( "radar", false ) setPlayerHudComponentVisible ( "clock", false ) setPlayerHudComponentVisible ( "all", false ) showPlayerHudComponent("all",false) end end bindKey("f5", "down", HideShow) Link to comment
Storm-Hanma Posted March 8, 2018 Share Posted March 8, 2018 good keep learning new things!! 1 Link to comment
Overkillz Posted March 8, 2018 Share Posted March 8, 2018 Aqui tienes un codigo mas corto. Dado que el tuyo problamente te de errores. local showingHud = true -- AQUIT CAMBIALO POR 'false' si quieres que si/no se muestre desde el principio function toggleHUD() showingHud = not showingHud if showingHud then showChat(true) setPlayerHudComponentVisible ( "all", true ) outputChatBox("HUD Enabled") else showChat(false) setPlayerHudComponentVisible ( "all", false ) outputChatBox("HUD Disabled") end end bindKey("f5","down",toggleHUD) Link to comment
Lisandu Posted December 21, 2021 Share Posted December 21, 2021 It worked and thanks to All 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