AlexWo Posted May 22, 2013 Posted May 22, 2013 Hi. In my script I just want that if a player hit's the Marker he get teleported to Ammunation1. I got mixed up with how to get the local Player. I only have a client side. Weaponshop1 = createMarker(1368, -1279.8, 12.7, "cylinder", 1.5, 255, 255, 255, 255) function warpinto1 (source) setElementInterior ( source, 1, 286, -40, 1001 ) end addEventHandler( "onPlayerMarkerHit", Weaponshop1, warpinto1) I'm not sure with the functions how to get the local Player who enters the Marker Thank you for helping me
Castillo Posted May 22, 2013 Posted May 22, 2013 "onPlayerMarkerHit" is a server side event, and the way you add the event handler is wrong, change 'Weaponshop1' with 'root'. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Castillo Posted May 22, 2013 Posted May 22, 2013 Wiki quote: root: This is at the very base of the tree - all elements are children (or descendants) of this element. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
AlexWo Posted May 22, 2013 Author Posted May 22, 2013 I have to change now: addEventHandler( "onPlayerMarkerHit", Weaponshop1, warpinto1) to.. addEventHandler( "onPlayerMarkerHit", root, warpinto1) or how because I'm not sure...
Castillo Posted May 22, 2013 Posted May 22, 2013 Yes, exactly, and the script must be set as server side on the meta.xml. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
AlexWo Posted May 22, 2013 Author Posted May 22, 2013 Ok I did that but if I enter the marker it just disapears.
Castillo Posted May 22, 2013 Posted May 22, 2013 That's because the first argument of "onPlayerMarkerHit" is the marker the player hit, not the player that hit the marker. Weaponshop1 = createMarker ( 1368, -1279.8, 12.7, "cylinder", 1.5, 255, 255, 255, 255 ) function warpinto1 ( ) setElementInterior ( source, 1, 286, -40, 1001 ) end addEventHandler ( "onPlayerMarkerHit", root, warpinto1 ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Castillo Posted May 22, 2013 Posted May 22, 2013 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
K4stic Posted May 22, 2013 Posted May 22, 2013 it will send you to interior at any marker because have root addEventHandler ( "onPlayerMarkerHit", root, warpinto1 ) so use this better Weaponshop1 = createMarker ( 1368, -1279.8, 12.7, "cylinder", 1.5, 255, 255, 255, 255 ) function warpinto1 ( player ) if ( source == Weaponshop1 ) then setElementInterior ( player, 1, 286, -40, 1001 ) end end addEventHandler ( "onPlayerMarkerHit", root, warpinto1 ) Giving a Fuck? Nope, That isn't in My Skill Set
Castillo Posted May 22, 2013 Posted May 22, 2013 Well, that's correct, but your code is so wrong. Weaponshop1 = createMarker ( 1368, -1279.8, 12.7, "cylinder", 1.5, 255, 255, 255, 255 ) function warpinto1 ( theMarker ) if ( theMarker == Weaponshop1 ) then setElementInterior ( source, 1, 286, -40, 1001 ) end end addEventHandler ( "onPlayerMarkerHit", root, warpinto1 ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Moderators IIYAMA Posted May 23, 2013 Moderators Posted May 23, 2013 Skipper was probably confused with the event "onMarkerHit". Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
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