addEventHandler("onClientMarkerHit", rozpoczecie, function(gracz)
if gracz ~= localPlayer then return end
if getPedOccupiedVehicle(localPlayer) then return end
if getElementData(localPlayer, "pracuje") then
if getElementData(localPlayer, "pracuje") ~= "kosiarki" then exports["np-notyfikacje"]:noti("Posiadasz inn? aktywn? prace!", "error") return end
end
addEventHandler("onClientRender", root, guistart)
okno1 = true
showCursor(true)
triggerServerEvent("pokazTopke:kosiarki:source", localPlayer)
end)
local font = dxCreateFont("cz.ttf", 10)
local font2 = dxCreateFont("cz.ttf", 12)
local font = dxCreateFont("cz.ttf", 10)
local font2 = dxCreateFont("cz.ttf", 12)
local pracownicy = { }
local listaulepszen = {
{"Pojemniejsza kosiarka", "Dzi?ki temu twoja kosiarka ma wieksz? pojemno?? kosza", 500, "dolar.png"},
{"Zarobek +5%", "Dzi?ki temu ulepszeniu zarabiasz wi?cej o 5%", 700, "dolar.png"},
}
addEventHandler("onClientClick", root, function(btn, state)
if btn == "left" and state == "down" then
if mysz(scale_x(729), scale_y(592), scale_x(139), scale_y(44)) and okno1 == true and ulepszenia == false then
if getElementData(localPlayer, "pracuje") == "kosiarki" then
zakonczprace()
else
rozpocznijprace()
end
elseif mysz(scale_x(889), scale_y(592), scale_x(139), scale_y(44)) and okno1 == true and ulepszenia == false then
ulepszenia = true
elseif mysz(scale_x(1010), scale_y(261), scale_x(16), scale_y(16)) and okno1 == true and ulepszenia == false then
removeEventHandler("onClientRender", root, guistart)
okno1 = false
showCursor(false)
elseif mysz(scale_x(1011), scale_y(262), scale_x(16), scale_y(16)) and okno1 == true and ulepszenia == true then
ulepszenia = false
end
for i, v in ipairs(listaulepszen) do
local dodatekY = (scale_y(72))*(i-1)
if mysz(scale_x(904), scale_y(312)+dodatekY, scale_x(113), scale_y(38)) and okno1 == true and ulepszenia == true then
local punkty = getElementData(localPlayer, "kospunkty") or 0
if punkty < tonumber(v[3]) then exports["np-notyfikacje"]:noti("Posiadasz za ma?o punkt?w by zakupi? to ulepszenie", "error") return end
if v[1] == "Pojemniejsza kosiarka" then
if getElementData(localPlayer, "kosiarki:ulepszenie1") == 1 then exports["np-notyfikacje"]:noti("Posiadasz ju? to ulepszenie", "error") return end
setElementData(localPlayer, "kosiarki:ulepszenie1", 1)
elseif v[1] == "Zarobek +5%" then
if getElementData(localPlayer, "kosiarki:ulepszenie2") == 1 then exports["np-notyfikacje"]:noti("Posiadasz ju? to ulepszenie", "error") return end
setElementData(localPlayer, "kosiarki:ulepszenie2", 1)
end
exports["np-notyfikacje"]:noti("Zakupujesz ulepszenie: "..v[1])
setElementData(localPlayer, "kospunkty", punkty-tonumber(v[3]))
end
end
end
end)
function rozpocznijprace()
setElementData(localPlayer, "pracuje", "kosiarki")
triggerServerEvent("dajKosiarke:kosiarki", localPlayer)
losuj()
zaladunek = 0
removeEventHandler("onClientRender", root, guistart)
okno1 = false
showCursor(false)
wyladunek = createMarker(735.11, -1303.03, 13.57-.95, "cylinder", 2, 25, 131)
addEventHandler("onClientMarkerHit", wyladunek, function(gracz)
if gracz ~= localPlayer then return end
if not getPedOccupiedVehicle(localPlayer) then return end
if getElementData(localPlayer, "kosiarki:ulepszenie1") == 1 then
ilosc = 500
else
ilosc = 250
end
if zaladunek ~= ilosc then return end
if ilosc == 250 then
zarobek = math.random(70, 90)
elseif ilosc == 500 then
zarobek = math.random(100, 40)
end
if getElementData(localPlayer, "premium") then
zarobek = zarobek + zarobek*0.15
end
if getElementData(localPlayer, "kosiarki:ulepszenie1") == 2 then
zarobek = zarobek + zarobek*0.05
end
local nagroda = math.random(1, 5)
if tonumber(nagroda) == 5 then
local los2 = math.random(1, 3)
if getElementData(localPlayer, "premium") then
los2 = math.random(2, 6)
end
setElementData(localPlayer, "punkty", getElementData(localPlayer, "punkty")+los2)
exports["np-notyfikacje"]:noti("Za dobr? prace otrzymujesz "..los2.." RP")
end
local zarobek2 = string.format("%1d", zarobek)
setElementData(localPlayer, "pieniadze", getElementData(localPlayer, "pieniadze")+zarobek2)
exports["np-notyfikacje"]:noti("Wy?adowa?e? trawe zarabiasz "..zarobek2.." PLN")
dostal_powiadomienie = false;
zaladunek = 0
local los = math.random(1,3)
local pkt = getElementData(localPlayer, "kospunkty") or 0
setElementData(localPlayer, "kospunkty", pkt+los)
end)
end
function zakonczprace()
setElementData(localPlayer, "pracuje", false)
triggerServerEvent("usunKosiarke:kosiarki", localPlayer)
for i, v in ipairs(getElementsByType("marker")) do
if getElementData(v, "element") then
destroyElement(getElementData(v, "element"))
destroyElement(v)
end
end
destroyElement(wyladunek)
end
local miejsca = {
{773.27, -1295.40, 13.56},
{752.78, -1295.84, 13.57},
{752.78, -1253.25, 13.56},
{774.34, -1253.13, 13.56},
}
function losuj()
trawy = 0
local los = miejsca[math.random(#miejsca)]
for i = 1, 30 do
local add = i
obj = createObject(818, los[1], los[2]+add, los[3]-2)
setObjectScale(obj, 0.5)
marker = createMarker(los[1], los[2]+add, los[3], "corona", 0.8, 255, 255, 255, 0)
setElementData(marker, "element", obj)
trawy = trawy + 1
end
for i = 1, 14 do
local add = i
obj = createObject(818, los[1]-add, los[2], los[3]-2)
setObjectScale(obj, 0.5)
marker = createMarker(los[1]-add, los[2], los[3], "corona", 0.8, 255, 255, 255, 0)
setElementData(marker, "element", obj)
trawy = trawy + 1
for i2 = 1, 30 do
local add2 = i2
obj = createObject(818, los[1]-add, los[2]+add2, los[3]-2)
setObjectScale(obj, 0.5)
marker = createMarker(los[1]-add, los[2]+add2, los[3], "corona", 0.8, 255, 255, 255, 0)
setElementData(marker, "element", obj)
trawy = trawy + 1
end
end
addEventHandler("onClientMarkerHit", root, function(gracz)
if gracz ~= localPlayer then return end
if not source then return end
if not getElementData(source, "element") then return end
if not getPedOccupiedVehicle(gracz) then return end
if getElementData(localPlayer, "kosiarki:ulepszenie1") == 1 then
ilosc = 350
else
ilosc = 250
end
if zaladunek == ilosc then
if not dostal_powiadomienie then
exports["np-notyfikacje"]:noti("Twoja kosiarka jest pe?na musisz j? wy?adowa?", "error");
dostal_powiadomienie = true;
end
return;
end
destroyElement(getElementData(source, "element"))
destroyElement(source)
trawy = trawy - 1
zaladunek = zaladunek + 1
if trawy == 0 then
for i, v in ipairs(getElementsByType("marker")) do
if getElementData(v, "element") then
destroyElement(getElementData(v, "element"))
destroyElement(v)
end
end
marker = false
losuj()
triggerServerEvent("daj:koszlecenia", localPlayer, localPlayer)
end
end)
end
addEventHandler("onClientColShapeLeave", strefa, function(gracz)
if gracz ~= localPlayer then return end
if getElementData(localPlayer, "pracuje") == "kosiarki" then
zakonczprace()
end
end)
--opcje
function shadowText(text,x,y,w,h,color,size,font,xx,yy,x1,x2,x3,x4,x5)
dxDrawText(text,x+1,y+1,w+1,h+1,tocolor(0,0,0),size,font,xx,yy,x1,x2,x3,x4,x5)
dxDrawText(text,x,y,w,h,color,size,font,xx,yy,x1,x2,x3,x4,x5)
end
function mysz(psx,psy,pssx,pssy,abx,aby)
if not isCursorShowing() then return end
cx,cy=getCursorPosition()
cx,cy=cx*sx,cy*sy
if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
return true,cx,cy
else
return false
end
end
function scale_x(value)
local result = (value / 1440) * sx
return result
end
function scale_y(value)
local result = (value / 900) * sy
Nie możesz pisać nowych tematów Nie możesz odpowiadać w tematach Nie możesz zmieniać swoich postów Nie możesz usuwać swoich postów Nie możesz głosować w ankietach