* Set client log level to info * Added element prop sync util * Added check to make sure veh upgrade was valid * Fixed incorrect acct settings being saved * Added help tip when using invalid anim * Fixed create biz cmd * Allow biz owners to set biz name * Allow biz owners to give biz to player or clan * Added biz clan rank cmd * Allow those with permission to lock/unlock biz & houses * Fix set biz interior * Allow players with permission to withdraw from biz till * Added utils to check if player has biz permissions for till/lock/lights * Added check if players are in same int/vw on talk/shout/whisper * Follow server civilians cvar when toggling ambience * Renamed some clan cmds to prefix with "clan" * Added vehlivery cmd * Set server log level to debug * Show veh owner info on enter * Sync body parts & props on IV * Add clan help in help cmd * Don't show values for melee weapons * Add IV support for some utils * Sync player ped fight style in SA * Added fightstyle cmd * Fix wrong job owner on vehinfo cmd * Return false on world label support util for IV
212 lines
6.9 KiB
JavaScript
212 lines
6.9 KiB
JavaScript
// ===========================================================================
|
|
// Vortrex's Roleplay Resource
|
|
// https://github.com/VortrexFTW/gtac_roleplay
|
|
// ===========================================================================
|
|
// FILE: chat.js
|
|
// DESC: Provides chat functions and usage
|
|
// TYPE: Server (JavaScript)
|
|
// ===========================================================================
|
|
|
|
function initChatScript() {
|
|
logToConsole(LOG_INFO, "[VRR.Chat]: Initializing chat script ...");
|
|
logToConsole(LOG_INFO, "[VRR.Chat]: Chat script initialized successfully!");
|
|
return true;
|
|
}
|
|
|
|
// ===========================================================================
|
|
|
|
function meActionCommand(command, params, client) {
|
|
if(areParamsEmpty(params)) {
|
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
|
return false;
|
|
}
|
|
|
|
meActionToNearbyPlayers(client, params);
|
|
return true;
|
|
}
|
|
|
|
// ===========================================================================
|
|
|
|
function doActionCommand(command, params, client) {
|
|
if(isPlayerMuted(client)) {
|
|
messagePlayerError(client, "You are muted and can't chat!");
|
|
return false;
|
|
}
|
|
|
|
if(areParamsEmpty(params)) {
|
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
|
return false;
|
|
}
|
|
|
|
doActionToNearbyPlayers(client, params);
|
|
return true;
|
|
}
|
|
|
|
// ===========================================================================
|
|
|
|
function shoutCommand(command, params, client) {
|
|
if(isPlayerMuted(client)) {
|
|
messagePlayerError(client, "You are muted and can't chat!");
|
|
return false;
|
|
}
|
|
|
|
if(areParamsEmpty(params)) {
|
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
|
return false;
|
|
}
|
|
|
|
shoutToNearbyPlayers(client, params);
|
|
return true;
|
|
}
|
|
|
|
// ===========================================================================
|
|
|
|
function talkCommand(command, params, client) {
|
|
if(isPlayerMuted(client)) {
|
|
messagePlayerError(client, "You are muted and can't chat!");
|
|
return false;
|
|
}
|
|
|
|
if(areParamsEmpty(params)) {
|
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
|
return false;
|
|
}
|
|
|
|
talkToNearbyPlayers(client, params);
|
|
return true;
|
|
}
|
|
|
|
// ===========================================================================
|
|
|
|
function whisperCommand(command, params, client) {
|
|
if(isPlayerMuted(client)) {
|
|
messagePlayerError(client, "You are muted and can't chat!");
|
|
return false;
|
|
}
|
|
|
|
if(areParamsEmpty(params)) {
|
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
|
return false;
|
|
}
|
|
|
|
whisperToNearbyPlayers(client, params);
|
|
return true;
|
|
}
|
|
|
|
// ===========================================================================
|
|
|
|
function adminChatCommand(command, params, client) {
|
|
if(isPlayerMuted(client)) {
|
|
messagePlayerError(client, "You are muted and can't chat!");
|
|
return false;
|
|
}
|
|
|
|
if(areParamsEmpty(params)) {
|
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
|
return false;
|
|
}
|
|
|
|
messageAdmins(`${getInlineChatColourByType("jobYellow")}[Admin Chat] ${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} [#CCCCCC](${getPlayerStaffTitle(client)})${getInlineChatColourByName("white")}: ${params}`);
|
|
}
|
|
|
|
// ===========================================================================
|
|
|
|
function clanChatCommand(command, params, client) {
|
|
if(isPlayerMuted(client)) {
|
|
messagePlayerError(client, "You are muted and can't chat!");
|
|
return false;
|
|
}
|
|
|
|
if(areParamsEmpty(params)) {
|
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
|
return false;
|
|
}
|
|
|
|
clanChat(client, params);
|
|
}
|
|
|
|
// ===========================================================================
|
|
|
|
function talkToNearbyPlayers(client, messageText) {
|
|
let clients = getClientsInRange(getPlayerPosition(client), getGlobalConfig().talkDistance);
|
|
for(let i in clients) {
|
|
if(getPlayerInterior(client) == getPlayerInterior(clients[i] && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
|
|
messagePlayerTalk(clients[i], client, messageText);
|
|
}
|
|
}
|
|
}
|
|
|
|
// ===========================================================================
|
|
|
|
function phoneOutgoingToNearbyPlayers(client, messageText) {
|
|
let clients = getClientsInRange(getPlayerPosition(client), getGlobalConfig().talkDistance);
|
|
for(let i in clients) {
|
|
messagePlayerNormal(`[#CCCCCC]${getCharacterFullName(client)} ${getInlineChatColourByName("lightGrey")}(to phone): ${getInlineChatColourByName("white")}${messageText}`);
|
|
}
|
|
}
|
|
|
|
// ===========================================================================
|
|
|
|
function phoneIncomingToNearbyPlayers(client, messageText) {
|
|
let clients = getClientsInRange(getPlayerPosition(client), getGlobalConfig().radioSpeakerDistance);
|
|
for(let i in clients) {
|
|
messagePlayerNormal(`[#CCCCCC]${getCharacterFullName(client)} ${getInlineChatColourByName("lightGrey")}(from phone): ${getInlineChatColourByName("white")}${messageText}`);
|
|
}
|
|
}
|
|
|
|
// ===========================================================================
|
|
|
|
function whisperToNearbyPlayers(client, messageText) {
|
|
let clients = getClientsInRange(getPlayerPosition(client), getGlobalConfig().talkDistance);
|
|
for(let i in clients) {
|
|
if(getPlayerInterior(client) == getPlayerInterior(clients[i] && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
|
|
messagePlayerWhisper(clients[i], client, messageText);
|
|
}
|
|
}
|
|
}
|
|
|
|
// ===========================================================================
|
|
|
|
function shoutToNearbyPlayers(client, messageText) {
|
|
let clients = getClientsInRange(getPlayerPosition(client), getGlobalConfig().shoutDistance);
|
|
for(let i in clients) {
|
|
if(getPlayerInterior(client) == getPlayerInterior(clients[i] && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
|
|
messagePlayerShout(clients[i], client, messageText);
|
|
}
|
|
}
|
|
}
|
|
|
|
// ===========================================================================
|
|
|
|
function doActionToNearbyPlayers(client, messageText) {
|
|
let clients = getClientsInRange(getPlayerPosition(client), getGlobalConfig().doActionDistance);
|
|
for(let i in clients) {
|
|
if(getPlayerInterior(client) == getPlayerInterior(clients[i] && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
|
|
messagePlayerDoAction(clients[i], client, messageText);
|
|
}
|
|
}
|
|
}
|
|
|
|
// ===========================================================================
|
|
|
|
function meActionToNearbyPlayers(client, messageText) {
|
|
let clients = getClientsInRange(getPlayerPosition(client), getGlobalConfig().meActionDistance);
|
|
for(let i in clients) {
|
|
if(getPlayerInterior(client) == getPlayerInterior(clients[i] && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
|
|
messagePlayerMeAction(clients[i], client, messageText);
|
|
}
|
|
}
|
|
}
|
|
|
|
// ===========================================================================
|
|
|
|
function clanChat(client, messageText) {
|
|
let clients = getClients();
|
|
for(let i in clients) {
|
|
if(arePlayersInSameClan(client, clients[i])) {
|
|
messagePlayerClanChat(clients[i], client, messageText);
|
|
}
|
|
}
|
|
}
|
|
|
|
// ===========================================================================
|