Piorun Posted August 7, 2010 Share Posted August 7, 2010 Hi! I've got next problem. I want to create some function like this: local localPlayer = getLocalPlayer ( ) function test ( ) addEventHandler( "onClientRender", getRootElement(), function( ) local px, py, pz = getElementPosition ( localPlayer ) local x, y, z = getScreenFromWorldPosition( px, py, pz+1 ); if x then example = dxDrawText( "Imię Nazwisko", x, y ); end end ) end addEventHandler ( "onClientPlayerJoin", getLocalPlayer(), test ) How it should work? When player join into the server this function should create a Text and show this text at the top of head. With "addCommandHandler" it's work. Any sugestions? Link to comment
dzek (varez) Posted August 8, 2010 Share Posted August 8, 2010 onClientPlayerJoin will NEVER be triggered for local player.. This can be use on local player to do something on ANY player join, but not local player. Why? Becouse first you join the server, then download scripts. When scripts got run - you are already joined for few secounds.. This is popular mistake. Use onClientResourceStart instead And don't forget to attach it to getResourceRootElement(getThisResource()) instead of getRootElement() ps. I'm almost sure that you can't draw Polish letters like "ę" ps2. Notice that on wiki page of onClientPlayerJoin there is text: "It is triggered for all players other than the local player.". Read carefully next time Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now