local bankCol = createColCircle(1583.03,-1323.5,15) timers = {} function AntiBank(player, matching) if matching and getElementType(player) ~= "vehicle" then if (getTeamName(getPlayerTeam(player)) == "Criminals") then if(not exports.SANLcrime:getTimeLeftForBankRob()) then if(exports.SANLcrime:hasBankJustBeenRobed()) then exports.SANLcommands:sendMessage("The bank is robbable. You may enter on duty.",player,255,0,0) return else timers[player] = setTimer(takePlayerHealth,10000,0,player,20) exports.SANLcommands:sendMessage("The bank is not robbable. You will continue to lose health/gain stars until you leave the area and come back off duty. *ENDING SHIFT WHILE IN THE AREA WILL NOT STOP THE TIMER*",player,255,0,0) end end end end end addEventHandler("onColShapeHit",bankCol,AntiBank) function takePlayerHealth(player, health) setElementHealth(player, tonumber(getElementHealth(player))-tonumber(health)) exports.SANLpoliceDatabase:recordCrime(player, 4) end function killTimers(player, matching) if matching and getElementType(player) ~= "vehicle" then if isTimer(timers[player]) then killTimer(timers[player]) end return else if matching and getElementType(player) == "vehicle" then if isTimer(timers[player]) then killTimer(timers[player]) end end end end addEventHandler("onColShapeLeave",bankCol,killTimers) function offduty(player, matching) if matching and getElementType(player) == "player" then if(getTeamName(getPlayerTeam(player)) ~= "Criminals") then if isTimer(timers[player]) then killTimer(timers[player]) end end end end addEventHandler("onColShapeHit",bankCol,offduty)