Jump to content

Não executa a função


Recommended Posts

Boa tarde pessoal, estou criando um script de trabalho de caminhão, porém quando o player chega no marker final, a função não é executada.


-- Client
function criar_Marker_Entrega(thePlayer, x, y, z)
    if isElement(markerFinal) and isElement(blipFinal) then
        remover_Marker_Entrega(getLocalPlayer(), x, y, z)
    end 
    markerFinal = createMarker(-2431.1218261719, -617.41790771484, 132.55635070801, "checkpoint", 3.0, 30, 144, 255)
    blipFinal = createBlipAttachedTo(markerFinal, 0, 2, 255, 0, 0, 255, 0, 99999999, thePlayer)
end




function remover_Marker_Entrega()
    if isElement(markerFinal) then
        destroyElement(markerFinal)
    end
    if isElement(blipFinal) then
        destroyElement(blipFinal)
    end
end




function entregar_Encomenda_Trabalho_Caminhoneiro(hitElement, matchingDimension)
    if (source == markerFinal) then
        if getElementData(source, "Trab:Caminhoneiro") and getElementData(source, "CaminhoneiroCarga") then
            outputChatBox("teste", 255, 255, 255, true)
            triggerServerEvent("entrega_Encomenda_Trabalho_Caminhoneiro", root)
            remover_Marker_Entrega(getLocalPlayer(), x, y, z)
            triggerServerEvent("elements_Visible_False", root)
        end
    end
end
addEventHandler("onClientMarkerHit", root, entregar_Encomenda_Trabalho_Caminhoneiro)



-- Server
function remover_Veiculo_Trabalho(vehicle)
    if isElement(caminhao) then
        destroyElement(caminhao)
    end
    if isElement(carga) then
        destroyElement(carga)
    end
end
addEvent("Removeh_Vehicle", true)
addEventHandler("Removeh_Vehicle", getRootElement(), remover_Veiculo_Trabalho)




function entrega_Trabalho_Caminhoneiro(thePlayer)
    remover_Veiculo_Trabalho()
    outputChatBox("#1E90FFVocê entregou a encomenda e por isso recebeu R$5.000.", 255, 255, 255, true)
    givePlayerMoney(thePlayer, 5000)
    destroyElement(caminhao)
    destroyElement(carga)
end
addEvent("entrega_Encomenda_Trabalho_Caminhoneiro", true)
addEventHandler("entrega_Encomenda_Trabalho_Caminhoneiro", getRootElement(), entrega_Trabalho_Caminhoneiro)

 

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