• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Old cassino action script to tfs 1.x

Thorn

Spriting since 2013
Joined
Sep 24, 2012
Messages
2,203
Solutions
1
Reaction score
921
Location
Chile
Hello guys, i had this awesome cassino script, i dont know really how i got it, i think here in otland years ago, it's for tfs 0.4, i think it works great for that version, altho now im using tfs 1.2 and i was wondering if any of you guys would do me the favor to convert it into tfs 1.x
plz!!

Code:
function onUse(cid, item, frompos, item2, topos)
local pos = getCreaturePosition(cid)
   local cost_per_click  = 500000 -- Amount in gold coins. 30,000 = 3 cc. Set to 0 if you want no money to be taken.
   local item_per_click  = 0 -- Amount of items needed to use lever. Set to 0 in you want no item to be used.
   local item_currency  = 0 -- Item needed to use lever. Set as Demonic Essences currently.
   local item_name  = "demonic essence"
  
   local chance_to_win  = 30 -- Percent 30/100
   local casino_machine = 21720
  
   local ids = { -- THIS IS WHERE YOU PUT ALL ITEMS YOU WANT FOR PRIZES
     [1] =  {item_name = "Overflow energy ring", itemID = 30442, amount = 1},
     [2] =  {item_name = "Overmind knight ring", itemID = 30438, amount = 1},
     [3] =  {item_name = "Overmind mage ring", itemID = 30439, amount = 1}
   }

   -- Don't edit below unless your sure you know what to do. :P
   local exstorage = 45001
   local player_gold  = getPlayerItemCount(cid,2148)
   local player_plat  = getPlayerItemCount(cid,2152)*100
   local player_crys  = getPlayerItemCount(cid,2160)*10000
   local player_blood = getPlayerItemCount(cid,21667)*1000000
   local player_ultimate = getPlayerItemCount(cid,23912)*100000000
   local player_money  = player_gold + player_plat + player_crys + player_blood + player_ultimate
   if exhaustion.check(cid, exstorage) then
     return doPlayerSendCancel(cid, "Please wait a few seconds before using the casino again.")
   end
   if item.itemid == casino_machine then
     if player_money >= cost_per_click then
       if getPlayerItemCount(cid,item_currency) >= item_per_click then
         doPlayerRemoveMoney(cid, cost_per_click)
         doPlayerRemoveItem(cid, item_currency, item_per_click)
         if(math.random(1, 100) <= chance_to_win) then
           local rand = ids[math.random(#ids)]
           local item = doPlayerAddItem(cid, rand.itemID, rand.amount)
           if rand.amount <= 1 then
           doSendMagicEffect(pos, 30)
             doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Winner! You receive ".. rand.amount .." ".. rand.item_name ..".")
           else
           doSendMagicEffect(pos, 30)
             doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Winner! You receive ".. rand.amount .." ".. rand.item_name .."s.")
           end
         else
         doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Sorry, no luck!")
         end
       else
         doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You require ".. item_per_click .." ".. item_name .." to use the lottery machine.")
       end
     else
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "You require ".. cost_per_click .." gold coins to use the lottery machine.")
     end
   else
     return doPlayerSendCancel(cid, "This is the incorrect item for this script! Check casino_machine ID.")
   end
   exhaustion.set(cid, exstorage, 1)
return true
end
 
idk
Code:
local config = {
    cost = 1000,
    chance = 30,
    prize = {30442, 30438, 30439},
    cooldownStorage = 1000
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getStorageValue(config.cooldownStorage) >= os.time() then
        player:sendCancelMessage("Please wait few seconds to play again.")
        return true
    end

    if not player:removeMoney(config.cost) then
        player:sendCancelMessage("You need atleast ".. config.cost .." gold coins to play.")
        return true
    end

    local random = math.random
    if random(100) <= config.chance then
        local itemId = config.prize[random(#config.prize)]
        player:addItem(itemId, 1)
        player:getPosition():sendMagicEffect(random(CONST_ME_FIREWORK_YELLOW, CONST_ME_FIREWORK_BLUE))
        player:sendTextMessage(MESSAGE_INFO_DESCR, "Gratz you won a " .. ItemType(itemId):getName() .. ".")
    end

    player:setStorageValue(config.cooldownStorage, os.time() + 5)
    return true
end
 
Last edited:
idk
Code:
local config = {
    cost = 1000,
    chance = 30,
    prize = {30442, 30438, 30439},
    cooldownStorage = 1000
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getStorageValue(config.cooldownStorage) >= os.time() then
        player:sendCancelMessage("Please wait few seconds to play again.")
        return true
    end

    if not player:removeMoney(config.cost) then
        player:sendCancelMessage("You need atleast ".. config.cost .." gold coins to play.")
        return true
    end

    local random = math.random
    if random(config.chance) == 1 then
        local itemId = config.prize[random(#config.prize)]
        player:addItem(itemId, 1)
        player:getPosition():sendMagicEffect(random(CONST_ME_FIREWORK_YELLOW, CONST_ME_FIREWORK_BLUE))
        player:sendTextMessage(MESSAGE_INFO_DESCR, "Gratz you won a " .. ItemType(itemId):getName() .. ".")
    end

    player:setStorageValue(config.cooldownStorage, os.time() + 5)
    return true
end
hello man thank you so much for taking your time to do this!
i tested it and added two lines, but anyway, it doesnt win anything, even if i change the chance to 100 :(

Lua:
local config = {
    cost = 100000,
    chance = 100,
    prize = {28783, 28785},
    cooldownStorage = 1000
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getStorageValue(config.cooldownStorage) >= os.time() then
        player:sendCancelMessage("Please wait few seconds to play again.")
        return true
    end
    if not player:removeMoney(config.cost) then
        player:sendCancelMessage("You need atleast ".. config.cost .." gold coins to play.")
        return true
    end
    local random = math.random
    if random(config.chance) == 1 then
        local itemId = config.prize[random(#config.prize)]
        player:addItem(itemId, 1)
        player:getPosition():sendMagicEffect(random(CONST_ME_FIREWORK_YELLOW, CONST_ME_FIREWORK_BLUE))
        player:sendTextMessage(MESSAGE_INFO_DESCR, "Gratz you won a " .. ItemType(itemId):getName() .. ".")
        else
    player:getPosition():sendMagicEffect(CONST_ME_POFF)
    player:sendTextMessage(MESSAGE_INFO_DESCR, "No has ganado nada ")
   
    end
   
    player:setStorageValue(config.cooldownStorage, os.time() + 5)
    return true
end
 
Back
Top