JohnLehn Posted January 21, 2021 Share Posted January 21, 2021 Hello! I have the code bellow, how can i make it to teleport in vehicle? function sf (source, thePlayer) local adminname = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..adminname, aclGetGroup ( "Admin" ) ) then setElementPosition(thePlayer, -1997.923828125, 171.4658203125, 27.6875) else outputChatBox("No acces!", thePlayer, 255, 0, 0) end end addCommandHandler("gotosf", sf) Link to comment
NeXuS™ Posted January 21, 2021 Share Posted January 21, 2021 You have to check if the player is in a vehicle, you can use getPedOccupiedVehicle for this. If he is in a vehicle, you set the vehicle's position instead of the player, which is returned by the function mentioned above. Also, your function will throw errors, as "thePlayer" value defined in your function is actually the command name that was executed, in this case "gotosf", check addCommandHandler for more info on this topic. Link to comment
Tekken Posted January 21, 2021 Share Posted January 21, 2021 I think he wants warpPedIntoVehicle, this will teleport a player into a vehicle. Link to comment
Hydra Posted January 21, 2021 Share Posted January 21, 2021 function sf(thePlayer, command) local adminname = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..adminname, aclGetGroup ( "Admin" ) ) then setElementPosition(thePlayer, -1997.923828125, 171.4658203125, 27.6875) warpPedIntoVehicle(thePlayer, theVehicle, 0) else outputChatBox("No acces!", thePlayer, 255, 0, 0) end end addCommandHandler("gotosf", sf) This is how it should look if you want to teleport the player in a vehicle Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now