Advertisement
Lolcats_babe

Untitled

May 14th, 2015
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. //CLIENTSIDE
  2. net.Receive("POIP_NameMenu", function()
  3.  
  4. local backboard = vgui.Create("DFrame")
  5. backboard:SetSize(350, 350)
  6. backboard:Center()
  7. backboard:ShowCloseButton(false)
  8. backboard:SetTitle("Name!")
  9. backboard:MakePopup()
  10.  
  11. local nameprompt = vgui.Create("DLabel", backboard)
  12. nameprompt:SetText([[ Welcome to the server!
  13. In order to play properly, you need
  14. an RP name. Pick a proper RP name,
  15. or else you may be banned!]])
  16. nameprompt:SetFont("HUDHintTextLarge")
  17. nameprompt:SizeToContents()
  18. nameprompt:SetPos(50, 90)
  19.  
  20. local firstnamebox = vgui.Create("DTextEntry", backboard)
  21. firstnamebox:SetPos( 35, 220 )
  22. firstnamebox:SetSize( 275, 25 )
  23. firstnamebox:SetText( "First Name" )
  24.  
  25. local lastnamebox = vgui.Create("DTextEntry", backboard)
  26. lastnamebox:SetPos( 35, 255 )
  27. lastnamebox:SetSize( 275, 25 )
  28. lastnamebox:SetText( "Last Name" )
  29.  
  30.  
  31. local acceptname = vgui.Create("DButton", backboard)
  32. acceptname:SetPos( 15, 305 )
  33. acceptname:SetText( "Accept Name." )
  34. acceptname:SetSize( 320, 30 )
  35. acceptname.DoClick = function()
  36.  
  37. if (firstnamebox:GetValue() == "" or lastnamebox:GetValue() == "" or !firstnamebox:GetValue() or !lastnamebox:GetValue()) then
  38. LocalPlayer():Notify("You need a name! Try again.", 3)
  39. return
  40. end
  41. local name = firstnamebox:GetValue().." "..lastnamebox:GetValue()
  42.  
  43. if string.len(name) > 28 then
  44. LocalPlayer():Notify("That name is too long. Pick another one.", 3)
  45. return
  46. end
  47.  
  48. net.Start("POIP_NameChange")
  49. net.WriteString(name)
  50. net.SendToServer()
  51.  
  52.  
  53. backboard:Close()
  54. end
  55.  
  56.  
  57. end)
  58.  
  59.  
  60. //SERVERSIDE
  61. net.Receive("POIP_NameChange", function(_, ply)
  62. local to = net.ReadString()
  63. POIP_ChangeName(ply, to) //obviously change this to whatever your name changing function is.
  64. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement