Jump to content

[Help] Not sure with getLocalPlayer


AlexWo

Recommended Posts

Hi.

In my script I just want that if a player hit's the Marker he get teleported to Ammunation1.

I got mixed up with how to get the local Player.

I only have a client side.

Weaponshop1 = createMarker(1368, -1279.8, 12.7, "cylinder", 1.5, 255, 255, 255, 255) 
  
  
function warpinto1 (source) 
setElementInterior ( source, 1, 286, -40, 1001 ) 
end 
  
addEventHandler( "onPlayerMarkerHit", Weaponshop1, warpinto1) 
  

I'm not sure with the functions how to get the local Player who enters the Marker

Thank you for helping me :)

Link to comment

That's because the first argument of "onPlayerMarkerHit" is the marker the player hit, not the player that hit the marker.

Weaponshop1 = createMarker ( 1368, -1279.8, 12.7, "cylinder", 1.5, 255, 255, 255, 255 ) 
  
function warpinto1 ( ) 
    setElementInterior ( source, 1, 286, -40, 1001 ) 
end 
addEventHandler ( "onPlayerMarkerHit", root, warpinto1 ) 

Link to comment

it will send you to interior at any marker because have root

addEventHandler ( "onPlayerMarkerHit", root, warpinto1 ) 

so use this better

Weaponshop1 = createMarker ( 1368, -1279.8, 12.7, "cylinder", 1.5, 255, 255, 255, 255 ) 
  
function warpinto1 ( player ) 
    if ( source == Weaponshop1 ) then 
        setElementInterior ( player, 1, 286, -40, 1001 ) 
    end 
end 
addEventHandler ( "onPlayerMarkerHit", root, warpinto1 ) 

Link to comment

Well, that's correct, but your code is so wrong.

Weaponshop1 = createMarker ( 1368, -1279.8, 12.7, "cylinder", 1.5, 255, 255, 255, 255 ) 
  
function warpinto1 ( theMarker ) 
    if ( theMarker == Weaponshop1 ) then 
        setElementInterior ( source, 1, 286, -40, 1001 ) 
    end 
end 
addEventHandler ( "onPlayerMarkerHit", root, warpinto1 ) 

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