local artefakt = {} local spawny = { {2915.09,-980.56,11.85, nazwa="przy skokach do wody"}, {757.67,-1269.22,13.56, nazwa="na korcie do tenisa"}, --{497.76,-1048.86,137.58, nazwa="na antenie satelitarnej"}, {1127.27,-1446.12,15.80, nazwa="na patio"}, {1520.80,-2281.86,13.38, nazwa="na lotnisku"}, {1974.41,-1448.32,13.50, nazwa="na skateparku"}, {2027.34,-1399.35,37.21, nazwa="na budynku szpitala"}, {1749.58,-1423.09,34.81, nazwa="na jednym z blokowisk"}, {1456.96,-1793.90,75.07, nazwa="na 'pałacu kultury'"}, {962.08,-1374.11,26.59, nazwa="na jednym z billboardów"}, {2595.64,-1167.16,69.34, nazwa="na jednym z billboardów"}, {1865.68,-1270.84,43.64, nazwa="na jednym z billboardów"}, { 1075.60,-1207.15,30.40, nazwa="na jednym z billboardów"}, { 1355.02,-914.96,49.45, nazwa="na jednym z billboardów"}, {1870.49,-1225.20,106.36, nazwa="na rurociagu"}, {2745.03,-1610.28,106.46, nazwa="na rurociagu"}, {1999.25,-1875.79,106.3, nazwa="na rurociagu"}, {1045.96,-1711.66,106.24, nazwa="na rurociągu"}, {1470.80,-1803.01,113.89, nazwa="na wieżowcu"}, --{2541.59,-1579.38,40.12, nazwa="na domie na drzewie"}, {2561.03,-2136.90,-0.07, nazwa="na śluzie"}, {2201.07,-2327.20,33.71, nazwa="na dźwigu"}, {1999.25,-1875.79,106.3, nazwa="na rurociagu"}, {714.30,-1488.29,1.93, nazwa="na molo"}, {892.87,-1234.41,16.58, nazwa="przy wejściu do kanałów"}, {1459.04,-777.68,99.86, nazwa="na nadajniku"} } local ARTEFAKT_RESPAWN=1000*60*6 local artefaktstrefa = createColCuboid(131.54, -2883.89, 0.42, 2854, 2200, 138) local gsstrefa = createColCuboid(2233.50,-1726.28,11.5, 306.69, 97.36, 126) local checkpozagranica = false local checkpozaswiatem = false local checkwwolnejstrefie = false local odilugraczy = 10 addCommandHandler("artefakt", function(plr) local nosiciel=getElementAttachedTo(artefakt.marker) if nosiciel and isElement(nosiciel) and getElementType(nosiciel)=="player" then outputChatBox("Artefakt jest w posiadaniu gracza " .. getPlayerName(nosiciel), plr, 0,255,255) return elseif getElementDimension(artefakt.marker)>0 or getElementInterior(artefakt.marker)>0 then outputChatBox("Nie wiadomo gdzie jest artefakt.", plr, 0,255,255) return end local x,y,z=getElementPosition(artefakt.marker) local x0,y0,z0=getElementPosition(plr) local dist=getDistanceBetweenPoints3D(x,y,z,x0,y0,z0) outputChatBox(string.format("Artefakt znajduje się gdzieś w miescie Los Santos. Odległość: %dm", dist), plr, 0,255,255) end,false,false) local function spawnArtefakt() if artefakt.marker and isElement(artefakt.marker) then local nosiciel=getElementAttachedTo(artefakt.marker) if nosiciel then detachElements(artefakt.marker, nosiciel) -- detachElements(artefakt.blip, nosiciel) end destroyElement(artefakt.marker) end if artefakt.blip and isElement(artefakt.blip) then destroyElement(artefakt.blip) end local sp=spawny[math.random(1,#spawny)] artefakt.marker=createMarker(sp[1],sp[2],sp[3],"corona", 6, 255,255,255, 120) artefakt.lastSpawn=getTickCount() artefakt.lastPickup=getTickCount() outputChatBox("* Artefakt pojawia się " .. sp.nazwa .. ". Wpisz /artefakt", root, 0,255,255) --artefakt.blip=createBlipAttachedTo(artefakt.marker, 2, 255,255,255,255, 100, 99999) end local colorstep=0 local function artefaktCheck() colorstep=colorstep+2 local r,g,b=127 + (colorstep/8)%127,127 + (colorstep/4)%127,127 + colorstep%127 setMarkerColor(artefakt.marker, r,g,b,255) local nosiciel=getElementAttachedTo(artefakt.marker) if nosiciel and not isElement(nosiciel) then nosiciel=nil end if getTickCount()-artefakt.lastSpawn>ARTEFAKT_RESPAWN then if nosiciel then outputChatBox("* Artefakt postanawia Cię opuścić.", nosiciel, 0,255,255) setElementData(nosiciel, "haveArtefakt", false) exports["bp-core"]:reinitBlip(nosiciel) end spawnArtefakt() return end if nosiciel then setElementInterior(artefakt.marker, getElementInterior(nosiciel)) setElementDimension(artefakt.marker, getElementDimension(nosiciel)) if colorstep%64==0 then if getElementInterior(nosiciel)>0 or getElementDimension(nosiciel)>0 then if checkwwolnejstrefie or checkauto or checkpozaswiatem or checkpozagranica then return end if math.random(1,2)==1 then outputChatBox("* Czujesz dziwne mrowienie na plecach. Wyjdź stąd lub artefakt Cię opuści.", nosiciel, 0,255,255) setTimer(graczpozaswiatem, 6000, 1, nosiciel) checkpozaswiatem = true else outputChatBox("* Oblewa Cię zimny pot. Wyjdź stąd lub artefakt Cię opuści.", nosiciel, 0,255,255) setTimer(graczpozaswiatem, 6000, 1, nosiciel) checkpozaswiatem = true end return end local area=getElementData(nosiciel,"area") if area and area==1 then if checkwwolnejstrefie or checkauto or checkpozaswiatem or checkpozagranica then return end if math.random(1,2)==1 then outputChatBox("* Czujesz dziwne mrowienie na plecach. Opuść tę strefę lub artefakt Cię opuści.", nosiciel, 0,255,255) setTimer(graczwwolnejstrefie, 6000, 1, nosiciel) checkwwolnejstrefie = true else outputChatBox("* Oblewa Cię zimny pot. Opuść tę strefę lub artefakt Cię opuści.", nosiciel, 0,255,255) setTimer(graczwwolnejstrefie, 6000, 1, nosiciel) checkwwolnejstrefie = true end return end artefakt.lastSpawn=getTickCount() local ra=math.random(1,3) if ra==2 and getElementHealth(nosiciel)<100 then outputChatBox("* Artefakt ulecza Cię.", nosiciel, 0,255,255) setElementHealth(nosiciel, 100.0) elseif ra==3 and getPedArmor(nosiciel)<100 then outputChatBox("* Artefakt dodaje Ci armora.", nosiciel,0,255,255) setPedArmor(nosiciel, 100.0) end end end end local function artefaktCheck2() local nosiciel=getElementAttachedTo(artefakt.marker) if nosiciel then if getPlayerCount() < odilugraczy then spawnArtefakt() outputChatBox("* Tracisz artefakt z powodu małej ilości graczy.", nosiciel, 0, 255, 255) outputChatBox("* Gracz " .. getPlayerName(nosiciel) .. " traci artefakt z powodu małej ilości graczy.", root, 0, 255, 255) local x, y, z = getElementPosition(nosiciel) setElementData(nosiciel, "haveArtefakt", false) if getPedOccupiedVehicle(nosiciel) then blowVehicle(getPedOccupiedVehicle(nosiciel)) else createExplosion(x, y, z, 4) createExplosion(x+0.01, y, z, 4) createExplosion(x-0.01, y, z, 4) killPed(nosiciel) end return end if getElementInterior(nosiciel)>0 or getElementDimension(nosiciel)>0 then if checkwwolnejstrefie or checkauto or checkpozaswiatem or checkpozagranica then return end if math.random(1,2)==1 then outputChatBox("* Czujesz dziwne mrowienie na plecach. Wyjdź stąd lub artefakt Cię opuści.", nosiciel, 0,255,255) setTimer(graczpozaswiatem, 6000, 1, nosiciel) checkpozaswiatem = true else outputChatBox("* Oblewa Cię zimny pot. Wyjdź stąd lub artefakt Cię opuści.", nosiciel, 0,255,255) setTimer(graczpozaswiatem, 6000, 1, nosiciel) checkpozaswiatem = true end return end local area=getElementData(nosiciel,"area") if area and area==1 then if checkwwolnejstrefie or checkauto or checkpozaswiatem or checkpozagranica then return end if math.random(1,2)==1 then outputChatBox("* Czujesz dziwne mrowienie na plecach. Opuść tę strefę lub artefakt Cię opuści.", nosiciel, 0,255,255) setTimer(graczwwolnejstrefie, 6000, 1, nosiciel) checkwwolnejstrefie = true else outputChatBox("* Oblewa Cię zimny pot. Opuść tę strefę lub artefakt Cię opuści.", nosiciel, 0,255,255) setTimer(graczwwolnejstrefie, 6000, 1, nosiciel) checkwwolnejstrefie = true end return end end end spawnArtefakt() setTimer(artefaktCheck, 2000, 0) setTimer(artefaktCheck2, 4000, 0) local function artefaktBonus() local nosiciel=getElementAttachedTo(artefakt.marker) if nosiciel and not isElement(nosiciel) then nosiciel=nil end if not nosiciel then return end if getElementInterior(nosiciel)>0 or getElementDimension(nosiciel)>0 then if checkwwolnejstrefie or checkauto or checkpozaswiatem or checkpozagranica then return end if math.random(1,2)==1 then outputChatBox("* Czujesz dziwne mrowienie na plecach. Wyjdź stąd lub artefakt Cię opuści.", nosiciel, 0,255,255) setTimer(graczpozaswiatem, 6000, 1, nosiciel) checkpozaswiatem = true else outputChatBox("* Oblewa Cię zimny pot. Wyjdź stąd lub artefakt Cię opuści.", nosiciel, 0,255,255) setTimer(graczpozaswiatem, 6000, 1, nosiciel) checkpozaswiatem = true end return end local area=getElementData(nosiciel,"area") if area and area==1 then if checkwwolnejstrefie or checkauto or checkpozaswiatem or checkpozagranica then return end if math.random(1,2)==1 then outputChatBox("* Czujesz dziwne mrowienie na plecach. Opuść tę strefę lub artefakt Cię opuści.", nosiciel, 0,255,255) setTimer(graczwwolnejstrefie, 6000, 1, nosiciel) checkwwolnejstrefie = true else outputChatBox("* Oblewa Cię zimny pot. Opuść tę strefę lub artefakt Cię opuści.", nosiciel, 0,255,255) setTimer(graczwwolnejstrefie, 6000, 1, nosiciel) checkwwolnejstrefie = true end return end artefakt.lastSpawn=getTickCount() local baseTime = (getTickCount() -artefakt.lastPickup)/1000; if (baseTime>30*60) then baseTime=30*60 end; if isElementWithinColShape(nosiciel, gsstrefa) then local bonus=math.ceil(baseTime*math.sqrt(getPlayerCount())/400)+5 exports["bp-core"]:givePlayerScore(nosiciel, bonus) --setElementData(nosiciel, "Respekt", getElementData(nosiciel, "Respekt") + bonus) --outputChatBox("Otrzymałeś: " .. bonus .. " pkt. respektu.", nosiciel, 0, 255, 255) -- givePlayerMoney(nosiciel, baseTime*getPlayerCount()/4); outputChatBox("* Artefakt dodaje Ci respekt.", nosiciel, 0, 255,255) --outputDebugString("ARTEFAKT +" .. bonus) else local bonus=math.ceil(baseTime*math.sqrt(getPlayerCount())/400) exports["bp-core"]:givePlayerScore(nosiciel, bonus) --setElementData(nosiciel, "Respekt", getElementData(nosiciel, "Respekt") + bonus) --outputChatBox("Otrzymałeś: " .. bonus .. " pkt. respektu.", nosiciel, 0, 255, 255) -- givePlayerMoney(nosiciel, baseTime*getPlayerCount()/4); outputChatBox("* Artefakt dodaje Ci respekt.", nosiciel, 0, 255,255) --outputDebugString("ARTEFAKT +" .. bonus) end end setTimer(artefaktBonus, 1000*4*60, 0) addEventHandler("onMarkerHit", resourceRoot, function(el,md) if not md or getElementType(el)~="player" then return end if getPedOccupiedVehicle(el) then --outputChatBox("Aby podnieść artefakt, musisz opuścić pojazd.", el ,0,255,255) return end if (getElementData(el, "isGlued")) then --outputChatBox("Nie możesz podnieść artefaktu będąc przyklejonym!", el) return end local nosiciel=getElementAttachedTo(source) if not nosiciel or not isElement(nosiciel) then 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 if (getPlayerTeam(el,"frakcje")) then outputChatBox("Nie mozesz podniesc artefaktu bedac czlonkiem frakcji.",el) return end outputChatBox(getPlayerName(el) .. " podnosi artefakt. Wpisz /artefakt",root,0,255,255) outputChatBox(" ",root,0,255,255) outputChatBox("- Poruszaj się wyłącznie na obszarze miasta Los Santos",el,0,255,255) outputChatBox("- Unikaj stref bez DM",el,0,255,255) outputChatBox("- Możesz biegać pieszo, albo uzyj pojazdu Fiat 126p",el,0,255,255) setElementData(el, "haveArtefakt", true) artefakt.blip=createBlipAttachedTo(artefakt.marker, 25) attachElements( source, el) artefakt.lastPickup=getTickCount() setPlayerNametagColor (el, 0,255,255) --exports["bp-core"]:reinitBlip(player) else -- outputDebugString("Nosiciel: " .. getElementType(nosiciel)) end end) addEventHandler("onPlayerWasted", root, function() local nosiciel=getElementAttachedTo(artefakt.marker) if nosiciel and nosiciel==source then detachElements(artefakt.marker, source) artefakt.lastSpawn=getTickCount() destroyElement(artefakt.blip) outputChatBox(getPlayerName(source) .. " ginie i traci artefakt. Wpisz /artefakt",root,0,255,255) setElementData(source, "haveArtefakt", false) if getElementDimension(nosiciel)>0 or getElementInterior(nosiciel)>0 then spawnArtefakt() end end end) addEventHandler("onPlayerQuit", root, function() local nosiciel=getElementAttachedTo(artefakt.marker) if nosiciel==source then outputChatBox(getPlayerName(nosiciel) .. " wychodzi z serwera i traci artefakt. Wpisz /artefakt",root,0,255,255) spawnArtefakt() end end) addEventHandler("onPlayerJoin", getRootElement(), function() local nosiciel = getElementAttachedTo(artefakt.marker) if nosiciel or isElement(nosiciel) then attachElements(artefakt.marker, nosiciel) end end) addEventHandler ( "onColShapeLeave", artefaktstrefa, function( plr ) local nosiciel=getElementAttachedTo(artefakt.marker) if nosiciel==plr then if checkwwolnejstrefie or checkauto or checkpozaswiatem then return end setTimer(graczwstrefie, 4000, 1, plr) outputChatBox("Masz 4 sekundy na powrót do strefy Los Santos. Inaczej artefakt Cię opuści.", plr, 0, 255, 255) checkpozagranica = true --spawnArtefakt() end end) addEventHandler ( "onColShapeLeave", gsstrefa, function(el, md) local nosiciel=getElementAttachedTo(artefakt.marker) if nosiciel==el then if md then outputChatBox("* Opuszczasz strefę z dodatkowym bonusem.", el, 0, 255, 255) end end end) addEventHandler ( "onColShapeHit", gsstrefa, function(plr,md) local nosiciel=getElementAttachedTo(artefakt.marker) if nosiciel==plr then if md then outputChatBox("* Wchodzisz w strefę z dodatkowym bonusem.", plr, 0, 255, 255) end end end) function graczwstrefie(nosiciel) if checkwwolnejstrefie or checkpozaswiatem or checkauto then return end -- if not checkwwolnejstrefie then local x, y, z = getElementPosition(nosiciel) if x < 131.54 or x > 2985 or y < -2883 or y > -684 or z>138 or z<0 then spawnArtefakt() outputChatBox("* Opuszczasz strefę Los Santos. Artefakt postanawia Cię opuścić.", nosiciel, 0, 255, 255) outputChatBox("* Gracz " .. getPlayerName(nosiciel) .. " opuszcza strefę Los Santos i traci Artefakt.", root, 0, 255, 255) checkpozagranica = false setElementData(nosiciel, "haveArtefakt", false) if getPedOccupiedVehicle(nosiciel) then blowVehicle(getPedOccupiedVehicle(nosiciel)) else createExplosion(x, y, z, 4) createExplosion(x+0.01, y, z, 4) createExplosion(x-0.01, y, z, 4) killPed(nosiciel) end else outputChatBox("* Wróciłeś/aś do strefy Los Santos.", nosiciel, 0, 255, 255) checkpozagranica = false end --end end function graczpozaswiatem(nosiciel) local x, y, z = getElementPosition(nosiciel) if checkwwolnejstrefie or checkpozagranica or checkauto then return end local int = getElementInterior(nosiciel) local dim = getElementDimension(nosiciel) if dim > 0 or int > 0 then spawnArtefakt() outputChatBox("* Jesteś nieosiągalny/a. Artefakt postanawia Cię opuścić.", nosiciel, 0, 255, 255) outputChatBox("* Gracz " .. getPlayerName(nosiciel) .. " ginie i traci Artefakt.", root, 0, 255, 255) checkpozaswiatem = false setElementData(nosiciel, "haveArtefakt", false) if getPedOccupiedVehicle(nosiciel) then blowVehicle(getPedOccupiedVehicle(nosiciel)) else createExplosion(x, y, z, 4) createExplosion(x+0.01, y, z, 4) createExplosion(x-0.01, y, z, 4) killPed(nosiciel) end else checkpozaswiatem = false outputChatBox("* Jesteś ponownie osiągalny/a.", nosiciel, 0, 255, 255) end end function graczwwolnejstrefie(nosiciel) local x, y, z = getElementPosition(nosiciel) if checkpozagranica or checkpozaswiatem or checkauto then return end local area = getElementData(nosiciel, "area") if tonumber(area) == 1 then spawnArtefakt() outputChatBox("* Jesteś w wolnej strefie. Artefakt postanawia Cię opuścić.", nosiciel, 0, 255, 255) outputChatBox("* Gracz " .. getPlayerName(nosiciel) .. " ginie i traci Artefakt.", root, 0, 255, 255) checkwwolnejstrefie = false setElementData(nosiciel, "haveArtefakt", false) if getPedOccupiedVehicle(nosiciel) then blowVehicle(getPedOccupiedVehicle(nosiciel)) else createExplosion(x, y, z, 4) createExplosion(x+0.01, y, z, 4) createExplosion(x-0.01, y, z, 4) killPed(nosiciel) end else checkwwolnejstrefie = false outputChatBox("* Opuściłeś/aś wolną strefę.", nosiciel, 0, 255, 255) end end addEventHandler("onVehicleStartEnter", getRootElement(), function(plr, seat) local artefakt = getElementData(plr, "haveArtefakt") if artefakt ~= true then return end if getElementModel(source) == 496 then return end outputChatBox("* Nie możesz kierować tym autem kiedy posiadasz artefakt.", plr, 0, 255, 255) cancelEvent() end) function graczMaArtefakt(plr) local nosiciel=getElementAttachedTo(artefakt.marker) if nosiciel and nosiciel==plr then return true end return false end