Advertisement
Guest User

kradzież.lua

a guest
Jun 16th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.50 KB | None | 0 0
  1. local vehID = 1
  2.  
  3. local kradziez = {
  4. pojazdy = {
  5. zwykle = {
  6. {589, 526, 587, 603, 475, 489},
  7. },
  8. premium = {
  9. {411, 506, 451, 560, 477, 559}
  10. },
  11. pozycje = {
  12. {1404.42, -2262.15, 13.01, 178.5},
  13. {2055.68, -1903.58, 13.03, 3.1},
  14. {2185.34, -1807.02, 12.82, 177.9},
  15. {2464.05, -1546.45, 23.48, 87.4},
  16. {2217.62, -1166.49, 25.21, 92.0},
  17. {2810.01, -1826.26, 9.41, 268.2},
  18. {1672.57, 1286.74, 10.28, 358.7},
  19. {2602.52, 1836.45, 10.31, 90.1},
  20. {2186.26, 1996.56, 10.31, 267.4},
  21. {1692.34, 2053.96, 10.73, 90.4},
  22. {1338.19, 326.24, 19.49, 245.4},
  23. {2397.03, -47.95, 26.70, 182.1},
  24. {311.22, -1808.01, 3.91, 179.0},
  25. {396.21, -2017.55, 7.27, 88.6},
  26. ---{1928.81,-1092.22,24.26,84.0},
  27. {1575.87, -1010.93, 23.39, 358.5},
  28. {2229.97, -1344.83, 23.47, 270.2},
  29. {2390.56, -1488.08, 23.31, 89.8},
  30. },
  31. },
  32. dziuple = {
  33. {2741.31, -2001.45, 13.04, 265.9},
  34. {1894.65, -1990.73, 13.03, 271.0},
  35. },
  36. wiadomosci = {
  37. {"KtoĹ› kradnie pojazd!"},
  38. {"Ktoś ukradł mój pojazd!"},
  39. {"Doszło do kradzieży, ktoś odjeżdża moim autem!"},
  40. }
  41. }
  42.  
  43. local function getPlayersByData(dataName, dataValue)
  44. local playersTable = {}
  45. for i,v in ipairs(getElementsByType("player")) do
  46. if getElementData(v, dataName) and getElementData(v, dataName) == "Policja" then
  47. table.insert(playersTable, v)
  48. end
  49. end
  50. return playersTable
  51. end
  52.  
  53. local marker = createMarker(0, 0, -100, "cylinder", 4, 255,0,0,100 )
  54. local col = createColSphere(0, 0, -100, 1.7)
  55. local nagroda
  56.  
  57. function stworzPojazd()
  58. local pojazd = math.random(1, 6)
  59. if pojazd >= 4 then
  60. vehicleModel = kradziez.pojazdy.premium
  61. nagroda = 25000
  62. else
  63. vehicleModel = kradziez.pojazdy.zwykle
  64. nagroda = 15000
  65. end
  66. local pozycja = math.random(1, #kradziez.pojazdy.pozycje)
  67. local dziupla = math.random(1, #kradziez.dziuple)
  68. local wiadomosc = math.random(1, #kradziez.wiadomosci)
  69.  
  70. local model,x,y,z,rx,ry,rz = vehicleModel[1][pojazd], kradziez.pojazdy.pozycje[pozycja][1], kradziez.pojazdy.pozycje[pozycja][2], kradziez.pojazdy.pozycje[pozycja][3]+0.3, 0, 0,kradziez.pojazdy.pozycje[pozycja][4]
  71.  
  72. --setElementPosition(marker, kradziez.dziuple[dziupla][1], kradziez.dziuple[dziupla][2], kradziez.dziuple[dziupla][3])
  73.  
  74. exports.DB:zapytanie(string.format("UPDATE lss_vehicles SET model=%d, przechowalnia=0, hp=1000, loc='"..x..","..y..","..z.."', rot='"..rx..","..ry..","..rz.."', przebieg=0, bak=25, locked=1, frozen=1, opis='(( "..getVehicleNameFromModel( model ).." ))' WHERE id=%d", model, vehID))
  75. exports["lss-vehicles"]:veh_reload(vehID)
  76.  
  77. for i,v in ipairs(getElementsByType("vehicle")) do
  78. local dbid=getElementData(v,"dbid")
  79. if getElementData( v, "dbid" ) == "1" then
  80. setElementData(v, "veh:gangkradziez:nagroda", nagroda)
  81. setElementData(v, "veh:gangkradziez:locked", true)
  82. attachElements( col, v )
  83. fixVehicle( v )
  84. end
  85. end
  86. for k, gangus in ipairs(getElementsByType("player")) do
  87. local character = getElementData(gangus, "character")
  88. if (character.co_id) then
  89. for i,v in ipairs(getElementsByType("vehicle")) do
  90. local dbid=getElementData(v,"dbid")
  91. if getElementData( v, "dbid" ) == "1" then
  92. local blip = createBlipAttachedTo(v, 41, 2, 255, 255, 255, 255, 0, 99999.0, gangus )
  93. cTimer = setTimer( function ()
  94. destroyElement( v )
  95. outputChatBox("Czas na dotarcie do pojazdu minął, event zakończony.", gangus, 255,0,0) -- DODAC USUWANIE BLIPA
  96. end, 15*60000, 1 )
  97. end
  98. end
  99.  
  100. outputChatBox("W "..getZoneName( kradziez.pojazdy.pozycje[pozycja][1], kradziez.pojazdy.pozycje[pozycja][2], kradziez.pojazdy.pozycje[pozycja][3], true ).." w okolicach "..getZoneName( kradziez.pojazdy.pozycje[pozycja][1], kradziez.pojazdy.pozycje[pozycja][2], kradziez.pojazdy.pozycje[pozycja][3] ).." pojawił się pojazd "..getVehicleNameFromModel(vehicleModel[1][pojazd]).. ", za który możemy zgarnąć łatwy hajs. Ukradnij go i przewieź do dziupli, uważaj na policję.", gangus, 255,0,0)
  101. outputChatBox("(( Pojazd oraz dziupla zostały oznaczone na mapie, po ukradnięciu pojazdu policja otrzyma zawiadomienie o kradzieży ))", gangus)
  102. end
  103. end
  104. end
  105.  
  106. addEventHandler("onVehicleStartEnter", root, function( kto, seat)
  107. local poj = source
  108. if getElementData(source, "dbid") == "1" then
  109. local character = getElementData(kto, "character")
  110. if (character.co_id) then
  111. if seat == 0 then
  112. if isVehicleLocked( source ) then
  113. cancelEvent()
  114. if isElementWithinColShape( kto, col ) then
  115. if isTimer(cTimer) then killTimer( cTimer ) end
  116. setPedAnimation ( kto, "CASINO", "dealone", 5000, true, false, false, false )
  117. setTimer(function () setVehicleLocked(poj, false) outputChatBox("(( Udało Ci się otworzyć zamek. ))", kto) setElementData(poj, "veh:gangkradziez:locked", false) end, 5000, 1)
  118. else
  119. outputChatBox("(( PodejdĹş do drzwi kierowcy. ))", kto)
  120. end
  121. end
  122. end
  123. end
  124. end
  125. end)
  126.  
  127. addEventHandler("onVehicleEnter", root, function( kto, seat)
  128. local poj = source
  129. if getElementData(source, "dbid") == "1" then
  130. if seat ~= 0 then return end
  131. local character = getElementData(kto, "character")
  132.  
  133. if (character.co_id) then
  134. if character.co_id == 6 then
  135. setElementPosition(marker,1883.16,-1983.38,12.5)
  136. elseif character.co_id == 5 then
  137. setElementPosition(marker,2750.65,-2002.26,12.5)
  138. else
  139. local dziupla = math.random(1, #kradziez.dziuple)
  140. setElementPosition(marker,kradziez.dziuple[dziupla][1], kradziez.dziuple[dziupla][2], kradziez.dziuple[dziupla][3])
  141. end
  142. local markerBlip = createBlipAttachedTo( marker, 24, 2, 255, 255, 255, 255, 0, 99999, kto)
  143. outputChatBox("Dostarcz pojazd do dziupli. Bądź ostrożny, policja otrzymała zawiadomienie o kradzieży.", kto, 255,0,0)
  144. outputChatBox("(( Dziupla jest oznaczona blipem 'D'. ))", kto)
  145. oTimer = setTimer( function ( )
  146. chuj, ile = getTimerDetails(oTimer)
  147. for k, gangus in ipairs(getElementsByType("player")) do
  148. local character = getElementData(gangus, "character")
  149. if (character.co_id) == 5 or (character.co_id) == 6 then
  150. outputChatBox("(( Czas na dostarczenie pojazdu do dziupli: "..ile.." minut. ))", gangus)
  151. end
  152. end
  153. end, 10*6000, 10 )
  154. vehTimer = setTimer( function ()
  155. for k, gangus in ipairs(getElementsByType("player")) do
  156. local character = getElementData(gangus, "character")
  157. if (character.co_id) == 5 or (character.co_id) == 6 then
  158. outputChatBox("(( Czas na dostarczenie pojazdu do dziupli minÄ…Ĺ‚. )).", gangus)
  159. outputChatBox("Nie zdążyliście na czas, pojazd przepadł.", gangus, 255,0,0)
  160. if getElementData(poj, "veh:blippd") ~= false then destroyElement( getElementData(poj, "veh:blippd") ) end
  161. for k,v in ipairs(getAttachedElements(marker)) do
  162. destroyElement(v)
  163. end
  164. for k,v in ipairs(getAttachedElements(poj)) do
  165. destroyElement(v)
  166. end
  167. destroyElement( marker )
  168. --destroyElement( col )
  169. destroyElement( poj )
  170. end
  171. end
  172. end, 10*60050, 1 )
  173. end
  174. end
  175. end)
  176.  
  177. addEventHandler("onMarkerHit", marker, function( kto )
  178. if getElementType( kto ) == "vehicle" then
  179. if getElementData(kto, "dbid") == "1" then
  180. local kierowca = getVehicleOccupant( kto, 0 )
  181. if kierowca then
  182. local character = getElementData(kierowca, "character")
  183. if (character.co_id) then
  184. if (character.co_id) == 5 then
  185. local nagrodaa = 120 -- tonumber(getElementData(kto, "veh:gangkradziez:nagroda"))+math.random(1337,2137)
  186. exports["lss-pojemniki"]:insertItemToContainer(14733, -1, 11, 0, "GotĂłwka")
  187. else
  188. exports["lss-pojemniki"]:insertItemToContainer(14094, -1, 11, 0, "GotĂłwka")
  189. end
  190. outputChatBox("Brawo! Dobra robota, udało Ci się dostarczyć pojazd do dziupli. Za tę robotę zgarneliśmy: chuj$!", kierowca, 255,0,0)
  191. outputChatBox("(( GotĂłwka dodana do sejfu organizacji. ))", kierowca)
  192. if isTimer( oTimer ) then killTimer( oTimer ) end
  193. if isTimer( vehTimer ) then killTimer( vehTimer ) end
  194. if getElementData(kto, "veh:blippd") ~= false then destroyElement( getElementData(kto, "veh:blippd") ) end
  195. for k,v in ipairs(getAttachedElements(marker)) do
  196. destroyElement(v)
  197. end
  198. for k,v in ipairs(getAttachedElements(kto)) do
  199. destroyElement(v)
  200. end
  201. destroyElement( kto )
  202. destroyElement( marker )
  203. end
  204. end
  205. end
  206. end
  207. end)
  208.  
  209. addEventHandler("onVehicleExplode", root, function( kto )
  210. local vehs = source
  211. if getElementData(source, "dbid") == "1" then
  212. if isTimer( oTimer ) then killTimer( oTimer ) end
  213. if isTimer( vehTimer ) then killTimer( vehTimer ) end
  214. if getElementData(source, "veh:blippd") ~= false then destroyElement( getElementData(source, "veh:blippd") ) end
  215. for k,v in ipairs(getAttachedElements(marker)) do
  216. destroyElement(v)
  217. end
  218. for k,v in ipairs(getAttachedElements(source)) do
  219. destroyElement(v)
  220. end
  221. destroyElement( col )
  222. destroyElement( marker )
  223. setTimer( function () destroyElement( vehs ) end, 60000, 1 )
  224. for k, gangus in ipairs(getElementsByType("player")) do
  225. local character = getElementData(gangus, "character")
  226. if (character.co_id) then
  227. if (character.co_id) == 5 or (character.co_id) == 6 then
  228. outputChatBox("(( Event zakończony, pojazd wybuchł. )))", gangus) -- CENA DODAC
  229. end
  230. end
  231. end
  232. end
  233. end)
  234.  
  235. stworzPojazd()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement