SA:MP Помогите сделать луа скрипт

TheClaudePlay

Известный
Автор темы
226
50
Версия SA-MP
  1. 0.3.7 (R1)
  2. Другая
Нашёл тему, в которой сделан лёгкий спидометр.

Нужно доработать и сделать так, чтобы он работал только на определённом транспорте.
Ещё в той теме есть проблема с кодировкой!
 
Решение
Lua:
local x, y = 20, 500
local multiply = 1.0

local models = {
  400,
} -- https://open.mp/docs/scripting/resources/vehicleid

main = function()
  local font = renderCreateFont("Arial", 17, 13)
  while true do
    wait(0)
    if isCharInAnyCar(PLAYER_PED) and not isPauseMenuActive() then
      for k, v in pairs(models) do
        local res = isCharInModel(PLAYER_PED, v)
        if res then
          renderFontDrawText(
            font,
            string.format(
              "Скорость: %.1f",
              getCarSpeed(storeCarCharIsInNoSave(PLAYER_PED)) * multiply
            ),
            x,
            y,
            0xFFffffff,
            false
          )
        end
      end
    end
  end
end

Deps

Известный
258
193
Вместо того, чтобы просить помощь, лучше сделай сам, в дальнейшем много возможностей открывается.

Глянь это и придумай что с него можно сворганить:
 
  • Bug
Реакции: constersuonsis
Lua:
local x, y = 20, 500
local multiply = 1.0

local models = {
  400,
} -- https://open.mp/docs/scripting/resources/vehicleid

main = function()
  local font = renderCreateFont("Arial", 17, 13)
  while true do
    wait(0)
    if isCharInAnyCar(PLAYER_PED) and not isPauseMenuActive() then
      for k, v in pairs(models) do
        local res = isCharInModel(PLAYER_PED, v)
        if res then
          renderFontDrawText(
            font,
            string.format(
              "Скорость: %.1f",
              getCarSpeed(storeCarCharIsInNoSave(PLAYER_PED)) * multiply
            ),
            x,
            y,
            0xFFffffff,
            false
          )
        end
      end
    end
  end
end