Jump to content

Help with "Setting a player's vehicle's velocity" script.


3ehud

Recommended Posts

Posted

I need help with a script, that will be allowed to use only by "Policja" ACL group, and it sets player's vehicle maxVelocity to 0.1, but i need the script to change it back to normal velocity when i want. The command needs to look like this: /commandName thePlayer maxVelocity. So i need some help because i don't even know Lua, aaand i used wiki and looked in some scripts too. Maybe you guys, the Lua masters out there will help me out? Huge thanks.

Here's what I've done.

function emp ( thePlayer, theVehicle )
   local theVehicle = getPedOccupiedVehicle ( thePlayer )
     then setVehicleHandling(v, "maxVelocity", 0.1)
end

addCommandHandler ( string turnoff, function emp, [bool restricted = false, bool caseSensitive = true] )

Posted
-- Server Side code
function setVehicleOriginalVelocity(thePlayer)
  local veh = getPedOccupiedVehicle(thePlayer)
  if veh then -- Make sure the player is in the vehicle
    local vehModel = getElementModel(veh)
    local originalVelocity = getOriginalHandling(vehModel)["maxVelocity"]
    setVehicleHandling(veh, "maxVelocity", originalVelocity)
  else
    outputChatBox("You are not in Vehicle!", thePlayer)
  end
end
addCommandHandler("setoriginalvel", setVehicleOriginalVelocity)

 

Posted
9 hours ago, 3ehud said:

yup

acuatlly it now doesnt show the message but still aint working

You sure? Can you show us how did you put it server side in XML?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...