Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 17/11/22 in all areas

  1. A coroutine is a kind of thread type, which you can use to put a function to a temporary stop. The coroutine.create method requires a function and returns the coroutine. local co co = coroutine.create(function () end) The coroutine.yield method stops the thread, when it is called inside of the function. local co co = coroutine.create(function () coroutine.yield() end) To start a coroutine you can must call the method coroutine.resume, the first argument has to be the coroutine. local co co = coroutine.create(function () print("A") coroutine.yield() print("B") end) coroutine.resume(co) -- print A -- but does NOT print B To resume the coroutine after yield, just call coroutine.resume again. local co co = coroutine.create(function () coroutine.yield() print("B") end) coroutine.resume(co) -- start -- coroutine.yield() coroutine.resume(co) -- print B Add an async function of any kind (timer) and you are ready to go. local co co = coroutine.create(function () print("A") coroutine.yield() print("B") end) coroutine.resume(co) -- print A setTimer(function () coroutine.resume(co) -- print B end, 5000, 1)
    1 point
  2. Видел скрипт, который позволял кататься ботам по карте, как в GTA SA. Он довольно гибкий в настройке, если разобраться. Но сервер грузит сильно с большим количеством ботов... https://mtaresource.ru/resource?rid=173 Идея, как я понял, следующая: Есть таблица, содержащая "узлы". Между этими узлами строится прямая. По ней и происходит движение. Далее потребуется знание написания кода для ИИ, чтобы боты не предоставляли угрозу окружающим игрокам))
    1 point
  3. ?. Можете последить за прогрессом Trilogy Multiplayer. Только стоит понимать, что к MTA он отношение не имеет и это отдельный проект.
    1 point
×
×
  • Create New...