Jump to content

I need help with Job Markers


Qunix

Recommended Posts

I have been trying to make very basic job where you follow the markers and on the end you recieve 1$ and from that point the code just starts to repeat itself sending overflows and errors in the console.
Here is the script try it for yourself I started scripting 4 days ago. If you have and easier way to make this code or something else let me know I've been searching on the wiki, youtube and still nothing for the past 5 hours, im really frustrated...

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

addEventHandler('onPlayerJoin', root, function()

    spawnPlayer(source, 0, 0, 5)
    
    fadeCamera(source, true)
    
    setCameraTarget(source, source)
end)


local kamion = createVehicle(578, 10, 10, 4) -- kamion is in Croatian truck
function posao(source, command)
    local playerPos = getElementPosition(source)
    local vozilo = getElementModel(kamion) -- vozilo is in Croatian vehicle
    local vozac = getVehicleOccupant(kamion) --vozac is in Croatian driver
    local work = true
        if vozilo == 578 and vozac then
        outputChatBox("POSAO JE ZAPOCET")
        mx, my, mz = 22, 13, 3
        local marker = createMarker(mx, my, mz, "checkpoint", 2, 255, 0, 0, 255)
        addEventHandler('onPlayerMarkerHit', vozac, function()
        setElementPosition(marker, mx*0+44, my ,mz)
        addEventHandler('onPlayerMarkerHit', vozac, function()
        setElementPosition(marker, mx*0+88, my ,mz)
        addEventHandler('onPlayerMarkerHit', vozac, function()
        givePlayerMoney(vozac, 1)
        addEventHandler('onPlayerMarkerLeave', vozac, function()
        return --from this point the code just repeats itself
        end)
        end)
        end)
        end)
        end
end
addCommandHandler("posao", posao) --posao on Croatian stands for work or job 

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