Imposter Posted July 18, 2012 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) Eat My Dust - DM/Deathmatch
Castillo Posted July 18, 2012 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'. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Imposter Posted July 18, 2012 Author 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 Eat My Dust - DM/Deathmatch
Castillo Posted July 18, 2012 Posted July 18, 2012 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Imposter Posted July 18, 2012 Author 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 Eat My Dust - DM/Deathmatch
Castillo Posted July 18, 2012 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 San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Imposter Posted July 18, 2012 Author 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!! Eat My Dust - DM/Deathmatch
AMARANT Posted July 18, 2012 Posted July 18, 2012 It seems that it's because of you have the same name for your Entrance/Exit functions.
Castillo Posted July 18, 2012 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 ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Imposter Posted July 18, 2012 Author 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. Eat My Dust - DM/Deathmatch
Imposter Posted July 18, 2012 Author 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? Eat My Dust - DM/Deathmatch
Perfect Posted August 22, 2012 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 Multi Theft Auto Player since middle of 2011. Everybody want to act Crazy/Smart/Intelligent/Different/Unique/Innocent and Thats why I am Perfect.
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