Jump to content

[HELP]removeEventHandler is not working!


VeryBigSmoke

Recommended Posts

Hello, i make a script everthing happened but removeEventHandler not working, pls help me.

function dxUyari(durum,yazi,sekil)
	if durum == oyuncu then
	dxDrawRectangle(x-150,100,animasyon,50,tocolor(0,0,0,200))
	animasyon = animasyon+10
	if animasyon >= 299 then
				animasyon = 300
				alpha = 255
			end
	dxDrawText(yazi,x-100,110,0,0,tocolor(255,255,255,alpha),1,Font1)
	dxDrawRectangle(x-150,143,lineimage,1,tocolor(255,255,255,255))
	lineimage = lineimage+9.99
	if lineimage >=299 then
		lineimage = 300
	end
	if sekil == "uyari" then
		dxDrawImage ( x-145, 105, imageanimasyon, 30, 'dosyalar/uyari.png', 0, 0, 0 )
		imageanimasyon = imageanimasyon+3
			if imageanimasyon >= 29 then
				imageanimasyon = 30
			end
	elseif sekil == "yasak" then
		dxDrawImage ( x-145, 105, imageanimasyon, 30, 'dosyalar/yasak.png', 0, 0, 0 )
		imageanimasyon = imageanimasyon+3
			if imageanimasyon >= 29 then
				imageanimasyon = 30
			end
	elseif sekil == "onay" then
		dxDrawImage ( x-145, 105, imageanimasyon, 30, 'dosyalar/onay.png', 0, 0, 0 )
		imageanimasyon = imageanimasyon+3
			if imageanimasyon >= 29 then
				imageanimasyon = 30
			end
	end
	dxDrawRectangle ( x-150,144, g*2, u+1 ,tocolor(238 ,233, 233)) 
    g = g + 0.3
    if (g >= 149) then
    	removeEventHandler("onClientRender",getRootElement(),dxUyari)
    	end
    end
end
--TEST
addEventHandler("onClientRender",getRootElement(),function()
	dxUyari(oyuncu,"Test","onay")
end)

not stop when g = 150 then sorry bad english 

Link to comment
    function dxUyari(durum,yazi,sekil)
    	if durum == oyuncu then
    	dxDrawRectangle(x-150,100,animasyon,50,tocolor(0,0,0,200))
    	animasyon = animasyon+10
    	if animasyon >= 299 then
    				animasyon = 300
    				alpha = 255
    			end
    	dxDrawText(yazi,x-100,110,0,0,tocolor(255,255,255,alpha),1,Font1)
    	dxDrawRectangle(x-150,143,lineimage,1,tocolor(255,255,255,255))
    	lineimage = lineimage+9.99
    	if lineimage >=299 then
    		lineimage = 300
    	end
    	if sekil == "uyari" then
    		dxDrawImage ( x-145, 105, imageanimasyon, 30, 'dosyalar/uyari.png', 0, 0, 0 )
    		imageanimasyon = imageanimasyon+3
    			if imageanimasyon >= 29 then
    				imageanimasyon = 30
    			end
    	elseif sekil == "yasak" then
    		dxDrawImage ( x-145, 105, imageanimasyon, 30, 'dosyalar/yasak.png', 0, 0, 0 )
    		imageanimasyon = imageanimasyon+3
    			if imageanimasyon >= 29 then
    				imageanimasyon = 30
    			end
    	elseif sekil == "onay" then
    		dxDrawImage ( x-145, 105, imageanimasyon, 30, 'dosyalar/onay.png', 0, 0, 0 )
    		imageanimasyon = imageanimasyon+3
    			if imageanimasyon >= 29 then
    				imageanimasyon = 30
    			end
    	end
    	dxDrawRectangle ( x-150,144, g*2, u+1 ,tocolor(238 ,233, 233)) 
        g = g + 0.3
        if (g >= 149) then
        	removeEventHandler("onClientRender",getRootElement(),TEST)
        	end
        end
    end
    --TEST
function TEST()
    dxUyari(oyuncu,"Test","onay")
end
addEventHandler("onClientRender",getRootElement(),TEST )

 

Link to comment

i want the dxUyari function, exist from has function remove

Example 

addEventHandler("onClientRender",getRootElement(),function()
    dxUyari(oyuncu, "asd","uyari")
end)

dxUyarı when g does 150 then destroy self.

But not working if u do test see.

 

