Author Topic: Custom ULX Commands / Server Mail  (Read 196536 times)

0 Members and 2 Guests are viewing this topic.

Offline Timmy

  • Ulysses Team Member
  • Sr. Member
  • *****
  • Posts: 252
  • Karma: 168
  • Code monkey
Re: Custom ULX Commands / Server Mail
« Reply #90 on: January 04, 2016, 12:29:52 PM »
It's not possible to nest quotes in console commands.

Possible workarounds:
Put your command in a .cfg file and execute that file instead
1. Create a new file <something>.cfg in <steam_install>/garrysmod/cfg/
2. The file should contain the console command you want to execute e.g.:
Code: [Select]
ulx tsaycolor "Keep calm, love Team Ulysses" red3. After saving the file, you should be able to run:
Code: [Select]
exec <something>
Code: [Select]
bind p "exec <something>"
Modify the command so nested quotes can be avoided
Code: [Select]
ulx_tsay_color_table = { "black", "white", "red", "blue", "green", "orange", "purple", "pink", "gray", "yellow" }

function ulx.tsaycolor( calling_ply, color, message )
    local pink = Color( 255, 0, 97 )
    local white = Color( 255, 255, 255 )
    local black = Color( 0, 0, 0 )
    local red = Color( 255, 0, 0 )
    local blue = Color( 0, 0, 255 )
    local green = Color( 0, 255, 0 )
    local orange = Color( 255, 127, 0 )
    local purple = Color( 51, 0, 102 )
    local gray = Color( 96, 96, 96 )
    local grey = Color( 96, 96, 96 )
    local maroon = Color( 128, 0, 0 )
    local yellow = Color( 255, 255, 0 )

    if color == "pink" then
        ULib.tsayColor( nil, false, pink, message )
    elseif color == "white" then
        ULib.tsayColor( nil, false, white, message )
    elseif color == "black" then
        ULib.tsayColor( nil, false, black, message )
    elseif color == "red" then
        ULib.tsayColor( nil, false, red, message )
    elseif color == "blue" then
        ULib.tsayColor( nil, false, blue, message )
    elseif color == "green" then
        ULib.tsayColor( nil, false, green, message )
    elseif color == "orange" then
        ULib.tsayColor( nil, false, orange, message )
    elseif color == "purple" then
        ULib.tsayColor( nil, false, purple, message )
    elseif color == "gray" then
        ULib.tsayColor( nil, false, gray, message )
    elseif color == "grey" then
        ULib.tsayColor( nil, false, grey, message )
    elseif color == "maroon" then
        ULib.tsayColor( nil, false, maroon, message )
    elseif color == "yellow" then
        ULib.tsayColor( nil, false, yellow, message )
    elseif color == "default" then
        ULib.tsay( nil, message )
    end

    if util.tobool( GetConVarNumber( "ulx_logChat" ) ) then
        ulx.logString( string.format( "(tsay from %s) %s", calling_ply:IsValid() and calling_ply:Nick() or "Console", message ) )
    end
end
local tsaycolor = ulx.command( "Chat", "ulx tsaycolor", ulx.tsaycolor, "!color", true, true )
tsaycolor:addParam{ type=ULib.cmds.StringArg, hint="color", completes=ulx_tsay_color_table, ULib.cmds.restrictToCompletes }
tsaycolor:addParam{ type=ULib.cmds.StringArg, hint="message", ULib.cmds.takeRestOfLine }
tsaycolor:defaultAccess( ULib.ACCESS_ADMIN )
tsaycolor:help( "Send a message to everyone in the chat box with color." )
The modified version allows you to run:
Code: [Select]
ulx tsaycolor red Keep calm, love Team Ulysses
Code: [Select]
bind p "ulx tsaycolor red Keep calm, love Team Ulysses"
« Last Edit: July 11, 2018, 12:16:37 AM by Timmy »

Offline Officially

  • Newbie
  • *
  • Posts: 11
  • Karma: 1
Re: Custom ULX Commands / Server Mail
« Reply #91 on: January 06, 2016, 12:32:38 PM »
It's not possible to nest quotes in console commands.

Possible workarounds:
Put your command in a .cfg file and execute that file instead
1. Create a new file <something>.cfg in <steam_install>/garrysmod/cfg/
2. The file should contain the console command you want to execute e.g.:
Code: [Select]
ulx tsaycolor "Keep calm, love Team Ulysses" red3. After saving the file, you should be able to run:
Code: [Select]
exec <something>
Code: [Select]
bind p "exec <something>"
Modify the command so nested quotes can be avoided
Here is a link to the modified command. You may click "Revisions" to see exactly what I changed.
The modified version allows you to run:
Code: [Select]
ulx tsaycolor red Keep calm, love Team Ulysses
Code: [Select]
bind p "ulx tsaycolor red Keep calm, love Team Ulysses"
WORKING! This calls for a celebration! Thanks so much  :)

