Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local caller = getScriptCaller()
- local t = getAllUserData()
- local rate_prefix = "piss"
- local time_delay = 1*60*60
- function contains(table, val)
- for i=1,#table do
- if table[i] == val then
- return true
- end
- end
- return false
- end
- function getDelta()
- local t = {}
- t.current = getLocalData(rate_prefix .. tostring(caller.id))
- t.delta = math.random(0, 10)
- t.delta = signRoll(t.delta)
- if t.current + t.delta < 0 then
- t.delta = -t.current
- t.current = 0
- else
- t.current = t.current + t.delta
- end
- setLocalData(rate_prefix .. tostring(caller.id), t.current)
- return t
- end
- function updateTime(timeType)
- setLocalData(rate_prefix .. tostring(caller.id) .. timeType, os.time())
- end
- function checkTime(timeType)
- local time = getLocalData(rate_prefix .. tostring(caller.id) .. timeType)
- if not time then
- setLocalData(rate_prefix .. tostring(caller.id), 0)
- updateTime(timeType)
- return true
- end
- if time and os.time() - tonumber(time) > time_delay then
- updateTime(timeType)
- return true
- end
- return false
- end
- function printTop()
- local t = getAllUserData()
- local s = 'ТОП ОБОССЫВАТЕЛЕЙ КОНФЫ\n'
- --local r = {}
- if not getUserCount() then
- return 'Используй в конфе!'
- end
- for i = 1, getUserCount() do
- if t[i] and t[i].id and getLocalData(rate_prefix .. tostring(t[i].id)) then
- t[i].score = tonumber(getLocalData(rate_prefix .. tostring(t[i].id)))
- else
- t[i] = nil
- end
- end
- local c = {}
- for i = 1, getUserCount() do
- if t[i] then
- table.insert(c, t[i])
- end
- end
- table.sort(c, function(a,b) return a.score > b.score end)
- for i = 1, #c do
- if c[i].first_name then
- s = s .. c[i].first_name .. ' - ' ..c[i].score .. '\n'
- end
- end
- return s
- end
- function piss(params)
- if params == caller.username then return "*Ты обоссался, но это не защитывается!" end
- if checkTime('piss') then
- for i = 1, getUserCount() do
- if t[i] and t[i].id and t[i].username == params then
- local rep = 1
- local current = getLocalData(rate_prefix .. tostring(caller.id)) or 0
- setLocalData(rate_prefix .. tostring(caller.id), current+rep)
- return "🍾" .. caller.username .. "🍾 " .. "обоссал ".. params .. "🍹🫦"
- end
- end
- return "*Не нахожу чувака с ником " .. params
- else
- return os.date('Ты уже поссал недавно.\n Приходи через %H часов %M минут', time_delay - os.time() + tonumber(getLocalData(rate_prefix .. tostring(caller.id .. 'piss'))))
- end
- end
- function serve(params)
- return piss(params)
- end
- if _ARGS == 'top' or _ARGS == 'топ' then
- return printTop()
- end
- if _ARGS == 'reset' or _ARGS == 'сброс' then
- if getScriptCaller().username == "Ox7FF"
- then
- setLocalData(rate_prefix .. tostring(caller.id) .. "piss", 0)
- return "*Временные настройки сброшены."
- else return "*Ты не админ."
- end
- end
- if _ARGS then
- local index = string.find(_ARGS, '@')
- if index then
- params = string.gsub(_ARGS, "@", "")
- return serve(params)
- else
- action = _ARGS
- return serve(action)
- end
- end
- return [[
- ==========СИСТЕМА РЕЙТИНГА==========
- !!piss @username - обоссать пользователя.
- !!piss top - вывести топ пользователей.
- ]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement