Jump to content

[RESOLVIDO] Renderizar


Recommended Posts

Olá de novo, tive outro problema, é assim, eu quero fazer com que renderiza um dx quando entrar no marker, e se o player sair do marker, o dx some, só que nao sei oq ta dando, eu tentei de uma forma e n consegui, alguém sabe uma forma?

Server

function msgentrar (source) 
if isElementWithinMarker (source, MarkerArma1 ) then 
triggerClientEvent(source,"verarma", root) 
else 
triggerClientEvent(source,"fecharverarma", root) 
end 
end 
addEventHandler( "onMarkerHit", MarkerArma1, msgentrar) 

Client

painelverarma = false 
function dxverarma() 
        dxDrawRectangle(botx-249, 4, 313, 71, tocolor(3, 0, 0, 203), false) 
        dxDrawText("Digite /entrar para ver a arma", botx2-263, 32, 558, 53, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) 
    end 
     
function abrirverarma() 
if painelverarma == false then 
addEventHandler ("onClientRender", root, dxverarma) 
painelverarma = true 
end 
end 
addEvent ("verarma", true) 
addEventHandler ("verarma", root, abrirverarma) 
  
function fecharverarma() 
if painelverarma == true then 
removeEventHandler ("onClientRender", root, dxverarma) 
painelverarma = false 
end 
end 
addEvent ("fecharverarma", true) 
addEventHandler ("fecharverarma", root, fecharverarma) 

Link to comment

Bom... consegui resolver, o problema era saber acrescentar essa função no server

function msgentrar (source) 
triggerClientEvent(source,"verarma", root) -- Abrir o dx 
end 
addEventHandler( "onMarkerHit", MarkerArma1, msgentrar) -- Ao entrar no marker 
  
function fecharverarma(source) 
triggerClientEvent(source,"fecharverarma", root) -- Fechar o dx 
end 
addEventHandler ("onMarkerLeave", MarkerArma1, fecharverarma) -- Quando o player sair do marker 

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