Jump to content

Can anyone help me solve this problem?


MagroCrazy

Recommended Posts

Whenever I go to do a dx panel this error appears ... What can I do to correct?

"ERROR: Server triggered clientside event "eventoabrir", but event is not added clientside"

-------------------CLIENT--------------------------

function abrir (_,state)
if painel == false then
showCursor(true)
addEventHandler("onClientRender", root, Pdx)
painel = true
else
showCursor(false)
removeEventHandler("onClientRender", root, Pdx)
painel = false
end
end
addEvent("abrir", true)
addEventHandler("abrir", root , abrir)

 

------------------SERVER--------------------------

local abrir = "painel"

function showPanellr(thePlayer)
    triggerClientEvent(root, "abrir", thePlayer)
end
addEventHandler("onMarkerHit", mrkInicio, showPanellr)

Link to comment
-- Client

function abrir ()
    if painel == false then
        showCursor(true)
        addEventHandler("onClientRender", root, Pdx)
        painel = true
    else
        showCursor(false)
        removeEventHandler("onClientRender", root, Pdx)
        painel = false
    end
end
addEvent("abrir", true)
addEventHandler("abrir", resourceRoot, abrir)

-- Server

function showPanellr(thePlayer)
    if getElementType( thePlayer ) == "player" then
        triggerClientEvent(thePlayer, "abrir", thePlayer)
    end
end
addEventHandler("onMarkerHit", mrkInicio, showPanellr) 

 

  • Sad 1
Link to comment

Mr.Loki, I replace what you sent me with my files and the error persisted ... I'm going to send the panel here and would like you to help me make it work

ERROR:[gameplay]\[PainelDx]\cliente.lua2: attempt to call global 'guiGetScreenSize' (a nil value)

"ERROR: Server triggered clientside event "abrir", but event is not added clientside"

 


local screenW, screenH = guiGetScreenSize()
local resW, resH = 1280, 720
local x, y = (resW/screenW),(resH/screenH)

