Jump to content

Bank Rob [HELP]


Recommended Posts

marker1 = createMarker(1201,-1340,12.2,"cylinder",2,255,0,0,255) 
function bankRobStart(player) 
    local getPTeam = getTeamFromName("Criminals") 
    local playerTeam = getPlayerTeam(player) 
    if playerTeam == getPTeam then 
        if getElementType(player) == "player" then 
        outputChatBox("Stay on the marker for 5 seconds to finish bank robbing", player, 255,0,0) 
        theTime = setTimer (function() 
        givePlayerMoney(player, 50) 
        end, 5000, 0) 
        end 
    else 
        outputChatBox("You are not criminal", player, 255, 0, 0) 
    end 
end 
addEventHandler("onMarkerHit",marker1,bankRobStart) 
  
function killTime() 
    if isTimer(theTime) then 
        killTimer(theTime) 
    end 
end 
addEventHandler("onMarkerLeave", marker1, killTime) 
addEventHandler("onPlayerQuit", getRootElement(), killTime) 
addEventHandler("onPlayerWasted", getRootElement(), killTime) 

Example marker1.

Available for 10minutes. After that it gets destroy. Again, after 20 minutes from destruction. It spawns again for 10minutes. Need some help here.

Link to comment
setTimer(function() 
marker1 = createMarker(1201,-1340,12.2,"cylinder",2,255,0,0,255) 
end,30000,0) 

Here I made this but the other function

addEventHandler("onMarkerHit",marker1,bankRobStart) 

Error expected element on argument 2, got nil. Since I made the marker inside the setTimer function. the marker1 on argument 2 cant be called.

Link to comment
function startBR() 
brEnt = createMarker(1570.2,-1337.7,17,"arrow",1,0,255,0,255) 
outputChatBox("Bank is now open, you can rob it for 1 minute") 
setTimer(destroyElement,60000,1,brEnt) 
end 
addCommandHandler("br",startBR) 

So I have made this marker (entrance to bank rob), and disappears after 1 minute.

1) But what eventHandler should I use for it to start the function as soon as the server starts?

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