Offline FrontSideGaming

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
Re: Custom ULX Commands / Server Mail
« Reply #92 on: January 13, 2016, 04:58:20 PM »
I put one file into the addons and I restarted my server none of the new commands pop up but every now and then the auto tsay color comes up. HELP PLEZ?!
« Last Edit: January 13, 2016, 05:14:26 PM by FrontSideGaming »

Offline Bob Dylan

  • Newbie
  • *
  • Posts: 10
  • Karma: -5
Re: Custom ULX Commands / Server Mail
« Reply #93 on: January 14, 2016, 06:37:25 PM »
Hey can you please help me so that your chat tags show the players teams in a color.
E.G. Blue for guards, Red for prisoners
TEAM_PRISONER & TEAM_GUARD, please help <3

Offline shrederblade99

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
Re: Custom ULX Commands / Server Mail
« Reply #94 on: January 26, 2016, 11:48:00 AM »
How do i delete the custom tags in chat?

Offline ickycoolboy

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
Re: Custom ULX Commands / Server Mail
« Reply #95 on: January 26, 2016, 03:11:12 PM »
Delete cc_chattags.lua located in "lua/ulx/modules/sh" in the addon folder you downloaded.

Offline galassi

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
Re: Custom ULX Commands / Server Mail
« Reply #96 on: February 08, 2016, 03:06:45 PM »
have to resurrect an antiquated post, but one quick question, how do i use the mail addon?

Offline notedhalfling

  • Newbie
  • *
  • Posts: 4
  • Karma: 2
Re: Custom ULX Commands / Server Mail
« Reply #97 on: February 09, 2016, 07:54:28 PM »
have to resurrect an antiquated post, but one quick question, how do i use the mail addon?
stick it on your addons folder and restart the server, then type !mail in chat or press f6 to open it

Offline nex86

  • Newbie
  • *
  • Posts: 22
  • Karma: 0
Re: Custom ULX Commands / Server Mail
« Reply #98 on: February 11, 2016, 01:45:45 PM »
I tried either installing onecategorie and the regular one but the commands won't show up in ULX at all.
I installed them correctly like any other addon.

ULX is up2date since I'm getting it from workshop.

Offline Moofin Man

  • Newbie
  • *
  • Posts: 10
  • Karma: -2
Re: Custom ULX Commands / Server Mail
« Reply #99 on: February 24, 2016, 09:43:12 PM »
Can you remove the auto tags? It is ruining adverts in DarkRP

Offline Moofin Man

  • Newbie
  • *
  • Posts: 10
  • Karma: -2
Re: Custom ULX Commands / Server Mail
« Reply #100 on: February 24, 2016, 09:49:45 PM »
I fixed the problem about the Chat Tags. If you are having an issue in the DarkRP goto (The CMD File you are using)/lua/ULX/Modules/sh and delete cc_chattags.lua.

Offline Nathan5643

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Re: Custom ULX Commands / Server Mail
« Reply #101 on: April 12, 2016, 09:27:10 AM »
I made an addon that contains sounds for my server but I was wondering how to make the "soundlist" command find those sounds in my addon (If their is a way to do this)

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Custom ULX Commands / Server Mail
« Reply #102 on: April 12, 2016, 03:42:18 PM »
Nathan, I poked around in the code.
It seems to use some standard Gmod locations, with some fancy additional blacklist, combined with ULX playsound.
Playsound presumes all sounds are stored in /sound (literal server, or virtual addon).
So, anything in addons/youraddon/sound/yoursounds/*.* that are compatible with Source should work.
Remember though, they'd have to be on the server and the client for sound to play.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Nathan5643

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Re: Custom ULX Commands / Server Mail
« Reply #103 on: April 13, 2016, 08:22:10 AM »
Hmm, the path is addons/myaddonname/vo/npc/male01
Should that still work?


EDIT: The sounds do work for Murder taunts but they don't seem to be found by soundlist. I can also play the sounds using ULX playsound just I have to have the path each time I want to play one
« Last Edit: April 13, 2016, 08:31:01 AM by Nathan5643 »

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Custom ULX Commands / Server Mail
« Reply #104 on: April 13, 2016, 06:46:00 PM »
Hmm, the path is addons/myaddonname/vo/npc/male01
Should that still work?
EDIT: The sounds do work for Murder taunts but they don't seem to be found by soundlist. I can also play the sounds using ULX playsound just I have to have the path each time I want to play one
No. Gmod and playsound expect /sound to be the root folder to search.
 addons/myaddonname/vo/npc/male01 would need to be  addons/myaddonname/sound/vo/npc/male01
Then to play that sound, you'd need "ulx playsound vo/npc/male01"
Or you could just dump all your sounds in  addons/myaddonname/sound/, and use "ulx playsound blah" without the path, but I've personally never liked doing that due to me being retentive about keeping things separate/organized.

"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming