Imposter Posted July 18, 2012 Share Posted July 18, 2012 Hey guys, im trying to make a code that will allow a player to enter a building, but it wont work, when i step on the marker, nothing happens. the marker "theExit" is inside the interior PAPER"3" and is NOT VISIBLE. Please help, im so screwed over. function loadResource() theEntrance = createMarker ( 1481.0408935547, -1771.6051513672, 18.795755386353+1, "arrow", 1.5, 0, 255, 0, 170 ) theExit = createMarker ( 389.8681640625, 173.9693145752, 1008.3828125+1, "arrow", 1.5, 0, 255, 0, 170 ) estateBlip = createBlip ( 1481.0408935547, -1771.6051513672, 18.795755386353+1, 44, 0, 0, 0, 255 ) outputChatBox ( "The Estate has been Loaded!!" ) end addEventHandler ( "onResourceStart", getRootElement(), loadResource) function markerHitE (hitPlayer, matchingDimension) if (source == theExit) then outputChatBox( "You are leaving the Estate!", source ) end end addEventHandler ("onMarkerHit", getRootElement(), markerHitE) function markerHitE (hitPlayer, matchingDimension) if (source == theEntrace) then outputChatBox( "You are entering the Estate!", source ) end end addEventHandler ("onMarkerHit", getRootElement(), markerHitE) Link to comment
Castillo Posted July 18, 2012 Share Posted July 18, 2012 function loadResource ( ) theEntrance = createMarker ( 1481.0408935547, -1771.6051513672, 18.795755386353+1, "arrow", 1.5, 0, 255, 0, 170 ) theExit = createMarker ( 389.8681640625, 173.9693145752, 1008.3828125+1, "arrow", 1.5, 0, 255, 0, 170 ) estateBlip = createBlip ( 1481.0408935547, -1771.6051513672, 18.795755386353+1, 44, 0, 0, 0, 255 ) outputChatBox ( "The Estate has been Loaded!!" ) end addEventHandler ( "onResourceStart", resourceRoot, loadResource ) function markerHitE ( hitPlayer, matchingDimension ) if ( source == theEntrace ) then outputChatBox ( "You are entering the Estate!", hitPlayer ) elseif ( source == theExit ) then outputChatBox ( "You are leaving the Estate!", hitPlayer ) end end addEventHandler ( "onMarkerHit", getRootElement(), markerHitE ) Your problem was that you we're using 'source' in outputChatBox, but your player element is 'hitPlayer'. Link to comment
Imposter Posted July 18, 2012 Author Share Posted July 18, 2012 function loadResource ( ) theEntrance = createMarker ( 1481.0408935547, -1771.6051513672, 18.795755386353+1, "arrow", 1.5, 0, 255, 0, 170 ) theExit = createMarker ( 389.8681640625, 173.9693145752, 1008.3828125+1, "arrow", 1.5, 0, 255, 0, 170 ) estateBlip = createBlip ( 1481.0408935547, -1771.6051513672, 18.795755386353+1, 44, 0, 0, 0, 255 ) outputChatBox ( "The Estate has been Loaded!!" ) end addEventHandler ( "onResourceStart", resourceRoot, loadResource ) function markerHitE ( hitPlayer, matchingDimension ) if ( source == theEntrace ) then outputChatBox ( "You are entering the Estate!", hitPlayer ) elseif ( source == theExit ) then outputChatBox ( "You are leaving the Estate!", hitPlayer ) end end addEventHandler ( "onMarkerHit", getRootElement(), markerHitE ) Your problem was that you we're using 'source' in outputChatBox, but your player element is 'hitPlayer'. thanks Link to comment
Imposter Posted July 18, 2012 Author Share Posted July 18, 2012 (edited) You're welcome. still a problem, when i hit the marker , nothing hapens, it]s there a problem in my positioning? code: function loadResource() theEntrance = createMarker ( 1481.0408935547, -1771.6051513672, 18.795755386353+1, "arrow", 1.5, 0, 255, 0, 100 ) theExit = createMarker ( 389.8681640625, 173.9693145752, 1008.3828125+1, "arrow", 1.5, 0, 255, 0, 100 ) estateBlip = createBlip ( 1481.0408935547, -1771.6051513672, 18.795755386353, 44, 0, 0, 0, 255 ) outputChatBox ( "The Estate has been Loaded!!" ) end addEventHandler ( "onResourceStart", getRootElement(), loadResource) function markerHitE (hitPlayer, matchingDimension) if (source == theExit) then outputChatBox( "You are leaving the Estate!", hitPlayer ) end end addEventHandler ("onMarkerHit", getRootElement(), markerHitE) function markerHitE (hitPlayer, matchingDimension) if (source == theEntrace) then outputChatBox( "You are entering the Estate!", hitPlayer ) setElementPosition ( hitPlayer, 389.8681640625, 173.9693145752, 1008.3828125 ) end end addEventHandler ("onMarkerHit", getRootElement(), markerHitE) Edited July 18, 2012 by Guest Link to comment
Castillo Posted July 18, 2012 Share Posted July 18, 2012 Your script only outputs a message to chatbox, it doesn't set position or anything, for that you must use: setElementPosition Link to comment
Imposter Posted July 18, 2012 Author Share Posted July 18, 2012 Your script only outputs a message to chatbox, it doesn't set position or anything, for that you must use: setElementPosition i know that, but it wont even output to the chat box!! Link to comment
AMARANT Posted July 18, 2012 Share Posted July 18, 2012 It seems that it's because of you have the same name for your Entrance/Exit functions. Link to comment
Castillo Posted July 18, 2012 Share Posted July 18, 2012 function loadResource ( ) theEntrance = createMarker ( 1481.0408935547, -1771.6051513672, 18.795755386353+1, "arrow", 1.5, 0, 255, 0, 170 ) theExit = createMarker ( 389.8681640625, 173.9693145752, 1008.3828125+1, "arrow", 1.5, 0, 255, 0, 170 ) estateBlip = createBlip ( 1481.0408935547, -1771.6051513672, 18.795755386353+1, 44, 0, 0, 0, 255 ) outputChatBox ( "The Estate has been Loaded!!" ) end addEventHandler ( "onResourceStart", resourceRoot, loadResource ) function markerHitE ( hitPlayer, matchingDimension ) if ( source == theEntrace ) then outputChatBox ( "You are entering the Estate!", hitPlayer ) setElementPosition ( hitPlayer, 389.8681640625, 173.9693145752, 1008.3828125 ) elseif ( source == theExit ) then outputChatBox ( "You are leaving the Estate!", hitPlayer ) end end addEventHandler ( "onMarkerHit", getRootElement(), markerHitE ) Link to comment
Imposter Posted July 18, 2012 Author Share Posted July 18, 2012 function loadResource ( ) theEntrance = createMarker ( 1481.0408935547, -1771.6051513672, 18.795755386353+1, "arrow", 1.5, 0, 255, 0, 170 ) theExit = createMarker ( 389.8681640625, 173.9693145752, 1008.3828125+1, "arrow", 1.5, 0, 255, 0, 170 ) estateBlip = createBlip ( 1481.0408935547, -1771.6051513672, 18.795755386353+1, 44, 0, 0, 0, 255 ) outputChatBox ( "The Estate has been Loaded!!" ) end addEventHandler ( "onResourceStart", resourceRoot, loadResource ) function markerHitE ( hitPlayer, matchingDimension ) if ( source == theEntrace ) then outputChatBox ( "You are entering the Estate!", hitPlayer ) setElementPosition ( hitPlayer, 389.8681640625, 173.9693145752, 1008.3828125 ) elseif ( source == theExit ) then outputChatBox ( "You are leaving the Estate!", hitPlayer ) end end addEventHandler ( "onMarkerHit", getRootElement(), markerHitE ) This still wont work, if u wanna try it, go to the police station at SA and go to the triads marker it wont do anything. Link to comment
Imposter Posted July 18, 2012 Author Share Posted July 18, 2012 function loadResource ( ) theEntrance = createMarker ( 1481.0408935547, -1771.6051513672, 18.795755386353+1, "arrow", 1.5, 0, 255, 0, 170 ) theExit = createMarker ( 389.8681640625, 173.9693145752, 1008.3828125+1, "arrow", 1.5, 0, 255, 0, 170 ) estateBlip = createBlip ( 1481.0408935547, -1771.6051513672, 18.795755386353+1, 44, 0, 0, 0, 255 ) outputChatBox ( "The Estate has been Loaded!!" ) end addEventHandler ( "onResourceStart", resourceRoot, loadResource ) function markerHitE ( hitPlayer, matchingDimension ) if ( source == theEntrace ) then outputChatBox ( "You are entering the Estate!", hitPlayer ) setElementPosition ( hitPlayer, 389.8681640625, 173.9693145752, 1008.3828125 ) elseif ( source == theExit ) then outputChatBox ( "You are leaving the Estate!", hitPlayer ) end end addEventHandler ( "onMarkerHit", getRootElement(), markerHitE ) This still wont work, if u wanna try it, go to the police station at SA and go to the triads marker it wont do anything. Found the prob.. it says if ( source == theEntrace ) then instead of if ( source == theEntrance ) then one more thing, how can i make it teleport the player into an interior? Link to comment
Perfect Posted August 22, 2012 Share Posted August 22, 2012 function loadResource ( ) theEntrance = createMarker ( 1481.0408935547, -1771.6051513672, 18.795755386353+1, "arrow", 1.5, 0, 255, 0, 170 ) theExit = createMarker ( 389.8681640625, 173.9693145752, 1008.3828125+1, "arrow", 1.5, 0, 255, 0, 170 ) estateBlip = createBlip ( 1481.0408935547, -1771.6051513672, 18.795755386353+1, 44, 0, 0, 0, 255 ) outputChatBox ( "The Estate has been Loaded!!" ) end addEventHandler ( "onResourceStart", resourceRoot, loadResource ) function markerHitE ( hitPlayer, matchingDimension ) if ( source == theEntrace ) then outputChatBox ( "You are entering the Estate!", hitPlayer ) setElementPosition ( hitPlayer, 389.8681640625, 173.9693145752, 1008.3828125 ) elseif ( source == theExit ) then outputChatBox ( "You are leaving the Estate!", hitPlayer ) end end addEventHandler ( "onMarkerHit", getRootElement(), markerHitE ) This still wont work, if u wanna try it, go to the police station at SA and go to the triads marker it wont do anything. Found the prob.. it says if ( source == theEntrace ) then instead of if ( source == theEntrance ) then one more thing, how can i make it teleport the player into an interior? you can use setElementInterior Link to comment
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