Jump to content

Cancel createMarker


Lloyd Logan

Recommended Posts

I have this so far

function startJob ( thePlayer ) 
           local x, y, z = unpack ( pickups [ math.random ( #pickups ) ] ) 
            markers [ thePlayer ] = createMarker ( x, y, z, "cylinder", 3.5, 255, 0, 0 ) 
            local skins = unpack ( pedCus [ math.random ( #pedCus ) ] ) 
            peds [ thePlayer ] = createPed( skins, x, y, z )    
            blips [ thePlayer ] = createBlipAttachedTo ( markers [ thePlayer ], 41 ) 
            addEventHandler ( "onMarkerHit", markers [ thePlayer ], warpit ) 
end 
         
         
function teamSet ( ) 
    local team = getTeamFromName ( "Taxi Driver" ) 
    if team then 
        setPlayerTeam ( source, team ) 
        setPlayerNametagColor ( source, 0, 255, 0 ) 
            setElementModel(source, 57) 
            outputChatBox("You are now employed as a Taxi Driver!", thePlayer) 
        else 
            local teamw = getTeamFromName ( "Taxi Driver" ) 
            if teamw then 
            cancelEvent() 
            outputChatBox("You are already a Taxi driver!", source) 
        end 
    end 
end 
addEvent ( "sTeame", true) 
addEventHandler ( "sTeame", root, teamSet ) 
  
function enterVehicle ( thePlayer, seat, jacked ) -- when a player enters a vehicle 
    if getElementType ( thePlayer ) == "player" then 
    if ( taxiVehs[getElementModel ( source )] ) and ( not taxiTeams[getPlayerTeam( thePlayer )] ) then -- if the vehicle is one of 4 police cars, and the skin is not a police skin 
        removePedFromVehicle( thePlayer )-- force the player out of the vehicle 
        outputChatBox("Only Taxi Drivers can drive this vehicle!", thePlayer) 
        end 
    end 
end 
addEventHandler ( "onVehicleEnter", getRootElement(), enterVehicle ) 
  
markers = { } 
blips = { } 
peds = { } 
  
  
  
function inVEH ( thePlayer ) 
    if ( getElementType ( thePlayer ) == "player" and isPedInVehicle ( thePlayer ) ) then  
        if ( getElementModel ( source ) == 420 ) then 
           addEventHandler ( "onMarkerHit", markers [ thePlayer ], dropoff ) 
        end 
    else 
        if ( isElement ( markers [ thePlayer ] ) ) then 
            destroyElement ( markers [ thePlayer ] ) 
        end 
        if ( isElement ( blips [ thePlayer ] ) ) then 
            destroyElement( blips [ thePlayer ] ) 
        end 
    end 
end 
addEvent("onVehicleEnter", true) 
addEventHandler ( "onVehicleEnter", getRootElement(), inVEH ) 
  
  
function warpit ( thePlayer ) 
    if ( getElementType ( thePlayer ) == "player" and isPedInVehicle ( thePlayer ) ) then 
        local vehicle = getPedOccupiedVehicle ( thePlayer ) 
        if ( getElementModel ( vehicle ) == 420 ) then 
            warpPedIntoVehicle ( peds [ thePlayer ], vehicle, 2 ) 
            pickMeUp ( thePlayer ) 
        end 
    end 
end 
  
 function dropoff( thePlayer ) 
        if ( getElementType ( thePlayer ) == "player" and isPedInVehicle ( thePlayer ) ) then  
        local vehiclee = getPedOccupiedVehicle ( thePlayer ) 
        if ( getElementModel ( vehiclee ) == 420 ) then 
        local x, y, z = unpack ( dropoffss [ math.random ( #dropoffss ) ] ) 
        markers [ thePlayer ] = createMarker ( x, y, z - 1, "cylinder", 3.5, 255, 0, 0, 50 ) 
        blips [ thePlayer ] = createBlipAttachedTo ( markers [ thePlayer ], 41 ) 
        addEventHandler("onMarkerHit", markers [ thePlayer ], pickmeup) 
    end 
    end 
end 
  
function pickmeup( thePlayer ) 
    givePlayerMoney( thePlayer, 500 ) 
    setTimer(destroyElement, 3000, 1, peds [ thePlayer ]) 
    setTimer(outputChatBox, 1000, 1, "Customer : Thank you very much!", thePlayer) 
    setTimer(outputChatBox, 1000, 1, "You have eaerned $500!", thePlayer, 255, 124, 0) 
    destroyElement( blips [ thePlayer ] ) 
    destroyElement( markers [ thePlayer ] ) 
    outputChatBox ( "Destination reached.", thePlayer ) 
    triggerEvent("nowLie", getRootElement()) 
end 
  
     
  
function deleteOnExit( thePlayer ) 
         destroyElement( blips [ thePlayer ] ) 
         destroyElement( markers [ thePlayer ] ) 
         destroyElement( peds [ thePlayer ] ) 
end 
addEventHandler("onVehicleExit", getRootElement(), deleteOnExit) 
  
function pickMeUp ( thePlayer ) 
    if ( isElement ( markers [ thePlayer ] ) ) then 
        destroyElement ( markers [ thePlayer ] ) 
    end 
    if ( isElement ( blips [ thePlayer ] ) ) then 
        destroyElement( blips [ thePlayer ] ) 
        end 
    end 

Link to comment
function teamSet ( ) 
    local team = getTeamFromName ( "Taxi Driver" ) 
    if team then 
        setPlayerTeam ( source, team ) 
        setPlayerNametagColor ( source, 0, 255, 0 ) 
            setElementModel(source, 57) 
            outputChatBox("You are now employed as a Taxi Driver!", thePlayer) 
        else 
            local teamw = getTeamFromName ( "Taxi Driver" ) 
            if teamw then 
            cancelEvent() 
            outputChatBox("You are already a Taxi driver!", source) 
        end 
    end 
end 
addEvent ( "sTeame", true) 
addEventHandler ( "sTeame", root, teamSet ) 
  
function enterVehicle ( thePlayer, seat, jacked ) -- when a player enters a vehicle 
    if getElementType ( thePlayer ) == "player" then 
    if ( taxiVehs[getElementModel ( source )] ) and ( not taxiTeams[getPlayerTeam( thePlayer )] ) then -- if the vehicle is one of 4 police cars, and the skin is not a police skin 
        removePedFromVehicle( thePlayer )-- force the player out of the vehicle 
        outputChatBox("Only Taxi Drivers can drive this vehicle!", thePlayer) 
        end 
    end 
end 
addEventHandler ( "onVehicleEnter", getRootElement(), enterVehicle ) 
  
markers = { } 
blips = { } 
peds = { } 
  
function startJob ( thePlayer ) 
    local x, y, z = unpack ( pickups [ math.random ( #pickups ) ] ) 
    markers [ thePlayer ] = createMarker ( x, y, z, "cylinder", 3.5, 255, 0, 0 ) 
    local skins = unpack ( pedCus [ math.random ( #pedCus ) ] ) 
    peds [ thePlayer ] = createPed( skins, x, y, z )   
    blips [ thePlayer ] = createBlipAttachedTo ( markers [ thePlayer ], 41 ) 
    addEventHandler ( "onMarkerHit", markers [ thePlayer ], warpit ) 
end 
  
function inVEH ( thePlayer ) 
    if ( getElementType ( thePlayer ) == "player" and isPedInVehicle ( thePlayer ) ) then 
        if ( getElementModel ( source ) == 420 ) then 
           startJob ( thePlayer ) 
        end 
    else 
        if ( isElement ( markers [ thePlayer ] ) ) then 
            destroyElement ( markers [ thePlayer ] ) 
        end 
        if ( isElement ( blips [ thePlayer ] ) ) then 
            destroyElement( blips [ thePlayer ] ) 
        end 
    end 
end 
addEvent("onVehicleEnter", true) 
addEventHandler ( "onVehicleEnter", getRootElement(), inVEH ) 
  
function warpit ( thePlayer ) 
    if ( getElementType ( thePlayer ) == "player" and isPedInVehicle ( thePlayer ) ) then 
        local vehicle = getPedOccupiedVehicle ( thePlayer ) 
        if ( getElementModel ( vehicle ) == 420 ) then 
            warpPedIntoVehicle ( peds [ thePlayer ], vehicle, 2 ) 
            dropoff ( thePlayer ) 
        end 
    end 
end 
  
function dropoff ( thePlayer ) 
    if ( getElementType ( thePlayer ) == "player" and isPedInVehicle ( thePlayer ) ) then 
        local vehiclee = getPedOccupiedVehicle ( thePlayer ) 
        if ( getElementModel ( vehiclee ) == 420 ) then 
            local x, y, z = unpack ( dropoffss [ math.random ( #dropoffss ) ] ) 
            markers [ thePlayer ] = createMarker ( x, y, z - 1, "cylinder", 3.5, 255, 0, 0, 50 ) 
            blips [ thePlayer ] = createBlipAttachedTo ( markers [ thePlayer ], 41 ) 
            addEventHandler ( "onMarkerHit", markers [ thePlayer ], pickmeup ) 
        end 
    end 
end 
  
function pickmeup( thePlayer ) 
    if ( isElement ( markers [ thePlayer ] ) ) then 
        destroyElement ( markers [ thePlayer ] ) 
    end 
    if ( isElement ( blips [ thePlayer ] ) ) then 
        destroyElement( blips [ thePlayer ] ) 
    end 
    givePlayerMoney( thePlayer, 500 ) 
    setTimer(destroyElement, 3000, 1, peds [ thePlayer ]) 
    setTimer(outputChatBox, 1000, 1, "Customer : Thank you very much!", thePlayer) 
    setTimer(outputChatBox, 1000, 1, "You have eaerned $500!", thePlayer, 255, 124, 0) 
    triggerEvent("nowLie", getRootElement()) 
end 
  
function deleteOnExit( thePlayer ) 
    if ( isElement ( markers [ thePlayer ] ) ) then 
        destroyElement ( markers [ thePlayer ] ) 
    end 
    if ( isElement ( blips [ thePlayer ] ) ) then 
        destroyElement( blips [ thePlayer ] ) 
    end 
    if ( isElement ( peds [ thePlayer ] ) ) then 
        destroyElement( peds [ thePlayer ] ) 
    end 
end 
addEventHandler("onVehicleExit", getRootElement(), deleteOnExit) 

Link to comment
You're welcome.

:? It is now creating two pickup markers after you drop a customer off and doesn't create a drop off marker

local pickups = { 
[1]={ 2060.7685546875, -1941.1181640625, 13.14103603363 }, 
[2]={ 2114.5068359375, -1611.302734375, 13.167269706726 }, 
[3]={ 1932.9521484375, -1776.1259765625, 13.16081237793 }, 
[4]={ 1057.41796875, -1568.4853515625, 13.166387557983 } 
}  
  
local dropoffss = { 
  
[1]={ 1965.54296875 , -1883.013671875, 13.160305023193 }, 
[2]={ 1467.3916015625, -1736.419921875, 13.242918014526 }, 
[3]={ 2376.1064453125, -1728.4091796875, 13.162055015564 }, 
[4]={ 1066.5029296875, -1200.86328125, 18.405519485474 } 
} 
  
local pedCus = { 
[1]={ 9 }, 
[2]={ 10 }, 
[3]={ 14 }, 
[4]={ 15 }, 
[5]={ 37 } 
} 
  
  
Teame = createTeam("Taxi Driver", 0, 255, 0) 
  
taxiTeams = { [Teame] = true } 
taxiVehs = { [420] = true } 
  
function startJob ( thePlayer ) 
           local x, y, z = unpack ( pickups [ math.random ( #pickups ) ] ) 
            markers [ thePlayer ] = createMarker ( x, y, z, "cylinder", 5.0, 255, 0, 0, 0 ) 
            local skins = unpack ( pedCus [ math.random ( #pedCus ) ] ) 
            peds [ thePlayer ] = createPed( skins, x, y, z )    
            blips [ thePlayer ] = createBlipAttachedTo ( markers [ thePlayer ], 41 ) 
            addEventHandler ( "onMarkerHit", markers [ thePlayer ], warpit ) 
end 
         
         
function teamSet ( ) 
    local team = getTeamFromName ( "Taxi Driver" ) 
    if team then 
        setPlayerTeam ( source, team ) 
        setPlayerNametagColor ( source, 0, 255, 0 ) 
            setElementModel(source, 57) 
            outputChatBox("You are now employed as a Taxi Driver!", thePlayer) 
        else 
            local teamw = getTeamFromName ( "Taxi Driver" ) 
            if teamw then 
            cancelEvent() 
            outputChatBox("You are already a Taxi driver!", source) 
        end 
    end 
end 
addEvent ( "sTeame", true) 
addEventHandler ( "sTeame", root, teamSet ) 
  
function enterVehicle ( thePlayer, seat, jacked ) -- when a player enters a vehicle 
    if getElementType ( thePlayer ) == "player" then 
    if ( taxiVehs[getElementModel ( source )] ) and ( not taxiTeams[getPlayerTeam( thePlayer )] ) then -- if the vehicle is one of 4 police cars, and the skin is not a police skin 
        removePedFromVehicle( thePlayer )-- force the player out of the vehicle 
        outputChatBox("Only Taxi Drivers can drive this vehicle!", thePlayer) 
        end 
    end 
end 
addEventHandler ( "onVehicleEnter", getRootElement(), enterVehicle ) 
  
markers = { } 
blips = { } 
peds = { } 
  
  
  
function inVEH ( thePlayer ) 
    if ( getElementType ( thePlayer ) == "player" and isPedInVehicle ( thePlayer ) ) then  
        if ( getElementModel ( source ) == 420 ) then 
            startJob ( thePlayer ) 
           addEventHandler ( "onMarkerHit", markers [ thePlayer ], dropoff ) 
         end 
    end 
end 
addEvent("onVehicleEnter", true) 
addEventHandler ( "onVehicleEnter", getRootElement(), inVEH ) 
  
  
function warpit ( thePlayer ) 
    if ( getElementType ( thePlayer ) == "player" and isPedInVehicle ( thePlayer ) ) then 
        local vehicle = getPedOccupiedVehicle ( thePlayer ) 
        if ( getElementModel ( vehicle ) == 420 ) then 
            setTimer(warpPedIntoVehicle, 2000, 1, peds [ thePlayer ], vehicle, 2 ) 
            pickMeUp ( thePlayer ) 
        end 
    end 
end 
  
 function dropoff( thePlayer ) 
        if ( getElementType ( thePlayer ) == "player" and isPedInVehicle ( thePlayer ) ) then  
        local vehiclee = getPedOccupiedVehicle ( thePlayer ) 
        if ( getElementModel ( vehiclee ) == 420 ) then 
        local x, y, z = unpack ( dropoffss [ math.random ( #dropoffss ) ] ) 
        markers [ thePlayer ] = createMarker ( x, y, z - 1, "cylinder", 5.0, 255, 0, 0, 50 ) 
        blips [ thePlayer ] = createBlipAttachedTo ( markers [ thePlayer ], 41 ) 
        addEventHandler("onMarkerHit", markers [ thePlayer ], pickmeup) 
    end 
    end 
end 
  
function pickmeup( thePlayer ) 
    givePlayerMoney( thePlayer, 500 ) 
    setTimer(destroyElement, 3000, 1, peds [ thePlayer ]) 
    setTimer(outputChatBox, 1000, 1, "You have earned $500!", thePlayer, 255, 124, 0) 
    destroyElement( blips [ thePlayer ] ) 
    destroyElement( markers [ thePlayer ] ) 
    if outputChatBox ( "Destination reached.", thePlayer ) then 
    if startJob ( thePlayer ) then 
    removeEventHandler("onMarkerHit", getRootElement(), dropoff) 
    end 
    end 
end 
  
     
  
function deleteOnExit( thePlayer ) 
         destroyElement( blips [ thePlayer ] ) 
         destroyElement( markers [ thePlayer ] ) 
         destroyElement( peds [ thePlayer ] ) 
end 
addEventHandler("onVehicleExit", getRootElement(), deleteOnExit) 
  
function pickMeUp ( thePlayer ) 
    if ( isElement ( markers [ thePlayer ] ) ) then 
        destroyElement ( markers [ thePlayer ] ) 
    end 
    if ( isElement ( blips [ thePlayer ] ) ) then 
        destroyElement( blips [ thePlayer ] ) 
        end 
    end 

Link to comment
local pickups = { 
[1]={ 2060.7685546875, -1941.1181640625, 13.14103603363 }, 
[2]={ 2114.5068359375, -1611.302734375, 13.167269706726 }, 
[3]={ 1932.9521484375, -1776.1259765625, 13.16081237793 }, 
[4]={ 1057.41796875, -1568.4853515625, 13.166387557983 } 
} 
  
local dropoffss = { 
[1]={ 1965.54296875 , -1883.013671875, 13.160305023193 }, 
[2]={ 1467.3916015625, -1736.419921875, 13.242918014526 }, 
[3]={ 2376.1064453125, -1728.4091796875, 13.162055015564 }, 
[4]={ 1066.5029296875, -1200.86328125, 18.405519485474 } 
} 
  
local pedCus = { 
[1]={ 9 }, 
[2]={ 10 }, 
[3]={ 14 }, 
[4]={ 15 }, 
[5]={ 37 } 
} 
  
  
Teame = createTeam("Taxi Driver", 0, 255, 0) 
  
taxiTeams = { [Teame] = true } 
taxiVehs = { [420] = true } 
  
function teamSet ( ) 
    local team = getTeamFromName ( "Taxi Driver" ) 
    if team then 
        setPlayerTeam ( source, team ) 
        setPlayerNametagColor ( source, 0, 255, 0 ) 
            setElementModel(source, 57) 
            outputChatBox("You are now employed as a Taxi Driver!", thePlayer) 
        else 
            local teamw = getTeamFromName ( "Taxi Driver" ) 
            if teamw then 
            cancelEvent() 
            outputChatBox("You are already a Taxi driver!", source) 
        end 
    end 
end 
addEvent ( "sTeame", true) 
addEventHandler ( "sTeame", root, teamSet ) 
  
function enterVehicle ( thePlayer, seat, jacked ) -- when a player enters a vehicle 
    if getElementType ( thePlayer ) == "player" then 
        if ( taxiVehs[getElementModel ( source )] ) and ( not taxiTeams[getPlayerTeam( thePlayer )] ) then -- if the vehicle is one of 4 police cars, and the skin is not a police skin 
            removePedFromVehicle( thePlayer )-- force the player out of the vehicle 
            outputChatBox("Only Taxi Drivers can drive this vehicle!", thePlayer) 
        end 
    end 
end 
addEventHandler ( "onVehicleEnter", getRootElement(), enterVehicle ) 
  
markers = { } 
blips = { } 
peds = { } 
  
function startJob ( thePlayer ) 
    local x, y, z = unpack ( pickups [ math.random ( #pickups ) ] ) 
    markers [ thePlayer ] = createMarker ( x, y, z, "cylinder", 5.0, 255, 0, 0, 0 ) 
    local skins = unpack ( pedCus [ math.random ( #pedCus ) ] ) 
    peds [ thePlayer ] = createPed( skins, x, y, z )   
    blips [ thePlayer ] = createBlipAttachedTo ( markers [ thePlayer ], 41 ) 
    addEventHandler ( "onMarkerHit", markers [ thePlayer ], warpit ) 
end 
  
function inVEH ( thePlayer ) 
    if ( getElementType ( thePlayer ) == "player" and isPedInVehicle ( thePlayer ) ) then 
        if ( getElementModel ( source ) == 420 ) then 
            startJob ( thePlayer ) 
        end 
    end 
end 
addEventHandler ( "onVehicleEnter", getRootElement(), inVEH ) 
  
function warpit ( thePlayer ) 
    if ( getElementType ( thePlayer ) == "player" and isPedInVehicle ( thePlayer ) ) then 
        local vehicle = getPedOccupiedVehicle ( thePlayer ) 
        if ( getElementModel ( vehicle ) == 420 ) then 
            setTimer ( warpPedIntoVehicle, 2000, 1, peds [ thePlayer ], vehicle, 2 ) 
            destroyJob ( thePlayer ) 
            local x, y, z = unpack ( dropoffss [ math.random ( #dropoffss ) ] ) 
            markers [ thePlayer ] = createMarker ( x, y, z - 1, "cylinder", 5.0, 255, 0, 0, 50 ) 
            blips [ thePlayer ] = createBlipAttachedTo ( markers [ thePlayer ], 41 ) 
            addEventHandler ( "onMarkerHit", markers [ thePlayer ], pickmeup ) 
        end 
    end 
end 
  
function pickmeup ( thePlayer ) 
    if ( getElementType ( thePlayer ) == "player" and isPedInVehicle ( thePlayer ) ) then 
        givePlayerMoney ( thePlayer, 500 ) 
        outputChatBox ( "You have earned $500!", thePlayer, 255, 124, 0 ) 
        destroyJob ( thePlayer ) 
        setTimer ( 
            function ( ) 
                if ( isElement ( peds [ thePlayer ] ) ) then 
                    destroyElement ( peds [ thePlayer ] ) 
                end 
                startJob ( thePlayer ) 
            end 
            ,3000, 1 
        ) 
    end 
end 
  
function deleteOnExit ( thePlayer ) 
    if ( isElement ( markers [ thePlayer ] ) ) then 
        destroyElement ( markers [ thePlayer ] ) 
    end 
    if ( isElement ( blips [ thePlayer ] ) ) then 
        destroyElement ( blips [ thePlayer ] ) 
    end 
    if ( isElement ( peds [ thePlayer ] ) ) then 
        destroyElement ( peds [ thePlayer ] ) 
    end 
end 
addEventHandler ( "onVehicleExit", getRootElement(), deleteOnExit ) 
  
function destroyJob ( thePlayer ) 
    if ( isElement ( markers [ thePlayer ] ) ) then 
        destroyElement ( markers [ thePlayer ] ) 
    end 
    if ( isElement ( blips [ thePlayer ] ) ) then 
        destroyElement( blips [ thePlayer ] ) 
    end 
end 

Link to comment
local pickups = { 
[1]={ 2060.7685546875, -1941.1181640625, 13.14103603363 }, 
[2]={ 2114.5068359375, -1611.302734375, 13.167269706726 }, 
[3]={ 1932.9521484375, -1776.1259765625, 13.16081237793 }, 
[4]={ 1057.41796875, -1568.4853515625, 13.166387557983 } 
} 
  
local dropoffss = { 
[1]={ 1965.54296875 , -1883.013671875, 13.160305023193 }, 
[2]={ 1467.3916015625, -1736.419921875, 13.242918014526 }, 
[3]={ 2376.1064453125, -1728.4091796875, 13.162055015564 }, 
[4]={ 1066.5029296875, -1200.86328125, 18.405519485474 } 
} 
  
local pedCus = { 
[1]={ 9 }, 
[2]={ 10 }, 
[3]={ 14 }, 
[4]={ 15 }, 
[5]={ 37 } 
} 
  
  
Teame = createTeam("Taxi Driver", 0, 255, 0) 
  
taxiTeams = { [Teame] = true } 
taxiVehs = { [420] = true } 
  
function teamSet ( ) 
    local team = getTeamFromName ( "Taxi Driver" ) 
    if team then 
        setPlayerTeam ( source, team ) 
        setPlayerNametagColor ( source, 0, 255, 0 ) 
            setElementModel(source, 57) 
            outputChatBox("You are now employed as a Taxi Driver!", thePlayer) 
        else 
            local teamw = getTeamFromName ( "Taxi Driver" ) 
            if teamw then 
            cancelEvent() 
            outputChatBox("You are already a Taxi driver!", source) 
        end 
    end 
end 
addEvent ( "sTeame", true) 
addEventHandler ( "sTeame", root, teamSet ) 
  
function enterVehicle ( thePlayer, seat, jacked ) -- when a player enters a vehicle 
    if getElementType ( thePlayer ) == "player" then 
        if ( taxiVehs[getElementModel ( source )] ) and ( not taxiTeams[getPlayerTeam( thePlayer )] ) then -- if the vehicle is one of 4 police cars, and the skin is not a police skin 
            removePedFromVehicle( thePlayer )-- force the player out of the vehicle 
            outputChatBox("Only Taxi Drivers can drive this vehicle!", thePlayer) 
        end 
    end 
end 
addEventHandler ( "onVehicleEnter", getRootElement(), enterVehicle ) 
  
markers = { } 
blips = { } 
peds = { } 
  
function startJob ( thePlayer ) 
    local x, y, z = unpack ( pickups [ math.random ( #pickups ) ] ) 
    markers [ thePlayer ] = createMarker ( x, y, z, "cylinder", 5.0, 255, 0, 0, 0 ) 
    local skins = unpack ( pedCus [ math.random ( #pedCus ) ] ) 
    peds [ thePlayer ] = createPed( skins, x, y, z )   
    blips [ thePlayer ] = createBlipAttachedTo ( markers [ thePlayer ], 41 ) 
    addEventHandler ( "onMarkerHit", markers [ thePlayer ], warpit ) 
end 
  
function inVEH ( thePlayer ) 
    if ( getElementType ( thePlayer ) == "player" and isPedInVehicle ( thePlayer ) ) then 
        if ( getElementModel ( source ) == 420 ) then 
            startJob ( thePlayer ) 
        end 
    end 
end 
addEventHandler ( "onVehicleEnter", getRootElement(), inVEH ) 
  
function warpit ( thePlayer ) 
    if ( getElementType ( thePlayer ) == "player" and isPedInVehicle ( thePlayer ) ) then 
        local vehicle = getPedOccupiedVehicle ( thePlayer ) 
        if ( getElementModel ( vehicle ) == 420 ) then 
            setTimer ( warpPedIntoVehicle, 2000, 1, peds [ thePlayer ], vehicle, 2 ) 
            destroyJob ( thePlayer ) 
            local x, y, z = unpack ( dropoffss [ math.random ( #dropoffss ) ] ) 
            markers [ thePlayer ] = createMarker ( x, y, z - 1, "cylinder", 5.0, 255, 0, 0, 50 ) 
            blips [ thePlayer ] = createBlipAttachedTo ( markers [ thePlayer ], 41 ) 
            addEventHandler ( "onMarkerHit", markers [ thePlayer ], pickmeup ) 
        end 
    end 
end 
  
function pickmeup ( thePlayer ) 
    if ( getElementType ( thePlayer ) == "player" and isPedInVehicle ( thePlayer ) ) then 
        givePlayerMoney ( thePlayer, 500 ) 
        outputChatBox ( "You have earned $500!", thePlayer, 255, 124, 0 ) 
        destroyJob ( thePlayer ) 
        setTimer ( 
            function ( ) 
                if ( isElement ( peds [ thePlayer ] ) ) then 
                    destroyElement ( peds [ thePlayer ] ) 
                end 
                startJob ( thePlayer ) 
            end 
            ,3000, 1 
        ) 
    end 
end 
  
function deleteOnExit ( thePlayer ) 
    if ( isElement ( markers [ thePlayer ] ) ) then 
        destroyElement ( markers [ thePlayer ] ) 
    end 
    if ( isElement ( blips [ thePlayer ] ) ) then 
        destroyElement ( blips [ thePlayer ] ) 
    end 
    if ( isElement ( peds [ thePlayer ] ) ) then 
        destroyElement ( peds [ thePlayer ] ) 
    end 
end 
addEventHandler ( "onVehicleExit", getRootElement(), deleteOnExit ) 
  
function destroyJob ( thePlayer ) 
    if ( isElement ( markers [ thePlayer ] ) ) then 
        destroyElement ( markers [ thePlayer ] ) 
    end 
    if ( isElement ( blips [ thePlayer ] ) ) then 
        destroyElement( blips [ thePlayer ] ) 
    end 
end 

It works! Thank you, it is now released on the community! (Don't worry, you're in there too!

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