Page 1 of 1

Auto Message in Chat

Posted: Sun Nov 28, 2021 10:57 am
by Painkiller
Hello Community and SP Team,

How can I also tell the plugin to automatically display the commands in the chat so that players know what commands are available for the chat.

Example: Type "Ranking" in the chat to see your stats.

Best with multiple color codes to highlight it.

Syntax: Select all

from messages import VGUIMenu
from commands.say import SayCommand

def motd(index, title, site, show=True):
name = 'info'
subkeys = {'title': title, 'type': '2', 'msg': site}

VGUIMenu(name, subkeys=subkeys, show=show).send(index)


Thanks in Advance

Re: Auto Message in Chat

Posted: Sun Nov 28, 2021 11:31 am
by velocity
Try this:

Syntax: Select all

from messages import SayText2
from listeners.tick import Repeat
from listeners import OnLevelInit
from random import choice
MSG = ['Example: Type "Ranking" in the chat to see your stats.',
'other message #green colors..']
MSG_INTERVAL = 120


@Repeat
def _msg_repeater():
rng_choice = choice(MSG)
SayText2(str(rng_choice)).send()


def msg_repeater_start():
_msg_repeater.cancel_on_level_end = True
_msg_repeater.start(MSG_INTERVAL)


@OnLevelInit
def _on_level_start(_):
msg_repeater_start()


msg_repeater_start()

Re: Auto Message in Chat

Posted: Sun Nov 28, 2021 11:48 am
by Painkiller
It works and I was able to match colors to some extent.

Thanks a lot