ajobr Posted July 22, 2020 Share Posted July 22, 2020 Esse erro está acontecendo no meu script já o revisei diversas vezes e não consigo encontrar o erro... Esse erro aparece nos dois 'addEventHandler' a seguir. local dxfont0_fonte = dxCreateFont("font/fonte.ttf", 10) local dxfont1_fonte = dxCreateFont("font/fonte.ttf", 35) local screenW, screenH = guiGetScreenSize() local resW, resH = 1360,768 local x, y = (screenW/resW), (screenH/resH) --math.abs(math.sin(getTickCount()/300))*255) function isEventHandlerAdded( sEventName, pElementAttachedTo, func ) if type( sEventName ) == 'string' and isElement( pElementAttachedTo ) and type( func ) == 'function' then local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo ) if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then for i, v in ipairs( aAttachedFunctions ) do if v == func then return true end end end end return false end function dinfo() local alpha = interpolateBetween(1, 0, 0, 255, 0, 0, (getTickCount()-tick2)/1000, "Linear") dxDrawRectangle(x*0, y*0, x*1360, y*768, tocolor(0, 0, 0, alpha), false) dxDrawText("DORMINDO...", screenW * 0.3581, screenH * 0.4336, screenW * 0.7132, screenH * 0.5182, tocolor(255, 255, 255, math.abs(math.sin(getTickCount()/300))*255), x*1.00, dxfont1_fonte, "left", "top", false, false, false, false, false) end function renderD() if not isEventHandlerAdded("onClientRender", root, dinfo) then addEventHandler("onClientRender", root, dinfo) end end addEvent("renderD", true) addEventHandler("renderD", root, renderD) function closeDxD() if isEventHandlerAdded("onClientRender", root, dinfo) then removeEventHandler("onClientRender", root, dinfo) showCursor(false) end end function close() if isEventHandlerAdded("onClientRender", root, Fenster2[1]) then if state == "down" then if isCursorOnElement(screenW * 0.6007, screenH * 0.3307, screenW * 0.0279, screenH * 0.0469) then removeEventHandler("onClientRender", root, Fenster2[1]) showCursor(false) end end end end addEventHandler("onClientGUIClick", Knopf2[4] , close) function dormir() if isEventHandlerAdded("onClientRender", root, Fenster2[1]) then if state == "down" then if isCursorOnElement(screenW * 0.4110, screenH * 0.4766, screenW * 0.1176, screenH * 0.0521) then tick2 = getTickCount() destroyElement(Fenster2[1]) triggerServerEvent("dormir", localPlayer) closeDx() setTimer(function() closeDxD() end, 30000, 1) end end end end addEventHandler("onClientGUIClick", Knopf2[4] , dormir) function isCursorOnElement( posX, posY, width, height ) if isCursorShowing( ) then local mouseX, mouseY = getCursorPosition( ) local clientW, clientH = guiGetScreenSize( ) local mouseX, mouseY = mouseX * clientW, mouseY * clientH if ( mouseX > posX and mouseX < ( posX + width ) and mouseY > posY and mouseY < ( posY + height ) ) then return true end end return false end Link to comment
DNL291 Posted July 22, 2020 Share Posted July 22, 2020 knopf2[4] deveria ser um elemento-gui mas não está definido no seu código, e isso retorna nil. 1 Link to comment
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