• Print GMOD Map Coordinates to Chat?
    13 replies, posted
Hello! I am recently playing a lot of SWRP. The Server where I am playing uses coordinates and it's bloody annoying to copy and paste them. Until then, you already got overrun. I would know if there is a possibility to make a Script which does the following: When I type in something in console (like f.ex showcoordinates just as example), it prints the message. I could also connect it to commands (Like /advert). I have no experience in scripts, so I would appreciate any help. Cheers!
Yes, it's not that hard, due you have 0 idea about coding, [url]www.scriptfodder.com[/url] is your best option
[QUOTE=gonzalolog;51960218]Yes, it's not that hard, due you have 0 idea about coding, [url]www.scriptfodder.com[/url] is your best option[/QUOTE] Ah rip, I thought it was a simple script. Yeah, gonna check the place out, if no one knows an solution then I'll request a Job.
lua_run_cl pos = self:GetPos() Ppos = tostring(pos) RunConsoleCommand("say",Ppos) Shouldn't this just do the job?
[code]concommand.Add( "printcoords", function( ply, cmd, args ) print( LocalPlayer():GetPos() ) end )[/code] ? or [code] bind X "lua_run_cl print(LocalPlayer():GetPos())" [/code] [code] bind X "lua_run_cl print(LocalPlayer():GetPos()); SetClipboardText(LocalPlayer():GetPos())" [/code]
[QUOTE=gonzalolog;51960218]Yes, it's not that hard, due you have 0 idea about coding, [url]www.scriptfodder.com[/url] is your best option[/QUOTE] Can we not do this everytime someone makes a thread like this? He is asking for help on something very simple. Toedeli, I don't know if you mean that the coordinates are printed on the screen or something, but if they are, there is already a console command which is getpos. I believe it gives you the coordinates and angles but you can just copy the coordinates. You can try out Flixs console command and see if that works.
Alright, as I have no idea with LUA (Kinda embarrasing to ask) Do I have to put it in the LUA Folder?
[QUOTE=Toedeli;51960327]Alright, as I have no idea with LUA (Kinda embarrasing to ask) Do I have to put it in the LUA Folder?[/QUOTE] The second 2 I posted are literally just in-game binds you should be able to do through the console. lua code can be put in a .lua file in IIRC "GarrysMod\garrysmod\lua\autorun\client" and it should run. Bearing in mind the server you are playing on needs to allow clientside lua for any of this to work.
[QUOTE=Toedeli;51960327]Alright, as I have no idea with LUA (Kinda embarrasing to ask) Do I have to put it in the LUA Folder?[/QUOTE] No, you could type this in the console [CODE] bind k "lua_run_cl pos = self:GetPos() Ppos = tostring(pos) RunConsoleCommand('say',Ppos)" [/CODE] Everytime you press "k" your coordinates will be printed if you dont want that anymore just type [CODE] unbind k [/CODE]
Thanks a lot guys, currently busy so unable to Play GMOD, thanks all for your help! And @Cushie does your addon have to be added as .lua file into the LUA Folder?
[QUOTE=Flixs;51960362]No, you could type this in the console [CODE] bind k "lua_run_cl pos = self:GetPos() Ppos = tostring(pos) RunConsoleCommand('say',Ppos)" [/code] [/QUOTE] self wont work in this context iirc. LocalPlayer() instead. [QUOTE=Toedeli;51960471]Thanks a lot guys, currently busy so unable to Play GMOD, thanks all for your help! And @Cushie does your addon have to be added as .lua file into the LUA Folder?[/QUOTE] The 1st lua code needs to be in a file to create the command in the location I said above, the 2nd two can just be pasted in the console in-game and will create the command that way. You only need 1 of the 3 methods (The 3rd prints as well as copies to clipboard) Like I said though the server you play on needs to have clinetisde lua enabled or none of it will work.
[QUOTE=Cushie;51960484]self wont work in this context iirc. LocalPlayer() instead.[/QUOTE] It does, I've tried it on my server.
[CODE] function SWEP:DrawHUD() surface.SetFont( "CloseCaption_Bold" ) surface.SetTextColor( 255, 255, 255, 255 ) surface.SetTextPos( 0, 0 ) surface.DrawText( tostring(LocalPlayer():GetPos()) ) end[/CODE]
[QUOTE=MrKuBu;52529375][CODE] function SWEP:DrawHUD() surface.SetFont( "CloseCaption_Bold" ) surface.SetTextColor( 255, 255, 255, 255 ) surface.SetTextPos( 0, 0 ) surface.DrawText( tostring(LocalPlayer():GetPos()) ) end[/CODE][/QUOTE] mate [IMG]https://image.prntscr.com/image/Tn1BYJKXQ8OqN2grJ8bocg.png[/IMG]
Sorry, you need to Log In to post a reply to this thread.