• How to get players position on doclick?
    8 replies, posted
Hi I am wondering how to get a players positions as soon as he/she presses a dbutton. I am not wanting to continusly get his/hers location but just the location where they were when they pressed the dbutton. How would I do that. Here is the code I got. [CODE] button.DoClick = function() playerpos = ? end [/CODE]
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/gui/MousePos]gui.MousePos[/url] Be aware it returns 2 values ( the x and y position )
[QUOTE=solid_jake;52565019][img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/gui/MousePos]gui.MousePos[/url] Be aware it returns 2 values ( the x and y position )[/QUOTE] I think you misread me. I meant the location in the 3D world. Not their mouse location.
[QUOTE=solid_jake;52565019][img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/gui/MousePos]gui.MousePos[/url] Be aware it returns 2 values ( the x and y position )[/QUOTE] I guess they mean the literal position of the player, as of [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/GetPos]Entity:GetPos[/url] [editline]12th August 2017[/editline] Ninja'd
Yeah but how do I get the ent that pressed the button
If uppon pressing the button, the action you want the player to make should influence something serverside/on other players, you should use the [URL="http://wiki.garrysmod.com/page/Net_Library_Usage"]Net library[/URL] If you just want to store the information on the client that presses the button, then use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Global/LocalPlayer]LocalPlayer[/url]
GetPos Is shared, there's no need of networking it
[QUOTE=gonzalolog;52565140]GetPos Is shared, there's no need of networking it[/QUOTE] I said the thing about networking for the server to get the pos of the client, not for the client to send a vector which any script kiddie can "hack" if they find the source code
[QUOTE=ZeroToHero;52565026]I think you misread me. I meant the location in the 3D world. Not their mouse location.[/QUOTE] Definitely did, apologies
Sorry, you need to Log In to post a reply to this thread.