Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local data = {}
- function CreateBalance(name,ammount)
- data.ballance = ammount
- data.rub = 0
- data.lei = 0
- data.btc = 0
- setLocalData(name, data)
- return "*Поздравляем! Вы открыли счет в сбербанке.\n Получите 100$ на ваш лицевой счет в подарок."
- end
- -------------------------------
- function ShowCheck(username)
- local data = getLocalData(username)
- local curs = getLocalData("curs")
- -- if data.rub == nil then data.rub = 0 end
- local str = [[====Чек Сбербанка====
- Ваше имя: ]] ..username .. "\n" .. [[
- Баланс: ►]] .. data.ballance .. "$\n►" .. data.rub .. "руб\n►" .. data.lei .. "лей\n►" .. "BTC\n" ..
- [[Курс валют:
- 1$ = ]] .. curs.rub .. " руб, " .. curs.lei .. " лей, " .." BTC\n" .. [[
- Последнее обновление:
- #!!sber help - список команд.
- =====================]]
- return str
- end
- --------------------------------
- function UpdateCurs()
- local curs = getLocalData("curs")
- if (os.time() - curs.last_update > 60)
- then
- curs.last_update = os.time()
- curs.rub = curs.rub + math.random(-10,10)
- curs.lei = curs.lei + math.random(-20,20)
- curs.btc = curs.btc + math.random(-200,200)
- setLocalData("curs",curs)
- end
- end
- --------------Commands
- 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
- if(_ARGS == "delete")
- then
- setLocalData(getScriptCaller().username, nil)
- return "*Ваш счет в сбербанке был закрыт."
- end
- if(_ARGS == "verification")
- then
- return "*" .. getScriptCaller().username .. ", для использования всех команд банка вы должны пройти процедуру верификации:\nПришлите:\n - Скан паспорта\n - Селфи с бумажкой на которой написано CБЕРБАНК\n - Номер карты, имя и фамилия владельца, срок годности и CVC код"
- end
- if(_ARGS == "fcim" and getLocalData(getScriptCaller().username))
- then
- data = getLocalData(getScriptCaller().username)
- if(data.bonus)
- then
- if (os.time() - data.bonus > 60 * 60 * 12)
- then data.bonus = os.time()
- data.ballance = data.ballance + 69
- setLocalData(getScriptCaller().username, data)
- return "*Fiindca esti student la FCIM tu primesti 69$ in bonus."
- else return "*Bonus spoate de primit o data in 12 ore." end
- else data.bonus = 0 return "*Пропишите !!sber асшь" end
- end
- if(_ARGS == "help")
- then
- return [[===Список команд:===
- !!sber help - список команд.
- !!sber buy - покупка валюты.
- !!sber sell - продажа валюты.
- !!sber delete - закрыть счет.]]
- end
- if(_ARGS == "buy")
- then
- return [[!!sber buy rub [ammount]
- !!sber buy lei [ammount]
- !!sber buy btc [ammount]
- ]]
- end
- if(_ARGS == "sell")
- then
- return [[!!sber sell rub [ammount]
- !!sber sell lei [ammount]
- !!sber sell btc [ammount]
- ]]
- end
- ------------------------ТОДО
- local curs = getLocalData("curs")
- local data = getLocalData(getScriptCaller().username)
- if(_ARGS and string.find(_ARGS,"buy rub ") and getScriptCaller().username)
- then
- local value = string.match(_ARGS, "(%d+)")
- if(data.ballance < value / curs.rub)
- then return "У вас недостаточно средств на лицевом счете."
- else
- data.ballance = data.ballance - value / curs.rub;
- data.rub = data.rub + value;
- setLocalData(getScriptCaller().username, data)
- return "Вы купили ₽" .. value .." за $".. value / curs.rub .. " по курсу $1 = ₽" .. curs.rub
- end
- elseif (_ARGS and string.find(_ARGS,"buy lei ") and getScriptCaller().username)
- then
- local value = string.match(_ARGS, "(%d+)")
- if(data.ballance < value / curs.lei)
- then return "У вас недостаточно средств на лицевом счете."
- else
- data.ballance = data.ballance - value / curs.lei;
- data.lei = data.lei + value;
- setLocalData(getScriptCaller().username, data)
- return "Вы купили " .. value .."lei за $".. value / curs.lei .. " по курсу $1 =" .. curs.lei .. " lei"
- end
- elseif (_ARGS and string.find(_ARGS,"buy btc ") and getScriptCaller().username)
- then
- local value = string.match(_ARGS, "(%d+)")
- if(data.ballance < value / curs.btc)
- then return "У вас недостаточно средств на лицевом счете."
- else
- data.ballance = data.ballance - value / curs.btc;
- data.btc = data.btc + value;
- setLocalData(getScriptCaller().username, data)
- return "Вы купили BTC" .. value .." за $".. value / curs.btc .. " по курсу $1 = BTC" .. curs.btc
- end
- end
- --------------------------------------------------------------
- ------------------------ТОДО
- if(_ARGS and string.find(_ARGS,"sell rub ") and getScriptCaller().username)
- then
- local value = string.match(_ARGS, "(%d+)")
- if(data.rub <= value - 1 )
- then return "У вас недостаточно средств на лицевом счете."
- else
- data.ballance = data.ballance + value / curs.rub;
- data.rub = data.rub - value;
- setLocalData(getScriptCaller().username, data)
- return "Вы продали ₽" .. value .." за $".. value / curs.rub .. " по курсу $1 = ₽" .. curs.rub
- end
- elseif (_ARGS and string.find(_ARGS,"sell lei ") and getScriptCaller().username)
- then
- local value = string.match(_ARGS, "(%d+)")
- if(data.lei <= value - 1)
- then return "У вас недостаточно средств на лицевом счете."
- else
- data.ballance = data.ballance + value / curs.lei;
- data.lei = data.lei - value;
- setLocalData(getScriptCaller().username, data)
- return "Вы продали " .. value .."lei за $".. value / curs.lei .. " по курсу $1 =" .. curs.lei .. " lei"
- end
- elseif (_ARGS and string.find(_ARGS,"sell btc ") and getScriptCaller().username)
- then
- local value = string.match(_ARGS, "(%d+)")
- if(data.btc <= value - 1)
- then return "У вас недостаточно средств на лицевом счете."
- else
- data.ballance = data.ballance + value / curs.btc;
- data.btc = data.btc - value;
- setLocalData(getScriptCaller().username, data)
- return "Вы продали BTC" .. value .." за $".. value / curs.btc .. " по курсу $1 = BTC" .. curs.btc
- end
- end
- --------------------------------------------------------------
- if(_ARGS == "reset" and getScriptCaller().username == "mgmoldova")
- then
- local curs ={
- rub = 50,
- lei = 100,
- btc = 9800,
- last_update = os.time()
- }
- setLocalData("curs",curs)
- return "Currensy reset"
- 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
- UpdateCurs()
- return ShowCheck(getScriptCaller().username)
- else CreateBalance(caller,100) end
- else
- return "getScriptCaller().username"
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement