Facebook
From Colossal Tamarin, 5 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 214
  1. --[[
  2.         Autor: Malentas
  3. ]]
  4.  
  5. local ziolo = createMarker(x,y,z, "cylinder", 2, 255, 255, 255, 100)
  6. local przerobka = createMarker(x,y,z, "cylinder", 2, 255, 255, 255, 100)
  7. local handel = createMarker(x,y,z, "cylinder", 2, 255, 255, 255, 100)
  8.  
  9. local timer1 = { }
  10. local timer2 = { }
  11.  
  12. local cenaziola = 1000
  13.  
  14. addEventHandler("onMarkerHit", ziolo, function(hit)
  15.         if getElementType(hit) ~= "player" then return end
  16.         outputChatBox("Rozpoczynasz zbieranie zioła...", hit)
  17.         timer1[hit] = setTimer(function()
  18.                 local ile = getElementData(hit, "ziolo") or 0
  19.                 setElementData(hit, "ziolo", ile+1)
  20.                 outputChatBox("Zbierasz +1 zioła", hit)
  21.         end, 5000, 0)
  22. end)
  23.  
  24. addEventHandler("onMarkeLeave", ziolo, function(hit)
  25.         if isTimer(timer1[hit]) then
  26.                 killTimer(timer1[hit])
  27.         end
  28. end)
  29.  
  30. addEventHandler("onMarkerHit", przerobka, function(hit)
  31.         if getElementType(hit) ~= "player" then return end
  32.         local ile1 = getElementData(hit, "ziolo") or 0
  33.         if ile1 <= 0 then outputChatBox("Nie posiadasz zioła do przerobienia.", hit) return end
  34.         outputChatBox("Rozpoczynasz przerabianie zioła...", hit)
  35.         timer2[hit] = setTimer(function()
  36.                 local ile1 = getElementData(hit, "ziolo") or 0
  37.                 if ile1 <= 0 then outputChatBox("Nie posiadasz już zioła do przerobienia.", hit) return end
  38.                 local ile2 = getElementData(hit, "przerobione:ziolo") or 0
  39.                 setElementData(hit, "przerobione:ziolo", ile2+1)
  40.                 setElementData(hit, "ziolo", ile1-1)
  41.                 outputChatBox("Przerobiłeś 1 zioło", hit)
  42.         end, 5000, 0)
  43. end)
  44.  
  45. addEventHandler("onMarkeLeave", przerobka, function(hit)
  46.         if isTimer(timer2[hit]) then
  47.                 killTimer(timer2[hit])
  48.         end
  49. end)
  50.  
  51. addEventHandler("onPlayerQuit", root, function()
  52.         if isTimer(timer1[source]) then
  53.                 killTimer(timer1[source])
  54.         end
  55.         if isTimer(timer2[source]) then
  56.                 killTimer(timer2[source])
  57.         end
  58. end)
  59.  
  60. addEventHandler("onMarkerHit", handel, function(hit)
  61.         if getElementType(hit) ~= "player" then return end
  62.         local ile = getElementData(hit, "przerobione:ziolo") or 0
  63.         if ile <= 0 then outputChatBox("Nie posiadasz przerobionego zioła.", hit) return end
  64.         givePlayerMoney(hit, ile*cenaziola)
  65.         outputChatBox("Za przerobione zioło otrzymujesz "..ile*cenaziola.." PLN", hit)
  66.         setElementData(hit, "przerobione:ziolo", 0)
  67. end)