Не обновляеться инфа в реконе если чел сидит в машине

calculatorxss

Новичок
Автор темы
24
2
Версия MoonLoader
.027.0-preview
Не могу понять почему не обновляется, нужно проверку сделать? но как , я забыл

вот видос, если кто может помогите


Lua:
local newFrame = imgui.OnFrame(
    function() return stats[0] end,
    function(player)
        spec_nick = sampGetPlayerNickname(spec_id)
        darktheme_custom()
        imgui.SetNextWindowSize(imgui.ImVec2(450, 250), imgui.Cond.FirstUseEver)
        imgui.SetNextWindowPos(imgui.ImVec2(1690, 630), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
        imgui.Begin(u8'Статистика на '.. spec_nick, nil, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoMove + imgui.WindowFlags.NoCollapse)
          if isKeyJustPressed(VK_RBUTTON) and not sampIsChatInputActive() and not sampIsDialogActive() then
        imgui.ShowCursor = not imgui.ShowCursor
        end

        local isPed, pPed = sampGetCharHandleBySampPlayerId(spec_id)
if isPed then   
    spec_score = sampGetPlayerScore(spec_id)
    spec_ping = sampGetPlayerPing(spec_id)
    spec_hp = sampGetPlayerHealth(spec_id)
    spec_armor = sampGetPlayerArmor(spec_id)
    spec_skin = getCharModel(pPed)
    spec_weapon = getCurrentCharWeapon(pPed)
    spec_int = getCharActiveInterior(pPed)
    spec_veh = sampGetVehicleIdByCarHandle(car)
end
        
    weap = getweaponname(spec_weapon)
    
        imgui.Columns(2, "Recon", true)

        imgui.Text(u8'Имя : '.. spec_nick)
      
        imgui.NextColumn()
      
        imgui.Text(u8'Уровень : '.. spec_score)
      
        imgui.NextColumn()
        imgui.Separator()
      
        imgui.Text(u8'Пинг : '.. spec_ping)
      
        imgui.NextColumn()
      
        imgui.Text(u8'Здоровье : '.. spec_hp)
      
        imgui.NextColumn()
        imgui.Separator()
      
        imgui.Text(u8'Броня : '.. spec_armor)
      
        imgui.NextColumn()
      
        imgui.Text(u8'Скин : '..spec_skin)
      
        imgui.NextColumn()
        imgui.Separator()
      
        imgui.Text(u8'Оружие/ПТ : '..spec_weapon)
      
        imgui.NextColumn()
      
        imgui.Text(u8'Интерьер : '..spec_int)
      
        imgui.NextColumn()
        imgui.Separator()
        
      
        imgui.Columns(1)

        imgui.End()
    end
)
 

chapo

tg/inst: @moujeek
Всефорумный модератор
9,204
12,528
покажи хуки на рпс через которые получаешь ид игрока

Скорее всего ошибка именно там, потому что если игрок в тачке, то сервак присылает тебе спек за машиной в которой он сидит, а не за самим игроком
 

dmitry.karle

Известный
410
108
Lua:
require('lib.samp.events').onSendCommand = function(cmd)
    local reconID = cmd:match('/re .+')
    if reconID then
        --cod
        sampAddChatMessage('Ввели '..reconID, -1)
    end
end

либо с помощью текстдрава которые в спеке проверка хэндла персонажа sampGetCharHandleBySampPlayerId()


Lua:
require('lib.samp.events').onShowTextDraw = function(id, data)
    --cod
end
 

chapo

tg/inst: @moujeek
Всефорумный модератор
9,204
12,528
Lua:
require('lib.samp.events').onSendCommand = function(cmd)
    local reconID = cmd:match('/re .+')
    if reconID then
        --cod
        sampAddChatMessage('Ввели '..reconID, -1)
    end
end

либо с помощью текстдрава которые в спеке проверка хэндла персонажа sampGetCharHandleBySampPlayerId()


Lua:
require('lib.samp.events').onShowTextDraw = function(id, data)
    --cod
end
Хуевая идея. Неверная регулярка и багнется при неверно введенном иде или если игрок не подключен.
Можно сделать что-то примерно такое
Lua:
local SampEvents = require('lib.samp.events');
local Spectate = {
    target = {
        lastInputId = nil,
        id = nil,
        ped = nil
    }
};

function Spectate.target.handler(isPlayer, id, camType)
    Spectate.target.id = isPlayer and id or Spectate.target.lastInputId;
    local isStreamed, targetHandle = sampGetCharHandleBySampPlayerId(Spectate.target.id);
    if (isStreamed) then
        Spectate.target.ped = targetHandle;
    end
end

function SampEvents.onSendCommand(cmd)
    if (cmd:find('/re (%d+)')) then
        Spectate.target.lastInputId = tonumber(cmd:match('/re (%d+)'));
    end
end

function SampEvents.onSpectatePlayer(...)
    Spectate.target.handler(true, ...);
end

function SampEvents.onSpectateVehicle(...)
    Spectate.target.handler(false, ...);
end
 

dmitry.karle

Известный
410
108
Неверная регулярка и багнется при неверно введенном иде или если игрок не подключен
да эт понятно, я себе тоже проверки делал. Для примера скинул, один хуй у него проеб в хэндлах isCharOnFoot(Ped ped) doesCharExist(Ped ped)
 

calculatorxss

Новичок
Автор темы
24
2
покажи хуки на рпс через которые получаешь ид игрока

Скорее всего ошибка именно там, потому что если игрок в тачке, то сервак присылает тебе спек за машиной в которой он сидит, а не за самим игроком
Lua:
function se.onTogglePlayerSpectating()
    if spec_id ~= -1 then
        recwindow[0] = true
        pokaran[0] = true
        stats[0] = true
    end
end

function getMyNick()
    return sampGetPlayerNickname(select(2, sampGetPlayerIdByCharHandle(1)))
end
function getMyId()
    return select(2, sampGetPlayerIdByCharHandle(1))
end
function se.onTogglePlayerSpectating()
    if spec_id ~= -1 then
        recwindow[0] = true
        pokaran[0] = true
        stats[0] = true
    end
end

Все что нашел с спек ид