function onUse(cid, item, frompos, item2, topos)
if ((item.actionid == 4334) and (item.itemid == 1945)) then
local kasapos = {199=frompos.x-1, 46=frompos.y, 7=frompos.z, stackpos=255}
local kasa = getThingfromPos(kasapos)
local wygrana = (kasa.type * 10)
local rand = math.random(1, 5)
if kasa.itemid == 2152 or kasa.itemid == 2148 or kasa.itemid == 2160 then
if kasa.type <= 10 then
if rand == 1 then
doRemoveItem(kasa.uid,kasa.type)
doCreateItem(kasa.itemid,wygrana,kasapos)
doSendMagicEffect(kasapos,31)
doPlayerSendTextMessage(cid,22,"Wygrales!!!")
doTransformItem(item.uid,item.itemid+1)
else
doPlayerSendCancel(cid,"Straciłes tylko kase...")
doRemoveItem(kasa.uid,kasa.type)
doSendMagicEffect(kasapos,2)
doTransformItem(item.uid,item.itemid+1)
end
else
doPlayerSendCancel(cid,"Maksymalna kwota zakladu to 10!")
end
else
doPlayerSendCancel(cid,"Poloz obok pieniadze!")
end
elseif ((item.actionid == 4334) and (item.itemid == 1946)) then
local kasapos = {x=frompos.x-1, y=frompos.y, z=frompos.z, stackpos=255}
local kasa = getThingfromPos(kasapos)
local wygrana = (kasa.type * 10)
local rand = math.random(1, 5)
if kasa.itemid == 2152 or kasa.itemid == 2148 or kasa.itemid == 2160 then
if kasa.type <= 10 then
if rand == 1 then
doRemoveItem(kasa.uid,kasa.type)
doCreateItem(kasa.itemid,wygrana,kasapos)
doSendMagicEffect(kasapos,31)
doPlayerSendTextMessage(cid,22,"Wygraleś!!!")
doTransformItem(item.uid,item.itemid-1)
else
doPlayerSendCancel(cid,"Straciles tylko kase...")
doRemoveItem(kasa.uid,kasa.type)
doSendMagicEffect(kasapos,2)
doTransformItem(item.uid,item.itemid-1)
end
else
doPlayerSendCancel(cid,"Maksymalna kwota zakladu to 10!")
end
else
doPlayerSendCancel(cid,"Poloz obok pieniadze!")
end
else
return 0
end
return 1
end