• 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!

Lua Casino percent win

PuzzeL

www.XERIA.pl Come! :D
Joined
Feb 7, 2010
Messages
62
Reaction score
3
Location
//Poland
Whats up, can someone give me rewrite this script so that the percentage chance of winning was smaller, it is best determined by me.
Thanks in advance.
/ translator explained
Code:
<?xml version="1.0" encoding="utf-8"?>
<mod name="Casino lever2" enabled="yes">
  <action uniqueid="5889" event="script"><![CDATA[
        local pos = {x=998, y=1022, z=7, stackpos = 255}
      
        local cash = 2160
        local t = {
            [{1, 55}] = 0,
            [{56, 90}] = 2,
            [{91, 100}] = 3
        }
        local a, b = getItemInfo(cash).name, getItemInfo(cash).plural

        function onUse(cid, item, fromPosition, itemEx, toPosition)
            local v = getThingfromPos(pos)
            if v.itemid ~= cash then
                return doCreatureSay(cid, 'Mozesz uzywac do gry tylko ' .. b .. '.', TALKTYPE_ORANGE_1, false, cid)
            end

            local r = math.random(100)
            for i, k in pairs(t) do
                if r >= i[1] and r <= i[2] then
                    doRemoveItem(v.uid)
                    if k < 1 then
                        doCreatureSay(cid, 'Straciles ' .. v.type .. ' ' .. (v.type == 1 and a or b) .. ' :(', TALKTYPE_ORANGE_1, false, cid)
                        doSendMagicEffect(pos, CONST_ME_POFF)
                    else
                        doCreatureSay(cid, 'Wygrales ' .. v.type * k .. ' ' .. (v.type == 1 and a or b) .. ' :)', TALKTYPE_ORANGE_1, false, cid)
                        doCreateItem(cash, v.type * k, pos)
                        doSendMagicEffect(pos, CONST_ME_MAGIC_RED)
                        doSendMagicEffect(toPosition, CONST_ME_SOUND_YELLOW)
                    end
                    return true
                end
            end
        end
    ]]></action>
</mod>
 
Right now you got 10% chanse to win 3x gold, 35% chanse to win 2x gold and 55% risk of losing.
You can increase the first interval to make it less likely to win.

For example:
Code:
local t = {
    [{1, 70}] = 0,
    [{71, 90}] = 2,
    [{91, 100}] = 3
}

This gives 10% chanse to win 3x gold, 20% chanse to win 2x gold and 70% risk of losing.
 
Back
Top