sianko = math.random(30000,38000)
function rgbToHex(red, green, blue, alpha)
if( ( red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255 ) or ( alpha and ( alpha < 0 or alpha > 255 ) ) ) then
return nil
end
if alpha then
return string.format("#%.2X%.2X%.2X%.2X", red, green, blue, alpha)
else
return string.format("#%.2X%.2X%.2X", red, green, blue)
end
end
kordy = math.random(1,20)
if kordy == 1 then
x,y,z = 571.86, -1743.04, 12.40
elseif kordy == 2 then
x,y,z = -1993.66, 495.93, 35.17-1
elseif kordy == 3 then
x,y,z = -1734.76, 879.55, 25.09
elseif kordy == 4 then
x,y,z = -1672.76, 1206.60, 32.94
elseif kordy == 5 then
x,y,z = -1954.63, 1229.69, 31.65
elseif kordy == 6 then
x,y,z = -2472.77, 1070.43, 55.79
elseif kordy == 7 then
x,y,z = 1087.37, -1764.54, 13.36
elseif kordy == 8 then
x,y,z = 1488.79, -1675.96, 14.05
elseif kordy == 9 then
x,y,z = -2534.11, 62.38, 9.16
elseif kordy == 10 then
x,y,z = 232.68, -1807.06, 4.48
elseif kordy == 11 then
x,y,z = -2508.71, -687.03, 139.32
elseif kordy == 12 then
x,y,z = -2345.68, 995.06, 50.90
elseif kordy == 13 then
x,y,z = -1777.59, 1308.74, 59.73
elseif kordy == 14 then
x,y,z = -1495.67, 1285.25, 7.18
elseif kordy == 15 then
x,y,z = -1479.10, 430.31, 7.19
elseif kordy == 16 then
x,y,z = -1720.76, 225.34, 1.96
elseif kordy == 17 then
x,y,z = -1906.07, 299.56, 41.05
elseif kordy == 18 then
x,y,z = -1823.01, 1053.20, 46.08
elseif kordy == 19 then
x,y,z = -1686.90, 1033.48, 56.91
elseif kordy == 20 then
x,y,z = -2081.21, 1066.13, 65.58
end
dupka = createMarker(x,y,z-1, "cylinder", 3, 255, 255, 255, 0)
createBlip(x, y, z, 59,2,0,0,0,0,0,175)
setElementAlpha(dupka, 0)
cipa = createElement("text")
--to na pozniej bo tera swieta skin = math.random(1,100)
skin = math.random(130,131)
setElementData(cipa, "name", "Dealer ")
setElementPosition(cipa, x+1.5,y,z+1)
setElementFrozen(cipa,true)
**** = createPed(skin,x+1.5,y,z, 90)
outputChatBox("> Dealer pojawi? si? gdzie? na mapie, szukajcie blipu (fioletowy ludzik)!", root, 168, 149, 27)
addEventHandler("onMarkerHit", resourceRoot, function(el,md)
print(getElementData(el, "marihuana"))
sianko = math.random(10000,12000)
dupka1 = sianko*tonumber(getElementData(el, "marihuana"))
outputChatBox("Dealer: Siema, s?ysza?em ?e masz troche temaciku, mo?e chcesz mi troszeczk? sprzeda? po tanio?ci?? P?ac? "..dupka1.." za "..tonumber(getElementData(el, "marihuana")).." g", el, 255, 255, 255)
outputChatBox(rgbToHex(255, 0, 0).."Aby sprzeda? marihuan? dealerowi u?yj komendy: /sprzedaj.marihuane. (sprzedajesz wszystkie gramy marihuany)", el, 255, 0, 0)
outputChatBox(rgbToHex(255, 0, 0).."Aby kupi? nasiono marihuany u?yj komendy: /kup.nasiono <ilosc> - koszt za sztuk? to 425,000 $", el, 255, 0, 0)
end)
addCommandHandler("sprzedaj.marihuane", function(plr,cmd)
if not isElementWithinMarker(plr, dupka) then return end
marihuanina = getElementData(plr, "marihuana")
sianko = math.random(820000,862000)
dupka1 = sianko*tonumber(getElementData(plr, "marihuana"))
dupka2 = dupka1
exports["pystories-db"]:dbSet("UPDATE pystories_users SET marihuana=? WHERE id=?", 0, getElementData(plr,"player:sid"))
setElementData(plr, "marihuana", 0)
givePlayerMoney(plr, dupka2)
outputChatBox("Dealer: Dziena byczku, pachnie wy?mienicie! Z fartem", plr, 255, 255, 255)
triggerClientEvent(plr, "createNotif",plr,"Pomy?lnie sprzedano wszystkie g marihuany!",3,"success")
end)
addCommandHandler("kup.nasiono", function(plr,cmd, ilosc)
if not isElementWithinMarker(plr, dupka) then return end
if not tonumber(ilosc) then
outputChatBox('* U?yj: /kup.nasiono <ilosc>', plr)
return
end
kasa = tonumber(ilosc)*525000
if getPlayerMoney(plr) < kasa then
outputChatBox("* Nie posiadasz wystarczaj?co pieni?dzy!", plr)
return end
ilosc = tonumber(ilosc)
if ilosc == 0 or ilosc < 0 then
outputChatBox("* Poda?e?(a?) nieprawid?ow? warto??.", plr)
return
end
nasiono = getElementData(plr, "player:nasiona")
takePlayerMoney(plr, kasa)
exports["pystories-db"]:dbSet("UPDATE pystories_users SET nasiona=nasiona+? WHERE id=?", ilosc, getElementData(plr, "player:sid"))
outputChatBox("* Zakupiono "..ilosc.." nasion", plr)
end)
local randomTime = math.random(10, 30)
setTimer(function()
restartResource(getThisResource())
end, randomTime*20000, 1)