call id

Kegwineye.

Участник
Автор темы
478
20
Форматирование кода.
Версия MoonLoader
.026-beta
как сделать звонок по ID?
1665493768076.png

Lua:
_, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
function getnumber(id)
    sampSendChat("/number " .. id)
end
function sampev.onServerMessage(color, msg)
    if msg:match("^{......}%a+_%a+%[%d+%]:    {......}%d+$") then
        local number = msg:match("^{......}%a+_%a+%[%d+%]:    {......}(%d+)$")
        lua_thread.create(function()
            sampAddChatMessage(localscripttag.. 'Звоним по номеру: {aa0000}'..number, -1)
            wait(500)
            sampSendChat("/call " .. number)
        end)
        return false
    end
end
 
Последнее редактирование модератором:
Решение
видимо.


ачо я могу сделать по твоему. если и в правду выдает лишь серверное сообщение, и на этом всё.
Ставить проверки и узнать на каком этапе появляется ошибка:
Lua:
require 'lib.moonloader'
local sampev = require 'lib.samp.events'

local number = ''
local calling = false

function main()
    if not isSampLoaded() then return end
    while not isSampAvailable() do wait(100) end
    sampRegisterChatCommand('fcall', function(arg)
        arg = tonumber(arg)
        if arg ~= nil and sampIsPlayerConnected(arg) then
            sampSendChat('/number '..arg)
            calling = true
        else
            sampAddChatMessage("Введите корректный ID игрока", -1)
        end
    end)
 
    while true do...

Kegwineye.

Участник
Автор темы
478
20

shawtyglock.

Активный
186
57
по логике от сервера. потому что и на мобиле оно есть.
Lua:
require 'lib.moonloader'
local sampev = require 'lib.samp.events'

local number = ''
local calling = false

function main()
    if not isSampLoaded() then return end
    while not isSampAvailable() do wait(100) end
    sampRegisterChatCommand('fcall', function(arg)
        arg = tonumber(arg)
        if arg ~= nil and sampIsPlayerConnected(arg) then
            sampSendChat('/number '..arg)
            calling = true
        else
            sampAddChatMessage("Введите корректный ID игрока", -1)
        end
    end)
   
    while true do
        wait(0)
    end
end

function sampev.onServerMessage(text, color)
    if calling then
        local number = text:match("%* {FFFFFF}Номер игрока {63BD4E}%a+_%a+%[%d+%]{FFFFFF}: {63BD4E}(%d+)")
        if number then
            lua_thread.create(function()
                wait(500)
                sampSendChat("/call "..tostring(number))
                number = nil
            end)
        end
    end
end
 
Последнее редактирование:

Kegwineye.

Участник
Автор темы
478
20
Lua:
require 'lib.moonloader'
local sampev = require 'lib.samp.events'

local number = ''
local calling = false

function main()
    if not isSampLoaded() then return end
    while not isSampAvailable() do wait(100) end
    sampRegisterChatCommand('fcall', function(arg)
        arg = tonumber(arg)
        if arg ~= nil and sampIsPlayerConnected(arg) then
            sampSendChat('/number '..arg)
            calling = true
        else
            sampAddChatMessage("Введите корректный ID игрока", -1)
        end
    end)
  
    while true do
        wait(0)
    end
end

function sampev.onServerMessage(text, color)
    if calling then
        local number = text:match("%* {FFFFFF}Номер игрока {63BD4E}%a+_%a+%[%d+%]{FFFFFF}: {63BD4E}(%d+)")
        if number then
            lua_thread.create(function()
                wait(500)
                sampSendChat("/call "..tostring(number))
                number = nil
            end)
        end
    end
end
так же выводит лишь сообщение после /number, а звонка нет
 

Kegwineye.

Участник
Автор темы
478
20
бля, вы реально 3 страницы делаете регулярку?
видимо.

Без нормального фидбека можно и 10 страниц настрочить
ачо я могу сделать по твоему. если и в правду выдает лишь серверное сообщение, и на этом всё.
 
Последнее редактирование:

shawtyglock.

Активный
186
57
видимо.


ачо я могу сделать по твоему. если и в правду выдает лишь серверное сообщение, и на этом всё.
Ставить проверки и узнать на каком этапе появляется ошибка:
Lua:
require 'lib.moonloader'
local sampev = require 'lib.samp.events'

local number = ''
local calling = false

function main()
    if not isSampLoaded() then return end
    while not isSampAvailable() do wait(100) end
    sampRegisterChatCommand('fcall', function(arg)
        arg = tonumber(arg)
        if arg ~= nil and sampIsPlayerConnected(arg) then
            sampSendChat('/number '..arg)
            calling = true
        else
            sampAddChatMessage("Введите корректный ID игрока", -1)
        end
    end)
 
    while true do
        wait(0)
    end
end

function sampev.onServerMessage(text, color)
    if calling then
        sampAddChatMessage("Звоню...", -1)
        local number = text:match("%* {FFFFFF}Номер игрока {63BD4E}%a+_%a+%[%d+%]{FFFFFF}: {63BD4E}(%d+)")
        if number then
            sampAddChatMessage("Номер: "..number, -1)
            lua_thread.create(function()
                wait(500)
                sampSendChat("/call "..tostring(number))
                number = nil
                calling = false
            end)
        end
    end
end

Так-же, если на этом сервере легко получить телефон, сим-карту и телефонную книжку, то неплохо было бы написать мне в лс айпи
 
  • Нравится
  • Вау
Реакции: qdIbp и Kegwineye.