local markers = {
[1] = {9, 0, 376.960, -8.443, 1000.851};
[2] = {9, 1, 376.960, -8.443, 1000.851};
[3] = {9, 2, 376.960, -8.443, 1000.851};
[4] = {9, 3, 376.960, -8.443, 1000.851};
[5] = {9, 4, 376.960, -8.443, 1000.851};
[6] = {9, 6, 376.960, -8.443, 1000.851};
[7] = {9, 7, 376.960, -8.443, 1000.851};
[8] = {9, 8, 376.960, -8.443, 1000.851};
[9] = {9, 9, 376.960, -8.443, 1000.851};
[10] = {9, 10, 376.960, -8.443, 1000.851};
[11] = {9, 11, 376.960, -8.443, 1000.851};
[12] = {5, 1, 376.790, -131.844, 1000.492};
[13] = {5, 3, 376.790, -131.844, 1000.492};
[14] = {5, 4, 376.790, -131.844, 1000.492};
[15] = {5, 5, 376.790, -131.844, 1000.492};
[16] = {5, 6, 376.790, -131.844, 1000.492};
[17] = {5, 7, 376.790, -131.844, 1000.492};
[18] = {5, 8, 376.790, -131.844, 1000.492};
[19] = {5, 9, 376.790, -131.844, 1000.492};
[20] = {5, 10, 376.790, -131.844, 1000.492};
[21] = {5, 11, 376.790, -131.844, 1000.492};
[22] = {10, 0, 377.408, -74.636, 1000.507};
[23] = {10, 1, 377.408, -74.636, 1000.507};
[24] = {10, 2, 377.408, -74.636, 1000.507};
[25] = {10, 3, 377.408, -74.636, 1000.507};
[26] = {10, 4, 377.408, -74.636, 1000.507};
[27] = {10, 5, 377.408, -74.636, 1000.507};
[28] = {10, 6, 377.408, -74.636, 1000.507};
[29] = {10, 7, 377.408, -74.636, 1000.507};
[30] = {10, 8, 377.408, -74.636, 1000.507};
[31] = {10, 9, 377.408, -74.636, 1000.507};
[32] = {15, 5, 202.684, -104.479, 1004.140};
[33] = {15, 5, 202.684, -104.479, 1004.140};
[34] = {15, 6, 202.684, -104.479, 1004.140};
[35] = {15, 7, 202.684, -104.479, 1004.140};
[36] = {15, 8, 202.684, -104.479, 1004.140};
[37] = {5, 9, 207.338, -11.747, 1004.210};
[38] = {5, 10, 207.338, -11.747, 1004.210};
[39] = {5, 11, 207.338, -11.747, 1004.210};
[40] = {18, 1, 149.154, -73.947, 1000.804};
[41] = {18, 2, 149.154, -73.947, 1000.804};
[42] = {18, 3, 149.154, -73.947, 1000.804};
[43] = {18, 4, 149.154, -73.947, 1000.804};
[44] = {1, 1, 208.036, -34.857, 1000.929};
[45] = {1, 2, 208.036, -34.857, 1000.929};
[46] = {18, 1, -29.63, -89.36, 1002.54};
[47] = {18, 3, -29.63, -89.36, 1002.54};
[48] = {18, 99, -29.63, -89.36, 1002.54};
[49] = {4, 0, -28.04, -29.6, 1002.55};
[50] = {6, 0, -25.38, -54.62, 1002.54};
[51] = {6, 1, -25.38, -54.62, 1002.54};
[52] = {6, 5, -25.38, -54.62, 1002.54};
[53] = {6, 7, -25.38, -54.62, 1002.54}
}
local theMarkers = {}
crimtimer = {}
robmarker = {}
escapetimer = {}
function onStartCreateMarkers ()
for ID in pairs(markers) do
theMarkers[ID] = createMarker (markers[ID][3], markers[ID][4], markers[ID][5], "cylinder", 2.5, 255, 0, 0, 155)
setElementPosition ( theMarkers[ID], markers[ID][3], markers[ID][4], markers[ID][5] )
setElementInterior ( theMarkers[ID], markers[ID][1], markers[ID][3], markers[ID][4], markers[ID][5] )
setElementDimension ( theMarkers[ID], markers[ID][2] )
end
end
addEventHandler ( "onResourceStart", getRootElement(), onStartCreateMarkers)
function markerHit ( thePlayer, hitElement, matchingDimension )
if (theMarkers[ID]) then
local ID = theMarkers[source]
if (getElementType(hitElement) == thePlayer ) then
if (getTeamName(getPlayerTeam(thePlayer)) == "Criminals") then
outputDebugString ( "marker entered by a criminal" )
outputChatBox(thePlayer, "Use /robstore to rob this store!", 255, 0, 0) else
outputDebugString ( "marker entered by a non-criminal" )
end
end
end
end
addEventHandler ( "onClientMarkerHit", getRootElement(), markerHit )
function start ( thePlayer, matchingDimension )
getElementPosition( thePlayer )
if isElementWithinMarker(player, theMarkers[ID]) then
local x, y, z = getElementPosition( thePlayer )
local source = theMarkers[ID]
if (z > 1000 and z < 1010) then
if (getTeamName(getPlayerTeam(thePlayer)) == "Criminals") then
outputDebugString ( "rob has been triggered by a criminal" )
if isTimer(robmarker[source]) then
outputChatBox(player, "This store has recently been robbed, come back later.", 255, 0, 0) else
outputChatBox(player, "Robbery started! Stay alive for 3 minutes inside the shop, cops are warned!", 255, 0, 0)
robmarker[source] = setTimer (robtimer, 1800000, 1 ) -- 30 min
crimTimer[source] = setTimer ( crimtimer, 180000, 1 ) -- 3 min
for ID in pairs(themarkers[source]) do -- moet alleen marker worden in die ene shop die overvallen wordt
setMarkerSize ( theMarkers[source], 40)
end
end
end
end
end
end
addEventHandler ( "onClientMarkerHit", getRootElement(), start )
addCommandHandler ( "robstore", start )
function succes ( thePlayer, matchingDimension)
if isElementWithinMarker(player, theMarkers[source]) then
if isTimer(crimTimer[source]) then
outputChatBox(player, "You've left the store, robbery failed!", 255, 0, 0) else
escapeTimer[source] = setTimer ( escapetimer, 300000, 1 ) -- 5 min
outputChatBox(player, "Leave the store and survive 5 minutes without dieing/getting arrested to get the money!", 255, 0, 0)
if isTimer(escapetimer[source]) == false then
outputChatBox(player, "You have succesfully escaped, here's your money (the cops will still be looking for you)!", 255, 0, 0)
givePlayerMoney ( player, 5000 )
end
end
end
end
addEventHandler ("onClientMarkerLeave", getRootElement(), succes )
--moeten uitzoeken welke shop welke locatienaam moet krijgen (aangezien ..location.. ofzo vast niet werkt met interiors)
--(LOCAL) [2][CSG]UniQ: at the moment they start police gets a message