Facebook
From Anorexic Capybara, 5 Years ago, written in Lua.
Embed
Download Paste or View Raw
Hits: 203
  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 getPlayerCount() < odilugraczy then return end
  59.         if artefakt.marker and isElement(artefakt.marker) then
  60.                 local nosiciel=getElementAttachedTo(artefakt.marker)
  61.                 if nosiciel then
  62.                                         detachElements(artefakt.marker, nosiciel)
  63.                                 --      detachElements(artefakt.blip, nosiciel)                                
  64.                 end
  65.                                 destroyElement(artefakt.marker)                                                        
  66.         end
  67.         if artefakt.blip and isElement(artefakt.blip) then
  68.                 destroyElement(artefakt.blip)
  69.         end
  70.  
  71.  
  72.         local sp=spawny[math.random(1,#spawny)]
  73.         artefakt.marker=createMarker(sp[1],sp[2],sp[3],"corona", 6, 255,255,255, 120)
  74.         artefakt.lastSpawn=getTickCount()
  75.         artefakt.lastPickup=getTickCount()
  76.         outputChatBox("* Artefakt pojawia się " .. sp.nazwa .. ". Wpisz /artefakt", root, 0,255,255)
  77.         --artefakt.blip=createBlipAttachedTo(artefakt.marker, 2, 255,255,255,255, 100, 99999)
  78. end
  79.  
  80.  
  81. local colorstep=0
  82.  
  83. local function artefaktCheck()
  84.         colorstep=colorstep+2
  85.         local r,g,b=127 + (colorstep/8)%127,127 + (colorstep/4)%127,127 + colorstep%127
  86.         setMarkerColor(artefakt.marker, r,g,b,255)
  87.         local nosiciel=getElementAttachedTo(artefakt.marker)
  88.         if nosiciel and not isElement(nosiciel) then nosiciel=nil end
  89.         if getTickCount()-artefakt.lastSpawn>ARTEFAKT_RESPAWN then
  90.                 if nosiciel then
  91.                         outputChatBox("* Artefakt postanawia Cię opuścić.", nosiciel, 0,255,255)
  92.                                                 setElementData(nosiciel, "haveArtefakt", false)  
  93.                                                 if getElementData(nosiciel, "vip") and not getElementData(nosiciel, "gang") then
  94.                                                         setPlayerNametagColor(nosiciel, 255, 255, 0)
  95.                                                 elseif getElementData(nosiciel, "gang") == "LSV" then
  96.                                                         setPlayerNametagColor(nosiciel, 60,0,102)
  97.                                                 elseif getElementData(nosiciel, "gang") == "BoS" then
  98.                                                         setPlayerNametagColor(nosiciel, 21,0,36)
  99.                                                 elseif getElementData(nosiciel, "gang") == "CoG" then
  100.                                                         setPlayerNametagColor(nosiciel, 192,102,255)
  101.                                                 elseif getElementData(nosiciel, "gang") == "SFR" then          
  102.                                                         setPlayerNametagColor(nosiciel, 36,0,61)
  103.                                                 elseif getElementData(nosiciel, "gang") == "TLH" then  
  104.                                                         setPlayerNametagColor(nosiciel, 234,204,255)
  105.                                                 else
  106.                                                         setPlayerNametagColor(nosiciel, 153,205,255)
  107.                                                 end
  108.                                                 exports["bp-core"]:reinitBlip(nosiciel)
  109.                end
  110.                 spawnArtefakt()
  111.                 return
  112.        end
  113.         if nosiciel then
  114.                 setElementInterior(artefakt.marker, getElementInterior(nosiciel))
  115.                 setElementDimension(artefakt.marker, getElementDimension(nosiciel))
  116.                 if colorstep%64==0 then
  117.                                         if getElementInterior(nosiciel)>0 or getElementDimension(nosiciel)>0 then
  118.                                                         if checkwwolnejstrefie or checkauto or checkpozaswiatem or checkpozagranica then return end
  119.                                                                         if math.random(1,2)==1 then
  120.                                                                                         outputChatBox("* Czujesz dziwne mrowienie na plecach. Wyjdź stąd lub artefakt Cię opuści.", nosiciel, 0,255,255)
  121.                                                                                         setTimer(graczpozaswiatem, 6000, 1, nosiciel)
  122.                                                                                         checkpozaswiatem = true
  123.                                                                         else
  124.                                                                                         outputChatBox("* Oblewa Cię zimny pot. Wyjdź stąd lub artefakt Cię opuści.", nosiciel, 0,255,255)
  125.                                                                                         setTimer(graczpozaswiatem, 6000, 1, nosiciel)
  126.                                                                                         checkpozaswiatem = true
  127.                                                                         end
  128.                                                                         return
  129.                                         end
  130.                 local area=getElementData(nosiciel,"area")
  131.                                                 if area and area==1 then
  132.                                                                 if checkwwolnejstrefie or checkauto or checkpozaswiatem or checkpozagranica then return end
  133.                                                                                 if math.random(1,2)==1 then
  134.                                                                                                 outputChatBox("* Czujesz dziwne mrowienie na plecach. Opuść tę strefę lub artefakt Cię opuści.", nosiciel, 0,255,255)
  135.                                                                                                 setTimer(graczwwolnejstrefie, 6000, 1, nosiciel)
  136.                                                                                                 checkwwolnejstrefie = true
  137.                                                                                 else
  138.                                                                                                 outputChatBox("* Oblewa Cię zimny pot. Opuść tę strefę lub artefakt Cię opuści.", nosiciel, 0,255,255)
  139.                                                                                                 setTimer(graczwwolnejstrefie, 6000, 1, nosiciel)
  140.                                                                                                 checkwwolnejstrefie = true                                                                      
  141.                                                                                 end
  142.                                                                                 return
  143.                                 end
  144.  
  145.                 artefakt.lastSpawn=getTickCount()
  146.                 local ra=math.random(1,3)
  147.                 if ra==2 and getElementHealth(nosiciel)<100  then
  148.                         outputChatBox("* Artefakt ulecza Cię.", nosiciel, 0,255,255)
  149.                         setElementHealth(nosiciel, 100.0)
  150.                 elseif ra==3 and getPedArmor(nosiciel)<100 then
  151.                         outputChatBox("* Artefakt dodaje Ci armora.", nosiciel,0,255,255)
  152.                         setPedArmor(nosiciel, 100.0)
  153.                 end
  154.                 end
  155.         end
  156. end
  157. local function artefaktCheck2()
  158.         local nosiciel=getElementAttachedTo(artefakt.marker)
  159.         if nosiciel then
  160.                                         if getPlayerCount() < odilugraczy then
  161.                                                 spawnArtefakt()
  162.                                                 outputChatBox("* Tracisz artefakt z powodu małej ilości graczy.", nosiciel, 0, 255, 255)
  163.                                                 outputChatBox("* Gracz " .. getPlayerName(nosiciel) .. " traci artefakt z powodu małej ilości graczy.", root, 0, 255, 255)
  164.                                                 local x, y, z = getElementPosition(nosiciel)
  165.                                                                                                 setElementData(nosiciel, "haveArtefakt", false)  
  166.                                                         if getPedOccupiedVehicle(nosiciel) then
  167.                                                                         blowVehicle(getPedOccupiedVehicle(nosiciel))
  168.                                                         else
  169.                                                                         createExplosion(x, y, z, 4)
  170.                                                                         createExplosion(x+0.01, y, z, 4)        
  171.                                                                         createExplosion(x-0.01, y, z, 4)                                        
  172.                                                                         killPed(nosiciel)
  173.                                                         end                                            
  174.                                                 return
  175.                                         end
  176.                                         if getElementInterior(nosiciel)>0 or getElementDimension(nosiciel)>0 then
  177.                                                         if checkwwolnejstrefie or checkauto or checkpozaswiatem or checkpozagranica then return end
  178.                                                                         if math.random(1,2)==1 then
  179.                                                                                         outputChatBox("* Czujesz dziwne mrowienie na plecach. Wyjdź stąd lub artefakt Cię opuści.", nosiciel, 0,255,255)
  180.                                                                                         setTimer(graczpozaswiatem, 6000, 1, nosiciel)
  181.                                                                                         checkpozaswiatem = true
  182.                                                                         else
  183.                                                                                         outputChatBox("* Oblewa Cię zimny pot. Wyjdź stąd lub artefakt Cię opuści.", nosiciel, 0,255,255)
  184.                                                                                         setTimer(graczpozaswiatem, 6000, 1, nosiciel)
  185.                                                                                         checkpozaswiatem = true
  186.                                                                         end
  187.                                                                         return
  188.                                         end
  189.                 local area=getElementData(nosiciel,"area")
  190.                                                 if area and area==1 then
  191.                                                                 if checkwwolnejstrefie or checkauto or checkpozaswiatem or checkpozagranica then return end
  192.                                                                                 if math.random(1,2)==1 then
  193.                                                                                                 outputChatBox("* Czujesz dziwne mrowienie na plecach. Opuść tę strefę lub artefakt Cię opuści.", nosiciel, 0,255,255)
  194.                                                                                                 setTimer(graczwwolnejstrefie, 6000, 1, nosiciel)
  195.                                                                                                 checkwwolnejstrefie = true
  196.                                                                                 else
  197.                                                                                                 outputChatBox("* Oblewa Cię zimny pot. Opuść tę strefę lub artefakt Cię opuści.", nosiciel, 0,255,255)
  198.                                                                                                 setTimer(graczwwolnejstrefie, 6000, 1, nosiciel)
  199.                                                                                                 checkwwolnejstrefie = true                                                                      
  200.                                                                                 end
  201.                                                                                 return
  202.                                 end
  203.  
  204.                 end
  205.         end
  206.  
  207. spawnArtefakt()
  208.  
  209. setTimer(artefaktCheck, 2000, 0)
  210. setTimer(artefaktCheck2, 4000, 0)
  211.  
  212. local function artefaktBonus()
  213.         local nosiciel=getElementAttachedTo(artefakt.marker)
  214.         if nosiciel and not isElement(nosiciel) then nosiciel=nil end
  215.         if not nosiciel then return end
  216.  
  217.                                         if getElementInterior(nosiciel)>0 or getElementDimension(nosiciel)>0 then
  218.                                                         if checkwwolnejstrefie or checkauto or checkpozaswiatem or checkpozagranica then return end
  219.                                                                         if math.random(1,2)==1 then
  220.                                                                                         outputChatBox("* Czujesz dziwne mrowienie na plecach. Wyjdź stąd lub artefakt Cię opuści.", nosiciel, 0,255,255)
  221.                                                                                         setTimer(graczpozaswiatem, 6000, 1, nosiciel)
  222.                                                                                         checkpozaswiatem = true
  223.                                                                         else
  224.                                                                                         outputChatBox("* Oblewa Cię zimny pot. Wyjdź stąd lub artefakt Cię opuści.", nosiciel, 0,255,255)
  225.                                                                                         setTimer(graczpozaswiatem, 6000, 1, nosiciel)
  226.                                                                                         checkpozaswiatem = true
  227.                                                                         end
  228.                                                                         return
  229.                                                         end
  230.                 local area=getElementData(nosiciel,"area")
  231.                                                 if area and area==1 then
  232.                                                                 if checkwwolnejstrefie or checkauto or checkpozaswiatem or checkpozagranica then return end
  233.                                                                                 if math.random(1,2)==1 then
  234.                                                                                                 outputChatBox("* Czujesz dziwne mrowienie na plecach. Opuść tę strefę lub artefakt Cię opuści.", nosiciel, 0,255,255)
  235.                                                                                                 setTimer(graczwwolnejstrefie, 6000, 1, nosiciel)
  236.                                                                                                 checkwwolnejstrefie = true
  237.                                                                                 else
  238.                                                                                                 outputChatBox("* Oblewa Cię zimny pot. Opuść tę strefę lub artefakt Cię opuści.", nosiciel, 0,255,255)
  239.                                                                                                 setTimer(graczwwolnejstrefie, 6000, 1, nosiciel)
  240.                                                                                                 checkwwolnejstrefie = true                                                                      
  241.                                                                                 end
  242.                                                                                 return
  243.                                 end
  244.                 artefakt.lastSpawn=getTickCount()
  245.                 local baseTime = (getTickCount() -artefakt.lastPickup)/1000;
  246.                 if (baseTime>30*60) then baseTime=30*60 end;
  247.                                 if isElementWithinColShape(nosiciel, gsstrefa) then
  248.                                         local bonus=math.ceil(baseTime*math.sqrt(getPlayerCount())/400)+5
  249.                                         exports["bp-core"]:givePlayerScore(nosiciel, bonus)
  250.                                         --setElementData(nosiciel, "Respekt", getElementData(nosiciel, "Respekt") + bonus)
  251.                                         --outputChatBox("Otrzymałeś: " .. bonus .. " pkt. respektu.", nosiciel, 0, 255, 255)
  252. --                                        givePlayerMoney(nosiciel, baseTime*getPlayerCount()/4);
  253.                                         outputChatBox("* Artefakt dodaje Ci respekt.", nosiciel, 0, 255,255)
  254.                                         --outputDebugString("ARTEFAKT +" .. bonus)                                      
  255.                                 else
  256.                                         local bonus=math.ceil(baseTime*math.sqrt(getPlayerCount())/400)
  257.                                         exports["bp-core"]:givePlayerScore(nosiciel, bonus)
  258.                                         --setElementData(nosiciel, "Respekt", getElementData(nosiciel, "Respekt") + bonus)
  259.                                         --outputChatBox("Otrzymałeś: " .. bonus .. " pkt. respektu.", nosiciel, 0, 255, 255)
  260. --                                        givePlayerMoney(nosiciel, baseTime*getPlayerCount()/4);
  261.                                         outputChatBox("* Artefakt dodaje Ci respekt.", nosiciel, 0, 255,255)
  262.                                         --outputDebugString("ARTEFAKT +" .. bonus)
  263.                                 end
  264. end
  265.  
  266. setTimer(artefaktBonus, 1000*4*60, 0)
  267.  
  268.  
  269.  
  270. addEventHandler("onMarkerHit", resourceRoot, function(el,md)
  271.         if not md or getElementType(el)~="player" then return end
  272.         if getPedOccupiedVehicle(el) then
  273.              --outputChatBox("Aby podnieść artefakt, musisz opuścić pojazd.", el ,0,255,255)
  274.                 return
  275.         end
  276.                 if (getElementData(el, "isGlued")) then
  277.                         --outputChatBox("Nie możesz podnieść artefaktu będąc przyklejonym!", el)
  278.                         return
  279.                 end            
  280.         local nosiciel=getElementAttachedTo(source)
  281.         if not nosiciel or not isElement(nosiciel) then
  282.                         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
  283.                             if (getPlayerTeam(el,"frakcje"))         then
  284.                                     outputChatBox("Nie mozesz podniesc artefaktu bedac czlonkiem frakcji.",el)
  285.                                     return
  286.                             end
  287.                                 outputChatBox(getPlayerName(el) .. " podnosi artefakt. Wpisz /artefakt",root,0,255,255)
  288.                 outputChatBox(" ",root,0,255,255)
  289.                 outputChatBox("- Poruszaj się wyłącznie na obszarze miasta Los Santos",el,0,255,255)
  290.                 outputChatBox("- Unikaj stref bez DM",el,0,255,255)
  291.                 outputChatBox("- Możesz biegać pieszo, albo uzyj pojazdu Fiat 126p",el,0,255,255)
  292.                                 setElementData(el, "haveArtefakt", true)                                
  293.                 artefakt.blip=createBlipAttachedTo(artefakt.marker, 25)
  294.                 attachElements( source, el)
  295.                 artefakt.lastPickup=getTickCount()
  296.                                 setPlayerNametagColor (el, 0,255,255)
  297.                               --exports["bp-core"]:reinitBlip(player)
  298.         else
  299.  --                         outputDebugString("Nosiciel: " .. getElementType(nosiciel))
  300.         end
  301. end)
  302.  
  303.  
  304.  
  305. addEventHandler("onPlayerWasted", root, function()
  306.         local nosiciel=getElementAttachedTo(artefakt.marker)
  307.         if nosiciel and nosiciel==source then
  308.                 detachElements(artefakt.marker, source)
  309.                 artefakt.lastSpawn=getTickCount()
  310.                                 destroyElement(artefakt.blip)
  311.                 outputChatBox(getPlayerName(source) .. " ginie i traci artefakt. Wpisz /artefakt",root,0,255,255)
  312.                                                                 setElementData(source, "haveArtefakt", false)                          
  313.                 if getElementDimension(nosiciel)>0 or getElementInterior(nosiciel)>0 then
  314.                                         spawnArtefakt()
  315.                 end
  316.         end
  317. end)
  318.  
  319.  
  320.  
  321. addEventHandler("onPlayerQuit", root, function()
  322.                 local nosiciel=getElementAttachedTo(artefakt.marker)
  323.                 if nosiciel==source then
  324.                 outputChatBox(getPlayerName(nosiciel) .. " wychodzi z serwera i traci artefakt. Wpisz /artefakt",root,0,255,255)
  325.                                 spawnArtefakt()
  326.                 end
  327. end)
  328.  
  329.  
  330. addEventHandler("onPlayerJoin", getRootElement(), function()
  331.         local nosiciel = getElementAttachedTo(artefakt.marker)
  332.         if nosiciel or isElement(nosiciel) then
  333.                 attachElements(artefakt.marker, nosiciel)
  334.         end
  335.  end)
  336.  
  337. addEventHandler ( "onColShapeLeave", artefaktstrefa, function( plr )
  338.                 local nosiciel=getElementAttachedTo(artefakt.marker)
  339.                 if nosiciel==plr then
  340.                         if checkwwolnejstrefie or checkauto or checkpozaswiatem then return end
  341.                                 setTimer(graczwstrefie, 4000, 1, plr)
  342.                                 outputChatBox("Masz 4 sekundy na powrót do strefy Los Santos. Inaczej artefakt Cię opuści.", plr, 0, 255, 255)
  343.                                 checkpozagranica = true
  344.                                 --spawnArtefakt()
  345.                         end
  346. end)
  347.  
  348.  
  349.  
  350. addEventHandler ( "onColShapeLeave", gsstrefa, function(el, md)
  351.                 local nosiciel=getElementAttachedTo(artefakt.marker)
  352.                 if nosiciel==el then
  353.                                 if md then
  354.                                                 outputChatBox("* Opuszczasz strefę z dodatkowym bonusem.", el, 0, 255, 255)
  355.                                 end
  356.                 end
  357. end)
  358.  
  359. addEventHandler ( "onColShapeHit", gsstrefa, function(plr,md)
  360.                 local nosiciel=getElementAttachedTo(artefakt.marker)
  361.                 if nosiciel==plr then
  362.                                 if md then
  363.                                                 outputChatBox("* Wchodzisz w strefę z dodatkowym bonusem.", plr, 0, 255, 255)
  364.                                 end
  365.                 end
  366. end)
  367.  
  368.  
  369. function graczwstrefie(nosiciel)
  370.         if checkwwolnejstrefie or checkpozaswiatem or checkauto then return end
  371.         --      if not checkwwolnejstrefie then
  372.                         local x, y, z = getElementPosition(nosiciel)
  373.                         if x < 131.54 or x > 2985 or y < -2883 or y > -684 or z>138 or z<0 then
  374.                                 spawnArtefakt()
  375.                                 outputChatBox("* Opuszczasz strefę Los Santos. Artefakt postanawia Cię opuścić.", nosiciel, 0, 255, 255)
  376.                                 outputChatBox("* Gracz " .. getPlayerName(nosiciel) .. " opuszcza strefę Los Santos i traci Artefakt.", root, 0, 255, 255)
  377.                                 checkpozagranica = false
  378.                                                                 setElementData(nosiciel, "haveArtefakt", false)                                                        
  379.                                 if getPedOccupiedVehicle(nosiciel) then
  380.                                         blowVehicle(getPedOccupiedVehicle(nosiciel))
  381.                                 else
  382.                                         createExplosion(x, y, z, 4)
  383.                                         createExplosion(x+0.01, y, z, 4)        
  384.                                         createExplosion(x-0.01, y, z, 4)                                        
  385.                                         killPed(nosiciel)
  386.                                 end                            
  387.                 else
  388.                                 outputChatBox("* Wróciłeś/aś do strefy Los Santos.", nosiciel, 0, 255, 255)
  389.                                 checkpozagranica = false                        
  390.                 end
  391.         --end
  392. end
  393.  
  394. function graczpozaswiatem(nosiciel)
  395. local x, y, z = getElementPosition(nosiciel)
  396.         if checkwwolnejstrefie or checkpozagranica or checkauto then return end
  397.  
  398.                 local int = getElementInterior(nosiciel)
  399.                 local dim = getElementDimension(nosiciel)
  400.                 if dim > 0 or int > 0 then
  401.                                 spawnArtefakt()
  402.                                 outputChatBox("* Jesteś nieosiągalny/a. Artefakt postanawia Cię opuścić.", nosiciel, 0, 255, 255)
  403.                                 outputChatBox("* Gracz " .. getPlayerName(nosiciel) .. " ginie i traci Artefakt.", root, 0, 255, 255)
  404.                                 checkpozaswiatem = false
  405.                                                                 setElementData(nosiciel, "haveArtefakt", false)                                                        
  406.                                 if getPedOccupiedVehicle(nosiciel) then
  407.                                         blowVehicle(getPedOccupiedVehicle(nosiciel))
  408.                                 else
  409.                                         createExplosion(x, y, z, 4)
  410.                                         createExplosion(x+0.01, y, z, 4)        
  411.                                         createExplosion(x-0.01, y, z, 4)                                        
  412.                                         killPed(nosiciel)
  413.                                 end                            
  414.                 else
  415.                                 checkpozaswiatem = false
  416.                                 outputChatBox("* Jesteś ponownie osiągalny/a.", nosiciel, 0, 255, 255)
  417.                 end
  418. end
  419.  
  420. function graczwwolnejstrefie(nosiciel)
  421. local x, y, z = getElementPosition(nosiciel)
  422.         if checkpozagranica or checkpozaswiatem or checkauto then return end
  423.                 local area = getElementData(nosiciel, "area")
  424.                 if tonumber(area) == 1 then
  425.                                 spawnArtefakt()
  426.                                 outputChatBox("* Jesteś w wolnej strefie. Artefakt postanawia Cię opuścić.", nosiciel, 0, 255, 255)
  427.                                 outputChatBox("* Gracz " .. getPlayerName(nosiciel) .. " ginie i traci Artefakt.", root, 0, 255, 255)
  428.                                 checkwwolnejstrefie = false
  429.                                                                 setElementData(nosiciel, "haveArtefakt", false)
  430.                                 if getPedOccupiedVehicle(nosiciel) then
  431.                                         blowVehicle(getPedOccupiedVehicle(nosiciel))
  432.                                 else
  433.                                         createExplosion(x, y, z, 4)
  434.                                         createExplosion(x+0.01, y, z, 4)        
  435.                                         createExplosion(x-0.01, y, z, 4)                                        
  436.                                         killPed(nosiciel)
  437.                                 end
  438.                 else
  439.                                 checkwwolnejstrefie = false    
  440.                                 outputChatBox("* Opuściłeś/aś wolną strefę.", nosiciel, 0, 255, 255)
  441.                 end
  442.         end
  443.  
  444. addEventHandler("onVehicleStartEnter", getRootElement(), function(plr, seat)
  445. local artefakt = getElementData(plr, "haveArtefakt")
  446.  
  447.         if artefakt ~= true then return end
  448.                 if getElementModel(source) == 496 then return end
  449.                         outputChatBox("* Nie możesz kierować tym autem kiedy posiadasz artefakt.", plr, 0, 255, 255)
  450.                         cancelEvent()
  451. end)
  452.  
  453. function graczMaArtefakt(plr)
  454.         local nosiciel=getElementAttachedTo(artefakt.marker)
  455.         if nosiciel and nosiciel==plr then
  456.                 return true
  457.         end
  458.         return false
  459. end