Wumbaloo Posted August 9, 2015 Posted August 9, 2015 Hey, here's my problem: I've a loginGUI and I want to draw the HUD when I'm logged, I don't know how to do that I tried with "export..", "dofile" but some errors, i tried with addEventHandler too.. client file for the hud is in: hud/client.lua and the client file for joining is: join/c_join.lua Also tried like that: function fermerpanelconnexion(source) guiSetEnabled(loginpanel, false) destroyElement(loginpanel) destroyElement(usernameInput) destroyElement(passwordInput) destroyElement(bouttonconnexion) destroyElement(boutoncreercompte) destroyElement(savemdp) showCursor(false) stopSound(soundmain) drawHud() end Can you help me? Computer science student at { EPITECH }
GTX Posted August 9, 2015 Posted August 9, 2015 Put them in same resource or file. Or you can use triggerEvent Do you require a paid scripter? Contact me! (Unavailable) Currently I am experienced in Lua, PHP, HTML, CSS, SQL and JS. Developer and owner of https://projectbea.st - Project Beast
Wumbaloo Posted August 9, 2015 Author Posted August 9, 2015 But, how can I hide my hud? Like, it's turn off and if i log on, my hud appeared Computer science student at { EPITECH }
Wumbaloo Posted August 9, 2015 Author Posted August 9, 2015 How can I hide the HUD first of all, when i do that, i can call it Computer science student at { EPITECH }
GTX Posted August 10, 2015 Posted August 10, 2015 showPlayerHudComponent Do you require a paid scripter? Contact me! (Unavailable) Currently I am experienced in Lua, PHP, HTML, CSS, SQL and JS. Developer and owner of https://projectbea.st - Project Beast
Wumbaloo Posted August 11, 2015 Author Posted August 11, 2015 Nah, my Hud that i do with directX dxDrawText dxDrawImage .. Computer science student at { EPITECH }
xeon17 Posted August 11, 2015 Posted August 11, 2015 Just create a simple function which will remove the render. Here is a simple example, setCustomHudVisible (no) function setCustomHudVisible (bool) if not (bool) then return end if (bool == yes) then addEventHandler('onClientRender',root,nameOfTheFunction) elseif (bool == no) then removeEventHandler('onClientRender',root,nameOfTheFunction) end end A unique GangWar gamemode waiting for you!Click here for more information.
Wumbaloo Posted August 11, 2015 Author Posted August 11, 2015 I deal with it: function setCustomHudVisible(stateHud) stateHud = not stateHud if stateHud == true then addEventHandler("onClientRender", getRootElement(), drawHud) elseif stateHud == false then removeEventHandler("onClientRender", getRootElement(), drawHud) end end stateHud = false addEventHandler("onPlayerSpawn", getRootElement(), setCustomHudVisible(true)) But ingame warning "Expected function at argument 3, got none", and then, in the s_join.lua, i wrote it: "stateHud = true" when the player is logged, but error, i export the function in the meta but don't work Computer science student at { EPITECH }
Wumbaloo Posted August 11, 2015 Author Posted August 11, 2015 Tried with the MySQL data: "connect" but still not working.. No error messages.. Function: datHud = getElementData(getLocalPlayer(), "connecter") function drawHud() if datHud == "1" or 1 then --HUD FUNCTION addEventHandler("onClientRender", getRootElement(), drawHud) else removeEventHandler("onClientRender", getRootElement(), drawHud) end end Computer science student at { EPITECH }
Wumbaloo Posted August 11, 2015 Author Posted August 11, 2015 Still not working.. function drawHud() local isLoggedIn = getElementData(localPlayer, "connecter") if not isLoggedIn then return end -- DRAW HUD end addCommandHandler("onClientRender", root, drawHud) Computer science student at { EPITECH }
GTX Posted August 11, 2015 Posted August 11, 2015 Note that element data "connecter" must be boolean. Do you require a paid scripter? Contact me! (Unavailable) Currently I am experienced in Lua, PHP, HTML, CSS, SQL and JS. Developer and owner of https://projectbea.st - Project Beast
Wumbaloo Posted August 11, 2015 Author Posted August 11, 2015 It return 1 if the player is spawned, else, return 0 Computer science student at { EPITECH }
GTX Posted August 11, 2015 Posted August 11, 2015 if isLoggedIn == 0 then return end Do you require a paid scripter? Contact me! (Unavailable) Currently I am experienced in Lua, PHP, HTML, CSS, SQL and JS. Developer and owner of https://projectbea.st - Project Beast
Wumbaloo Posted August 11, 2015 Author Posted August 11, 2015 Finally work! Thanks! Computer science student at { EPITECH }
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