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'.
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.
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.
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 )
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 )
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 )
Moderators IIYAMA Posted May 23, 2013 Moderators Posted May 23, 2013 Skipper was probably confused with the event "onMarkerHit".
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