function onUse(cid, item, frompos, itemEx, toPosition)
local nagrody = {
{nagroda = 2148, szansa = 10, ilosc_min = 3, ilosc_max = 8},
{nagroda = 2152, szansa = 10, ilosc_min = 1, ilosc_max = 12},
{nagroda = 2160, szansa = 10, ilosc_min = 6, ilosc_max = 41}
}
local reward = 0
local count = ""
for i = 1, #nagrody do
local nagroda = nagrody[i]
if math.random(0,100) > nagroda.szansa then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Peszek.")
end
if math.random(0,100) <= nagroda.szansa then
reward = nagroda.nagroda
ilosc = math.random(nagroda.ilosc_min, nagroda.ilosc_max)
if ilosc == 1 then
count = "Znalazles "..ilosc.." "..getItemNameById(reward).."."
else
count = "Znalazles "..ilosc.." "..getItemNameById(reward).."s."
end
break
end
end
if reward ~= 0 then
doPlayerAddItem(cid, reward, ilosc)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, count)
end
doRemoveItem(item.uid, 1)
return true
end
znalaz?em b??d jak po?o?y si? to jajko na skrzynce od dp to jajko po klikni?ciu nie znika ale daje itemke mo?na takim sposobem robi? niesko?czon? liczbe itemek
Notka moderatorska: |
Nie pisz tak bezsensownych post?w. Niech ka?dy z nich wniesie co? do tematu. |
function onUse(cid, item, frompos, item2, topos) -- By Seminari;
local LOSS = {2437, 2646, 2523, 2471, 2408}
local c = {
jajko = 4850,
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local count = 1
if(item.itemid == c.jajko) then
local randomChance = math.random(1, #LOSS)
doPlayerAddItem(cid, LOSS[randomChance], count)
doSendMagicEffect(topos,12)
doRemoveItem(item.uid, 1)
end
return true
end
-- By Seminari
local LOSS_MALY = {5080, 2798, 5879, 5880, 2365}
local LOSS_SREDNI = {5925, 6527, 2494, 2400, 11240, 6528, 12649, 7416, 12644}
local LOSS_DUZY = {8852, 6433, 11263, 5809, 5804, 8857, 6132, 6527, 7391, 2446}
c = {
MALY = 10502,
SREDNI = 10510,
DUZY = 7697,
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local count = 1
if(item.itemid == c.MALY) then
local randomChance = math.random(1, #LOSS_MALY)
if(randomChance == 2) then
count = math.random(1, 20)
elseif(randomChance == 3) then
count = math.random(1, 30)
elseif(randomChance == 4) then
count = math.random(1, 50)
end
doPlayerAddItem(cid, LOSS_MALY[randomChance], count)
elseif(item.itemid == c.SREDNI) then
local randomChance = math.random(1, #LOSS_SREDNI)
if(randomChance == 1) then
count = math.random(1, 50)
elseif(randomChance == 2) then
count = math.random(1, 50)
end
doPlayerAddItem(cid, LOSS_SREDNI[randomChance], count)
elseif(item.itemid == c.DUZY) then
local randomChance = math.random(1, #LOSS_DUZY)
if(randomChance == 8) then
count = math.random(1, 99)
end
doPlayerAddItem(cid, LOSS_DUZY[randomChance], count)
end
doSendMagicEffect(fromPosition, CONST_ME_GIFT_WRAPS)
doRemoveItem(item.uid, 1)
return true
end