Jump to content

getLocalPlayer


A3kri

Recommended Posts

I know this may sound stupid but Idk why it doesn't work x.x

local myMarker = createMarker ( -710.25555419922, 962.29443359375, 12.410507202148, "cylinder", 1.5, 255, 0, 0, 255 ) 
  
addEventHandler ( "onClientMarkerHit", myMarker, 
    function () 
        outputChatBox (  "   hi   " .. getPlayerName(getLocalPlayer()), getRootElement(), 100, 100, 100, true ) 
    end) 

nothing happens while it should print

hi    xxxxx 

Link to comment

Arguments for outputChatBox are different on client side,

  
local myMarker = createMarker ( -710.25555419922, 962.29443359375, 12.410507202148, "cylinder", 1.5, 255, 0, 0, 255 ) 
  
addEventHandler ( "onClientMarkerHit", myMarker, function ( p ) 
    if ( p == localPlayer ) then 
        outputChatBox (  "   hi   " .. getPlayerName(p), 100, 100, 100, true ) 
    end 
end) 

Link to comment
Arguments for outputChatBox are different on client side,
  
local myMarker = createMarker ( -710.25555419922, 962.29443359375, 12.410507202148, "cylinder", 1.5, 255, 0, 0, 255 ) 
  
addEventHandler ( "onClientMarkerHit", myMarker, function ( p ) 
    if ( p == localPlayer ) then 
        outputChatBox (  "   hi   " .. getPlayerName(p), 100, 100, 100, true ) 
    end 
end) 

thanks, it's fine.

Edited by Guest
Link to comment

getAttachedElements returns a table.

addEventHandler ( "onClientMarkerHit", myMarker, function ( p ) 
    if ( p == localPlayer ) then 
        local attachedElements = getAttachedElements (p) 
        for _,v in ipairs ( attachedElements ) 
            detachElements ( v, p ) 
        end 
        outputChatBox (  "   hi   " .. getPlayerName(p), 100, 100, 100, true ) 
    end 
end) 

Link to comment
getAttachedElements returns a table.
addEventHandler ( "onClientMarkerHit", myMarker, function ( p ) 
    if ( p == localPlayer ) then 
        local attachedElements = getAttachedElements (p) 
        for _,v in ipairs ( attachedElements ) 
            detachElements ( v, p ) 
        end 
        outputChatBox (  "   hi   " .. getPlayerName(p), 100, 100, 100, true ) 
    end 
end) 

yes i solved it x.x but you answered before i edit lol

thanks very much

Link to comment
getAttachedElements returns a table.
addEventHandler ( "onClientMarkerHit", myMarker, function ( p ) 
    if ( p == localPlayer ) then 
        local attachedElements = getAttachedElements (p) 
        for _,v in ipairs ( attachedElements ) 
            detachElements ( v, p ) 
        end 
        outputChatBox (  "   hi   " .. getPlayerName(p), 100, 100, 100, true ) 
    end 
end) 

yes i solved it x.x but you answered before i edit lol

thanks very much

No problameo.

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