devildead622 Posted March 18, 2013 Posted March 18, 2013 how can I do so that anyone can not pass a given location? for example, do not want anyone approaching this position: 1588.1999511719, -1638.5, 15.10000038147
Castillo Posted March 18, 2013 Posted March 18, 2013 You can create a colshape, and when they enter, you can kill them, or teleport them somewhere around.
devildead622 Posted March 18, 2013 Author Posted March 18, 2013 I would have to use this(https://wiki.multitheftauto.com/wiki/CreateColSphere) correct? can give me a help? I'm all confused looking at WIKI ^^
devildead622 Posted March 18, 2013 Author Posted March 18, 2013 function shapeHit ( thePlayer ) setElementPosition ( thePlayer, 1569, -1690, 6 ) end function setZone ( playerSource ) local zone = createColSphere ( 1588.1999511719, -1638.5, 15.10000038147, 15.0 ) -- create a col addEventHandler ( "onColShapeHit", zone, shapeHit ) -- add a handler for the onColShapeHit event end addEventHandler ( "onResourceStart", setZone ) I suppose this all wrong ... kk so this is I do?
PaiN^ Posted March 18, 2013 Posted March 18, 2013 zone = createColSphere ( 1588.1999511719, -1638.5, 15.10000038147, 15.0 ) function shapeHit ( ) setElementPosition ( thePlayer, 1569, -1690, 6 ) end addEventHandler ( 'onColShapeHit', zone, shapeHit )
DNL291 Posted March 18, 2013 Posted March 18, 2013 local zone = createColSphere( 1588.1999511719, -1638.5, 15.10000038147, 15.0 ) function shapeHit(hitPlayer, matchingDimension) if getElementType(hitPlayer) == "player" then setElementPosition( hitPlayer, 1569, -1690, 6 ) end end addEventHandler( 'onColShapeHit', zone, shapeHit )
iPrestege Posted March 18, 2013 Posted March 18, 2013 (edited) zone = createColSphere ( 1588.1999511719, -1638.5, 15.10000038147, 15.0 ) function shapeHit ( ) setElementPosition ( thePlayer, 1569, -1690, 6 ) end addEventHandler ( 'onColShapeHit', zone, shapeHit ) thePlayer = ?? not defined! You should to check the hitter is player or not! And use "local" . Edited March 18, 2013 by Guest
PaiN^ Posted March 18, 2013 Posted March 18, 2013 zone = createColSphere ( 1588.1999511719, -1638.5, 15.10000038147, 15.0 ) function shapeHit ( ) setElementPosition ( thePlayer, 1569, -1690, 6 ) end addEventHandler ( 'onColShapeHit', zone, shapeHit ) thePlayer = ?? not defined! Sorry, I've done it in a rush, But DNL291 fixed it ..
devildead622 Posted March 18, 2013 Author Posted March 18, 2013 how can I make an "if" for if the player is in a vehicle? and how can I set this vehicle as "ve"
Renkon Posted March 18, 2013 Posted March 18, 2013 local v = getPedOccupiedVehicle(pVar) if (v) then -- He is inside a car -- v = the car else -- He is NOT inside a car end
devildead622 Posted March 18, 2013 Author Posted March 18, 2013 what function to: remove player of vehicle? and teleport the vehicle?
iPrestege Posted March 18, 2013 Posted March 18, 2013 what function to:remove player of vehicle? and teleport the vehicle? setElementPosition
devildead622 Posted March 18, 2013 Author Posted March 18, 2013 local zone = createColSphere( 1588.1999511719, -1638.5, 15.10000038147, 15.0 ) function shapeHit(hitPlayer, matchingDimension) if getElementType(hitPlayer) == "player" then local v = getPedOccupiedVehicle(pVar) if (v) then removePedFromVehicle ( hitPlayer ) setElementPosition ( v, 1569, -1690, 6 ) warpPedIntoVehicle ( hitPlayer, v ) else setElementPosition( hitPlayer, 1569, -1690, 6 ) end end end addEventHandler( 'onColShapeHit', zone, shapeHit ) Work?
iPrestege Posted March 18, 2013 Posted March 18, 2013 local zone = createColSphere( 1588.1999511719, -1638.5, 15.10000038147, 15.0 ) function shapeHit(hitPlayer, matchingDimension) if getElementType(hitPlayer) == "player" then local v = getPedOccupiedVehicle(pVar) if (v) then removePedFromVehicle ( hitPlayer ) setElementPosition ( v, 1569, -1690, 6 ) warpPedIntoVehicle ( hitPlayer, v ) else setElementPosition( hitPlayer, 1569, -1690, 6 ) end end end addEventHandler( 'onColShapeHit', zone, shapeHit ) Work? Try this : local zone = createColSphere( 1588.1999511719, -1638.5, 15.10000038147, 15.0 ) function shapeHit(hitPlayer, matchingDimension) if getElementType(hitPlayer) == "player" then local v = getPedOccupiedVehicle(hitPlayer) if (v) then removePedFromVehicle ( hitPlayer ) setElementPosition ( v, 1569, -1690, 6 ) warpPedIntoVehicle ( hitPlayer, v ) else setElementPosition( hitPlayer, 1569, -1690, 6 ) end end end addEventHandler( 'onColShapeHit', zone, shapeHit )
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