..:D&G:.. Posted January 19, 2014 Posted January 19, 2014 How do I trigger this event: addCommandHandler("showhud", function () if handler then removeEventHandler("onClientRender",root,renderHud) handler = false else addEventHandler("onClientRender",root,renderHud) handler = true end So its handler = false like ONLY AN EXAMPLE: triggerEvent("hideHud", getLocalPlayer()) Or do I need to make an event?
Moderators IIYAMA Posted January 19, 2014 Moderators Posted January 19, 2014 local handler = false function myHudFunction () if handler then removeEventHandler("onClientRender",root,renderHud) handler = false else addEventHandler("onClientRender",root,renderHud) handler = true end end addCommandHandler("showhud",myHudFunction) addEvent("hideHud",true) addEventHandler("hideHud",root,myHudFunction) triggerEvent("hideHud", getLocalPlayer())
..:D&G:.. Posted January 19, 2014 Author Posted January 19, 2014 Doesn't work Here is what I did in the other script that triggers the event function hideInterfaceComponents() triggerEvent("hideHud", getLocalPlayer()) loadSettings() saveLanguageInformation() end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), hideInterfaceComponents)
Anubhav Posted January 19, 2014 Posted January 19, 2014 addEvent ( "hideHud", true ) addCommandHandler("showhud", function () if handler then removeEventHandler("onClientRender",root,renderHud) handler = false else addEventHandler("onClientRender",root,renderHud) handler = true end addEventHandler ( "hideHud", root, myHudFunction ) triggerEvent ( "hideHud", root, getLocalPlayer() )
Moderators IIYAMA Posted January 19, 2014 Moderators Posted January 19, 2014 [quote name=..&G:..]Doesn't work Here is what I did in the other script that triggers the event function hideInterfaceComponents() triggerEvent("hideHud", getLocalPlayer()) loadSettings() saveLanguageInformation() end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), hideInterfaceComponents) 1 That other script was already running before you triggered the event? 2 And what happens when you do: triggerEvent("hideHud", getLocalPlayer()) triggerEvent("hideHud", root) 3 Both are 100% clientside? 4 And what will happen when you put the event in the same script?
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