Salvus
Well-Known Member
- Joined
- Feb 7, 2019
- Messages
- 102
- Solutions
- 1
- Reaction score
- 69
I have this script that I would like to translate to TFS 1.3.
Not much work is needed to get it to TFS 1.3 but if you are noob then you are ^^
It's a casino script.
You put the items on one side and you pull the lever.
If you are the lucky one then you get one more like the item you bet.
Not much work is needed to get it to TFS 1.3 but if you are noob then you are ^^
It's a casino script.
You put the items on one side and you pull the lever.
If you are the lucky one then you get one more like the item you bet.
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local pPos = getPlayerPosition(cid)
local winpos = {x=1050, y=1609, z=6, stackpos=255}
local dicepos = {x=1048, y=1609, z=6}
local itempos = {x=1050, y=1610, z=6}
local winreward = getThingfromPos{x=1050, y=1609, z=6, stackpos=255}
local roll = math.random(5792,5797)
local itembet = getThingfromPos{x=1050, y=1610, z=6, stackpos=255}
local dice = getThingfromPos{x=1048, y=1609, z=6, stackpos=255}
local dons = {6391, 11306, 8850, 11325, 11240, 11117, 11304, 11355, 11302, 11305, 11356, 2357, 7379, 7429, 2294, 2270, 6391, 11306, 8850, 11325, 11240, 11117, 11304, 11355, 11302, 11305, 11356, 2357, 7379, 7429, 2294, 7409, 2537}
if itembet.uid ~= 0 then
if winreward.uid == 0 then
if roll == 5792 or roll == 5793 then
if(table.contains(dons, itembet.itemid)) then
doCreateItem(itembet.itemid, itembet.type, winpos)
local wonitem = getThingfromPos{x=1050, y=1609, z=6, stackpos=255}
item:setAttribute("description", "[Won in casino] [by: " .. string.lower(getCreatureName(cid)) .. "].")
doTransformItem(dice.uid, roll)
doSendDistanceShoot(itempos, winpos, 30)
Game.broadcastMessage(""..getCreatureName(cid).." has won "..getItemNameById(itembet.itemid).." in casino", MESSAGE_STATUS_CONSOLE_RED)
position:sendMagicEffect(dicepos, 26)
position:sendMagicEffect(winpos, 30)
doSendAnimatedText(dicepos, "".. roll - 5791 .."!", 246)
doSendAnimatedText(pPos, "WON!", 246)
else
doCreateItem(itembet.itemid, itembet.type, winpos)
doSendDistanceShoot(itempos, winpos, 30)
local wonitem = getThingfromPos{x=1050, y=1609, z=6, stackpos=255}
item:setAttribute(wonitem.uid, "description", "[Won in casino] [by: " .. string.lower(getCreatureName(cid)) .. "].")
doTransformItem(dice.uid, roll)
position:sendMagicEffect(dicepos, 26)
position:sendMagicEffect(winpos, 30)
doSendAnimatedText(dicepos, "".. roll - 5791 .."!", 246)
doSendAnimatedText(pPos, "WON!", 246)
end
elseif roll == 5794 or roll == 5795 or roll == 5796 then
if(table.contains(dons, itembet.itemid)) then
doTransformItem(dice.uid, roll)
position:sendMagicEffect(dicepos, 26)
doSendDistanceShoot(itempos, dicepos, 30)
doBroadcastMessage(""..getCreatureName(cid).." has lost "..getItemNameById(itembet.itemid).." in casino", MESSAGE_STATUS_CONSOLE_RED)
position:sendMagicEffect(itempos, 2)
doSendAnimatedText(dicepos, "".. roll - 5791 .."!", 180)
doSendAnimatedText(pPos, "FAIL!", 180)
doRemoveItem(itembet.uid)
else
doSendDistanceShoot(itempos, dicepos, 30)
doTransformItem(dice.uid, roll)
position:sendMagicEffect(dicepos, 26)
position:sendMagicEffect(itempos, 2)
doSendAnimatedText(dicepos, "".. roll - 5791 .."!", 180)
doSendAnimatedText(pPos, "FAIL!", 180)
doRemoveItem(itembet.uid)
end
elseif roll == 5797 then
doTransformItem(dice.uid, roll)
position:sendMagicEffect(dicepos, 26)
doSendAnimatedText(dicepos, "".. roll - 5791 .."!", 215)
doSendAnimatedText(pPos, "RE-ROLL!", 215)
end
else
doPlayerSendCancel(cid, 'Win position have to be empty to play.')
end
else
doPlayerSendCancel(cid, 'Put the item you want to bet with first.')
end
return true
end