Ulysses
General => Developers Corner => Topic started by: Neku 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.
-
You probably want to check out the input library for garrysmod located here... http://wiki.garrysmod.com/page/Category:input (http://wiki.garrysmod.com/page/Category:input)
Specifically this: http://wiki.garrysmod.com/page/input/LookupBinding (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 (http://wiki.garrysmod.com/page/Category:net)
A good example of how to use the net Library...
Server to Client.
SERVER:
util.AddNetworkString("sMsgStandard")
local str = "Hello"
net.Start("sMsgStandard")
net.WriteString(str)
net.Send(ply) -- ply, is the player entity your targeting.
CLIENT:
net.Receive("sMsgStandard", function()
local str = net.ReadString()
LocalPlayer():ChatPrint(str)
end)
Client to Server.
CLIENT:
local str = "Hello"
net.Start("HelloServer")
net.WriteString(str)
net.SendToServer()
SERVER:
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)
-
Unpooled Message (http://wiki.garrysmod.com/page/Calling_net.Start_with_unpooled_message_name)
Er, could you help me with this?
I used
util.AddNetworkString( "Debug2" )
But it isn't working. The client side of the script seems to give me an unpooled message error.
-
util.AddNetworkString( string )
placed in a serverside lua file has to match whatever string is being used in
net.Start( string )
-
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?
-
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.
-
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.
-
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.