Jump to content

Need Help: Player Teleport!


Jack_Miller

Recommended Posts

Why nobody can helps me with such a simple script? :D

@BinSlayer1 you tested it right? but now there are other locations where the player will be teleport to...the coordinates are random choosed...what is the problem?^^

there must be a solution...

Again:

- Markers will be created (script will be loaded...)

- Player will be teleported - Nope

- gives a Chat output - Nope

- debugscript show a error or warning or shice like that? - Nope...

So the fail must be inside the function, right?

Its not a scripting failure, because debugscript accept it...

Maybe we should think about the:

if (getElementType(player) == "player") and (isPedInVehicle(player) == false) then 

Link to comment

Just make a new resource, call it 'test'

Put the following code in a test.lua file

MillerTurmRauf = createMarker ( 0, 15, 4, "cylinder", 1, 255, 0, 0 ) 
MillerTurmRunter = createMarker ( 0, 0, 4, "cylinder", 1, 255, 0, 0 ) 
    
function turmrauf ( player ) 
    
    if (getElementType(player) == "player") and (isPedInVehicle(player) == false) then 
        setElementPosition ( player, 10, 0, 4 ) 
    end 
end 
addEventHandler ( "onMarkerHit", MillerTurmRauf, turmrauf ) 
  
function turmrunter ( player ) 
    
    if (getElementType(player) == "player") and (isPedInVehicle(player) == false) then 
        setElementPosition ( player, 10, 15, 4 ) 
    end 
end 
addEventHandler ( "onMarkerHit", MillerTurmRunter, turmrunter ) 

create a file called meta.xml and put the following in it:

<meta> 
<script src="test.lua" /> 
</meta> 

Run the 'play' gamemode.

Go to coordinates 0,0,0

You should see 2 markers nearby

Test each of them out..

Then adjust the script to your needs.. But don't put the same x,y,z location from the markers to the setElementPosition argument :/

PS: I tested the code and it works

Link to comment

help yourself: test if event triggered, and that doesnt mean putting chat output near setElementPosition.

if you have problems with such simple script (because others have even tested it and it works) — something is wrong on your side, and noone here can say with 100% certainty what exactly.

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