painel = false
function Pdx ()
	dxDrawLine((x*0.3543) - 1, (y*0.2656) - 1, (x*0.3543) - 1, y*0.6576, tocolor(0, 0, 0, 255), 1, false)
	dxDrawLine(x*0.6310, (y*0.2656) - 1, (x*0.3543) - 1, (y*0.2656) - 1, tocolor(0, 0, 0, 255), 1, false)
	dxDrawLine((x*0.3543) - 1, y*0.6576, x*0.6310, y*0.6576, tocolor(0, 0, 0, 255), 1, false)
	dxDrawLine(x*0.6310, y*0.6576, x*0.6310, (y*0.2656) - 1, tocolor(0, 0, 0, 255), 1, false)
	dxDrawRectangle(x*0.3543, y*0.2656, x*0.2767, y*0.3919, tocolor(0, 0, 0, 96), false)
	dxDrawRectangle(484, 204, 379, 40, tocolor(38, 235, 0, 254), false)
	dxDrawText("PETROBRAS", (x*0.3529) - 1, (y*0.2643) - 1, (x*0.6310) - 1, (y*0.3177) - 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false)
	dxDrawText("PETROBRAS", (x*0.3529) + 1, (y*0.2643) - 1, (x*0.6310) + 1, (y*0.3177) - 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false)
	dxDrawText("PETROBRAS", (x*0.3529) - 1, (y*0.2643) + 1, (x*0.6310) - 1, (y*0.3177) + 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false)
	dxDrawText("PETROBRAS", (x*0.3529) + 1, (y*0.2643) + 1, (x*0.6310) + 1, (y*0.3177) + 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false)
	dxDrawText("PETROBRAS", x*0.3529, y*0.2643, x*0.6310, y*0.3177, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false)
	dxDrawLine((x*0.4480) - 1, (y*0.5938) - 1, (x*0.4480) - 1, y*0.6445, tocolor(0, 0, 0, 255), 1, false)
	dxDrawLine(x*0.5381, (y*0.5938) - 1, (x*0.4480) - 1, (y*0.5938) - 1, tocolor(0, 0, 0, 255), 1, false)
	dxDrawLine((x*0.4480) - 1, y*0.6445, x*0.5381, y*0.6445, tocolor(0, 0, 0, 255), 1, false)
	dxDrawLine(x*0.5381, y*0.6445, x*0.5381, (y*0.5938) - 1, tocolor(0, 0, 0, 255), 1, false)
	dxDrawRectangle(x*0.4480, y*0.5938, x*0.0900, y*0.0508, tocolor(38, 235, 0, 254), false)
	dxDrawText("ACEITAR", (x*0.4473) - 1, (y*0.5938) - 1, (x*0.5381) - 1, (y*0.6445) - 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
	dxDrawText("ACEITAR", (x*0.4473) + 1, (y*0.5938) - 1, (x*0.5381) + 1, (y*0.6445) - 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
	dxDrawText("ACEITAR", (x*0.4473) - 1, (y*0.5938) + 1, (x*0.5381) - 1, (y*0.6445) + 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
	dxDrawText("ACEITAR", (x*0.4473) + 1, (y*0.5938) + 1, (x*0.5381) + 1, (y*0.6445) + 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
	dxDrawText("ACEITAR", x*0.4473, y*0.5938, x*0.5381, y*0.6445, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
	dxDrawText("BEM VINDO AO TRABALHO DE CAMINHONEIRO", (x*0.3638) - 1, (y*0.3307) - 1, (x*0.6237) - 1, (y*0.3633) - 1, tocolor(0, 0, 0, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
	dxDrawText("BEM VINDO AO TRABALHO DE CAMINHONEIRO", (x*0.3638) + 1, (y*0.3307) - 1, (x*0.6237) + 1, (y*0.3633) - 1, tocolor(0, 0, 0, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
	dxDrawText("BEM VINDO AO TRABALHO DE CAMINHONEIRO", (x*0.3638) - 1, (y*0.3307) + 1, (x*0.6237) - 1, (y*0.3633) + 1, tocolor(0, 0, 0, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
	dxDrawText("BEM VINDO AO TRABALHO DE CAMINHONEIRO", (x*0.3638) + 1, (y*0.3307) + 1, (x*0.6237) + 1, (y*0.3633) + 1, tocolor(0, 0, 0, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
	dxDrawText("BEM VINDO AO TRABALHO DE CAMINHONEIRO", x*0.3638, y*0.3307, x*0.6237, y*0.3633, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
	dxDrawText("PETROBRAS, ESTE TRABALHO CONSISTE NA ENTREGA", (x*0.3638) - 1, (y*0.3633) - 1, (x*0.6237) - 1, (y*0.3958) - 1, tocolor(0, 0, 0, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
	dxDrawText("PETROBRAS, ESTE TRABALHO CONSISTE NA ENTREGA", (x*0.3638) + 1, (y*0.3633) - 1, (x*0.6237) + 1, (y*0.3958) - 1, tocolor(0, 0, 0, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
	dxDrawText("PETROBRAS, ESTE TRABALHO CONSISTE NA ENTREGA", (x*0.3638) - 1, (y*0.3633) + 1, (x*0.6237) - 1, (y*0.3958) + 1, tocolor(0, 0, 0, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
	dxDrawText("PETROBRAS, ESTE TRABALHO CONSISTE NA ENTREGA", (x*0.3638) + 1, (y*0.3633) + 1, (x*0.6237) + 1, (y*0.3958) + 1, tocolor(0, 0, 0, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
	dxDrawText("PETROBRAS, ESTE TRABALHO CONSISTE NA ENTREGA", x*0.3638, y*0.3633, x*0.6237, y*0.3958, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
	dxDrawText("DE COMBUSTIVEL POR TODA SAN ANDREAS", (x*0.3638) - 1, (y*0.3958) - 1, (x*0.6237) - 1, (y*0.4284) - 1, tocolor(0, 0, 0, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
	dxDrawText("DE COMBUSTIVEL POR TODA SAN ANDREAS", (x*0.3638) + 1, (y*0.3958) - 1, (x*0.6237) + 1, (y*0.4284) - 1, tocolor(0, 0, 0, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
	dxDrawText("DE COMBUSTIVEL POR TODA SAN ANDREAS", (x*0.3638) - 1, (y*0.3958) + 1, (x*0.6237) - 1, (y*0.4284) + 1, tocolor(0, 0, 0, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
	dxDrawText("DE COMBUSTIVEL POR TODA SAN ANDREAS", (x*0.3638) + 1, (y*0.3958) + 1, (x*0.6237) + 1, (y*0.4284) + 1, tocolor(0, 0, 0, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
	dxDrawText("DE COMBUSTIVEL POR TODA SAN ANDREAS", x*0.3638, y*0.3958, x*0.6237, y*0.4284, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
	dxDrawText("SEM TEMPO DETERMINADO ONDE VOCÊ PODERA", (x*0.3638) - 1, (y*0.4284) - 1, (x*0.6237) - 1, (y*0.4609) - 1, tocolor(0, 0, 0, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
	dxDrawText("SEM TEMPO DETERMINADO ONDE VOCÊ PODERA", (x*0.3638) + 1, (y*0.4284) - 1, (x*0.6237) + 1, (y*0.4609) - 1, tocolor(0, 0, 0, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
	dxDrawText("SEM TEMPO DETERMINADO ONDE VOCÊ PODERA", (x*0.3638) - 1, (y*0.4284) + 1, (x*0.6237) - 1, (y*0.4609) + 1, tocolor(0, 0, 0, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
	dxDrawText("SEM TEMPO DETERMINADO ONDE VOCÊ PODERA", (x*0.3638) + 1, (y*0.4284) + 1, (x*0.6237) + 1, (y*0.4609) + 1, tocolor(0, 0, 0, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
	dxDrawText("SEM TEMPO DETERMINADO ONDE VOCÊ PODERA", x*0.3638, y*0.4284, x*0.6237, y*0.4609, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
	dxDrawText("RECEBER QUANTIAS ACIMA DE $8.000 MIL REAIS", (x*0.3638) - 1, (y*0.4609) - 1, (x*0.6237) - 1, (y*0.4935) - 1, tocolor(0, 0, 0, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
	dxDrawText("RECEBER QUANTIAS ACIMA DE $8.000 MIL REAIS", (x*0.3638) + 1, (y*0.4609) - 1, (x*0.6237) + 1, (y*0.4935) - 1, tocolor(0, 0, 0, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
	dxDrawText("RECEBER QUANTIAS ACIMA DE $8.000 MIL REAIS", (x*0.3638) - 1, (y*0.4609) + 1, (x*0.6237) - 1, (y*0.4935) + 1, tocolor(0, 0, 0, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
	dxDrawText("RECEBER QUANTIAS ACIMA DE $8.000 MIL REAIS", (x*0.3638) + 1, (y*0.4609) + 1, (x*0.6237) + 1, (y*0.4935) + 1, tocolor(0, 0, 0, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
	dxDrawText("RECEBER QUANTIAS ACIMA DE $8.000 MIL REAIS", x*0.3638, y*0.4609, x*0.6237, y*0.4935, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
	dxDrawText("BY:MAGROCRAZY", (x*0.5410) - 1, (y*0.6068) - 1, (x*0.6310) - 1, (y*0.6367) - 1, tocolor(0, 0, 0, 255), 1.00, "default", "center", "center", false, false, false, false, false)
	dxDrawText("BY:MAGROCRAZY", (x*0.5410) + 1, (y*0.6068) - 1, (x*0.6310) + 1, (y*0.6367) - 1, tocolor(0, 0, 0, 255), 1.00, "default", "center", "center", false, false, false, false, false)
	dxDrawText("BY:MAGROCRAZY", (x*0.5410) - 1, (y*0.6068) + 1, (x*0.6310) - 1, (y*0.6367) + 1, tocolor(0, 0, 0, 255), 1.00, "default", "center", "center", false, false, false, false, false)
	dxDrawText("BY:MAGROCRAZY", (x*0.5410) + 1, (y*0.6068) + 1, (x*0.6310) + 1, (y*0.6367) + 1, tocolor(0, 0, 0, 255), 1.00, "default", "center", "center", false, false, false, false, false)
	dxDrawText("BY:MAGROCRAZY", x*0.5410, y*0.6068, x*0.6310, y*0.6367, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
	dxDrawText("CASO QUEIRA CONTINUAR CLICK EM \"ACEITAR\"", (x*0.3638) - 1, (y*0.5169) - 1, (x*0.6237) - 1, (y*0.5495) - 1, tocolor(0, 0, 0, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
	dxDrawText("CASO QUEIRA CONTINUAR CLICK EM \"ACEITAR\"", (x*0.3638) + 1, (y*0.5169) - 1, (x*0.6237) + 1, (y*0.5495) - 1, tocolor(0, 0, 0, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
	dxDrawText("CASO QUEIRA CONTINUAR CLICK EM \"ACEITAR\"", (x*0.3638) - 1, (y*0.5169) + 1, (x*0.6237) - 1, (y*0.5495) + 1, tocolor(0, 0, 0, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
	dxDrawText("CASO QUEIRA CONTINUAR CLICK EM \"ACEITAR\"", (x*0.3638) + 1, (y*0.5169) + 1, (x*0.6237) + 1, (y*0.5495) + 1, tocolor(0, 0, 0, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
	dxDrawText("CASO QUEIRA CONTINUAR CLICK EM \"ACEITAR\"", x*0.3638, y*0.5169, x*0.6237, y*0.5495, tocolor(255, 255, 255, 255), 1.00, "sans", "center", "center", false, false, false, false, false)
	dxDrawText("X", (x*0.5974) - 1, (y*0.2656) - 1, (x*0.6310) - 1, (y*0.3164) - 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false)
	dxDrawText("X", (x*0.5974) + 1, (y*0.2656) - 1, (x*0.6310) + 1, (y*0.3164) - 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false)
	dxDrawText("X", (x*0.5974) - 1, (y*0.2656) + 1, (x*0.6310) - 1, (y*0.3164) + 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false)
	dxDrawText("X", (x*0.5974) + 1, (y*0.2656) + 1, (x*0.6310) + 1, (y*0.3164) + 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false)
	dxDrawText("X", x*0.5974, y*0.2656, x*0.6310, y*0.3164, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false)
end

function abrir ()
    if painel == false then
        showCursor(true)
        addEventHandler("onClientRender", root, Pdx)
        painel = true
    else
        showCursor(false)
        removeEventHandler("onClientRender", root, Pdx)
        painel = false
    end
end
addEvent("abrir", true)
addEventHandler("abrir", resourceRoot, abrir)

function isCursorOnElement(x,y,w,h)
 local mx,my = getCursorPosition ()
 local fullx,fully = guiGetScreenSize()
 cursorx,cursory = mx*fullx,my*fully
 if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then
  return true
 else
  return false
 end
end

function fechar (_,state)
if painel == true then
if  isCursorOnElement(x*0.5974, y*0.2656, x*0.6310, y*0.3164) then
removeEventHandler("onClientRender", root, Pdx)
showCursor(false)
painel = false
end
end
end
addEventHandler ("onClientClick", root, fechar)

 

Edited by MagroCrazy
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...