• Print

Author Topic: ulx module/ulx help  (Read 17910 times)

0 Members and 1 Guest are viewing this topic.

Offline lampman13

  • Jr. Member
  • **
  • Posts: 71
  • Karma: -10
Re: ulx module/ulx help
« Reply #15 on: February 25, 2014, 12:24:23 pm »
i thought it was in the developers corner and i know that it does but i only have one comma and it i suppoesed to be there but i even tryed to remove the comma so i could test it and it didnt work but i got it to work on client but not on a server for some reason and it is in addon format

Offline lynx

  • Jr. Member
  • **
  • Posts: 59
  • Karma: 15
Re: ulx module/ulx help
« Reply #16 on: February 25, 2014, 01:03:26 pm »
Remove the string concatinator (..) after the comma, and GetText is a function value so it needs to have (). So:
Code: [Select]
chat.AddText( Color( 0, 255, 0 ), "(ADMIN)", Color( 0, 255, 0 ), ..TextEntry:GetText )
Should be:
Code: [Select]
chat.AddText( Color( 0, 255, 0 ), "(ADMIN)", Color( 0, 255, 0 ), TextEntry:GetText() )

Offline lampman13

  • Jr. Member
  • **
  • Posts: 71
  • Karma: -10
Re: ulx module/ulx help
« Reply #17 on: February 25, 2014, 01:24:15 pm »
yeah i have that right now but it only works client side lol i did this last night i forgot i already had a thread and now i have a new one
but when i put it in a server it doesnt work can anyone help me with making it a ulx ! command and a "ulx    " command?

Offline lynx

  • Jr. Member
  • **
  • Posts: 59
  • Karma: 15
Re: ulx module/ulx help
« Reply #18 on: February 25, 2014, 01:38:26 pm »
Derma (textentry, etc) is all clientside. As is chat.AddText. If you want it to be distributed to clients, you need to either set up a net message (suggested) or a usermessage.

Net messages:
http://wiki.garrysmod.com/page/Net_Library_Usage

Send the text to the server (net.SendToServer) then process it to the clients you want (RecipientFilter) then send it back to the clients using a second net message, which the receive function would then process using chat.AddText

Offline lampman13

  • Jr. Member
  • **
  • Posts: 71
  • Karma: -10
Re: ulx module/ulx help
« Reply #19 on: February 25, 2014, 01:59:40 pm »
so my whole code wont work?

Offline lynx

  • Jr. Member
  • **
  • Posts: 59
  • Karma: 15
Re: ulx module/ulx help
« Reply #20 on: February 25, 2014, 02:31:06 pm »
It will, you just need to modify it to allow for talk between the client and the server.

Offline Cobalt

  • Full Member
  • ***
  • Posts: 216
  • Karma: 44
  • http://steamcommunity.com/id/__yvl/
Re: ulx module/ulx help
« Reply #21 on: February 25, 2014, 02:50:52 pm »
Derma (textentry, etc) is all clientside. As is chat.AddText. If you want it to be distributed to clients, you need to either set up a net message (suggested) or a usermessage.
You can also use something such as ULib.tsay.

Offline lampman13

  • Jr. Member
  • **
  • Posts: 71
  • Karma: -10
Re: ulx module/ulx help
« Reply #22 on: February 25, 2014, 07:07:12 pm »
ok and how do i use ulib.tsay like
Code: Lua
  1. Ulib.tsay(Color(255, 255, 255) "<MESSAGE GOES HERE>")

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: ulx module/ulx help
« Reply #23 on: February 25, 2014, 07:09:53 pm »
Isn't there a wiki full of ULX/ULib functions documented?

I'd look there for functions if I were you.
Out of the Garry's Mod business.

Offline lampman13

  • Jr. Member
  • **
  • Posts: 71
  • Karma: -10
Re: ulx module/ulx help
« Reply #24 on: February 25, 2014, 07:12:27 pm »
yeah but i dont really like the ulib wiki as it does not explain well it gives you pretty much Ulib.tsay and thats it not how to use it

