Jump to content

Attach ped to vehicle by a command name


Fabio(GNR)

Recommended Posts

im trying to create something that attaches the player to the vehicle, like /attach nameofvehicleowner, it should get the vehicle "name" from the name entered at the command as parameter.... but i kinda got problems :) it says bad argument at getPlayerName and at getPedOccupiedVehicle, what i can understand... but i didnt really find much about command parameters, my script:

function attachtoveh ( playerSource, commandName, name ) 
names = getPlayerName ( name ) 
vehicle = getPedOccupiedVehicle ( names ) 
if vehicle then 
atttachElements ( playerSource, vehicle ) 
end 
end 
addCommandHandler ( "attach", attachtoveh ) 

( there probably comes that class=kw6, its from site i guess cause its not in my script ;) )

Link to comment

try,

  
function attachtoveh ( playerSource, commandName, name ) 
names = getPlayerFromName ( name ) 
if names then 
vehicle = getPedOccupiedVehicle ( names ) 
if vehicle then 
attachElements ( playerSource, vehicle ) 
end 
end 
end 
addCommandHandler ( "attach", attachtoveh ) 

Link to comment
try,
  
function attachtoveh ( playerSource, commandName, name ) 
names = getPlayerFromName ( name ) 
if names then 
vehicle = getPedOccupiedVehicle ( names ) 
if vehicle then 
attachElements ( playerSource, vehicle ) 
end 
end 
end 
addCommandHandler ( "attach", attachtoveh ) 

Thanks will try as soon as possible ( in 10 minutes )

EDIT: Works, thanks

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