Jump to content

onClientRender function already handled


Recommended Posts

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

Link to comment

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 
  

Link to comment

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 by Guest
Link to comment

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) 

Link to comment
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) 

Copy My Post Again and Make sure it's ClientSide

===================

and this Code is ServerSide ,

addEventHandler("onPlayerUnmute",root, 
function ( ) 
   triggerClientEvent ( source , 'secondFunction', source ) 
end 
) 
Link to comment
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.

iam sure my code is Correct and will work fine , post the other code if you have one , or Send it Pm .

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...