Offline Cobalt

  • Full Member
  • ***
  • Posts: 216
  • Karma: 44
  • http://steamcommunity.com/id/__yvl/
Re: ulx module/ulx help
« Reply #25 on: February 26, 2014, 11:22:22 am »
ULib.tsayColor( nil, false, colorarg, text [, ...] )

Offline lampman13

  • Jr. Member
  • **
  • Posts: 71
  • Karma: -10
Re: ulx module/ulx help
« Reply #26 on: February 26, 2014, 01:51:34 pm »
Great but it still doesnt work on a server :/ i did the tsay thing but it doesnt work anything else i have to change (just remember im still new)
Code: Lua
  1. function UCast( ply )
  2.        
  3.         local ply = LocalPlayer()
  4.        
  5.         local BackGround = vgui.Create( "DFrame" )
  6.         BackGround:SetSize( 200,70 )
  7.         BackGround:SetPos( (ScrW()/2)-BackGround:GetWide(),(ScrH()/2)-BackGround:GetTall() )
  8.         BackGround:SetTitle( "UCast" )
  9.         BackGround:SetVisible( true )
  10.         BackGround:SetDraggable( true )
  11.         BackGround:ShowCloseButton( true )
  12.         BackGround:MakePopup()
  13.         BackGround.Paint = function()
  14.                 draw.RoundedBox(4, 0, 0, BackGround:GetWide(), BackGround:GetTall(), Color(0, 225, 225, 255))
  15.                 draw.RoundedBox(2, 2, 2, BackGround:GetWide()-4, 21, Color(255, 150, 0, 255))
  16.         end
  17.        
  18.         local TextEntry = vgui.Create( "DTextEntry", BackGround )
  19.         TextEntry:SetPos( 20,30 )
  20.         TextEntry:SetTall( 20 )
  21.         TextEntry:SetWide( 160 )
  22.         TextEntry:SetEnterAllowed( true )
  23.         TextEntry.OnEnter = function()
  24.                 ULib.tsayColor( nil, false, Color(0, 0, 0), "(", Color(255, 0, 0), "ADMIN MESSAGE", Color(0, 0, 0), ")", Color(0, 255, 0), TextEntry:GetText() )
  25.                 BackGround:SetVisible()
  26.         end
  27. end
  28. concommand.Add("ucast_menu",UCast)
  29.  
« Last Edit: February 26, 2014, 02:00:56 pm by lampman13 »

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: ulx module/ulx help
« Reply #27 on: February 26, 2014, 02:10:49 pm »
It will never work on server way you are trying.

THIS vvvvvvvv
Derma (textentry, etc) is all clientside. As is chat.AddText. If you want it to be distributed to clients, you need to either set up a net message (suggested) or a usermessage.

Net messages:
http://wiki.garrysmod.com/page/Net_Library_Usage

Send the text to the server (net.SendToServer) then process it to the clients you want (RecipientFilter) then send it back to the clients using a second net message, which the receive function would then process using chat.AddText

Logic would be like.
if server then
    concommand to send <your message> using <umsg or net message or whatever server to client Gmod code exists>
else
    function containing all your gui setup, including variable that holds 'text' you passed from server that was passed to below hook.
    <net or umsg or whatever client listening> hook to listen for your named <net/umsg/whatever> that runs function
end
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline lampman13

  • Jr. Member
  • **
  • Posts: 71
  • Karma: -10
Re: ulx module/ulx help
« Reply #28 on: February 26, 2014, 02:17:37 pm »
ok so JamminR you say my code just wont work on a server just not possible the ways its coded?

Offline Neku

  • Hero Member
  • *****
  • Posts: 549
  • Karma: 27
Re: ulx module/ulx help
« Reply #29 on: February 26, 2014, 03:15:29 pm »
ok so JamminR you say my code just wont work on a server just not possible the ways its coded?

Your code won't work because the server and client are two different things.

You need to send a message from the server to the client, telling them to do this.
Out of the Garry's Mod business.

  • Print