В простом Lua скрипте не работает задержка. Что не так?

Diego_Sativa

Известный
Автор темы
573
60
Версия SA-MP
  1. 0.3.7 (R1)
local valid, ped = getCharPlayerIsTargeting(PLAYER_HANDLE)
if valid and doesCharExist(ped) then
local result, id = sampGetPlayerIdByCharHandle(ped)
if result and isKeyDown(VK_I) then
sampSendChat(string.format("/invite %s", id) )
wait(10000)
sampSendChat(string.format("/giverank %s 7", id) )
end
 

SomaGnoma

Известный
429
147
Да я не шарю как это сделать бро

так?
Lua:
function main()
    while not isSampAvailable() do wait(0) end
    while true do wait(0)
        local valid, ped = getCharPlayerIsTargeting(PLAYER_HANDLE)
        if valid and doesCharExist(ped) then
            local result, id = sampGetPlayerIdByCharHandle(ped)
            if result and isKeyDown(VK_I) then
                sampSendChat(string.format("/invite %s", id) )
                    lua_thread.crate(function()
                wait(10000)
                    end
                sampSendChat(string.format("/giverank %s 7", id) )
            end
        end
    end
end
Lua:
lua_thread.create(function()
wait(10000)   
sampSendChat(string.format("/giverank %s 7", id) )
end)