• Lock speed of vehicle
    1 replies, posted
Hello all, Again still on my Roleplay GameMode, I need help about locking the speed of a vehicle. I tried to set the velocity on GM:MoveVehicle, however that's not working. So is there any way to lock the speed of a vehicle or lock x/y velocity not z ?
This: [lua] Vehicle:Fire('throttle', 0) [/lua] You could use it in a think hook and check if the velocity exceeds your wished max velocity. If that's the case, call Fire on the vehicle like I did. Example: [lua] local max = 20 -- Insert your vehicle entities here local vehtolimit = {} hook.Add('Think', 'limitspeed', function() for k, veh in pairs(vehtolimit) do if IsValid(veh) then if math.floor(veh:GetVelocity():Length() * 0.069) > max and IsValid(veh:GetDriver()) then veh:Fire('throttle', 0) end else table.remove(vehtolimit, k) end end end) [/lua]
Sorry, you need to Log In to post a reply to this thread.