Jump to content

Alguem pode Me ajuda PFV!


Recommended Posts

Entao to querendo cria um simples trabalho de entrega com tabela para quando o cara entrega ele ganha um dinheiro alguem pode me ajuda

eu tentei usa esse trabalho como fonte (em Baixo) mais ele nao cria os markes é nao cria os blips pra entregar, Se alguem poder me ajuda agradeço des de ja

Serve =

local StartEmprego02 = createMarker (1314.20227, -1159.26379, 23.82813 -1, "cylinder", 1.2, 0 ,26 ,255, 95) -- Local Onde Pega O Emprego

------------------------------------------------------------------------------------------------------------------------------------------------------------
local LetraTEmprego02 = createBlipAttachedTo ( StartEmprego02, 42 ) -- Letra T
setBlipVisibleDistance( LetraTEmprego02 , 700) -- Distancia Letra T "200" = 200 Metros Pra Ficar Visivel

------------------------------------------------------------------------------------------------------------------------------------------------------------

function HitarMarkerJobEmprego02 ( ThePlayer, d )
    if getElementType(ThePlayer) == "player" and d and isPedInVehicle(ThePlayer) ~= true then
        outputChatBox("#ffffff[ #001AFFTrabalho De Traficante #ffffff] -  #FFFFFFDigite#001AFF/sorvete #ffffff- Para pegar as drogas!", ThePlayer, 255, 255, 255, true)
    end
end
addEventHandler("onMarkerHit", StartEmprego02, HitarMarkerJobEmprego02)

------------------------------------------------------------------------------------------------------------------------------------------------------------

local vehEmprego02 = {}
function ComecoDeTudoEmprego02 (source)
    if isElementWithinMarker(source, StartEmprego02) and isPedInVehicle(source) ~= true and getElementDimension(source) == getElementDimension(StartEmprego02) then
        if vehEmprego02[source] and isElement( vehEmprego02[source] ) then destroyElement ( vehEmprego02[source] ) end
        
        local x,y,z = getElementPosition(source)
        setElementData( source, "Trabalho", "traficante de drogas" )
        vehEmprego02[source] = createVehicle(423, 1325.20374, -1173.83887, 23.65397)
        setVehicleLocked(vehEmprego02[source],true)
        
        warpPedIntoVehicle ( source, vehEmprego02[source] )
        setPlayerWantedLevel( source, 1 )
        triggerClientEvent( player, "traficante:onRequestDoAction", player, "create" )
        outputChatBox("#ffffff[ #001AFFTrabalho #ffffff] - #FFFFFFAgora Você É Um Traficante", source, 255, 255, 255, true) -- Mensagem Apos Pegar O Emprego
        outputChatBox("#ffffff[ #001AFFTrabalho #ffffff] - #FFFFFFLeve a Van até o Local Indicado no Mapa", source, 255, 255, 255, true)
        outputChatBox("#ffffff[ #001AFFTrabalho #ffffff] - #FFFFFFSe você for pego pela policia será preso! Então tome cuidado.", source, 255, 255, 255, true) -- Mensagem Apos Pegar O Emprego
        
        local vehOwner = source
        addEventHandler( "onVehicleExplode", vehEmprego02[source], 
            function()
                removePlayerFromJob( vehOwner, source, true )
                outputChatBox( "#ffffff[ #001AFFTrabalho #ffffff] - O seu veículo explodiu e você perdeu o emprego!", vehOwner, 230, 0, 0 )
            end
        )
    end
end
addCommandHandler ( "sorvete", ComecoDeTudoEmprego02 ) -- Comando Pra Pegar O Emprego

addEvent( "traficante:onPlayerFinishMission", true )
addEventHandler("traficante:onPlayerFinishMission", root,
    function()
        givePlayerMoney(client, 500)
        outputChatBox("#ffffff[ #001AFFTrabalho #ffffff] - #FFFFFFEntrega Finalizada, Você recebeu R$5000.",client,0,0,0,true) -- Mensagem Apos Finalizar O Emprego
        removePlayerFromJob( client, vehEmprego02[client] )
    end
)

------------------------------------------------------------------------------------------------------------------------------------------------------------

function SaiuDoEmprego02 (player)
    if (vehEmprego02[player]) and isElement(vehEmprego02[player]) then
        removePlayerFromJob( player, vehEmprego02[player], true )
        outputChatBox ("#ffffff[#001AFFTrabalho #ffffff] - #FFFFFFVocê Saiu Da Van E A Droga Foi Presa.", player ,0,0,0,true) -- Perder O Emprego Apos Sair Do Veiculo
    end
