Jump to content

O primeiro marker funciona mas o segundo não


Recommended Posts

Quando eu hito o segundo marker da função "MarkerEntregaFunction3" não acontece nada nem da nenhum erro
 

function MarkerEntregaFunction(thePlayer)
    if getElementType(thePlayer) ~= "player" then return end
        if isPedInVehicle(thePlayer) then
        local ocupado = getPedOccupiedVehicle(thePlayer)
            if getElementData(thePlayer, "EntregadorD") == true and getElementData(ocupado, "kombiEntregas") == true and getElementData(thePlayer, "Entregou") == false then
            givePlayerMoney(thePlayer, 1000)
            setElementVisibleTo(MarkerEntrega, thePlayer, false)
            setElementVisibleTo(BlipEntrega, thePlayer, false)
            setElementVisibleTo(MarkerEntrega2, thePlayer, true)
            setElementVisibleTo(BlipEntrega2, thePlayer, true)
            setElementData(thePlayer, "Entregou", true)
            end
        end
    end
addEventHandler("onMarkerHit", MarkerEntrega, MarkerEntregaFunction)

MarkerEntrega3 = createMarker(-1196.2092285156,-1028.4724121094,129.21192932129 - 1, "cylinder", 2.5, 69, 69, 69)
BlipEntrega3 = createBlipAttachedTo(MarkerEntrega2, 0)
setElementVisibleTo(MarkerEntrega3, root, false)
setElementVisibleTo(BlipEntrega3, root, false)

function MarkerEntregaFunction3(thePlayer)
    if getElementType(thePlayer) ~= "player" then return end
        if isPedInVehicle(thePlayer) then
        local ocupado = getPedOccupiedVehicle(thePlayer)
            if getElementData(thePlayer, "EntregadorD") == true and getElementData(ocupado, "kombiEntregas") == true and getElementData(thePlayer, "Entregou2") == false then
            givePlayerMoney(thePlayer, 1000)
            setElementVisibleTo(MarkerEntrega2, thePlayer, false)
            setElementVisibleTo(BlipEntrega2, thePlayer, false)
            setElementVisibleTo(MarkerEntrega3, thePlayer, true)
            setElementVisibleTo(BlipEntrega3, thePlayer, true)
            setElementData(thePlayer, "Entregou2", true)
        end
    end
end
addEventHandler("onMarkerHit", MarkerEntrega3, MarkerEntregaFunction3)

 

Link to comment
  • Other Languages Moderators

Depure seu código com vários outputChatBox para saber até qual linha ele está lendo, descobrindo assim qual condição está com problema.

function MarkerEntregaFunction3(thePlayer)
    outputChatBox("A", thePlayer)
    if getElementType(thePlayer) ~= "player" then return end
    outputChatBox("B", thePlayer)
    if isPedInVehicle(thePlayer) then
        outputChatBox("C", thePlayer)
        local ocupado = getPedOccupiedVehicle(thePlayer)
        if getElementData(thePlayer, "EntregadorD") == true and getElementData(ocupado, "kombiEntregas") == true and getElementData(thePlayer, "Entregou2") == false then
            outputChatBox("D", thePlayer)
            givePlayerMoney(thePlayer, 1000)
            setElementVisibleTo(MarkerEntrega2, thePlayer, false)
            setElementVisibleTo(BlipEntrega2, thePlayer, false)
            setElementVisibleTo(MarkerEntrega3, thePlayer, true)
            setElementVisibleTo(BlipEntrega3, thePlayer, true)
            setElementData(thePlayer, "Entregou2", true)
        end
    end
end
addEventHandler("onMarkerHit", MarkerEntrega3, MarkerEntregaFunction3)

 

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