mjau Posted August 8, 2011 Author Posted August 8, 2011 ehh k now i have one last problem before this is finished i want the player to be warped to the vehicle who created the marker when the player hit a ccolshape the colshape is there since when i enter it it says bad argument at setelementposition colshape = createColRectangle (313.0009765625, 1033.708984375, 100, 100) colshapeinterior = setElementInterior(colshape, 9) function createAndroMarker(thePlayer) x,y,z = getElementPosition( vehicle ) vehicle = getPedOccupiedVehicle(thePlayer) theMarker = createMarker ( x - 25, y + 5, z, "cylinder", 20.5, 0, 0, 255, 170 ) setTimer ( removeMarker, 4000, 1 ) addEventHandler( "onMarkerHit", theMarker, warpPlayerIntoAndro ) end addCommandHandler("marker", createAndroMarker) function warpPlayerIntoAndro(hitElement, dimensionMatch) outputDebugString("Warp function triggered") if getElementType(hitElement) ~= "player" then return end if isPedInVehicle(hitElement) then removePedFromVehicle(hitElement) end setElementInterior(hitElement, 9, 315.48, 984.13, 1959.11 ) end function removeMarker() destroyElement ( theMarker ) end function warpPlayerOut() setElementPosition(hitElement, x, y, z) end addEventHandler ( "onColShapeHit", colshape, warpPlayerOut )
JR10 Posted August 8, 2011 Posted August 8, 2011 Here: colshape = createColRectangle (313.0009765625, 1033.708984375, 100, 100) colshapeinterior = setElementInterior(colshape, 9) function createAndroMarker(thePlayer) x,y,z = getElementPosition( vehicle ) vehicle = getPedOccupiedVehicle(thePlayer) theMarker = createMarker ( x - 25, y + 5, z, "cylinder", 20.5, 0, 0, 255, 170 ) setTimer ( removeMarker, 4000, 1 ) addEventHandler( "onMarkerHit", theMarker, warpPlayerIntoAndro ) end addCommandHandler("marker", createAndroMarker) function warpPlayerIntoAndro(hitElement, dimensionMatch) outputDebugString("Warp function triggered") if getElementType(hitElement) ~= "player" then return end if isPedInVehicle(hitElement) then removePedFromVehicle(hitElement) end setElementInterior(hitElement, 9, 315.48, 984.13, 1959.11 ) end function removeMarker() destroyElement ( theMarker ) end function warpPlayerOut(hitElement) if getElementType(hitElement) ~= "player" then return end setElementPosition(hitElement, x, y, z) end addEventHandler ( "onColShapeHit", colshape, warpPlayerOut )
mjau Posted August 8, 2011 Author Posted August 8, 2011 tnx but now it dont set me at the courrent position of the andromada it sets me at its creation point i need to make it so i gets set where the andro is right then when i go in the colshape
JR10 Posted August 8, 2011 Posted August 8, 2011 That's because you made x, y, z global with the creation position. Try: colshape = createColRectangle (313.0009765625, 1033.708984375, 100, 100) colshapeinterior = setElementInterior(colshape, 9) function createAndroMarker(thePlayer) local x,y,z = getElementPosition( vehicle ) vehicle = getPedOccupiedVehicle(thePlayer) theMarker = createMarker ( x - 25, y + 5, z, "cylinder", 20.5, 0, 0, 255, 170 ) setTimer ( removeMarker, 4000, 1 ) addEventHandler( "onMarkerHit", theMarker, warpPlayerIntoAndro ) end addCommandHandler("marker", createAndroMarker) function warpPlayerIntoAndro(hitElement, dimensionMatch) outputDebugString("Warp function triggered") if getElementType(hitElement) ~= "player" then return end if isPedInVehicle(hitElement) then removePedFromVehicle(hitElement) end setElementInterior(hitElement, 9, 315.48, 984.13, 1959.11 ) end function removeMarker() destroyElement ( theMarker ) end function warpPlayerOut(hitElement) if getElementType(hitElement) ~= "player" then return end local x, y, z = getElementPosition( vehicle ) setElementPosition(hitElement, x, y, z) end addEventHandler ( "onColShapeHit", colshape, warpPlayerOut )
mjau Posted August 8, 2011 Author Posted August 8, 2011 yup mentioned you and solidsnake for helping me
JR10 Posted August 8, 2011 Posted August 8, 2011 Thanks, btw you should add a screenshot without the speedo, others will think it's with the resource.
Dev Posted August 9, 2011 Posted August 9, 2011 function warpPlayerIntoAndro(hitElement, matchingDimension) outputDebugString("Warp function triggered") local elementType = getElementType(hitElement) if (elementType == "player") then outputDebugString("hitElement verified as a player!") setElementInterior(hitElement, 9, 315.48, 984.13, 1959.11) end end Tell me if the second Debug string comes up. EDIT: Lol, sorry didn't see there were 3 pages.. Delete this
mjau Posted August 10, 2011 Author Posted August 10, 2011 its working now and btw you can delete your own posts as far i know
AGENT_STEELMEAT Posted August 10, 2011 Posted August 10, 2011 Why did you remove if not dimensionMatch then return end? That just checks to make sure the hitElement and the colshape/marker are in the same dimension... Anyway, try: function warpPlayerIntoAndro(hitElement, dimensionMatch) outputDebugString("Warp function triggered") if not dimensionMatch then return end outputDebugString("dimensionMatch") if getElementType == "player" and not isPedInVehicle(hitElement) then outputDebugString("hitElement is player and player is not in vehicle, warping...") setElementInterior(hitElement, 9, 315.48, 984.13, 1959.11 ) end end
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