Z4Zy Posted November 1, 2018 Share Posted November 1, 2018 (edited) Hello ! Below code working find without any error ! addEventHandler("onPlayerLogin",root, function () bindKey(source,"1","down", function (p) setElementPosition(p,0,0,5) end) end ) When player login, button 1 will bind to the function. So, when player press 1 key, he will wrap in to the position. But the problem is, when player in a vehicle, he wouldn't wrap into the position... ! There's a way to solve this like if player in a vehicle when he press 1, vehicle will destroy and player wrapped into the position. But, I want to wrap the player to the position without destroying the vehicle. Are there any way to troubleshoot by problem ? or any alternative way ? Please Help Me ! ------------------------------------------------------------------------------------------------------------------------------------------- heheey ! There's a function called 'removePedFromVehicle'. That was helped me in this occasion !! Thank You @removePedFromVehicle ..!! Edited November 1, 2018 by DeadthStrock Problem Resolved ! Link to comment
Dzsozi (h03) Posted November 1, 2018 Share Posted November 1, 2018 Check if the player is in a vehicle and then set the vehicle’s position as well. local vehicle = getPedOccupiedVehicle(p) if vehicle then setElementPosition(vehicle, 0, 0, 5) end Link to comment
Z4Zy Posted November 1, 2018 Author Share Posted November 1, 2018 1 hour ago, Dzsozi (h03) said: Check if the player is in a vehicle and then set the vehicle’s position as well. local vehicle = getPedOccupiedVehicle(p) if vehicle then setElementPosition(vehicle, 0, 0, 5) end what if player should wrap to one position and his vehicle to another position ? Link to comment
Mega9 Posted November 1, 2018 Share Posted November 1, 2018 You then use removePedFromVehicle before setting player's position. 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