Browse Source

Added amsg/pamsg game commands

release/0.19
Jessica James 5 years ago
parent
commit
920ac76afd
  1. 71
      src/Plugins/RenX/RenX.Commands/RenX_Commands.cpp
  2. 2
      src/Plugins/RenX/RenX.Commands/RenX_Commands.h

71
src/Plugins/RenX/RenX.Commands/RenX_Commands.cpp

@ -390,7 +390,7 @@ void PAdminMsgIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString
const Jupiter::ReadableString &PAdminMsgIRCCommand::getHelp(const Jupiter::ReadableString &)
{
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Sends an admin message in-game. Syntax: pamsg <Player> <Message>");
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Sends an admin message to a player in-game. Syntax: pamsg <Player> <Message>");
return defaultHelp;
}
@ -3383,6 +3383,75 @@ const Jupiter::ReadableString &ModRequestGameCommand::getHelp(const Jupiter::Rea
GAME_COMMAND_INIT(ModRequestGameCommand)
// AdminMessage Game Command
void AdminMessageGameCommand::create()
{
this->addTrigger(STRING_LITERAL_AS_REFERENCE("amsg"));
this->addTrigger(STRING_LITERAL_AS_REFERENCE("adminmsg"));
this->addTrigger(STRING_LITERAL_AS_REFERENCE("amessage"));
this->addTrigger(STRING_LITERAL_AS_REFERENCE("adminmessage"));
this->setAccessLevel(1);
}
void AdminMessageGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player, const Jupiter::ReadableString &parameters)
{
if (parameters.isNotEmpty())
{
Jupiter::StringS msg = player->gamePrefix + player->name + ": "_jrs + parameters;
source->sendAdminMessage(msg);
}
else
source->sendMessage(*player, "Error: Too few parameters. Syntax: amsg <player> <message>"_jrs);
}
const Jupiter::ReadableString &AdminMessageGameCommand::getHelp(const Jupiter::ReadableString &)
{
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Sends an admin message in-game. Syntax: amsg <message>");
return defaultHelp;
}
GAME_COMMAND_INIT(AdminMessageGameCommand)
// PAdminMessage Game Command
void PAdminMessageGameCommand::create()
{
this->addTrigger(STRING_LITERAL_AS_REFERENCE("pamsg"));
this->addTrigger(STRING_LITERAL_AS_REFERENCE("padminmsg"));
this->addTrigger(STRING_LITERAL_AS_REFERENCE("pamessage"));
this->addTrigger(STRING_LITERAL_AS_REFERENCE("padminmessage"));
this->setAccessLevel(1);
}
void PAdminMessageGameCommand::trigger(RenX::Server *source, RenX::PlayerInfo *player, const Jupiter::ReadableString &parameters)
{
if (parameters.wordCount(WHITESPACE) >= 2)
{
Jupiter::StringS name = Jupiter::StringS::getWord(parameters, 0, WHITESPACE);
Jupiter::StringS msg = player->gamePrefix + player->name + ": "_jrs + Jupiter::ReferenceString::gotoWord(parameters, 1, WHITESPACE);
RenX::PlayerInfo *target = source->getPlayerByPartName(name);
if (target == nullptr)
source->sendMessage(*player, "Error: Player not found."_jrs);
else
{
source->sendAdminMessage(*target, msg);
source->sendMessage(*player, "Message sent to "_jrs + target->name);
}
}
else
source->sendMessage(*player, "Error: Too few parameters. Syntax: pamsg <player> <message>"_jrs);
}
const Jupiter::ReadableString &PAdminMessageGameCommand::getHelp(const Jupiter::ReadableString &)
{
static STRING_LITERAL_AS_NAMED_REFERENCE(defaultHelp, "Sends an admin message to a player in-game. Syntax: pamsg <player> <message>");
return defaultHelp;
}
GAME_COMMAND_INIT(PAdminMessageGameCommand)
// Kill Game Command
void KillGameCommand::create()

2
src/Plugins/RenX/RenX.Commands/RenX_Commands.h

@ -108,6 +108,8 @@ GENERIC_GAME_COMMAND(HelpGameCommand)
GENERIC_GAME_COMMAND(ModsGameCommand)
GENERIC_GAME_COMMAND(RulesGameCommand)
GENERIC_GAME_COMMAND(ModRequestGameCommand)
GENERIC_GAME_COMMAND(AdminMessageGameCommand)
GENERIC_GAME_COMMAND(PAdminMessageGameCommand)
GENERIC_GAME_COMMAND(KillGameCommand)
GENERIC_GAME_COMMAND(DisarmGameCommand)
GENERIC_GAME_COMMAND(DisarmC4GameCommand)

Loading…
Cancel
Save