toxicsmoke11 Posted August 8, 2014 Posted August 8, 2014 how do i fix this annoying error?its really pain in the ass it occurs when removing event handlers and trying to add them again like with dxDrawText onClientRender how to fix this?
toxicsmoke11 Posted August 8, 2014 Author Posted August 8, 2014 function test() -- dxdraw and shit bla bla -- couple of ends without handler function firstFunction() setElementData(localPlayer,"apple",1) addEventHandler("onClientRender",root,test) end addEvent("firstFunctionn",true) addEventHandler("firstFunctionn",root,firstFunction) function secondFunction() setElementData(localPlayer,"apple",0) thirdFunction() end addEvent("secondFunction",true) addEventHandler("secondFunction",root,secondFunction) function thirdFunction() removeEventHandler("onClientRender",getRootElement(),test) end the events are getting triggered by server side script
Anubhav Posted August 8, 2014 Posted August 8, 2014 If text is already rendered before then it will show the error. I don't know where is your problem.. Because as you told in function test and blablabla. Anyways try this: function test() -- dxdraw and :~ bla bla -- couple of ends without handler function firstFunction() setElementData(localPlayer,"apple",1) removeEventHandler("onClientRender",getRootElement(),test) addEventHandler("onClientRender",root,test) end addEvent("firstFunctionn",true) addEventHandler("firstFunctionn",root,firstFunction) function secondFunction() setElementData(localPlayer,"apple",0) thirdFunction() end addEvent("secondFunction",true) addEventHandler("secondFunction",root,secondFunction) function thirdFunction() removeEventHandler("onClientRender",getRootElement(),test) end
toxicsmoke11 Posted August 8, 2014 Author Posted August 8, 2014 no errors and the text is always drawn
Max+ Posted August 8, 2014 Posted August 8, 2014 no errors and the text is always drawn what's your problem Exactly Please Explain Better .
toxicsmoke11 Posted August 8, 2014 Author Posted August 8, 2014 no errors and the text is always drawn what's your problem Exactly Please Explain Better . it can clearly be seen in the script code that im trying to remove the text when custom event gets triggered,and it gets triggered in server side script
Max+ Posted August 8, 2014 Posted August 8, 2014 (edited) Try This , --- ClientSide addEvent('firstFunctionn', true ) addEventHandler ( 'firstFunctionn', root, function ( ) addEventHandler("onClientRender",root,test) setElementData(localPlayer,"apple",1) end ) addEvent ( 'secondFunction', true ) addEventHandler ( 'secondFunction', root, function ( ) setElementData(localPlayer,"apple",0) setTimer(removeEventHandler,1000,1,"onClientRender",getRootElement(),test) end ) Edited @ Edited August 8, 2014 by Guest
toxicsmoke11 Posted August 8, 2014 Author Posted August 8, 2014 no errors and text doesnt get removed edit: more info: im having element data 1, and it should be 0 when server event was triggered but i don't see any problem function serverFunction() setElementData(source,"apple",0) triggerClientEvent("secondFunction",source) end addEventHandler("onPlayerUnmute",root,serverFunction)
Max+ Posted August 8, 2014 Posted August 8, 2014 no errors and text doesnt get removededit: more info: im having element data 1, and it should be 0 when server event was triggered but i don't see any problem function serverFunction() setElementData(source,"apple",0) triggerClientEvent("secondFunction",source) end addEventHandler("onPlayerUnmute",root,serverFunction) Copy My Post Again and Make sure it's ClientSide =================== and this Code is ServerSide , addEventHandler("onPlayerUnmute",root, function ( ) triggerClientEvent ( source , 'secondFunction', source ) end )
toxicsmoke11 Posted August 8, 2014 Author Posted August 8, 2014 i dont really see point of making function unnamed,it will do same work only change what you did is added source twice, and it doesn't work for me.
Max+ Posted August 8, 2014 Posted August 8, 2014 i dont really see point of making function unnamed,it will do same workonly change what you did is added source twice, and it doesn't work for me. iam sure my code is Correct and will work fine , post the other code if you have one , or Send it Pm .
toxicsmoke11 Posted August 8, 2014 Author Posted August 8, 2014 i have tried your timer solution and it gave me error that it expected a function in 3rd argument but got nil what the fuck? function exists already and script says that it doesnt exist when i unmute myself
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