Jump to content

warp problem


Recommended Posts

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

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

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