Jump to content

[HELP] Player Warping


Imposter

Recommended Posts

How can i make a player warp>?

  
function loadResource ( ) 
    warpthingy= createMarker ( 1481.0408935547, -1771.6051513672, 18.795755386353+1, "arrow", 1.5, 0, 255, 0, 170 ) 
end 
addEventHandler ( "onResourceStart", resourceRoot, loadResource ) 
  
function markerHit ( thePlayer, matchingDimension ) 
    if ( source == warpthingy) then 
  
    end 
end 
addEventHandler ( "onMarkerHit", getRootElement(), markerHit ) 
  

Link to comment
By warp you mean set the player position? if so use:
setElementPosition 

yeah, but i need to warp it into a building interior for example the news paper interioir, this command puts me in a different place......................................IS ANYBODY GONNA HELP???

Link to comment
Use:
setElementInterior 
setElementDimension 

If i understand u correctly, then this should work...but it doesnt.

  
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 markerHit ( thePlayer, matchingDimension ) 
    if ( source == theEntrance ) then 
        outputChatBox ( "You are entering the Estate!", thePlayer ) 
        setElementDimension ( source, 10 ) 
        setElementInterior ( source, 3 , 389.8681640625, 173.9693145752, 1008.3828125 ) 
    elseif ( source == theExit ) then 
        outputChatBox ( "You are leaving the Estate!", thePlayer ) 
        setElementDimension ( source, 0 ) 
        setElementInterior ( source, 0 , 1481.0408935547, -1771.6051513672, 18.795755386353 ) 
    end 
end 
addEventHandler ( "onMarkerHit", getRootElement(), markerHit ) 
  

Link to comment
If i understand u correctly, then this should work...but it doesnt.

No, you didn't get me wrong. You just need to learn more about interior system in GTA. There are specific interiors with their own ID and coordinates. That function "setElementInterior" I gave to you is used to change your current noraml interior (which is 0). And you also have to know about dimensions.

Link to comment
If i understand u correctly, then this should work...but it doesnt.

No, you didn't get me wrong. You just need to learn more about interior system in GTA. There are specific interiors with their own ID and coordinates. That function "setElementInterior" I gave to you is used to change your current noraml interior (which is 0). And you also have to know about dimensions.

so technically, my script is suppose to work??

Link to comment
Technically, yes. But you have to specify correct coordinates, dimension and interior's ID. You can check out the interiors even from MTA Map Editor if you want.

OK, i got the id and locations, how will i use it?

  "PAPER" posX="388.87132732" posY="173.80432323" posZ="1008.38323254" rot="320" world="3" /> 

Link to comment
You have to use it like you did. Your mistake was that you were trying to change interior for 'source' in funciton arguments instead of 'thePlayer'. 'source' is your marker and not a player. I just didn't notice it back then, sorry.

this is NOT WORKING :'( PLEASE HELP ME :(

server side :

  
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 markerHit ( thePlayer, matchingDimension ) 
    if ( thePlayer == theEntrance ) then 
        outputChatBox ( "You are entering the Estate!", getRootElement() ) 
        setElementInterior ( thePlayer , 3 , 389.8681640625, 173.9693145752, 1008.3828125 ) 
        setElementDimension ( thePlayer, 3 ) 
    end 
end 
addEventHandler ( "onMarkerHit", getRootElement(), markerHit ) 
  

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 markerHit ( thePlayer, matchingDimension ) 
    if ( source == theEntrance ) then 
        outputChatBox ( "You are entering the Estate!" ) 
        setElementInterior ( thePlayer , 3 , 389.8681640625, 173.9693145752, 1008.3828125 ) 
        setElementDimension ( thePlayer, 3 ) 
    end 
end 
addEventHandler ( "onMarkerHit", getRootElement(), markerHit ) 
  

thePlayer can not be a marker

Link to comment

TwiX! has a point. You just need to understand that 'source' is an element for a specific function. It can be a player in one case and a marker in other one (like yours). To get this you have to refer to function description at MTA wiki. In section "Returns" or "Source" of every described function you will find the 'source' of needed one.

Link to comment
AMARANT tell it to NooP

i know that.

source in "onMarketHit" it's the marker

in NooP code. He compares the player with the marker, it is wrong

so this is wrong??

  
function markerHit ( thePlayer, matchingDimension ) 
    if ( thePlayer == theEstateEntrance ) then 
        outputChatBox ( "You are entering the Estate!", getRootElement() ) 
        setElementInterior ( thePlayer , 3 , 389.8681640625, 173.9693145752, 1008.3828125 ) 
        setElementDimension ( thePlayer, 3 ) 
    end 
end 
  

Link to comment

Yes, this line:

if ( thePlayer == theEstateEntrance ) then 

Should be:

if ( source == theEstateEntrance ) then 

And this line:

outputChatBox ( "You are entering the Estate!", getRootElement() ) 

Should be:

outputChatBox ( "You are entering the Estate!", thePlayer ) 

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