- 1
- 0
Ищу скрипт "спидометр бега персонажа km/h" Arizona RP
Что-то такое. но чтобы была точная скорость
speed:
require "moonloader"
require "sampfuncs"
local font
local enabled = true
local smoothSpeed = 0.0 -- сглаженная скорость
function main()
while not isSampAvailable() do wait(100) end
font = renderCreateFont("Arial", 14, 5)
sampAddChatMessage("[Speed] /speed", -1)
sampRegisterChatCommand("speed", function()
enabled = not enabled
sampAddChatMessage("[Speed] " .. (enabled and "ON" or "OFF"), -1)
end)
while true do
wait(0)
if enabled then
local speed = 0.0
if isCharInAnyCar(PLAYER_PED) then
local veh = storeCarCharIsInNoSave(PLAYER_PED)
speed = getCarSpeed(veh) * 3.6
elseif isCharOnFoot(PLAYER_PED) then
local vx, vy, vz = getCharVelocity(PLAYER_PED)
-- убираем прыжки по Z
local raw = math.sqrt(vx*vx + vy*vy)
-- калибровка под /re
speed = raw * 3.6 * (10 / 18)
end
-- сглаживание (главный фикс)
smoothSpeed = smoothSpeed + (speed - smoothSpeed) * 0.15
-- цвет по скорости
local r, g, b = 255, 255, 255
if smoothSpeed < 60 then
r, g, b = 100, 255, 100
elseif smoothSpeed < 120 then
r, g, b = 255, 255, 100
else
r, g, b = 255, 100, 100
end
local color = bit.bor(bit.lshift(255, 24), bit.lshift(r, 16), bit.lshift(g, 8), b)
local sw, sh = getScreenResolution()
renderFontDrawText(font,
string.format("Speed: %.0f km/h", smoothSpeed),
sw / 2, sh - 50,
color, 2)
end
end
end
Что-то такое. но чтобы была точная скорость
Последнее редактирование: