Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ruletka = {0,1,2,1,2,1,2,1,2,1,2,2,1,2,1,2,1,2,1,1,2,1,2,1,2, 1,2,1, 2,2,1,2,1,2,1,2,1}
- function CreateBalance(name,ammount)
- data.ballance = ammount
- setLocalData(name, data)
- return "*Поздравляем! Вы открыли счет.\n Получите 100$ на ваш лицевой счет в подарок."
- end
- function getColor(number)
- local color = {
- [0] = "green",
- [1] = "red",
- [2] = "black"
- }
- return color[ruletka[number]]
- end
- -------------------------------
- function ShowCheck(username)
- local data = getLocalData(username)
- local str = [[====Рулетка====
- Ваше имя: ]] ..username .. "\n" .. [[
- Баланс: ►]] .. data.ballance .. "$\n"
- return str
- end
- --------------------------------
- if(_ARGS and string.find(_ARGS,"info ") and getScriptCaller().username == "mgmoldova")
- then
- local username = string.gsub( _ARGS, "info ","" )
- if(getLocalData(username))
- then return ShowCheck(username)
- else return "ERROR"
- end
- end
- ball = math.random(0, 36)
- local data = getLocalData(getScriptCaller().username)
- if(_ARGS and string.find(_ARGS,"bet red ") and getScriptCaller().username)
- then
- local value = string.match(_ARGS, "(%d+)")
- if(data.ballance < value / 1 )
- then return "У вас недостаточно средств на лицевом счете."
- else
- data.ballance = data.ballance - value
- local str = "Ставка: " .. value .. " [Коефициент x3]" .. "\nВыпало " .. ball .. " (" .. getColor(ball) ..")\n"
- if (getColor(ball) == "red") then str = str .. "Вы выиграли " .. value * 3 .. "$" .. "\nСостояние счета: " .. data.ballance .. "$"
- data.ballance = data.ballance + value * 3
- else str = str .. "Вы проиграли " .. value .. "\nСостояние счета: " .. data.ballance .. "$" end
- setLocalData(getScriptCaller().username, data)
- return str
- end
- elseif (_ARGS and string.find(_ARGS,"bet black ") and getScriptCaller().username)
- then
- local value = string.match(_ARGS, "(%d+)")
- if(data.ballance < value / 1 ) then return "У вас недостаточно средств на лицевом счете."
- else
- data.ballance = data.ballance - value
- local str = "Ставка: " .. value .. " [Коефициент x3]".."\nВыпало " .. ball .. " (" .. getColor(ball) ..")\n"
- if (getColor(ball) == "black") then str = str .. "Вы выиграли " .. value * 3 .. "$" .. "\nСостояние счета: " .. data.ballance .."$"
- data.ballance = data.ballance + value * 3
- else str = str .. "Вы проиграли " .. value .. "\nСостояние счета: " .. data.ballance .."$" end
- setLocalData(getScriptCaller().username, data)
- return str
- end
- elseif (_ARGS and string.find(_ARGS,"bet green ") and getScriptCaller().username)
- then
- local value = string.match(_ARGS, "(%d+)")
- if(data.ballance < value / 1)
- then return "У вас недостаточно средств на лицевом счете."
- else
- data.ballance = data.ballance - value
- local str = "Ставка: " .. value .. "$ [Коефициент x3]".. "\nВыпало: " .. ball .. " (" .. getColor(ball) ..")\n"
- if (getColor(ball) == "green") then str = str .. "Вы выиграли: " .. value * 3 .. "$" .. "\nСостояние счета: " .. data.ballance .."$"
- data.ballance = data.ballance + value * 3
- else str = str .. "Вы проиграли: " .. value .. "\nСостояние счета: " .. data.ballance.. "$" end
- setLocalData(getScriptCaller().username, data)
- return str
- end
- end
- if(_ARGS and string.find(_ARGS,"bet ") and getScriptCaller().username and string.match(_ARGS, "(%d+) (%d+)") )
- then
- local value, bet = string.match(_ARGS, "(%d+) (%d+)")
- if(data.ballance < value / 1)
- then return "У вас недостаточно средств на лицевом счете."
- else
- data.ballance = data.ballance - value
- local ball = math.random(0, 36)
- local str = "Ставка: " .. value .. " Коефициент x36 " .. "Вы поставили на: " .. bet .."\nВыпало " .. ball .. " (" .. getColor(ball) ..")\n"
- if (bet == ball) then str = str .. "Вы выиграли " .. value * 3; data.ballance = data.ballance + value * 36 .. "\nСостояние счета: " .. data.ballance "$"
- else str = str .. "Вы проиграли " .. value .. "\nСостояние счета: " .. data.ballance .."$" end
- setLocalData(getScriptCaller().username, data)
- return str
- end
- end
- -- getScriptCaller() - get information of a user who called the script, returns table with fields id, username, first_name, last_name
- if(getScriptCaller().username)
- then caller = getScriptCaller().username
- if(getLocalData(caller) or not (getLocalData(caller)== nil))
- then return ShowCheck(getScriptCaller().username)
- else CreateBalance(caller,100) end
- else return "getScriptCaller().username" end
Add Comment
Please, Sign In to add comment