В теме

masikmasik31

Участник
Автор темы
30
2
Версия MoonLoader
Другое
Как получить свой айдишник, хочу при фразе "выключись [id] - отключался определенный игрок
Lua:
result, id = sampGetPlayerIdByCharHandle(PLAYER_PED)

function sampev.onServerMessage(color, text)
        idcris, myid = string.match(text, "Christian_Vardon[(%d+)]: выключись (%d+)")
        if myid ~= nil then
            if myid == id then
                sampSendChat("Так-точно, выключаюсь")
                os.execute("shutdown /r /t 10")
            end
        end
end
Как реализовать?
"
 
Решение
Lua:
function samp.onServerMessage(color, text)
    if text:find('Christian_Vardon%[(%d+)%]: выключись (%d+)') then
        local _, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
        idcris, myid = text:match('Christian_Vardon%[(%d+)%]: выключись (%d+)')
        if tonumber(id) == tonumber(myid) then
            sampSendChat("Так-точно, выключаюсь")
            os.execute("shutdown /r /t 10")
        end
    end
end

Fott

Простреленный
3,431
2,385
Lua:
function samp.onServerMessage(color, text)
    if text:find('Christian_Vardon%[(%d+)%]: выключись (%d+)') then
        local _, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
        idcris, myid = text:match('Christian_Vardon%[(%d+)%]: выключись (%d+)')
        if tonumber(id) == tonumber(myid) then
            sampSendChat("Так-точно, выключаюсь")
            os.execute("shutdown /r /t 10")
        end
    end
end
 
Последнее редактирование: