Jaga Posted August 17, 2020 Share Posted August 17, 2020 ola sou novo no sistema de dx, mas estou comecando a aprender agora, e estou tentando fazer um aqui, mas o debugscript 3 consta que esta tudo certo, mas o painel nao abre, ainda nao coloquei funcao para clicar em algo e fechar, mas so quero que ele abra apenas o painel mas ainda nada. CLIENT local screenW,screenH = guiGetScreenSize() local resW,resH = 1366,768 local x,y = (screenW/resW), (screenH/resH) painel = false ------------------------------------- function PainelBIKE () dxDrawImage(screenW * 0.1589, screenH * 0.0130, screenW * 0.6292, screenH * 0.9259, "painel.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(screenW * 0.6865, screenH * 0.2056, screenW * 0.0359, screenH * 0.0574, "fechar.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(screenW * 0.2474, screenH * 0.2806, screenW * 0.1953, screenH * 0.3704, "bmx.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(screenW * 0.4828, screenH * 0.2806, screenW * 0.1964, screenH * 0.3704, "mountain.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawImage(screenW * 0.3594, screenH * 0.5861, screenW * 0.1974, screenH * 0.1370, "alugar.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) end ---------------------------------------- function Open (_,state) if painel == false then showCursor(true) addEventHandler("onClientRender", root, PainelBIKE) painel = true else showCursor(false) removeEventHandler("onClientRender", root, PainelBIKE) painel = false end end addEvent("OpenDxBike", true) addEventHandler("OpenDxBike", root, Open) Quote SERVER mrkpanel = createMarker(1489.361, -1741.148, 13.547 -1,"cylinder",1.2,0,0,255,255) function AbrirPainelBike(thePlayer) local account = getPlayerAccount (thePlayer) if isGuestAccount (account) then outputChatBox ( "#ff0000✘ #ffffffAGENCIA #ff0000✘➺ #FFFFFFVocê não pode alugar um bike deslogado, Crie uma Conta!", thePlayer, 255,255,255,true) return end if isElementWithinMarker(thePlayer, mrkpanel) then triggerClientEvent(thePlayer,"OpenDxBike") end end addEventHandler("onMarkerHit", mrkpanel, AbrirPainelBike) Link to comment
Administrators Tut Posted August 17, 2020 Administrators Share Posted August 17, 2020 Thread has been moved to a more appropriate board, https://forum.multitheftauto.com/forum/97-portuguese-português/ Link to comment
Blaack Posted August 17, 2020 Share Posted August 17, 2020 Server-side mrkpanel = createMarker(1489.361, -1741.148, 13.547 -1,"cylinder",1.2,0,0,255,255) function AbrirPainelBike(hitElement) local thePlayer = hitElement local account = getPlayerAccount (thePlayer) if isGuestAccount (account) then outputChatBox ( "#ff0000✘ #ffffffAGENCIA #ff0000✘➺ #FFFFFFVocê não pode alugar um bike deslogado, Crie uma Conta!", thePlayer, 255,255,255,true) return end if isElementWithinMarker(thePlayer, mrkpanel) then triggerClientEvent("OpenDxBike", thePlayer) -- Player pode ser definido antes, porém tem de ser definido também ( leia o syntax da function) end end addEventHandler("onMarkerHit", mrkpanel, AbrirPainelBike) Link to comment
Boechat Posted August 17, 2020 Share Posted August 17, 2020 54 minutes ago, ~#BlackSCR said: Server-side mrkpanel = createMarker(1489.361, -1741.148, 13.547 -1,"cylinder",1.2,0,0,255,255) function AbrirPainelBike(hitElement) local thePlayer = hitElement local account = getPlayerAccount (thePlayer) if isGuestAccount (account) then outputChatBox ( "#ff0000✘ #ffffffAGENCIA #ff0000✘➺ #FFFFFFVocê não pode alugar um bike deslogado, Crie uma Conta!", thePlayer, 255,255,255,true) return end if isElementWithinMarker(thePlayer, mrkpanel) then triggerClientEvent("OpenDxBike", thePlayer) -- Player pode ser definido antes, porém tem de ser definido também ( leia o syntax da function) end end addEventHandler("onMarkerHit", mrkpanel, AbrirPainelBike) Desse jeito vai abrir o painel pra todos do server. Teste assim: local mrkpanel = createMarker(1489.361, -1741.148, 13.547 -1,"cylinder",1.2,0,0,255,255) function AbrirPainelBike(hitElement) if getElementType (hitElement) == 'player' then local account = getPlayerAccount (hitElement) if isGuestAccount (account) then outputChatBox ( "#ff0000✘ #ffffffAGENCIA #ff0000✘➺ #FFFFFFVocê não pode alugar um bike deslogado, Crie uma Conta!", thePlayer, 255,255,255,true) return end triggerClientEvent(hitElement, "OpenDxBike", hitElement) end end addEventHandler("onMarkerHit", mrkpanel, AbrirPainelBike) Link to comment
ber Posted August 21, 2020 Share Posted August 21, 2020 Sempre utilize resourceRoot no 3º argumento do addEventHandler quando for um evento customizado, se deixar como root qualquer script vai poder acessá-lo, podendo ocorrer problemas com scripts em conflito e perdendo desempenho no servidor. Para corrigir seu problema basta alterar essas 2 linhas: -- clientSide addEventHandler("OpenDxBike", resourceRoot, Open) -- serverSide triggerClientEvent(thePlayer, "OpenDxBike", resourceRoot) 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