- 54
- 1
- Версия MoonLoader
- .025-beta
Подскажите что за ошибка.
Код:
Lua:
script_name("ARZHelper.Marshmello.vk.com/chelovek_buduschego_228")
script_author("Маршмелька")
require "lib.moonloader"
local request = require 'requests'
local encoding = require 'encoding'
local sampev = require "lib.samp.events"
encoding.default = 'CP1251'
u8 = encoding.UTF8
ip = 0
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end
sampRegisterChatCommand("cip", cmd_cip)
while true do
wait(0)
end
end
function sampev.onServerMessage(color, msg)
if ip == 1 then
if msg:find(" IP: ") then
lua_thread.create(function()
local pName, rIP_1, rIP_2, rIP_3, rIP_4, nowIP_1, nowIP_2, nowIP_3, nowIP_4 = msg:match('(.+)%[(%d+).(%d+).(%d+).(%d+)] IP: {FFFFFF}(%d+).(%d+).(%d+).(%d+)')
rIP = rIP_1..'.'..rIP_2..'.'..rIP_3..'.'..rIP_4
nowIP = nowIP_1..'.'..nowIP_2..'.'..nowIP_3..'.'..nowIP_4
local result, response = pcall(request.get, "http://ip-api.com/json/"..rIP..'?lang=ru')
if result then
local resp = response.text
local reg_country, reg_countryCode, reg_region, reg_regionName, reg_city, reg_zip, reg_lat, reg_lon, reg_timezone, reg_isp, reg_org = resp:match('"country":"(.+)","countryCode":"(.+)","region":"(.+)","regionName":"(.+)","city":"(.+)","zip":"(.+)","lat":(.+),"lon":(.+),"timezone":"(.+)","isp":"(.+)","org":"(.+)"')
sampAddChatMessage('{2ed164}[Admin Helper] {FFA500}REG: Страна: {FF0000}'..u8:decode(reg_country)..'{FFFFFF}. Регион: {FF0000}'..u8:decode(reg_regionName), -1)
sampAddChatMessage('{2ed164}[Admin Helper] {FFA500}REG: Город: {FF0000}'..u8:decode(reg_city)..'{FFFFFF}. Провайдер: {FF0000}'..u8:decode(reg_isp), -1)
end
local result, response = pcall(request.get, "http://ip-api.com/json/"..nowIP..'?lang=ru')
if result then
local resp = response.text
local now_country, now_countryCode, now_region, now_regionName, now_city, now_zip, now_lat, now_lon, now_timezone, now_isp, now_org = resp:match('"country":"(.+)","countryCode":"(.+)","region":"(.+)","regionName":"(.+)","city":"(.+)","zip":"(.+)","lat":(.+),"lon":(.+),"timezone":"(.+)","isp":"(.+)","org":"(.+)"')
sampAddChatMessage('{2ed164}[Admin Helper] {FFFFFF}NOW: Страна: {FF0000}'..u8:decode(now_country)..'{FFFFFF}. Регион: {FF0000}'..u8:decode(now_regionName), -1)
sampAddChatMessage('{2ed164}[Admin Helper] {FFFFFF}NOW: Город: {FF0000}'..u8:decode(now_city)..'{FFFFFF}. Провайдер: {FF0000}'..u8:decode(now_isp), -1)
end
end)
ip = 0
end
end
end
function cmd_cip(id)
if id == nil or id == '' then
sampAddChatMessage('Введите ID', -1)
elseif id then
sampSendChat('/getip '..id)
ip = 1
end
end