end
addEventHandler ( "onVehicleExit", resourceRoot, SaiuDoEmprego02 )

------------------------------------------------------------------------------------------------------------------------------------------------------------

function MorreuNoEmprego02 ( ammo, attacker, weapon, bodypart )
    if isElement(vehEmprego02[source]) then
        removePlayerFromJob( source, vehEmprego02[source], true )
        outputChatBox ("#ffffff[ #001AFFTrabalho #ffffff] - #FFFFFFVoce Morreu e Perdeu o Emprego", source ,0,0,0,true) -- Perder O Emprego Apos Morrer
    end
end
addEventHandler ( "onPlayerWasted", getRootElement(), MorreuNoEmprego02 )

------------------------------------------------------------------------------------------------------------------------------------------------------------

function SaiuDoServerEmprego02 ( quitType )    
    if isElement(vehEmprego02[source]) then
        destroyElement (vehEmprego02[source]) -- Destruir Veiculo Apos Jogador Sair Do Servidor No Emprego
    end
end
addEventHandler ( "onPlayerQuit", getRootElement(), SaiuDoServerEmprego02 )

function removePlayerFromJob( player, pVeh, removeFromClient )
    if isElement(player) and isElement(pVeh) then
        setElementData( player, "Trabalho", nil )
        destroyElement( pVeh )
        
        if removeFromClient then
            triggerClientEvent( player, "traficante:onRequestDoAction", player, "destroy" )
        end
    end
end

local _destroyElement = destroyElement
function destroyElement(elem)
    if isElement(elem) then
        return _destroyElement(elem)
    end
    return false
end

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Client =

local traficante_locations = 
{
    { 1135.3686523438, -2004.0344238281, 69.0078125 },
    { 1318.93652, -1137.58923, 23.65625 }
    --{ x, y, z },
    --{ x, y, z },
    --{ x, y, z }
}

local traficante = {}

function onRequestDoActionFunc ( actionstr )
    if actionstr == "create" then
        createLocation( 1 )
    elseif actionstr == "destroy" then
        destroyElement( traficante.StopEmprego02 )
        destroyElement( traficante.BlipFinalEmprego02 )
        traficante.StopEmprego02, traficante.BlipFinalEmprego02 = nil, nil
    end
end
addEvent( "traficante:onRequestDoAction", true )
addEventHandler( "traficante:onRequestDoAction", root, onRequestDoActionFunc )

function FimDeTudoEmprego02 ()
    if traficante.StopEmprego02 and isElementWithinMarker(localPlayer, traficante.StopEmprego02) and getElementData( localPlayer, "trabalho" ) == "traficante de drogas" then
        if indexID == #traficante_locations then
            indexID = nil
            destroyElement( traficante.StopEmprego02 )
            destroyElement( traficante.BlipFinalEmprego02 )
            traficante.StopEmprego02, traficante.BlipFinalEmprego02 = nil, nil
            
            return triggerServerEvent( "traficante:onPlayerFinishMission", localPlayer )
        end
        outputChatBox( "#ffffff[ #001AFFTrabalho #ffffff] - Outra entrega disponível, leve a van até o local", 0,0,0,true )
        createLocation( indexID + 1 )
    end
end
addCommandHandler ( "entregar", FimDeTudoEmprego02 )

function AvisoEntregaFimEmprego02 (hitElement, dim)
    if isPedInVehicle(hitElement) and hitElement == localPlayer and dim and source == traficante.StopEmprego02 then
        outputChatBox("#ffffff[ #001AFFTrabalho #ffffff] - #FFFFFFDigite #001AFF/entregar #FFFFFFPara Concluir o Trabalho",0,0,0,true)
    end
end
addEventHandler( "onClientMarkerHit", resourceRoot, AvisoEntregaFimEmprego02 )

function createLocation( id )
    indexID = tonumber(id) or 1
    
    destroyElement( traficante.StopEmprego02 )
    destroyElement( traficante.BlipFinalEmprego02 )

    local x,y,z = unpack( markerTruck[indexID] )
    traficante.StopEmprego02 = createMarker( x, y, z, "cylinder", 7, 0 ,26 ,255, 95 )
    traficante.BlipFinalEmprego02 = createBlipAttachedTo( traficante.StopEmprego02, 0 )
    
    return indexID
end

local _destroyElement = destroyElement
function destroyElement(elem)
    if isElement(elem) then    return _destroyElement(elem) end
    --
    return false
end

 

Edited by DNL291
Use a formatação para o código Lua da próxima vez
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...