From 9dabdc9fc368ac14f1b48bf6c9d6cd3fde069057 Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Sun, 27 Dec 2020 21:25:01 -0600 Subject: [PATCH] Add param check to chat cmds --- scripts/server/chat.js | 47 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/scripts/server/chat.js b/scripts/server/chat.js index a31213e6..150c1e26 100644 --- a/scripts/server/chat.js +++ b/scripts/server/chat.js @@ -17,6 +17,11 @@ function initChatScript() { // --------------------------------------------------------------------------- function meActionCommand(command, params, client) { + if(areParamsEmpty(params)) { + messageClientSyntax(client, getCommandSyntaxText(command)); + return false; + } + meActionToNearbyPlayers(client, params); return true; } @@ -24,6 +29,11 @@ function meActionCommand(command, params, client) { // --------------------------------------------------------------------------- function doActionCommand(command, params, client) { + if(areParamsEmpty(params)) { + messageClientSyntax(client, getCommandSyntaxText(command)); + return false; + } + doActionToNearbyPlayers(client, params); return true; } @@ -31,6 +41,11 @@ function doActionCommand(command, params, client) { // --------------------------------------------------------------------------- function shoutCommand(command, params, client) { + if(areParamsEmpty(params)) { + messageClientSyntax(client, getCommandSyntaxText(command)); + return false; + } + shoutToNearbyPlayers(client, params); return true; } @@ -38,6 +53,11 @@ function shoutCommand(command, params, client) { // --------------------------------------------------------------------------- function talkCommand(command, params, client) { + if(areParamsEmpty(params)) { + messageClientSyntax(client, getCommandSyntaxText(command)); + return false; + } + talkToNearbyPlayers(client, params); return true; } @@ -45,12 +65,39 @@ function talkCommand(command, params, client) { // --------------------------------------------------------------------------- function whisperCommand(command, params, client) { + if(areParamsEmpty(params)) { + messageClientSyntax(client, getCommandSyntaxText(command)); + return false; + } + whisperToNearbyPlayers(client, params); return true; } // --------------------------------------------------------------------------- +function adminChatCommand(command, params, client) { + if(areParamsEmpty(params)) { + messageClientSyntax(client, getCommandSyntaxText(command)); + return false; + } + + messageAdmins(`[#FFFF00][Admin Chat] [#AAAAAA]${client.name} [#CCCCCC](${getPlayerStaffTitle(client)}) [#FFFFFF]:${params}`); +} + +// --------------------------------------------------------------------------- + +function clanChatCommand(command, params, client) { + if(areParamsEmpty(params)) { + messageClientSyntax(client, getCommandSyntaxText(command)); + return false; + } + + clanChat(client, params); +} + +// --------------------------------------------------------------------------- + function talkToNearbyPlayers(client, messageText) { let clients = getClientsInRange(client.player.position, getGlobalConfig().talkDistance); for(let i in clients) {