Скрипт не хочет работать

CanslerW

Участник
Автор темы
54
1
Версия MoonLoader
.025-beta
6tWYOD0tM3c.jpg

Подскажите что за ошибка.
Код:
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
 
Решение
Lua:
local request = require 'requests'
function main()
    repeat wait(0) until isSampAvailable()
    sampRegisterChatCommand("cip", function(n)
        if #n == 0 or not tonumber(n) then return sampAddChatMessage('Введите ID', -1) end
        sampSendChat('/getip '..n)
    end)
    wait(-1)
end

require('samp.events').onServerMessage = function(color, msg)
    local pName, rIP, nowIP = msg:match('(.+)%[(.+)] IP: {FFFFFF}(.+)')
    if not (pName and rIP and nowIP) then return end
    local response = decodeJson(request.get("http://ip-api.com/json/"..rIP).text)
    sampAddChatMessage('{2ed164}[Admin Helper] {FFA500}REG: Страна: {FF0000}'..response.country..'{FFFFFF}. Регион: {FF0000}'..response.regionName, -1)...

BUGIUA

Известный
55
5
6tWYOD0tM3c.jpg

Подскажите что за ошибка.
Код:
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
я хз как тебе помочь но что делает скрипт?
 

sᴀxᴏɴ

#Mary
Всефорумный модератор
791
846
Lua:
local request = require 'requests'
function main()
    repeat wait(0) until isSampAvailable()
    sampRegisterChatCommand("cip", function(n)
        if #n == 0 or not tonumber(n) then return sampAddChatMessage('Введите ID', -1) end
        sampSendChat('/getip '..n)
    end)
    wait(-1)
end

require('samp.events').onServerMessage = function(color, msg)
    local pName, rIP, nowIP = msg:match('(.+)%[(.+)] IP: {FFFFFF}(.+)')
    if not (pName and rIP and nowIP) then return end
    local response = decodeJson(request.get("http://ip-api.com/json/"..rIP).text)
    sampAddChatMessage('{2ed164}[Admin Helper] {FFA500}REG: Страна: {FF0000}'..response.country..'{FFFFFF}. Регион: {FF0000}'..response.regionName, -1)
    sampAddChatMessage('{2ed164}[Admin Helper] {FFA500}REG: Город: {FF0000}'..response.city..'{FFFFFF}. Провайдер: {FF0000}'..response.isp, -1)
    local response = decodeJson(request.get("http://ip-api.com/json/"..nowIP).text)
    sampAddChatMessage('{2ed164}[Admin Helper] {FFA500}NOW: Страна: {FF0000}'..response.country..'{FFFFFF}. Регион: {FF0000}'..response.regionName, -1)
    sampAddChatMessage('{2ed164}[Admin Helper] {FFA500}NOW: Город: {FF0000}'..response.city..'{FFFFFF}. Провайдер: {FF0000}'..response.isp, -1)
end
 
  • Влюблен
Реакции: CanslerW