require "lib.moonloader"
local ffi = require 'ffi'
local maxSpeed = 150
function main()
while not isSampAvailable() do wait(0) end
sampRegisterChatCommand("lim", function(arg)
local value = tonumber(arg)
if value and value > 0 then
maxSpeed = value
sampAddChatMessage("[Limiter] Лимит скорости установлен: " .. maxSpeed .. " km/h", -1)
else
sampAddChatMessage("[Limiter] Использование: /lim [число]", -1)
end
end)
while true do
wait(0)
if isCharInAnyCar(PLAYER_PED) then
local veh = storeCarCharIsInNoSave(PLAYER_PED)
if getDriverOfCar(veh) == PLAYER_PED then
local ptr = getCarPointer(veh)...
На LUA такого нету?
require "lib.moonloader"
local vkeys = require "vkeys"
local memory = require "memory"
local is_active = false
local speed_limit = 57 -- Стандартное ограничение по умолчанию
local last_key_time = 0 -- Таймер для плавного изменения при зажатии
-- Функция проверки, является ли транспорт велосипедом
local function isBicycle(modelID)
-- 481: BMX, 509: Bike, 510: Mountain Bike
return modelID == 481 or modelID == 509 or modelID == 510
end
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end
-- Команда активации/деактивации без сообщений в чат
sampRegisterChatCommand("velocity", function()
is_active = not is_active
if is_active then
printStringNow("~g~Velocity Limit ON ~w~(" .. speed_limit .. ")", 1500)
else
printStringNow("~r~Velocity Limit OFF", 1500)
end
end)
-- Команда: Установка лимита числом
sampRegisterChatCommand("vlimit", function(arg)
local val = tonumber(arg)
if val then
if val < 1 then val = 1 end -- Меньше 1 теперь поставить нельзя
speed_limit = val
printStringNow("~y~Limit set to: ~w~" .. tostring(speed_limit), 2000)
else
printStringNow("~r~Use: /vlimit [number]", 2000)
end
end)
while true do
wait(0)
-- Если скрипт включен и игрок в транспорте
if is_active and isCharInAnyCar(PLAYER_PED) then
local car = storeCarCharIsInNoSave(PLAYER_PED)
if car then
local model = getCarModel(car)
-- ПРОВЕРКА: Работаем ТОЛЬКО если это велосипед
if isBicycle(model) then
local current_time = os.clock()
-- Настройка скорости (Зажать L и УДЕРЖИВАТЬ Минус или Плюс)
if isKeyDown(vkeys.VK_L) then
-- Срабатывает каждые 0.05 секунд (20 раз в секунду), пока кнопка зажата
if isKeyDown(vkeys.VK_OEM_MINUS) and (current_time - last_key_time > 0.05) then
speed_limit = speed_limit - 1
if speed_limit < 1 then speed_limit = 1 end -- Защита (не меньше 1)
printStringNow("~y~Limit: ~w~" .. tostring(speed_limit), 1000)
last_key_time = current_time
elseif isKeyDown(vkeys.VK_OEM_PLUS) and (current_time - last_key_time > 0.05) then
speed_limit = speed_limit + 1
printStringNow("~y~Limit: ~w~" .. tostring(speed_limit), 1000)
last_key_time = current_time
end
end
-- Логика ограничения скорости
local ptr = getCarPointer(car)
if ptr ~= 0 then
-- Читаем текущую скорость машины (Векторы X и Y)
local vx = memory.getfloat(ptr + 0x44, false)
local vy = memory.getfloat(ptr + 0x48, false)
-- Считаем фактическую скорость по плоскости
local current_speed_ms = math.sqrt(vx * vx + vy * vy)
-- Переводим км/ч в метры/секунду
local max_speed_ms = speed_limit / 3.6
-- Если скорость превышает лимит, плавно срезаем её
if current_speed_ms > max_speed_ms then
if current_speed_ms > 0 then
local ratio = max_speed_ms / current_speed_ms
memory.setfloat(ptr + 0x44, vx * ratio, false)
memory.setfloat(ptr + 0x48, vy * ratio, false)
end
end
end
end
end
end
end
end
ну и хуйнянавайбкодил
Bike Velocity Limiter (Lua) Скрипт позволяет установить лимит максимальной скорости для велосипедов (BMX, Bike, Mountain Bike). Главные особенности:
Команды и управление:
- Умная активация: работает только на великах (ID 481, 509, 510). Если вы сядете в машину или на мотоцикл, скрипт мешать не будет, они поедут на своей максималке.
- Можно установить абсолютно любую скорость (от 0 и выше).
- Скрипт полностью "тихий" — ничего не пишет в чат. Все уведомления появляются внизу экрана (в стиле стандартных надписей GTA) и не светятся на скриншотах чата.
- Безопасная физика: скорость режется только по осям X и Y, поэтому прыжки в высоту (по оси Z) на BMX работают идеально и вас не будет "магнитить" к земле.
Требования: MoonLoader Установка: Закинуть файл bike_limiter.lua в папку moonloader.
- /velocity — Включить / Выключить ограничитель.
- /vlimit [число] — Задать точный лимит скорости (например: /vlimit 57).
- Зажать L и нажимать - (минус) или = (плюс) — Увеличивать или уменьшать лимит скорости прямо на ходу по 1 км/ч.
Lua:require "lib.moonloader" local vkeys = require "vkeys" local memory = require "memory" local is_active = false local speed_limit = 57 -- Стандартное ограничение по умолчанию local last_key_time = 0 -- Таймер для плавного изменения при зажатии -- Функция проверки, является ли транспорт велосипедом local function isBicycle(modelID) -- 481: BMX, 509: Bike, 510: Mountain Bike return modelID == 481 or modelID == 509 or modelID == 510 end function main() if not isSampLoaded() or not isSampfuncsLoaded() then return end while not isSampAvailable() do wait(100) end -- Команда активации/деактивации без сообщений в чат sampRegisterChatCommand("velocity", function() is_active = not is_active if is_active then printStringNow("~g~Velocity Limit ON ~w~(" .. speed_limit .. ")", 1500) else printStringNow("~r~Velocity Limit OFF", 1500) end end) -- Команда: Установка лимита числом sampRegisterChatCommand("vlimit", function(arg) local val = tonumber(arg) if val then if val < 1 then val = 1 end -- Меньше 1 теперь поставить нельзя speed_limit = val printStringNow("~y~Limit set to: ~w~" .. tostring(speed_limit), 2000) else printStringNow("~r~Use: /vlimit [number]", 2000) end end) while true do wait(0) -- Если скрипт включен и игрок в транспорте if is_active and isCharInAnyCar(PLAYER_PED) then local car = storeCarCharIsInNoSave(PLAYER_PED) if car then local model = getCarModel(car) -- ПРОВЕРКА: Работаем ТОЛЬКО если это велосипед if isBicycle(model) then local current_time = os.clock() -- Настройка скорости (Зажать L и УДЕРЖИВАТЬ Минус или Плюс) if isKeyDown(vkeys.VK_L) then -- Срабатывает каждые 0.05 секунд (20 раз в секунду), пока кнопка зажата if isKeyDown(vkeys.VK_OEM_MINUS) and (current_time - last_key_time > 0.05) then speed_limit = speed_limit - 1 if speed_limit < 1 then speed_limit = 1 end -- Защита (не меньше 1) printStringNow("~y~Limit: ~w~" .. tostring(speed_limit), 1000) last_key_time = current_time elseif isKeyDown(vkeys.VK_OEM_PLUS) and (current_time - last_key_time > 0.05) then speed_limit = speed_limit + 1 printStringNow("~y~Limit: ~w~" .. tostring(speed_limit), 1000) last_key_time = current_time end end -- Логика ограничения скорости local ptr = getCarPointer(car) if ptr ~= 0 then -- Читаем текущую скорость машины (Векторы X и Y) local vx = memory.getfloat(ptr + 0x44, false) local vy = memory.getfloat(ptr + 0x48, false) -- Считаем фактическую скорость по плоскости local current_speed_ms = math.sqrt(vx * vx + vy * vy) -- Переводим км/ч в метры/секунду local max_speed_ms = speed_limit / 3.6 -- Если скорость превышает лимит, плавно срезаем её if current_speed_ms > max_speed_ms then if current_speed_ms > 0 then local ratio = max_speed_ms / current_speed_ms memory.setfloat(ptr + 0x44, vx * ratio, false) memory.setfloat(ptr + 0x48, vy * ratio, false) end end end end end end end end
lua file
require "lib.moonloader"
local ffi = require 'ffi'
local maxSpeed = 150
function main()
while not isSampAvailable() do wait(0) end
sampRegisterChatCommand("lim", function(arg)
local value = tonumber(arg)
if value and value > 0 then
maxSpeed = value
sampAddChatMessage("[Limiter] Лимит скорости установлен: " .. maxSpeed .. " km/h", -1)
else
sampAddChatMessage("[Limiter] Использование: /lim [число]", -1)
end
end)
while true do
wait(0)
if isCharInAnyCar(PLAYER_PED) then
local veh = storeCarCharIsInNoSave(PLAYER_PED)
if getDriverOfCar(veh) == PLAYER_PED then
local ptr = getCarPointer(veh)
if ptr ~= 0 then
local vx = representIntAsFloat(readMemory(ptr + 0x44, 4, true))
local vy = representIntAsFloat(readMemory(ptr + 0x48, 4, true))
local horizontalSpeed = math.sqrt(vx^2 + vy^2)
local speedKmH = horizontalSpeed * 180
if speedKmH > maxSpeed then
local limitInGameUnits = maxSpeed / 180
local multiplier = limitInGameUnits / horizontalSpeed
local newVx = representFloatAsInt(vx * multiplier)
local newVy = representFloatAsInt(vy * multiplier)
writeMemory(ptr + 0x44, 4, newVx, true)
writeMemory(ptr + 0x48, 4, newVy, true)
end
end
end
end
end
end
function representIntAsFloat(val)
return ffi.cast('float*', ffi.new('int[1]', val))[0]
end
function representFloatAsInt(val)
return ffi.cast('int*', ffi.new('float[1]', val))[0]
end
затестил бы для началанавайбкодил
Bike Velocity Limiter (Lua) Скрипт позволяет установить лимит максимальной скорости для велосипедов (BMX, Bike, Mountain Bike). Главные особенности:
Команды и управление:
- Умная активация: работает только на великах (ID 481, 509, 510). Если вы сядете в машину или на мотоцикл, скрипт мешать не будет, они поедут на своей максималке.
- Можно установить абсолютно любую скорость (от 0 и выше).
- Скрипт полностью "тихий" — ничего не пишет в чат. Все уведомления появляются внизу экрана (в стиле стандартных надписей GTA) и не светятся на скриншотах чата.
- Безопасная физика: скорость режется только по осям X и Y, поэтому прыжки в высоту (по оси Z) на BMX работают идеально и вас не будет "магнитить" к земле.
Требования: MoonLoader Установка: Закинуть файл bike_limiter.lua в папку moonloader.
- /velocity — Включить / Выключить ограничитель.
- /vlimit [число] — Задать точный лимит скорости (например: /vlimit 57).
- Зажать L и нажимать - (минус) или = (плюс) — Увеличивать или уменьшать лимит скорости прямо на ходу по 1 км/ч.
Lua:require "lib.moonloader" local vkeys = require "vkeys" local memory = require "memory" local is_active = false local speed_limit = 57 -- Стандартное ограничение по умолчанию local last_key_time = 0 -- Таймер для плавного изменения при зажатии -- Функция проверки, является ли транспорт велосипедом local function isBicycle(modelID) -- 481: BMX, 509: Bike, 510: Mountain Bike return modelID == 481 or modelID == 509 or modelID == 510 end function main() if not isSampLoaded() or not isSampfuncsLoaded() then return end while not isSampAvailable() do wait(100) end -- Команда активации/деактивации без сообщений в чат sampRegisterChatCommand("velocity", function() is_active = not is_active if is_active then printStringNow("~g~Velocity Limit ON ~w~(" .. speed_limit .. ")", 1500) else printStringNow("~r~Velocity Limit OFF", 1500) end end) -- Команда: Установка лимита числом sampRegisterChatCommand("vlimit", function(arg) local val = tonumber(arg) if val then if val < 1 then val = 1 end -- Меньше 1 теперь поставить нельзя speed_limit = val printStringNow("~y~Limit set to: ~w~" .. tostring(speed_limit), 2000) else printStringNow("~r~Use: /vlimit [number]", 2000) end end) while true do wait(0) -- Если скрипт включен и игрок в транспорте if is_active and isCharInAnyCar(PLAYER_PED) then local car = storeCarCharIsInNoSave(PLAYER_PED) if car then local model = getCarModel(car) -- ПРОВЕРКА: Работаем ТОЛЬКО если это велосипед if isBicycle(model) then local current_time = os.clock() -- Настройка скорости (Зажать L и УДЕРЖИВАТЬ Минус или Плюс) if isKeyDown(vkeys.VK_L) then -- Срабатывает каждые 0.05 секунд (20 раз в секунду), пока кнопка зажата if isKeyDown(vkeys.VK_OEM_MINUS) and (current_time - last_key_time > 0.05) then speed_limit = speed_limit - 1 if speed_limit < 1 then speed_limit = 1 end -- Защита (не меньше 1) printStringNow("~y~Limit: ~w~" .. tostring(speed_limit), 1000) last_key_time = current_time elseif isKeyDown(vkeys.VK_OEM_PLUS) and (current_time - last_key_time > 0.05) then speed_limit = speed_limit + 1 printStringNow("~y~Limit: ~w~" .. tostring(speed_limit), 1000) last_key_time = current_time end end -- Логика ограничения скорости local ptr = getCarPointer(car) if ptr ~= 0 then -- Читаем текущую скорость машины (Векторы X и Y) local vx = memory.getfloat(ptr + 0x44, false) local vy = memory.getfloat(ptr + 0x48, false) -- Считаем фактическую скорость по плоскости local current_speed_ms = math.sqrt(vx * vx + vy * vy) -- Переводим км/ч в метры/секунду local max_speed_ms = speed_limit / 3.6 -- Если скорость превышает лимит, плавно срезаем её if current_speed_ms > max_speed_ms then if current_speed_ms > 0 then local ratio = max_speed_ms / current_speed_ms memory.setfloat(ptr + 0x44, vx * ratio, false) memory.setfloat(ptr + 0x48, vy * ratio, false) end end end end end end end end
lua file