- --[[
- Autor: Malentas
- ]]
- local ziolo = createMarker(x,y,z, "cylinder", 2, 255, 255, 255, 100)
- local przerobka = createMarker(x,y,z, "cylinder", 2, 255, 255, 255, 100)
- local handel = createMarker(x,y,z, "cylinder", 2, 255, 255, 255, 100)
- local timer1 = { }
- local timer2 = { }
- local cenaziola = 1000
- addEventHandler("onMarkerHit", ziolo, function(hit)
- if getElementType(hit) ~= "player" then return end
- outputChatBox("Rozpoczynasz zbieranie zioła...", hit)
- timer1[hit] = setTimer(function()
- local ile = getElementData(hit, "ziolo") or 0
- setElementData(hit, "ziolo", ile+1)
- outputChatBox("Zbierasz +1 zioła", hit)
- end, 5000, 0)
- end)
- addEventHandler("onMarkeLeave", ziolo, function(hit)
- if isTimer(timer1[hit]) then
- killTimer(timer1[hit])
- end
- end)
- addEventHandler("onMarkerHit", przerobka, function(hit)
- if getElementType(hit) ~= "player" then return end
- local ile1 = getElementData(hit, "ziolo") or 0
- if ile1 <= 0 then outputChatBox("Nie posiadasz zioła do przerobienia.", hit) return end
- outputChatBox("Rozpoczynasz przerabianie zioła...", hit)
- timer2[hit] = setTimer(function()
- local ile1 = getElementData(hit, "ziolo") or 0
- if ile1 <= 0 then outputChatBox("Nie posiadasz już zioła do przerobienia.", hit) return end
- local ile2 = getElementData(hit, "przerobione:ziolo") or 0
- setElementData(hit, "przerobione:ziolo", ile2+1)
- setElementData(hit, "ziolo", ile1-1)
- outputChatBox("Przerobiłeś 1 zioło", hit)
- end, 5000, 0)
- end)
- addEventHandler("onMarkeLeave", przerobka, function(hit)
- if isTimer(timer2[hit]) then
- killTimer(timer2[hit])
- end
- end)
- addEventHandler("onPlayerQuit", root, function()
- if isTimer(timer1[source]) then
- killTimer(timer1[source])
- end
- if isTimer(timer2[source]) then
- killTimer(timer2[source])
- end
- end)
- addEventHandler("onMarkerHit", handel, function(hit)
- if getElementType(hit) ~= "player" then return end
- local ile = getElementData(hit, "przerobione:ziolo") or 0
- if ile <= 0 then outputChatBox("Nie posiadasz przerobionego zioła.", hit) return end
- givePlayerMoney(hit, ile*cenaziola)
- outputChatBox("Za przerobione zioło otrzymujesz "..ile*cenaziola.." PLN", hit)
- setElementData(hit, "przerobione:ziolo", 0)
- end)