ULX

Author Topic: Grabbing binds  (Read 2704 times)

0 Members and 1 Guest are viewing this topic.

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Grabbing binds
« on: April 10, 2014, 09:19:19 PM »
Does anyone know how to get a target's binds? It would help me in identifying who is lying about unbinding certain commands.
Out of the Garry's Mod business.

Offline LuaTenshi

  • Hero Member
  • *****
  • Posts: 545
  • Karma: 47
  • Just your ordinary moon angel!
    • Mirai.Red
Re: Grabbing binds
« Reply #1 on: April 11, 2014, 10:54:59 AM »
You probably want to check out the input library for garrysmod located here... http://wiki.garrysmod.com/page/Category:input

Specifically this: http://wiki.garrysmod.com/page/input/LookupBinding

---

Also because the above is client side only you would need to use the "net" library. http://wiki.garrysmod.com/page/Category:net



A good example of how to use the net Library...

Server to Client.

SERVER:
Code: [Select]
util.AddNetworkString("sMsgStandard")
local str = "Hello"
net.Start("sMsgStandard")
net.WriteString(str)
net.Send(ply) -- ply, is the player entity your targeting.

CLIENT:
Code: [Select]
net.Receive("sMsgStandard", function()
local str = net.ReadString()
LocalPlayer():ChatPrint(str)
end)



Client to Server.

CLIENT:
Code: [Select]
local str = "Hello"
net.Start("HelloServer")
net.WriteString(str)
net.SendToServer()

SERVER:
Code: [Select]
util.AddNetworkString("HelloServer")
net.Receive("HelloServer", function(_, ply)
local str = net.ReadString()
print(ply,str) -- Will return the entity of the player who sent the message, as well as the message it self.
end)
« Last Edit: April 11, 2014, 10:56:51 AM by LuaTenshi »
I cry every time I see that I am not a respected member of this community.

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: Grabbing binds
« Reply #2 on: April 16, 2014, 07:37:19 PM »
Unpooled Message

Er, could you help me with this?

I used
Code: [Select]
util.AddNetworkString( "Debug2" )
But it isn't working. The client side of the script seems to give me an unpooled message error.
Out of the Garry's Mod business.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Grabbing binds
« Reply #3 on: April 16, 2014, 09:17:43 PM »
util.AddNetworkString( string )
placed in a serverside lua file has to match whatever string is being used in

net.Start( string )

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: Grabbing binds
« Reply #4 on: April 16, 2014, 10:28:32 PM »
util.AddNetworkString( string )
placed in a serverside lua file has to match whatever string is being used in

net.Start( string )

In this case, it's net.Receive( string ).
Should it still be the same?
Out of the Garry's Mod business.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Grabbing binds
« Reply #5 on: April 17, 2014, 05:01:11 AM »
Yeah. The unpooled message error just means you're trying to do a net message that doesn't exist.

All net messages have to be declared serverside with the AddNetworkString before they can be used.

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: Grabbing binds
« Reply #6 on: April 17, 2014, 10:24:38 PM »
Hm, it doesn't seem to be registering.

I used util.AddNetworkString( "Debug2" ), then called net.Receive( "Debug2" ), but it still seems to be failing.
Out of the Garry's Mod business.

Offline Cobalt

  • Full Member
  • ***
  • Posts: 216
  • Karma: 44
  • http://steamcommunity.com/id/__yvl/
Re: Grabbing binds
« Reply #7 on: April 18, 2014, 10:18:31 AM »
Hm, it doesn't seem to be registering.

I used util.AddNetworkString( "Debug2" ), then called net.Receive( "Debug2" ), but it still seems to be failing.
We can't help you unless you paste your code here.