yousseftawab Posted August 7, 2012 Share Posted August 7, 2012 I want the player to warp to the other side of the wall on marker hit and it Only Works if he is out of a vehicle I Want it for Both in a vehicle and out of a vehicle local allowedGroups = { ["Armed Forces"]=true } afMarker8 = createMarker ( 135.19999694824, 1938.4000244141, 18.60000038147, "cylinder", 5, 255, 255, 255, 0 ) function afmaker8(hitElement) if ( allowedGroups [ getElementData ( hitElement, "gang" ) ] ) then setElementPosition( hitElement, 135.19999694824, 1952.6999511719, 19 ) end end addEventHandler("onMarkerHit", afMarker8, afmaker8) Link to comment
Guest Guest4401 Posted August 7, 2012 Share Posted August 7, 2012 It is because I suppose you have only set element data to the player. You check if the elementData is ArmedForces or not, only for the player, not the vehicle.: getElementData ( hitElement, "gang" ) ] But if hitElement is a vehicle, then you have to get the vehicle's controller. These might help you: getElementType getVehicleOccupant / getVehicleController Link to comment
albers14 Posted August 7, 2012 Share Posted August 7, 2012 It is because I suppose you have only set element data to the player. You check if the elementData is ArmedForces or not, only for the player, not the vehicle.: getElementData ( hitElement, "gang" ) ] But if hitElement is a vehicle, then you have to get the vehicle's controller. These might help you: getElementType getVehicleOccupant / getVehicleController No theres 2 elements hitting the marker. The player and the vehicle. He just need to use getElementType The only reason the car/vehicle also dont warp with you is because you use getElementData. For that you can say, if getElementType(hitElement) == "player" then if isPedInVehicle(hitElement) then local car = getPedOccupiedVehicle(hitElement setElementPosition(car,x,y,z) setElementPosition(hitElement,x,y,z) warpPedIntoVehicle(hitElement, car) else setElementPosition(hitElement,x,y,z) This was the basic of it. You need to fix all the bugs that can happen. The thing i just wrote was an example and help for you 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