Add param check to chat cmds

This commit is contained in:
Vortrex
2020-12-27 21:25:01 -06:00
parent 13defbeb63
commit 9dabdc9fc3

View File

@@ -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) {