скрипт на отображение айпи

killcore

Новичок
Автор темы
4
0
Версия SA-MP
  1. 0.3.7-R3
нужен скрипт который выведет айпи с которого я подключаюсь на сервер, в чат или на экран текстом
 

smutchev

Участник
35
11
code:
local requests = require 'requests'

function main()
    while not isSampAvailable() do wait(0) end
    sampRegisterChatCommand("showmyip", function()
        lua_thread.create(function()
            local response = requests.get('http://api.ipify.org')
            if response.status_code == 200 then
                sampAddChatMessage("IP: " .. response.text, -1)
            else
                sampAddChatMessage("Error: " .. response.status_code, -1)
            end
        end)
    end)
    wait(-1)
end