• Print

Author Topic: OOC, ADVERT, PM, etc color change!  (Read 8456 times)

0 Members and 1 Guest are viewing this topic.

Offline Ballerd

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
OOC, ADVERT, PM, etc color change!
« on: March 14, 2018, 09:28:56 am »
This may be a dumb thing to ask but hey whatever, alright so I’m currently working on a gmod server and I’m taking some time and making it look great! I was wondering when people do OOC it says (OOC) Ballerd: Hey and the OOC color is the color of their job I want to make it a custom color and make it be like [OOC]. Any help would be great, thank you for your time and consideration ???
have a great rest of your day
-Ballerd

Offline BlueNova

  • Full Member
  • ***
  • Posts: 113
  • Karma: 13
  • The most powerful force in the universe.
Re: OOC, ADVERT, PM, etc color change!
« Reply #1 on: March 14, 2018, 09:34:44 am »
Believe you can make a custom darkrp command and remove the default ooc. Just make a new file and use DarkRP's functions

Code: Lua
  1. DarkRP.removeChatCommand("ooc")
  2. DarkRP.removeChatCommand("//")
  3. DarkRP.defineChatCommand("ooc", newooc)
  4. DarkRP.defineChatCommand("//", newooc)

As for the function just give it a color and have it echo to all players.

If you're using ULib/ULX you could do something like

Code: Lua
  1. ULib.tsayColor(Color(255, 0, 0), "(OOC) ", calling_ply:Nick(), ": ", Color(255, 255, 255), msg)

Offline Ballerd

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Re: OOC, ADVERT, PM, etc color change!
« Reply #2 on: March 14, 2018, 12:49:36 pm »
I did that, put into files but I'm getting this error which is weird to me but I'm still new to lua and learning my way.

[ERROR] addons/gravity_chat/lua/autorun/gravity_chat.lua:1: attempt to index global 'DarkRP' (a nil value)
  1. unknown - addons/gravity_chat/lua/autorun/gravity_chat.lua:1

Offline BlueNova

  • Full Member
  • ***
  • Posts: 113
  • Karma: 13
  • The most powerful force in the universe.
Re: OOC, ADVERT, PM, etc color change!
« Reply #3 on: March 14, 2018, 01:08:18 pm »
Well DarkRP you'll need to put in your darkrpmodifications addon likely as a darkrp_module

The ULib.tsayColor() should work so long as ULX Is a thing.

Offline Ballerd

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Re: OOC, ADVERT, PM, etc color change!
« Reply #4 on: March 14, 2018, 02:57:39 pm »
Here's my config and it's in darkrpmod/darkrp_modules

DarkRP.removeChatCommand("ooc")
DarkRP.removeChatCommand("//")
DarkRP.removeChatCommand("pm")
DarkRP.removeChatCommand("yell")

DarkRP.defineChatCommand("ooc", newooc)
DarkRP.defineChatCommand("//", newooc)
DarkRP.defineChatCommand("pm", newpm)
DarkRP.defineChatCommand("yell", newyell)


ULib.tsayColor(Color(255, 255, 255), "[", Color(200, 190, 60, 255), "PM", Color(255, 255, 255), "] ", calling_ply:Nick()..": ", Color(230, 230, 230, 255), msg)
ULib.tsayColor(Color(255, 0, 0), "[YELL] ", calling_ply:Nick(), ": ", Color(255, 255, 255), msg)
ULib.tsayColor(Color(255, 0, 0), "[OOC] ", calling_ply:Nick(), ": ", Color(255, 255, 255), msg)


Maybe I'm stupid but be nice ;)

Offline BlueNova

  • Full Member
  • ***
  • Posts: 113
  • Karma: 13
  • The most powerful force in the universe.
Re: OOC, ADVERT, PM, etc color change!
« Reply #5 on: March 14, 2018, 03:59:32 pm »
Here's my config and it's in darkrpmod/darkrp_modules

DarkRP.removeChatCommand("ooc")
DarkRP.removeChatCommand("//")
DarkRP.removeChatCommand("pm")
DarkRP.removeChatCommand("yell")

DarkRP.defineChatCommand("ooc", newooc)
DarkRP.defineChatCommand("//", newooc)
DarkRP.defineChatCommand("pm", newpm)
DarkRP.defineChatCommand("yell", newyell)


ULib.tsayColor(Color(255, 255, 255), "[", Color(200, 190, 60, 255), "PM", Color(255, 255, 255), "] ", calling_ply:Nick()..": ", Color(230, 230, 230, 255), msg)
ULib.tsayColor(Color(255, 0, 0), "[YELL] ", calling_ply:Nick(), ": ", Color(255, 255, 255), msg)
ULib.tsayColor(Color(255, 0, 0), "[OOC] ", calling_ply:Nick(), ": ", Color(255, 255, 255), msg)


Maybe I'm stupid but be nice ;)

When you declare the chat commands. Are you calling to functions? When using something like tsayColor (which I think would work in DarkRP I have no idea) you should place it within a function. And your defineChatCommands need to call to a function.

So something like this

Code: Lua
  1. function newpm(ply, target, message) --You'll need to find a way to target a player if you're not using ULX
  2.         --Some stuff for your new PM function
  3. end
  4.  
  5. DarkRP.removeChatCommand("pm")
  6. DarkRP.defineChatCommand("pm", newpm) --This second part is the function that's being called to



Of course you could try to make a ULX module for this, may be easier.

Code: Lua
  1. function ulx.pm(calling_ply, target_ply, message)
  2.         --Your PM function stuff
  3. end
  4.  
  5. local pm = ulx.command(CATEGORY_NAME, "ulx pm", ulx.pm, "/pm", true)
  6. pm:addParam{type=ULib.cmds.PlayerArg}
  7. pm:addParam{type=ULib.cmds.StringArg, hint="message", ULib.cmds.takeRestOfLine}
  8. pm:help("Sends a private message to a player.")

Personally I would do it that way but I mean you always can if it's easier.

  • Print