Updated the OP with more recent code and examples.
-snip-
[QUOTE=twoski;33480819]Updated the OP with more recent code and examples.[/QUOTE]
awesome, thank you sir.
out of curiosity, is there only a send to player function? or is there anything similar to recipient filters from usermessages?
Garry already said there will be a way to send to a player, send to multiple players, send to all players, and don't send to specific players.
[QUOTE=DylanWilson;33481118]awesome, thank you sir.
out of curiosity, is there only a send to player function? or is there anything similar to recipient filters from usermessages?[/QUOTE]
There is net.SendOmit although i have not tried messing with it yet. I'll take a look in a bit.
I'm having difficulty with the net.Send* functions.
A test on a server with two players:
[code]
lua_run player.GetAll()[1]:SendLua("net.Receive('abc',function(l)RunConsoleCommand('say','abc:'..l)end)")
> player.GetAll()[1]:SendLua("net.Receive('abc',function(l)RunConsoleCommand('say','abc:'..l)end)")...
lua_run player.GetAll()[2]:SendLua("net.Receive('abc',function(l)RunConsoleCommand('say','abc:'..l)end)")
> player.GetAll()[2]:SendLua("net.Receive('abc',function(l)RunConsoleCommand('say','abc:'..l)end)")...
> lua_run net.Start("abc") net.Broadcast()
> net.Start("abc") net.Broadcast()...
Deco: abc:16
Chewgum: abc:16
> lua_run net.Start("abc") net.Send()
> net.Start("abc") net.Send()...
> lua_run net.Start("abc") net.Send(Player(1))
> net.Start("abc") net.Send(Player(1))...
> lua_run net.Start("abc") net.Send(Player(2))
> net.Start("abc") net.Send(Player(2))...
Deco: abc:16
Chewgum: abc:16
> lua_run net.Start("abc") net.Send(Entity(1))
> net.Start("abc") net.Send(Entity(1))...
Deco: abc:16
Chewgum: abc:16
> lua_run net.Start("abc") net.Send(Entity(2))
> net.Start("abc") net.Send(Entity(2))...
Deco: abc:16
Chewgum: abc:16
> lua_run net.Start("abc") net.Send({Player(1)})
> net.Start("abc") net.Send({Player(1)})...
Deco: abc:16
Chewgum: abc:16
> lua_run net.Start("abc") net.Send({Player(2)})
> net.Start("abc") net.Send({Player(2)})...
Deco: abc:16
Chewgum: abc:16
> lua_run net.Start("abc") net.Send({})
> net.Start("abc") net.Send({})...
Deco: abc:16
Chewgum: abc:16
> lua_run net.Start("abc") net.Send(nil)
> net.Start("abc") net.Send(nil)...
> lua_run net.Start("abc") net.Send(1)
> net.Start("abc") net.Send(1)...
> lua_run net.Start("abc") net.Send(1337)
> net.Start("abc") net.Send(1337)...
> lua_run net.Start("abc") net.Send(true)
> net.Start("abc") net.Send(true)...
> lua_run net.Start("abc") net.SendOmit({})
> net.Start("abc") net.SendOmit({})...
Deco: abc:16
Chewgum: abc:16
> lua_run net.Start("abc") net.SendOmit({Player(1)})
> net.Start("abc") net.SendOmit({Player(1)})...
Deco: abc:16
Chewgum: abc:16
[/code]
There seems to be no way to send to a specific set of players.
I've tried CRecipientFilters too.
Are these functions not working yet?
So basicly the Net Library is a improved "datastream"? Sadly I haven't got a Beta key, as I can't fix some stuff that I'm using datastream for. (Sending pretty big text shit, ya'll know..)
[QUOTE=Persious;33490783]So basicly the Net Library is a improved "datastream"?[/QUOTE]
net.WriteTable is like a new datastream, but the rest of the library is like the old usermessage system.
net.Send and SendOmit should take a { ply, ply, ply } or just a ply
If it doesn't then post a bug in the beta forum
awesome, thanks garry.
any general guestimate on a release date so I can know when to start fixing my gamemode?
I'm sorry if this has been asked before, but are you replacing usermessage with the net library as well?
He's keeping the usermessage library as far as I know.
edit: But removing datastream
[QUOTE=thejjokerr;33492123]I was wondering this, is the net library faster for short messages as well? Or should we continue to use usermessages for that?[/QUOTE]
I don't know if the are faster but they have an increased max data limit.
He said somewhere that they're sent instantly, whereas user messages are sent on frame updates. (afaik)
I also suspect that a lot of small net messages will lag less than a lot of small umsgs, which will be nice.
Incidentally, has the NWVar system been moved from umsgs to this new system?
The n probably means the number of variables send.
[QUOTE=maurits150;33494572]The n probably means the number of variables send.[/QUOTE]
[url=http://www.facepunch.com/threads/1089200?p=32974347&viewfull=1#post32974347]Number of bytes.[/url]
[QUOTE=DylanWilson;33491965]awesome, thanks garry.
any general guestimate on a release date so I can know when to start fixing my gamemode?[/QUOTE]
Post whatever code relies on usermessages or datastream and i could convert it to use the net library if you want. It's actually really easy.
[QUOTE=Drew P. Richard;33492027]I'm sorry if this has been asked before, but are you replacing usermessage with the net library as well?[/QUOTE]
It's a bit redundant seeing as the net library is basically like usermessages 2.0, but if usermessages were removed it would probably break every older script that sends things to clients. So usermessages will be there for legacy support more or less.
So can I use RecipientFilter here or is there some sort of filtering thing I missed
Pfff, RecipientFilter was cooler
Are there any future plans to make it use RecipientFilter? Or is there a way to get members of a RecipientFilter? I'm planning to make usermessages and datastream use the net library and they both can take them in.
From what I saw earlier today it's still there, but I haven't tested it yet. I think Drakehawke came to the conclusion that it didn't though
[QUOTE=thejjokerr;33497316]I'd just override the recipientfilter metatable to store added players so you can get them later.[/QUOTE]
Ah shit you're right, I'm not thinking straight, thanks!
[QUOTE=garry;33491924]net.Send and SendOmit should take a { ply, ply, ply } or just a ply
If it doesn't then post a bug in the beta forum[/QUOTE]
Will it support PVS and PAS? Maybe net.SendPVS() and net.SendPAS()?
[QUOTE=Jinto;33498446]Will it support PVS and PAS? Maybe net.SendPVS() and net.SendPAS()?[/QUOTE] It already does support PVS.
[QUOTE=Jinto;33498446]Will it support PVS and PAS? Maybe net.SendPVS() and net.SendPAS()?[/QUOTE]
check the comments on my profile, twoski put a dump of the net library there, PAS and PVS are implemented
(thanks twoski)
And PAS
[img]http://www.bananatree.im/i/2EVQUOj.png[/img]
[QUOTE=CmdrMatthew;33500159]It already does support PVS.[/QUOTE]
Excellent.
[h2]Im Currently Working On The Wiki Page If Anyone Wants To Help[/h2]
[url]http://wiki.garrysmod.com/?title=Net[/url]
I know PVS, but what is PAS?
[QUOTE=FPtje;33503651]I know PVS, but what is PAS?[/QUOTE]
PVS and PAS, what are they both?
Sorry, you need to Log In to post a reply to this thread.