Fix megaphone cmd

This commit is contained in:
Vortrex
2022-02-13 19:33:28 -06:00
parent 279e763bfe
commit 9aab697287

View File

@@ -13,6 +13,43 @@ function initChatScript() {
return true;
}
function processPlayerChat(client, messageText) {
if(!getPlayerData(client)) {
messagePlayerError(client, "You need to login before you can chat!");
return false;
}
if(!isPlayerLoggedIn(client)) {
messagePlayerError(client, "You need to login before you can chat!");
return false;
}
if(!isPlayerSpawned(client)) {
messagePlayerError(client, "You need to spawn before you can chat!");
return false;
}
if(isPlayerMuted(client)) {
messagePlayerError(client, "You are muted and can't chat!");
return false;
}
messageText = messageText.substring(0, 128);
/*
let clients = getClients();
for(let i in clients) {
let translatedText;
translatedText = await translateMessage(messageText, getPlayerData(client).locale, getPlayerData(clients[i]).locale);
let original = (getPlayerData(client).locale == getPlayerData(clients[i]).locale) ? `` : ` {ALTCOLOUR}(${messageText})`;
messagePlayerNormal(clients[i], `💬 ${getCharacterFullName(client)}: [#FFFFFF]${translatedText}${original}`, clients[i], getColourByName("mediumGrey"));
}
*/
messagePlayerNormal(null, `💬 ${getCharacterFullName(client)}: ${messageText}`);
messageDiscordChatChannel(`💬 ${getCharacterFullName(client)}: ${messageText}`);
}
// ===========================================================================
function meActionCommand(command, params, client) {
@@ -214,12 +251,12 @@ function shoutToNearbyPlayers(client, messageText) {
// ===========================================================================
function megaphoneToNearbyPlayers(client, messageText) {
function megaPhoneToNearbyPlayers(client, messageText) {
let clients = getClients();
for(let i in clients) {
if(isPlayerSpawned(clients[i])) {
if(hasBitFlag(getPlayerData(clients[i]).accountData.flags.moderation, getModerationFlagValue("CanHearEverything")) || (getDistance(getPlayerPosition(client), getPlayerPosition(clients[i])) <= getGlobalConfig().megaphoneDistance && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
messagePlayerShout(clients[i], client, messageText);
messagePlayerMegaPhone(clients[i], client, messageText);
}
}
}