I delete removeEventHandler and make dxUyari = nil its worked but give debug i dont want this what can i do?

Link to comment
49 minutes ago, Sha67 said:

    function dxUyari(durum,yazi,sekil)
    	if durum == oyuncu then
    	dxDrawRectangle(x-150,100,animasyon,50,tocolor(0,0,0,200))
    	animasyon = animasyon+10
    	if animasyon >= 299 then
    				animasyon = 300
    				alpha = 255
    			end
    	dxDrawText(yazi,x-100,110,0,0,tocolor(255,255,255,alpha),1,Font1)
    	dxDrawRectangle(x-150,143,lineimage,1,tocolor(255,255,255,255))
    	lineimage = lineimage+9.99
    	if lineimage >=299 then
    		lineimage = 300
    	end
    	if sekil == "uyari" then
    		dxDrawImage ( x-145, 105, imageanimasyon, 30, 'dosyalar/uyari.png', 0, 0, 0 )
    		imageanimasyon = imageanimasyon+3
    			if imageanimasyon >= 29 then
    				imageanimasyon = 30
    			end
    	elseif sekil == "yasak" then
    		dxDrawImage ( x-145, 105, imageanimasyon, 30, 'dosyalar/yasak.png', 0, 0, 0 )
    		imageanimasyon = imageanimasyon+3
    			if imageanimasyon >= 29 then
    				imageanimasyon = 30
    			end
    	elseif sekil == "onay" then
    		dxDrawImage ( x-145, 105, imageanimasyon, 30, 'dosyalar/onay.png', 0, 0, 0 )
    		imageanimasyon = imageanimasyon+3
    			if imageanimasyon >= 29 then
    				imageanimasyon = 30
    			end
    	end
    	dxDrawRectangle ( x-150,144, g*2, u+1 ,tocolor(238 ,233, 233)) 
        g = g + 0.3
        if (g >= 149) then
        	removeEventHandler("onClientRender",getRootElement(),TEST)
        	end
        end
    end
    --TEST
function TEST()
    dxUyari(oyuncu,"Test","onay")
end
addEventHandler("onClientRender",getRootElement(),TEST )

 

Hmmm, have you tried this one yet? i think it's exactly what you want.

Edited by Sha67
Link to comment

I use this function in a lot of function so i need do:

    function dxUyari(durum,yazi,sekil)
    	if durum == oyuncu then
    	dxDrawRectangle(x-150,100,animasyon,50,tocolor(0,0,0,200))
    	animasyon = animasyon+10
    	if animasyon >= 299 then
    				animasyon = 300
    				alpha = 255
    			end
    	dxDrawText(yazi,x-100,110,0,0,tocolor(255,255,255,alpha),1,Font1)
    	dxDrawRectangle(x-150,143,lineimage,1,tocolor(255,255,255,255))
    	lineimage = lineimage+9.99
    	if lineimage >=299 then
    		lineimage = 300
    	end
    	if sekil == "uyari" then
    		dxDrawImage ( x-145, 105, imageanimasyon, 30, 'dosyalar/uyari.png', 0, 0, 0 )
    		imageanimasyon = imageanimasyon+3
    			if imageanimasyon >= 29 then
    				imageanimasyon = 30
    			end
    	elseif sekil == "yasak" then
    		dxDrawImage ( x-145, 105, imageanimasyon, 30, 'dosyalar/yasak.png', 0, 0, 0 )
    		imageanimasyon = imageanimasyon+3
    			if imageanimasyon >= 29 then
    				imageanimasyon = 30
    			end
    	elseif sekil == "onay" then
    		dxDrawImage ( x-145, 105, imageanimasyon, 30, 'dosyalar/onay.png', 0, 0, 0 )
    		imageanimasyon = imageanimasyon+3
    			if imageanimasyon >= 29 then
    				imageanimasyon = 30
    			end
    	end
    	dxDrawRectangle ( x-150,144, g*2, u+1 ,tocolor(238 ,233, 233)) 
        g = g + 0.3
        if (g >= 149) then
        	removeEventHandler("onClientRender",getRootElement(),TEST)
      		removeEventHandler("onClientRender",getRootElement(),TEST2)
      		removeEventHandler("onClientRender",getRootElement(),TEST3)
      		removeEventHandler("onClientRender",getRootElement(),TEST4)
        	end
        end
    end

this? But i dont want that, i want function anywhere do remove self.

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...