Jump to content

Help with localPlayer


Recommended Posts

Hello, i've created a tower for my server,

I created a gate marker but, when a source hit the marker all player are teleported to the player in the marker and go inside the gate.

It's client side (not full codes):

addEventHandler ( "onClientMarkerHit", root, 
    function ( ) 
        if not isPedInVehicle ( localPlayer ) then 
            if source == enter then 
               setElementInterior ( localPlayer, 1 ) 
               setElementPosition ( localPlayer, 2233.845703125, 1710.0625, 1011.0922851563 ) 
               outputChatBox ( "* welcome to Drrb's Tower", 255, 255, 0 ) 

Also all markers exactly have problem like this.

Link to comment
addEventHandler ( "onClientMarkerHit", root, 
    function ( ) 
        if not isPedInVehicle ( localPlayer ) == 1 then 
            if source == 1 then 
               setElementInterior ( localPlayer, 1 ) 
               setElementDimension ( localPlayer, 0 ) 
               setElementPosition ( localPlayer, 2233.845703125, 1710.0625, 1011.0922851563 ) 
               outputChatBox ( "* welcome to Drrb's Tower", 255, 255, 0 ) 

I've noticed you haven't set a dimension...

setElementDimension ( localPlayer, 0 ) <-- Change the 0 value to whatever dimension you're TPing to

Link to comment

The fck InVision? O_O"

if source == 1 then 

You should explain that to me...

anyway try this;

addEventHandler ( "onClientMarkerHit", root, 
    function ( hitElement ) 
        if ( isPedInVehicle ( getLocalPlayer() ) ) then return; end 
        if not ( getElementType( hitElement ) == "player" ) then return; end -- just to be sure! 
        if ( source == and hitElement == getLocalPlayer() ) then 
            setElementInterior ( getLocalPlayer(), 1 ); 
            setElementDimension ( getLocalPlayer(), 0 ); 
            setElementPosition ( getLocalPlayer() , 2233.845703125, 1710.0625, 1011.0922851563 ); 
            outputChatBox ( "* welcome to Drrb's Tower", 255, 255, 0 ) 
        end 
    end 
); 

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