• Need Help creating a name script
    42 replies, posted
use [URL="https://wiki.garrysmod.com/page/net/Receive"]net.Receive[/URL] and [URL="https://wiki.garrysmod.com/page/net/ReadString"]net.ReadString[/URL] on the server. EDIT: ninja'd
How do I "plug" the string into PData
You set the pdata value to the string you receive from net.ReadString which you get from net.Receive("your_net_message")
[QUOTE=Invule;52702325]You set the pdata value to the string you receive from net.ReadString which you get from net.Receive("your_net_message")[/QUOTE] So in net.ReadString() i would put in the parentheses "New Name" The string sent was name_entry:GetValue()
[QUOTE=jonnyetiz;52702335]So in net.ReadString() i would put in the parentheses "New Name" The string sent was name_entry:GetValue()[/QUOTE] No, you don't need to because you must read in the same order you write, so don't put anything in the parentheses. As Invule said, [U][I][B]READ THE NET LIBRARY USAGE PAGE ON THE WIKI![/B][/I][/U] All your questions are answered there!!!
[QUOTE=MelonShooter;52702341]No, you don't need to because you must read in the same order you write, so don't put anything in the parentheses. As Invule said, [U][I][B]READ THE NET LIBRARY USAGE PAGE ON THE WIKI![/B][/I][/U] All your questions are answered there!!![/QUOTE] Unfortunately, It doesnt. I looked over it a few times, It says nowhere how to get what a string is CALLED.
[QUOTE=jonnyetiz;52702370]Unfortunately, It doesnt. I looked over it a few times, It says nowhere how to get what a string is CALLED.[/QUOTE] What do you mean "how to get what a string is called"? a string is a string, you get the string by doing local something = net.ReadString() or just call net.ReadString() in pdata the "something" variable contains the content of the net.ReadString() which you use with net.WriteString() you managed to write all that sick vgui code, use net.Send, WriteString and Start correctly but you don't know how to retrieve it on the server?
[QUOTE=jonnyetiz;52702370]Unfortunately, It doesnt. I looked over it a few times, It says nowhere how to get what a string is CALLED.[/QUOTE] What are you even trying to say? Information is read in the same order in which it's written. Therefore, you will not need to put anything in the net.ReadString(). You can see it very clearly being done in the first example of the net library usage. Although it says net.ReadEntity(), it is the exact same concept. Idk if this is what you're asking, but specify what you mean by what it's called.
So just do net.Receive( "send_namedata", ply:SetPData( "Name", net.GetString()) )
Obviously you did not read anything we've told you. Read this: [url]https://wiki.garrysmod.com/page/Net_Library_Usage[/url] -- For real this time.
[QUOTE=jonnyetiz;52702568]So just do net.Receive( "send_namedata", ply:SetPData( "Name", net.GetString()) )[/QUOTE] Are you filtering out what we've said a bunch of times... I mean, it's in front of your eyes. If you read the wiki page on it, it very clearly shows everything you need to know about net messages. It might be in a different context, but can very easily be changed a little to fit your situation.
Jesus christ, read the damn wiki, Jonny. It literally says it there. The second argument is a FUNCTION!!!!
Solved.
Sorry, you need to Log In to post a reply to this thread.