Jump to content

[HELP] Enter Building


Imposter

Recommended Posts

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
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
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'.

:o thanks :D

Link to comment
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 by Guest
Link to comment
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
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
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
  • 1 month later...
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...