Jump to content

Bank Rob [HELP]


Recommended Posts

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

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

Posted

Maybe I will just change the idea since it is too complicated :). The one I have to put setTimer and destroys is the marker entrance. The rob marker will just stay then.

Posted
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?

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