Jump to content

[Help] Staff Car


Recommended Posts

root = getRootElement() 
  
  
 function admt(source) 
if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then 
  
 local x, y, z = getElementPosition(thePlayer) 
 local rx, ry, rz = getElementRotation(thePlayer) 
 theVehicle[thePlayer] = createVehicle( 526, x, y, z, rx, ry, rz, "Staff Car" ) 
 warpPedIntoVehicle(thePlayer, theVehicle[thePlayer]) 
 local newVelocity = ( handlingTable["maxVelocity"] + ( handlingTable["maxVelocity"] / 100 * 40 ) ) 
 setVehicleHandling ( theVehicle[thePlayer], "numberOfGears", 5 ) 
 setVehicleHandling ( theVehicle[thePlayer], "driveType", 'awd' ) 
 setVehicleHandling ( theVehicle[thePlayer], "maxVelocity", newVelocity ) 
 setVehicleHandling ( theVehicle[thePlayer], "engineAcceleration", handlingTable["engineAcceleration"] +8 ) 
  
        end 
 end 
 addCommandHandler("staffCar",admt) 

what is wrong here?

Link to comment

Change this:

function admt(source) 
if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then 

To:

function admt(thePlayer) 
if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(thePlayer)), aclGetGroup("Admin")) then 

And test it.

Link to comment
theVehicle = {} 
handlingTable = {} 
  
function admt( thePlayer ) 
    if isObjectInACLGroup( "user."..getAccountName( getPlayerAccount( thePlayer ) ), aclGetGroup("Admin") ) then 
        local x, y, z = getElementPosition( thePlayer ) 
        local rx, ry, rz = getElementRotation( thePlayer ) 
        theVehicle[thePlayer] = createVehicle( 526, x, y, z, rx, ry, rz, "Staff Car" ) 
        warpPedIntoVehicle( thePlayer, theVehicle[thePlayer] ) 
        local newVelocity = ( handlingTable["maxVelocity"] + ( handlingTable["maxVelocity"] / 100 * 40 ) ) 
        setVehicleHandling ( theVehicle[thePlayer], "numberOfGears", 5 ) 
        setVehicleHandling ( theVehicle[thePlayer], "driveType", 'awd' ) 
        setVehicleHandling ( theVehicle[thePlayer], "maxVelocity", newVelocity ) 
        setVehicleHandling ( theVehicle[thePlayer], "engineAcceleration", handlingTable["engineAcceleration"] +8 ) 
    end 
end 
addCommandHandler( "staffCar",admt ) 

and the 'handlingTable' not defined to.

Link to comment
theVehicle = { } 
  
function admt ( thePlayer ) 
    if isObjectInACLGroup ( "user.".. getAccountName ( getPlayerAccount ( thePlayer ) ), aclGetGroup ( "Admin" ) ) then 
        local x, y, z = getElementPosition ( thePlayer ) 
        local rx, ry, rz = getElementRotation ( thePlayer ) 
        theVehicle [ thePlayer ] = createVehicle ( 526, x, y, z, rx, ry, rz, "Staff Car" ) 
        local handlingTable = getVehicleHandling ( theVehicle [ thePlayer ] ) 
        warpPedIntoVehicle ( thePlayer, theVehicle [ thePlayer ] ) 
        local newVelocity = ( handlingTable [ "maxVelocity" ] + ( handlingTable [ "maxVelocity" ] / 100 * 40 ) ) 
        setVehicleHandling ( theVehicle [ thePlayer ], "numberOfGears", 5 ) 
        setVehicleHandling ( theVehicle [ thePlayer ], "driveType", 'awd' ) 
        setVehicleHandling ( theVehicle [ thePlayer ], "maxVelocity", newVelocity ) 
        setVehicleHandling ( theVehicle [ thePlayer ], "engineAcceleration", handlingTable [ "engineAcceleration" ] +8 ) 
    end 
end 
addCommandHandler ( "staffCar", admt ) 

Link to comment

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...