Galaxy
New Member
Hello Otlanders!
I have this script for casino:
but problem is... It never gives me my reward. And that is all
All other things works perfectly but just the reward doesn't appear anywhere :S
Could any1 help me? Please.
I have this script for casino:
Code:
--[ Script written and published by Devcod ]--
function onUse(cid, item, fromPosition, itemEx, toPosition)
local config = {
chance = math.random(1, 100), --losowanie
win_chance = 100, --chance of winning in percent
multi = 2, --multiplie of winning. eg, put 2cc, win 4cc if its x2.
items = {2160, 2152}, --id of playing items (cc)
min_count = 1, --minimum of cc
max_count = 10 --maximum of cc
}
local positions = {
[56501] = {x=(fromPosition.x-1), y=fromPosition.y, z=fromPosition.z, stackpos=255},
[56502] = {x=(fromPosition.x+1), y=fromPosition.y, z=fromPosition.z, stackpos=255},
[56503] = {x=(fromPosition.x+1), y=fromPosition.y, z=fromPosition.z, stackpos=255},
[56504] = {x=(fromPosition.x-1), y=fromPosition.y, z=fromPosition.z, stackpos=255}
}
local itemplay = getThingfromPos(positions[item.actionid])
local storage, exh = 56500, 2 --storage id, czas exh
if (item.itemid == 1945) then
doTransformItem(item.uid, 1946)
if (getPlayerStorageValue(cid, storage)-os.time(t) < 1) then
doPlayerSetStorageValue(cid, storage, os.time(t)+exh)
if (isInArray(config.items, itemplay.itemid)) then
if (itemplay.type >= config.min_count) and (itemplay.type <= config.max_count) then
if (config.chance <= config.win_chance) then
doRemoveItem(itemplay.uid, itemplay.type)
doCreateItem(itemplay.itemid, (itemplay.type*config.multi), positions[item.actionid])
doSendMagicEffect(positions[item.actionid], 31)
doSendMagicEffect(getCreaturePosition(cid), 27)
doPlayerSendCancel(cid, "Congratulations, you just won in our casino!")
doSendAnimatedText(getCreaturePosition(cid), "~!Winner!~", TEXTCOLOR_YELLOW)
return true
else
doRemoveItem(itemplay.uid, itemplay.type)
doSendMagicEffect(positions[item.actionid], 31)
doSendMagicEffect(getCreaturePosition(cid), 13)
doPlayerSendCancel(cid, "It is your unlucky day! You lost.")
doSendAnimatedText(getCreaturePosition(cid), "~!Loser!~", TEXTCOLOR_LIGHTBLUE)
return true
end
else
doPlayerSendCancel(cid, "You can play only with amount from ".. config.min_count .." to ".. config.max_count ..".")
doSendMagicEffect(fromPosition, 2)
return true
end
else
doPlayerSendCancel(cid, "You cannot play with this item.")
doSendMagicEffect(fromPosition, 2)
return true
end
else
doPlayerSendCancel(cid, "You must wait another ".. getPlayerStorageValue(cid, storage)-os.time(t) .." seconds.")
doSendMagicEffect(fromPosition, 2)
return true
end
else
doTransformItem(item.uid, 1945)
doSendMagicEffect(fromPosition, 2)
return true
end
end
but problem is... It never gives me my reward. And that is all
All other things works perfectly but just the reward doesn't appear anywhere :S
Could any1 help me? Please.