domiki = nil
require "lib.moonloader"
requests = require 'requests'
local inspect = require 'inspect'
local encoding = require 'encoding'
local sampev = require 'lib.samp.events'
encoding.default = 'CP1251'
u8 = encoding.UTF8
local lanes = require('lanes').configure()
function strpos (haystack, needle, offset)
local pattern = string.format("(%s)", needle)
local i = string.find (haystack, pattern, (offset or 0))
return (i ~= nil and i or false)
end
function main()
repeat wait(0) until isSampAvailable()
if not sampIsLocalPlayerSpawned() then
return false
end
act = true
servak = {"185.169.134.3:7777", "185.169.134.4:7777", "185.169.134.43:7777", "185.169.134.44:7777", "185.169.134.45:7777", "185.169.134.5:7777", "185.169.134.59:7777", "185.169.134.61:7777", "185.169.134.107:7777", "185.169.134.109:7777", "185.169.134.166:7777", "185.169.134.171:7777", "185.169.134.172:7777"}
servip, servport = sampGetCurrentServerAddress()
sexip = ""..servip..":"..servport
for i, val in ipairs(servak) do
if val == sexip then
server = i
end
end
sampRegisterChatCommand('checker', testarz3)
sampAddChatMessage("{ffff00}[Чекер имущества] {ffffff}loaded for playa squad", -1)
while true do
wait(0)
end
end
--Администратор Erbaev[228] забанил игрока Walt_Disney[228] на 15 дней. Причина: Чмо
function async_http_request(method, url, args, resolve, reject)
if not _G["lanes.async_http"] then
local linda = lanes.linda()
local lane_gen = lanes.gen("*", {package = {path = package.path, cpath = package.cpath}}, function()
local requests = require("requests")
while true do
local key, val = linda:receive(50 / 1000, "request")
if key == "request" then
local ok, result = pcall(requests.request, val.method, val.url, val.args)
if ok then
result.json, result.xml = nil, nil
linda:send("response", result)
else linda:send("error", result) end
end
end
end)
_G["lanes.async_http"] = {lane = lane_gen(), linda = linda}
end
local lanes_http = _G["lanes.async_http"]
lanes_http.linda:send("request", {method = method, url = url, args = args})
lua_thread.create(function(linda)
while true do
local key, val = linda:receive(0, "response", "error")
if key == "response" then return resolve(val)
elseif key == "error" then return reject(val) end
wait(0)
end
end, lanes_http.linda)
end
u = 0 -- don't delete
function random(x, y)
u = u + 1
if x ~= nil and y ~= nil then
return math.floor(x +(math.random(math.randomseed(os.time()+u))*999999 %y))
else
return math.floor((math.random(math.randomseed(os.time()+u))*100))
end
end
function urlencode(str)
if (str) then
str = string.gsub (str, "\n", "\r\n")
str = string.gsub (str, "([^%w ])",
function (c) return string.format ("%%%02X", string.byte(c)) end)
str = string.gsub (str, " ", "+")
end
return str
end
zaxod = {}
function sampev.onPlayerJoin(id, color, isNCP, nickname)
if act then
f = io.open("moonloader\\checker\\"..server.."\\".. nickname ..".txt","r+");
if f == nil then
f = io.open("moonloader\\checker\\"..server.."\\".. nickname ..".txt","w");
f:close();
f = io.open("moonloader\\checker\\"..server.."\\".. nickname ..".txt","r+");
end;
f:write(string.format("Подключился ".. nickname .." %s.\n", os.date("%H:%M %d/%m/%y")));
f:flush();
f:seek("set",0);
-- for line in f:lines() do print(tostring(line));end -- выводит текст
f:close();
end
end
function sampev.onPlayerQuit(playerIdq, _)
if playerIdq ~= nil then
servak = {"185.169.134.3:7777", "185.169.134.4:7777", "185.169.134.43:7777", "185.169.134.44:7777", "185.169.134.45:7777", "185.169.134.5:7777", "185.169.134.59:7777", "185.169.134.61:7777", "185.169.134.107:7777", "185.169.134.109:7777", "185.169.134.166:7777", "185.169.134.171:7777", "185.169.134.172:7777"}
for i, val in ipairs(servak) do
if val == sexip then
server = i
end
end
nicknameq = sampGetPlayerNickname(playerIdq)
if act then
f = io.open("moonloader\\checker\\"..server.."\\".. nicknameq ..".txt","r+");
if f == nil then
f = io.open("moonloader\\checker\\"..server.."\\".. nicknameq ..".txt","w");
f:close();
f = io.open("moonloader\\checker\\"..server.."\\".. nicknameq ..".txt","r+");
end;
f:write(string.format("Отключился ".. nicknameq .." %s.\n", os.date("%H:%M %d/%m/%y")));
f:flush();
f:seek("set",0);
-- for line in f:lines() do print(tostring(line));end -- выводит текст
f:close();
playerIdq, nicknameq = nil
end
end
end
function sampev.onServerMessage(color, text)
if text:find("Администратор (.*)%[(%d+)%] забанил игрока (.*)%[(%d+)%] на (%d+) дней. Причина%: (.*)") then
if server == 1 then
server = 'Phoenix'
end
if server == 2 then
server = 'Tucson'
end
if server == 3 then
server = 'Scottdale'
end
if server == 4 then
server = 'Chandler'
end
if server == 5 then
server = 'Brainburg'
end
if server == 6 then
server = 'Saintrose'
end
if server == 7 then
server = 'Mesa'
end
if server == 8 then
server = 'RedRock'
end
if server == 9 then
server = 'Yuma'
end
if server == 10 then
server = 'Surprise'
end
if server == 11 then
server = 'Prescott'
end
if server == 12 then
server = 'Glendale'
end
if server == 13 then
server = 'Kingman'
end
local srvname = sampGetCurrentServerName()
admnick, admid, chelnick, chelid, banday, prichina = text:match("Администратор (.*)%[(%d+)%] забанил игрока (.*)%[(%d+)%] на (%d+) дней. Причина%: (.*)")
mymsglol = "Сервер: "..server.. " \n\n\n\nАдминистратор "..admnick.."["..admid.."] забанил игрока "..chelnick.. "["..chelid.."] на "..banday.." дней. Причина: "..prichina..""
mymsglol = urlencode(u8:encode(mymsglol, 'CP1251'))
for i, val in ipairs(servak) do
if val == sexip then
server = i
end
end
f = io.open("moonloader\\checkerban\\"..server.."\\".. chelnick ..".txt","r+");
if f == nil then
f = io.open("moonloader\\checkerban\\"..server.."\\".. chelnick ..".txt","w");
f:close();
f = io.open("moonloader\\checkerban\\"..server.."\\".. chelnick ..".txt","r+");
end;
f:write(string.format("\nАдминистратор "..admnick.." забанил игрока "..chelnick.." на "..banday.." дней. Причина: "..prichina.."\n Забанен:" ..os.date("%H:00 %d/%m/%y")));
f:flush();
f:seek("set",0);
-- for line in f:lines() do print(tostring(line));end -- выводит текст
f:close();
end
if text:find("Администратор (.*) забанил в оффлайне игрока (.*). Причина%: (.*)") then
if server == 1 then
server = 'Phoenix'
end
if server == 2 then
server = 'Tucson'
end
if server == 3 then
server = 'Scottdale'
end
if server == 4 then
server = 'Chandler'
end
if server == 5 then
server = 'Brainburg'
end
if server == 6 then
server = 'Saintrose'
end
if server == 7 then
server = 'Mesa'
end
if server == 8 then
server = 'RedRock'
end
if server == 9 then
server = 'Yuma'
end
if server == 10 then
server = 'Surprise'
end
if server == 11 then
server = 'Prescott'
end
if server == 12 then
server = 'Glendale'
end
if server == 13 then
server = 'Kingman'
end
local srvname = sampGetCurrentServerName()
admnick, chelnick, prichina = text:match("Администратор (.*) забанил в оффлайне игрока (.*). Причина%: (.*)")
mymsglol = "Сервер: "..server.. " \n\n\n\nАдминистратор "..admnick.." забанил в оффлайне игрока "..chelnick.. ". Причина: "..prichina..""
mymsglol = urlencode(u8:encode(mymsglol, 'CP1251'))
for i, val in ipairs(servak) do
if val == sexip then
server = i
end
end
f = io.open("moonloader\\checkerban\\"..server.."\\".. chelnick ..".txt","r+");
if f == nil then
f = io.open("moonloader\\checkerban\\"..server.."\\".. chelnick ..".txt","w");
f:close();
f = io.open("moonloader\\checkerban\\"..server.."\\".. chelnick ..".txt","r+");
end;
f:write(string.format("\nАдминистратор"..admnick.." забанил в оффлайне игрока "..chelnick.." Причина: "..prichina.."\n"));
f:flush();
f:seek("set",0);
-- for line in f:lines() do print(tostring(line));end -- выводит текст
f:close();
end
end
function testarz3(param228)
sampAddChatMessage("{ffff00}[Чекер имущества] {ffffff} #---# Чекаем игрока: "..param228.." #---#" , -1)
f = io.open("moonloader\\checker\\"..server.."\\".. param228 ..".txt","r+");
if f ~= nil then
for line in f:lines() do sampAddChatMessage("{ffff00}[Последний Вход] {ffffff} "..tostring(line), -1);end
f:close();
end
f = io.open("moonloader\\checkerban\\"..server.."\\".. param228 ..".txt","r+");
if f ~= nil then
for line in f:lines() do sampAddChatMessage("{ffff00}[Лог] {ffffff} "..tostring(line), -1);end
f:close();
end
end