Facebook
From Abrupt Matamata, 5 Years ago, written in Lua.
Embed
Download Paste or View Raw
Hits: 235
  1. local artefakt = {}            
  2. local spawny = {
  3. {2915.09,-980.56,11.85, nazwa="przy skokach do wody"},
  4. {757.67,-1269.22,13.56, nazwa="na korcie do tenisa"},
  5. --{497.76,-1048.86,137.58, nazwa="na antenie satelitarnej"},
  6. {1127.27,-1446.12,15.80, nazwa="na patio"},
  7. {1520.80,-2281.86,13.38, nazwa="na lotnisku"},
  8. {1974.41,-1448.32,13.50, nazwa="na skateparku"},
  9. {2027.34,-1399.35,37.21, nazwa="na budynku szpitala"},
  10. {1749.58,-1423.09,34.81, nazwa="na jednym z blokowisk"},
  11. {1456.96,-1793.90,75.07, nazwa="na 'pałacu kultury'"},
  12. {962.08,-1374.11,26.59, nazwa="na jednym z billboardów"},
  13. {2595.64,-1167.16,69.34, nazwa="na jednym z billboardów"},
  14. {1865.68,-1270.84,43.64, nazwa="na jednym z billboardów"},
  15. { 1075.60,-1207.15,30.40, nazwa="na jednym z billboardów"},
  16. { 1355.02,-914.96,49.45, nazwa="na jednym z billboardów"},
  17. {1870.49,-1225.20,106.36, nazwa="na rurociagu"},
  18. {2745.03,-1610.28,106.46, nazwa="na rurociagu"},
  19. {1999.25,-1875.79,106.3, nazwa="na rurociagu"},
  20. {1045.96,-1711.66,106.24, nazwa="na rurociągu"},
  21. {1470.80,-1803.01,113.89, nazwa="na wieżowcu"},
  22. --{2541.59,-1579.38,40.12, nazwa="na domie na drzewie"},
  23. {2561.03,-2136.90,-0.07, nazwa="na śluzie"},
  24. {2201.07,-2327.20,33.71, nazwa="na dźwigu"},
  25. {1999.25,-1875.79,106.3, nazwa="na rurociagu"},
  26. {714.30,-1488.29,1.93, nazwa="na molo"},
  27. {892.87,-1234.41,16.58, nazwa="przy wejściu do kanałów"},
  28. {1459.04,-777.68,99.86, nazwa="na nadajniku"}
  29. }
  30.  
  31. local ARTEFAKT_RESPAWN=1000*60*6
  32.  
  33. local artefaktstrefa = createColCuboid(131.54, -2883.89, 0.42, 2854, 2200, 138)
  34. local gsstrefa = createColCuboid(2233.50,-1726.28,11.5, 306.69, 97.36, 126)
  35.  
  36. local checkpozagranica = false
  37. local checkpozaswiatem = false
  38. local checkwwolnejstrefie = false
  39.  
  40. local odilugraczy = 10
  41.  
  42. addCommandHandler("artefakt", function(plr)
  43.         local nosiciel=getElementAttachedTo(artefakt.marker)
  44.         if nosiciel and isElement(nosiciel) and getElementType(nosiciel)=="player" then
  45.                 outputChatBox("Artefakt jest w posiadaniu gracza " .. getPlayerName(nosiciel), plr, 0,255,255)
  46.                 return
  47.         elseif getElementDimension(artefakt.marker)>0 or getElementInterior(artefakt.marker)>0 then
  48.                 outputChatBox("Nie wiadomo gdzie jest artefakt.", plr, 0,255,255)
  49.                 return
  50.         end
  51.         local x,y,z=getElementPosition(artefakt.marker)
  52.         local x0,y0,z0=getElementPosition(plr)
  53.         local dist=getDistanceBetweenPoints3D(x,y,z,x0,y0,z0)
  54.         outputChatBox(string.format("Artefakt znajduje się gdzieś w miescie Los Santos. Odległość: %dm", dist), plr, 0,255,255)
  55. end,false,false)
  56.  
  57. local function spawnArtefakt()
  58.         if artefakt.marker and isElement(artefakt.marker) then
  59.                 local nosiciel=getElementAttachedTo(artefakt.marker)
  60.                 if nosiciel then
  61.                                         detachElements(artefakt.marker, nosiciel)
  62.                                 --      detachElements(artefakt.blip, nosiciel)                                
  63.                 end
  64.                                 destroyElement(artefakt.marker)                                                        
  65.         end
  66.         if artefakt.blip and isElement(artefakt.blip) then
  67.                 destroyElement(artefakt.blip)
  68.         end
  69.  
  70.  
  71.         local sp=spawny[math.random(1,#spawny)]
  72.         artefakt.marker=createMarker(sp[1],sp[2],sp[3],"corona", 6, 255,255,255, 120)
  73.         artefakt.lastSpawn=getTickCount()
  74.         artefakt.lastPickup=getTickCount()
  75.         outputChatBox("* Artefakt pojawia się " .. sp.nazwa .. ". Wpisz /artefakt", root, 0,255,255)
  76.         --artefakt.blip=createBlipAttachedTo(artefakt.marker, 2, 255,255,255,255, 100, 99999)
  77. end
  78.  
  79.  
  80. local colorstep=0
  81.  
  82. local function artefaktCheck()
  83.         colorstep=colorstep+2
  84.         local r,g,b=127 + (colorstep/8)%127,127 + (colorstep/4)%127,127 + colorstep%127
  85.         setMarkerColor(artefakt.marker, r,g,b,255)
  86.         local nosiciel=getElementAttachedTo(artefakt.marker)
  87.         if nosiciel and not isElement(nosiciel) then nosiciel=nil end
  88.         if getTickCount()-artefakt.lastSpawn>ARTEFAKT_RESPAWN then
  89.                 if nosiciel then
  90.                         outputChatBox("* Artefakt postanawia Cię opuścić.", nosiciel, 0,255,255)
  91.                                                 setElementData(nosiciel, "haveArtefakt", false)  
  92.                                                                                                 exports["bp-core"]:reinitBlip(nosiciel)
  93.                end
  94.                 spawnArtefakt()
  95.                 return
  96.        end
  97.         if nosiciel then
  98.                 setElementInterior(artefakt.marker, getElementInterior(nosiciel))
  99.                 setElementDimension(artefakt.marker, getElementDimension(nosiciel))
  100.                 if colorstep%64==0 then
  101.                                         if getElementInterior(nosiciel)>0 or getElementDimension(nosiciel)>0 then
  102.                                                         if checkwwolnejstrefie or checkauto or checkpozaswiatem or checkpozagranica then return end
  103.                                                                         if math.random(1,2)==1 then
  104.                                                                                         outputChatBox("* Czujesz dziwne mrowienie na plecach. Wyjdź stąd lub artefakt Cię opuści.", nosiciel, 0,255,255)
  105.                                                                                         setTimer(graczpozaswiatem, 6000, 1, nosiciel)
  106.                                                                                         checkpozaswiatem = true
  107.                                                                         else
  108.                                                                                         outputChatBox("* Oblewa Cię zimny pot. Wyjdź stąd lub artefakt Cię opuści.", nosiciel, 0,255,255)
  109.                                                                                         setTimer(graczpozaswiatem, 6000, 1, nosiciel)
  110.                                                                                         checkpozaswiatem = true
  111.                                                                         end
  112.                                                                         return
  113.                                         end
  114.                 local area=getElementData(nosiciel,"area")
  115.                                                 if area and area==1 then
  116.                                                                 if checkwwolnejstrefie or checkauto or checkpozaswiatem or checkpozagranica then return end
  117.                                                                                 if math.random(1,2)==1 then
  118.                                                                                                 outputChatBox("* Czujesz dziwne mrowienie na plecach. Opuść tę strefę lub artefakt Cię opuści.", nosiciel, 0,255,255)
  119.                                                                                                 setTimer(graczwwolnejstrefie, 6000, 1, nosiciel)
  120.                                                                                                 checkwwolnejstrefie = true
  121.                                                                                 else
  122.                                                                                                 outputChatBox("* Oblewa Cię zimny pot. Opuść tę strefę lub artefakt Cię opuści.", nosiciel, 0,255,255)
  123.                                                                                                 setTimer(graczwwolnejstrefie, 6000, 1, nosiciel)
  124.                                                                                                 checkwwolnejstrefie = true                                                                      
  125.                                                                                 end
  126.                                                                                 return
  127.                                 end
  128.  
  129.                 artefakt.lastSpawn=getTickCount()
  130.                 local ra=math.random(1,3)
  131.                 if ra==2 and getElementHealth(nosiciel)<100  then
  132.                         outputChatBox("* Artefakt ulecza Cię.", nosiciel, 0,255,255)
  133.                         setElementHealth(nosiciel, 100.0)
  134.                 elseif ra==3 and getPedArmor(nosiciel)<100 then
  135.                         outputChatBox("* Artefakt dodaje Ci armora.", nosiciel,0,255,255)
  136.                         setPedArmor(nosiciel, 100.0)
  137.                 end
  138.                 end
  139.         end
  140. end
  141. local function artefaktCheck2()
  142.         local nosiciel=getElementAttachedTo(artefakt.marker)
  143.         if nosiciel then
  144.                                         if getPlayerCount() < odilugraczy then
  145.                                                 spawnArtefakt()
  146.                                                 outputChatBox("* Tracisz artefakt z powodu małej ilości graczy.", nosiciel, 0, 255, 255)
  147.                                                 outputChatBox("* Gracz " .. getPlayerName(nosiciel) .. " traci artefakt z powodu małej ilości graczy.", root, 0, 255, 255)
  148.                                                 local x, y, z = getElementPosition(nosiciel)
  149.                                                                                                 setElementData(nosiciel, "haveArtefakt", false)  
  150.                                                         if getPedOccupiedVehicle(nosiciel) then
  151.                                                                         blowVehicle(getPedOccupiedVehicle(nosiciel))
  152.                                                         else
  153.                                                                         createExplosion(x, y, z, 4)
  154.                                                                         createExplosion(x+0.01, y, z, 4)        
  155.                                                                         createExplosion(x-0.01, y, z, 4)                                        
  156.                                                                         killPed(nosiciel)
  157.                                                         end                                            
  158.                                                 return
  159.                                         end
  160.                                         if getElementInterior(nosiciel)>0 or getElementDimension(nosiciel)>0 then
  161.                                                         if checkwwolnejstrefie or checkauto or checkpozaswiatem or checkpozagranica then return end
  162.                                                                         if math.random(1,2)==1 then
  163.                                                                                         outputChatBox("* Czujesz dziwne mrowienie na plecach. Wyjdź stąd lub artefakt Cię opuści.", nosiciel, 0,255,255)
  164.                                                                                         setTimer(graczpozaswiatem, 6000, 1, nosiciel)
  165.                                                                                         checkpozaswiatem = true
  166.                                                                         else
  167.                                                                                         outputChatBox("* Oblewa Cię zimny pot. Wyjdź stąd lub artefakt Cię opuści.", nosiciel, 0,255,255)
  168.                                                                                         setTimer(graczpozaswiatem, 6000, 1, nosiciel)
  169.                                                                                         checkpozaswiatem = true
  170.                                                                         end
  171.                                                                         return
  172.                                         end
  173.                 local area=getElementData(nosiciel,"area")
  174.                                                 if area and area==1 then
  175.                                                                 if checkwwolnejstrefie or checkauto or checkpozaswiatem or checkpozagranica then return end
  176.                                                                                 if math.random(1,2)==1 then
  177.                                                                                                 outputChatBox("* Czujesz dziwne mrowienie na plecach. Opuść tę strefę lub artefakt Cię opuści.", nosiciel, 0,255,255)
  178.                                                                                                 setTimer(graczwwolnejstrefie, 6000, 1, nosiciel)
  179.                                                                                                 checkwwolnejstrefie = true
  180.                                                                                 else
  181.                                                                                                 outputChatBox("* Oblewa Cię zimny pot. Opuść tę strefę lub artefakt Cię opuści.", nosiciel, 0,255,255)
  182.                                                                                                 setTimer(graczwwolnejstrefie, 6000, 1, nosiciel)
  183.                                                                                                 checkwwolnejstrefie = true                                                                      
  184.                                                                                 end
  185.                                                                                 return
  186.                                 end
  187.  
  188.                 end
  189.         end
  190.  
  191. spawnArtefakt()
  192.  
  193. setTimer(artefaktCheck, 2000, 0)
  194. setTimer(artefaktCheck2, 4000, 0)
  195.  
  196. local function artefaktBonus()
  197.         local nosiciel=getElementAttachedTo(artefakt.marker)
  198.         if nosiciel and not isElement(nosiciel) then nosiciel=nil end
  199.         if not nosiciel then return end
  200.  
  201.                                         if getElementInterior(nosiciel)>0 or getElementDimension(nosiciel)>0 then
  202.                                                         if checkwwolnejstrefie or checkauto or checkpozaswiatem or checkpozagranica then return end
  203.                                                                         if math.random(1,2)==1 then
  204.                                                                                         outputChatBox("* Czujesz dziwne mrowienie na plecach. Wyjdź stąd lub artefakt Cię opuści.", nosiciel, 0,255,255)
  205.                                                                                         setTimer(graczpozaswiatem, 6000, 1, nosiciel)
  206.                                                                                         checkpozaswiatem = true
  207.                                                                         else
  208.                                                                                         outputChatBox("* Oblewa Cię zimny pot. Wyjdź stąd lub artefakt Cię opuści.", nosiciel, 0,255,255)
  209.                                                                                         setTimer(graczpozaswiatem, 6000, 1, nosiciel)
  210.                                                                                         checkpozaswiatem = true
  211.                                                                         end
  212.                                                                         return
  213.                                                         end
  214.                 local area=getElementData(nosiciel,"area")
  215.                                                 if area and area==1 then
  216.                                                                 if checkwwolnejstrefie or checkauto or checkpozaswiatem or checkpozagranica then return end
  217.                                                                                 if math.random(1,2)==1 then
  218.                                                                                                 outputChatBox("* Czujesz dziwne mrowienie na plecach. Opuść tę strefę lub artefakt Cię opuści.", nosiciel, 0,255,255)
  219.                                                                                                 setTimer(graczwwolnejstrefie, 6000, 1, nosiciel)
  220.                                                                                                 checkwwolnejstrefie = true
  221.                                                                                 else
  222.                                                                                                 outputChatBox("* Oblewa Cię zimny pot. Opuść tę strefę lub artefakt Cię opuści.", nosiciel, 0,255,255)
  223.                                                                                                 setTimer(graczwwolnejstrefie, 6000, 1, nosiciel)
  224.                                                                                                 checkwwolnejstrefie = true                                                                      
  225.                                                                                 end
  226.                                                                                 return
  227.                                 end
  228.                 artefakt.lastSpawn=getTickCount()
  229.                 local baseTime = (getTickCount() -artefakt.lastPickup)/1000;
  230.                 if (baseTime>30*60) then baseTime=30*60 end;
  231.                                 if isElementWithinColShape(nosiciel, gsstrefa) then
  232.                                         local bonus=math.ceil(baseTime*math.sqrt(getPlayerCount())/400)+5
  233.                                         exports["bp-core"]:givePlayerScore(nosiciel, bonus)
  234.                                         --setElementData(nosiciel, "Respekt", getElementData(nosiciel, "Respekt") + bonus)
  235.                                         --outputChatBox("Otrzymałeś: " .. bonus .. " pkt. respektu.", nosiciel, 0, 255, 255)
  236. --                                        givePlayerMoney(nosiciel, baseTime*getPlayerCount()/4);
  237.                                         outputChatBox("* Artefakt dodaje Ci respekt.", nosiciel, 0, 255,255)
  238.                                         --outputDebugString("ARTEFAKT +" .. bonus)                                      
  239.                                 else
  240.                                         local bonus=math.ceil(baseTime*math.sqrt(getPlayerCount())/400)
  241.                                         exports["bp-core"]:givePlayerScore(nosiciel, bonus)
  242.                                         --setElementData(nosiciel, "Respekt", getElementData(nosiciel, "Respekt") + bonus)
  243.                                         --outputChatBox("Otrzymałeś: " .. bonus .. " pkt. respektu.", nosiciel, 0, 255, 255)
  244. --                                        givePlayerMoney(nosiciel, baseTime*getPlayerCount()/4);
  245.                                         outputChatBox("* Artefakt dodaje Ci respekt.", nosiciel, 0, 255,255)
  246.                                         --outputDebugString("ARTEFAKT +" .. bonus)
  247.                                 end
  248. end
  249.  
  250. setTimer(artefaktBonus, 1000*4*60, 0)
  251.  
  252.  
  253.  
  254. addEventHandler("onMarkerHit", resourceRoot, function(el,md)
  255.         if not md or getElementType(el)~="player" then return end
  256.         if getPedOccupiedVehicle(el) then
  257.              --outputChatBox("Aby podnieść artefakt, musisz opuścić pojazd.", el ,0,255,255)
  258.                 return
  259.         end
  260.                 if (getElementData(el, "isGlued")) then
  261.                         --outputChatBox("Nie możesz podnieść artefaktu będąc przyklejonym!", el)
  262.                         return
  263.                 end            
  264.         local nosiciel=getElementAttachedTo(source)
  265.         if not nosiciel or not isElement(nosiciel) then
  266.                         if getPlayerCount() < odilugraczy then outputChatBox("* Artefakt zablokowany z powodu małej ilości graczy. Uaktywnia się przy min 10 graczach online.", el, 0, 255, 255) return end
  267.                             if (getPlayerTeam(el,"frakcje"))         then
  268.                                     outputChatBox("Nie mozesz podniesc artefaktu bedac czlonkiem frakcji.",el)
  269.                                     return
  270.                             end
  271.                                 outputChatBox(getPlayerName(el) .. " podnosi artefakt. Wpisz /artefakt",root,0,255,255)
  272.                 outputChatBox(" ",root,0,255,255)
  273.                 outputChatBox("- Poruszaj się wyłącznie na obszarze miasta Los Santos",el,0,255,255)
  274.                 outputChatBox("- Unikaj stref bez DM",el,0,255,255)
  275.                 outputChatBox("- Możesz biegać pieszo, albo uzyj pojazdu Fiat 126p",el,0,255,255)
  276.                                 setElementData(el, "haveArtefakt", true)                                
  277.                 artefakt.blip=createBlipAttachedTo(artefakt.marker, 25)
  278.                 attachElements( source, el)
  279.                 artefakt.lastPickup=getTickCount()
  280.                                 setPlayerNametagColor (el, 0,255,255)
  281.                               --exports["bp-core"]:reinitBlip(player)
  282.         else
  283.  --                         outputDebugString("Nosiciel: " .. getElementType(nosiciel))
  284.         end
  285. end)
  286.  
  287.  
  288.  
  289. addEventHandler("onPlayerWasted", root, function()
  290.         local nosiciel=getElementAttachedTo(artefakt.marker)
  291.         if nosiciel and nosiciel==source then
  292.                 detachElements(artefakt.marker, source)
  293.                 artefakt.lastSpawn=getTickCount()
  294.                                 destroyElement(artefakt.blip)
  295.                 outputChatBox(getPlayerName(source) .. " ginie i traci artefakt. Wpisz /artefakt",root,0,255,255)
  296.                                                                 setElementData(source, "haveArtefakt", false)                          
  297.                 if getElementDimension(nosiciel)>0 or getElementInterior(nosiciel)>0 then
  298.                                         spawnArtefakt()
  299.                 end
  300.         end
  301. end)
  302.  
  303.  
  304.  
  305. addEventHandler("onPlayerQuit", root, function()
  306.                 local nosiciel=getElementAttachedTo(artefakt.marker)
  307.                 if nosiciel==source then
  308.                 outputChatBox(getPlayerName(nosiciel) .. " wychodzi z serwera i traci artefakt. Wpisz /artefakt",root,0,255,255)
  309.                                 spawnArtefakt()
  310.                 end
  311. end)
  312.  
  313.  
  314. addEventHandler("onPlayerJoin", getRootElement(), function()
  315.         local nosiciel = getElementAttachedTo(artefakt.marker)
  316.         if nosiciel or isElement(nosiciel) then
  317.                 attachElements(artefakt.marker, nosiciel)
  318.         end
  319.  end)
  320.  
  321. addEventHandler ( "onColShapeLeave", artefaktstrefa, function( plr )
  322.                 local nosiciel=getElementAttachedTo(artefakt.marker)
  323.                 if nosiciel==plr then
  324.                         if checkwwolnejstrefie or checkauto or checkpozaswiatem then return end
  325.                                 setTimer(graczwstrefie, 4000, 1, plr)
  326.                                 outputChatBox("Masz 4 sekundy na powrót do strefy Los Santos. Inaczej artefakt Cię opuści.", plr, 0, 255, 255)
  327.                                 checkpozagranica = true
  328.                                 --spawnArtefakt()
  329.                         end
  330. end)
  331.  
  332.  
  333.  
  334. addEventHandler ( "onColShapeLeave", gsstrefa, function(el, md)
  335.                 local nosiciel=getElementAttachedTo(artefakt.marker)
  336.                 if nosiciel==el then
  337.                                 if md then
  338.                                                 outputChatBox("* Opuszczasz strefę z dodatkowym bonusem.", el, 0, 255, 255)
  339.                                 end
  340.                 end
  341. end)
  342.  
  343. addEventHandler ( "onColShapeHit", gsstrefa, function(plr,md)
  344.                 local nosiciel=getElementAttachedTo(artefakt.marker)
  345.                 if nosiciel==plr then
  346.                                 if md then
  347.                                                 outputChatBox("* Wchodzisz w strefę z dodatkowym bonusem.", plr, 0, 255, 255)
  348.                                 end
  349.                 end
  350. end)
  351.  
  352.  
  353. function graczwstrefie(nosiciel)
  354.         if checkwwolnejstrefie or checkpozaswiatem or checkauto then return end
  355.         --      if not checkwwolnejstrefie then
  356.                         local x, y, z = getElementPosition(nosiciel)
  357.                         if x < 131.54 or x > 2985 or y < -2883 or y > -684 or z>138 or z<0 then
  358.                                 spawnArtefakt()
  359.                                 outputChatBox("* Opuszczasz strefę Los Santos. Artefakt postanawia Cię opuścić.", nosiciel, 0, 255, 255)
  360.                                 outputChatBox("* Gracz " .. getPlayerName(nosiciel) .. " opuszcza strefę Los Santos i traci Artefakt.", root, 0, 255, 255)
  361.                                 checkpozagranica = false
  362.                                                                 setElementData(nosiciel, "haveArtefakt", false)                                                        
  363.                                 if getPedOccupiedVehicle(nosiciel) then
  364.                                         blowVehicle(getPedOccupiedVehicle(nosiciel))
  365.                                 else
  366.                                         createExplosion(x, y, z, 4)
  367.                                         createExplosion(x+0.01, y, z, 4)        
  368.                                         createExplosion(x-0.01, y, z, 4)                                        
  369.                                         killPed(nosiciel)
  370.                                 end                            
  371.                 else
  372.                                 outputChatBox("* Wróciłeś/aś do strefy Los Santos.", nosiciel, 0, 255, 255)
  373.                                 checkpozagranica = false                        
  374.                 end
  375.         --end
  376. end
  377.  
  378. function graczpozaswiatem(nosiciel)
  379. local x, y, z = getElementPosition(nosiciel)
  380.         if checkwwolnejstrefie or checkpozagranica or checkauto then return end
  381.  
  382.                 local int = getElementInterior(nosiciel)
  383.                 local dim = getElementDimension(nosiciel)
  384.                 if dim > 0 or int > 0 then
  385.                                 spawnArtefakt()
  386.                                 outputChatBox("* Jesteś nieosiągalny/a. Artefakt postanawia Cię opuścić.", nosiciel, 0, 255, 255)
  387.                                 outputChatBox("* Gracz " .. getPlayerName(nosiciel) .. " ginie i traci Artefakt.", root, 0, 255, 255)
  388.                                 checkpozaswiatem = false
  389.                                                                 setElementData(nosiciel, "haveArtefakt", false)                                                        
  390.                                 if getPedOccupiedVehicle(nosiciel) then
  391.                                         blowVehicle(getPedOccupiedVehicle(nosiciel))
  392.                                 else
  393.                                         createExplosion(x, y, z, 4)
  394.                                         createExplosion(x+0.01, y, z, 4)        
  395.                                         createExplosion(x-0.01, y, z, 4)                                        
  396.                                         killPed(nosiciel)
  397.                                 end                            
  398.                 else
  399.                                 checkpozaswiatem = false
  400.                                 outputChatBox("* Jesteś ponownie osiągalny/a.", nosiciel, 0, 255, 255)
  401.                 end
  402. end
  403.  
  404. function graczwwolnejstrefie(nosiciel)
  405. local x, y, z = getElementPosition(nosiciel)
  406.         if checkpozagranica or checkpozaswiatem or checkauto then return end
  407.                 local area = getElementData(nosiciel, "area")
  408.                 if tonumber(area) == 1 then
  409.                                 spawnArtefakt()
  410.                                 outputChatBox("* Jesteś w wolnej strefie. Artefakt postanawia Cię opuścić.", nosiciel, 0, 255, 255)
  411.                                 outputChatBox("* Gracz " .. getPlayerName(nosiciel) .. " ginie i traci Artefakt.", root, 0, 255, 255)
  412.                                 checkwwolnejstrefie = false
  413.                                                                 setElementData(nosiciel, "haveArtefakt", false)
  414.                                 if getPedOccupiedVehicle(nosiciel) then
  415.                                         blowVehicle(getPedOccupiedVehicle(nosiciel))
  416.                                 else
  417.                                         createExplosion(x, y, z, 4)
  418.                                         createExplosion(x+0.01, y, z, 4)        
  419.                                         createExplosion(x-0.01, y, z, 4)                                        
  420.                                         killPed(nosiciel)
  421.                                 end
  422.                 else
  423.                                 checkwwolnejstrefie = false    
  424.                                 outputChatBox("* Opuściłeś/aś wolną strefę.", nosiciel, 0, 255, 255)
  425.                 end
  426.         end
  427.  
  428. addEventHandler("onVehicleStartEnter", getRootElement(), function(plr, seat)
  429. local artefakt = getElementData(plr, "haveArtefakt")
  430.  
  431.         if artefakt ~= true then return end
  432.                 if getElementModel(source) == 496 then return end
  433.                         outputChatBox("* Nie możesz kierować tym autem kiedy posiadasz artefakt.", plr, 0, 255, 255)
  434.                         cancelEvent()
  435. end)
  436.  
  437. function graczMaArtefakt(plr)
  438.         local nosiciel=getElementAttachedTo(artefakt.marker)
  439.         if nosiciel and nosiciel==plr then
  440.                 return true
  441.         end
  442.         return false
  443. end