Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
roulette
-- Получить шмотку по ID кейса и предметам в кейсе local function getRandomItemFromCase( caseID, items ) local chance = 0 local dropItem = "" if caseID == 1 then --[[ Шансы выпадения шмоток 8 - 1% 7 - 3% 6 - 5% 5 - 8% 4 - 13% 3 - 18% 2 - 23% 1 - 29% ]] -- 8 chance = math.random(1, 100) if (chance > 99) and (chance <= 100) then dropItem = "8" end -- 7 if (chance > 96) and (chance <= 99) then dropItem = "7" end -- 6 if (chance > 91) and (chance <= 96) then dropItem = "6" end -- 5 if (chance > 83) and (chance <= 91) then dropItem = "5" end -- 4 if (chance > 70) and (chance <= 83) then dropItem = "4" end -- 3 if (chance > 52) and (chance <= 70) then dropItem = "3" end -- 2 if (chance > 29) and (chance <= 52) then dropItem = "2" end -- 1 if (chance > 0) and (chance <= 29) then dropItem = "1" end end return dropItem end -- Функция перемешивания таблицы function shuffle(tbl) local size = #tbl for i = size, 1, -1 do local rand = math.random(size) tbl[i], tbl[rand] = tbl[rand], tbl[i] end return tbl end -- Функция перемешивания кейса с призом на 25м предмете local function getShuffledCase(item, items) local items_copy = items while #items_copy < 30 do for i = 1, #items do table.insert(items_copy, items[i]) end end items_copy = shuffle(items_copy) items_copy[25] = item return items_copy end m = {"a", "b", "c", "d", "e"} m = getShuffledCase("SUPER", m) for i = 1, #m do print(m[i] .. " " .. i) end
run
|
edit
|
history
|
help
0
test3
Creating habits v3, Lua
Visala Test
test
Random Item Generator (1 year)
Weird Lua OOP Lib
Hakusu
VWPASSATPOLIZEI
Area and Circumference of a circle.
cases