Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 26th, 2012  |  syntax: Lua  |  size: 5.42 KB  |  hits: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. local markers = {
  2. [1] = {9, 0, 376.960, -8.443, 1000.851};
  3. [2] = {9, 1, 376.960, -8.443, 1000.851};
  4. [3] = {9, 2, 376.960, -8.443, 1000.851};
  5. [4] = {9, 3, 376.960, -8.443, 1000.851};
  6. [5] = {9, 4, 376.960, -8.443, 1000.851};
  7. [6] = {9, 6, 376.960, -8.443, 1000.851};
  8. [7] = {9, 7, 376.960, -8.443, 1000.851};
  9. [8] = {9, 8, 376.960, -8.443, 1000.851};
  10. [9] = {9, 9, 376.960, -8.443, 1000.851};
  11. [10] = {9, 10, 376.960, -8.443, 1000.851};
  12. [11] = {9, 11, 376.960, -8.443, 1000.851};
  13. [12] = {5, 1, 376.790, -131.844, 1000.492};
  14. [13] = {5, 3, 376.790, -131.844, 1000.492};
  15. [14] = {5, 4, 376.790, -131.844, 1000.492};
  16. [15] = {5, 5, 376.790, -131.844, 1000.492};
  17. [16] = {5, 6, 376.790, -131.844, 1000.492};
  18. [17] = {5, 7, 376.790, -131.844, 1000.492};
  19. [18] = {5, 8, 376.790, -131.844, 1000.492};
  20. [19] = {5, 9, 376.790, -131.844, 1000.492};
  21. [20] = {5, 10, 376.790, -131.844, 1000.492};
  22. [21] = {5, 11, 376.790, -131.844, 1000.492};
  23. [22] = {10, 0, 377.408, -74.636, 1000.507};
  24. [23] = {10, 1, 377.408, -74.636, 1000.507};
  25. [24] = {10, 2, 377.408, -74.636, 1000.507};
  26. [25] = {10, 3, 377.408, -74.636, 1000.507};
  27. [26] = {10, 4, 377.408, -74.636, 1000.507};
  28. [27] = {10, 5, 377.408, -74.636, 1000.507};
  29. [28] = {10, 6, 377.408, -74.636, 1000.507};
  30. [29] = {10, 7, 377.408, -74.636, 1000.507};
  31. [30] = {10, 8, 377.408, -74.636, 1000.507};
  32. [31] = {10, 9, 377.408, -74.636, 1000.507};
  33. [32] = {15, 5, 202.684, -104.479, 1004.140};
  34. [33] = {15, 5, 202.684, -104.479, 1004.140};
  35. [34] = {15, 6, 202.684, -104.479, 1004.140};
  36. [35] = {15, 7, 202.684, -104.479, 1004.140};
  37. [36] = {15, 8, 202.684, -104.479, 1004.140};
  38. [37] = {5, 9, 207.338, -11.747, 1004.210};
  39. [38] = {5, 10, 207.338, -11.747, 1004.210};
  40. [39] = {5, 11, 207.338, -11.747, 1004.210};
  41. [40] = {18, 1, 149.154, -73.947, 1000.804};
  42. [41] = {18, 2, 149.154, -73.947, 1000.804};
  43. [42] = {18, 3, 149.154, -73.947, 1000.804};
  44. [43] = {18, 4, 149.154, -73.947, 1000.804};
  45. [44] = {1, 1, 208.036, -34.857, 1000.929};
  46. [45] = {1, 2, 208.036, -34.857, 1000.929};
  47. [46] = {18, 1, -29.63, -89.36, 1002.54};
  48. [47] = {18, 3, -29.63, -89.36, 1002.54};
  49. [48] = {18, 99, -29.63, -89.36, 1002.54};
  50. [49] = {4, 0, -28.04, -29.6, 1002.55};
  51. [50] = {6, 0, -25.38, -54.62, 1002.54};
  52. [51] = {6, 1, -25.38, -54.62, 1002.54};
  53. [52] = {6, 5, -25.38, -54.62, 1002.54};
  54. [53] = {6, 7, -25.38, -54.62, 1002.54}
  55. }
  56.  
  57. local theMarkers = {}
  58. crimtimer = {}
  59. robmarker = {}
  60. escapetimer = {}
  61.  
  62. function onStartCreateMarkers ()
  63.         for ID in pairs(markers) do
  64.         theMarkers[ID] = createMarker (markers[ID][3], markers[ID][4], markers[ID][5], "cylinder", 2.5, 255, 0, 0, 155)
  65.                 setElementPosition ( theMarkers[ID], markers[ID][3], markers[ID][4], markers[ID][5] )
  66.                 setElementInterior ( theMarkers[ID], markers[ID][1], markers[ID][3], markers[ID][4], markers[ID][5] )
  67.                 setElementDimension ( theMarkers[ID], markers[ID][2] )
  68.         end
  69. end
  70. addEventHandler ( "onResourceStart", getRootElement(), onStartCreateMarkers)
  71.  
  72. function markerHit ( thePlayer, hitElement, matchingDimension )
  73.         if (theMarkers[ID]) then
  74.                 local ID = theMarkers[source]
  75.                         if (getElementType(hitElement) == thePlayer ) then
  76.                                 if (getTeamName(getPlayerTeam(thePlayer)) == "Criminals") then
  77.                                 outputDebugString ( "marker entered by a criminal" )
  78.                                 outputChatBox(thePlayer, "Use /robstore to rob this store!", 255, 0, 0) else
  79.                                 outputDebugString ( "marker entered by a non-criminal" )
  80.                         end
  81.                 end
  82.         end
  83. end
  84. addEventHandler ( "onClientMarkerHit", getRootElement(), markerHit )
  85.  
  86. function start ( thePlayer, matchingDimension )
  87.                 getElementPosition( thePlayer )
  88.                 if isElementWithinMarker(player, theMarkers[ID]) then
  89.                 local x, y, z = getElementPosition( thePlayer )
  90.                 local source = theMarkers[ID]
  91.                         if (z > 1000 and z < 1010) then
  92.                                 if (getTeamName(getPlayerTeam(thePlayer)) == "Criminals") then
  93.                                 outputDebugString ( "rob has been triggered by a criminal" )
  94.                                         if isTimer(robmarker[source]) then
  95.                                                 outputChatBox(player, "This store has recently been robbed, come back later.", 255, 0, 0) else
  96.                                                 outputChatBox(player, "Robbery started! Stay alive for 3 minutes inside the shop, cops are warned!", 255, 0, 0)
  97.                                                 robmarker[source] = setTimer (robtimer, 1800000, 1 ) -- 30 min
  98.                                                 crimTimer[source] = setTimer ( crimtimer, 180000, 1 ) -- 3 min
  99.                                                 for ID in pairs(themarkers[source]) do -- moet alleen marker worden in die ene shop die overvallen wordt
  100.                                                 setMarkerSize ( theMarkers[source], 40)
  101.                                         end
  102.                                 end
  103.                         end
  104.                 end
  105.         end
  106. end
  107. addEventHandler ( "onClientMarkerHit", getRootElement(), start )
  108. addCommandHandler ( "robstore", start )
  109.  
  110. function succes ( thePlayer, matchingDimension)
  111.         if isElementWithinMarker(player, theMarkers[source]) then
  112.                 if isTimer(crimTimer[source]) then
  113.                         outputChatBox(player, "You've left the store, robbery failed!", 255, 0, 0) else
  114.                         escapeTimer[source]  = setTimer ( escapetimer, 300000, 1 ) -- 5 min
  115.                         outputChatBox(player, "Leave the store and survive 5 minutes without dieing/getting arrested to get the money!", 255, 0, 0)
  116.                                 if isTimer(escapetimer[source]) == false then
  117.                                         outputChatBox(player, "You have succesfully escaped, here's your money (the cops will still be looking for you)!", 255, 0, 0)
  118.                                         givePlayerMoney ( player, 5000 )
  119.                         end
  120.                 end
  121.         end
  122. end
  123. addEventHandler ("onClientMarkerLeave", getRootElement(), succes )
  124.  
  125. --moeten uitzoeken welke shop welke locatienaam moet krijgen (aangezien ..location.. ofzo vast niet werkt met interiors)
  126. --(LOCAL) [2][CSG]UniQ: at the moment they start police gets a message