Merge branch 'nightly' into organizing
This commit is contained in:
@@ -16,23 +16,23 @@ function initChatScript() {
|
||||
// ===========================================================================
|
||||
|
||||
function processPlayerChat(client, messageText) {
|
||||
if(!isConsole(client)) {
|
||||
if(!getPlayerData(client)) {
|
||||
if (!isConsole(client)) {
|
||||
if (!getPlayerData(client)) {
|
||||
messagePlayerError(client, getLocaleString(client, "MustBeLoggedInAndSpawnedToChat"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!isPlayerLoggedIn(client)) {
|
||||
if (!isPlayerLoggedIn(client)) {
|
||||
messagePlayerError(client, getLocaleString(client, "MustBeLoggedInAndSpawnedToChat"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!isPlayerSpawned(client)) {
|
||||
if (!isPlayerSpawned(client)) {
|
||||
messagePlayerError(client, getLocaleString(client, "MustBeLoggedInAndSpawnedToChat"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(isPlayerMuted(client)) {
|
||||
if (isPlayerMuted(client)) {
|
||||
messagePlayerError(client, getLocaleString(client, "MutedCantChat"));
|
||||
return false;
|
||||
}
|
||||
@@ -61,7 +61,7 @@ function processPlayerChat(client, messageText) {
|
||||
// ===========================================================================
|
||||
|
||||
function meActionCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
if (areParamsEmpty(params)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
@@ -73,12 +73,12 @@ function meActionCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function doActionCommand(command, params, client) {
|
||||
if(isPlayerMuted(client)) {
|
||||
if (isPlayerMuted(client)) {
|
||||
messagePlayerError(client, getLocaleString(client, "MutedCantChat"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(areParamsEmpty(params)) {
|
||||
if (areParamsEmpty(params)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
@@ -90,12 +90,12 @@ function doActionCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function shoutCommand(command, params, client) {
|
||||
if(isPlayerMuted(client)) {
|
||||
if (isPlayerMuted(client)) {
|
||||
messagePlayerError(client, getLocaleString(client, "MutedCantChat"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(areParamsEmpty(params)) {
|
||||
if (areParamsEmpty(params)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
@@ -107,17 +107,17 @@ function shoutCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function megaphoneChatCommand(command, params, client) {
|
||||
if(isPlayerMuted(client)) {
|
||||
if (isPlayerMuted(client)) {
|
||||
messagePlayerError(client, getLocaleString(client, "MutedCantChat"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(areParamsEmpty(params)) {
|
||||
if (areParamsEmpty(params)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!canPlayerUseMegaphone(client)) {
|
||||
if (!canPlayerUseMegaphone(client)) {
|
||||
messagePlayerError(client, getLocaleString(client, "CantUseMegaphone"));
|
||||
return false;
|
||||
}
|
||||
@@ -129,12 +129,12 @@ function megaphoneChatCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function talkCommand(command, params, client) {
|
||||
if(isPlayerMuted(client)) {
|
||||
if (isPlayerMuted(client)) {
|
||||
messagePlayerError(client, getLocaleString(client, "MutedCantChat"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(areParamsEmpty(params)) {
|
||||
if (areParamsEmpty(params)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
@@ -146,12 +146,12 @@ function talkCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function whisperCommand(command, params, client) {
|
||||
if(isPlayerMuted(client)) {
|
||||
if (isPlayerMuted(client)) {
|
||||
messagePlayerError(client, getLocaleString(client, "MutedCantChat"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(areParamsEmpty(params)) {
|
||||
if (areParamsEmpty(params)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
@@ -163,12 +163,12 @@ function whisperCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function adminChatCommand(command, params, client) {
|
||||
if(isPlayerMuted(client)) {
|
||||
if (isPlayerMuted(client)) {
|
||||
messagePlayerError(client, getLocaleString(client, "MutedCantChat"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(areParamsEmpty(params)) {
|
||||
if (areParamsEmpty(params)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
@@ -179,12 +179,12 @@ function adminChatCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function clanChatCommand(command, params, client) {
|
||||
if(isPlayerMuted(client)) {
|
||||
if (isPlayerMuted(client)) {
|
||||
messagePlayerError(client, getLocaleString(client, "MutedCantChat"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(areParamsEmpty(params)) {
|
||||
if (areParamsEmpty(params)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
@@ -196,9 +196,9 @@ function clanChatCommand(command, params, client) {
|
||||
|
||||
function talkToNearbyPlayers(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().talkDistance && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
|
||||
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().talkDistance && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
|
||||
messagePlayerTalk(clients[i], client, messageText);
|
||||
}
|
||||
}
|
||||
@@ -209,9 +209,9 @@ function talkToNearbyPlayers(client, messageText) {
|
||||
|
||||
function phoneOutgoingToNearbyPlayers(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().talkDistance && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
|
||||
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().talkDistance && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
|
||||
messagePlayerNormal(`[#CCCCCC]${getCharacterFullName(client)} {ALTCOLOUR}(to phone): {MAINCOLOUR}${messageText}`);
|
||||
}
|
||||
}
|
||||
@@ -222,9 +222,9 @@ function phoneOutgoingToNearbyPlayers(client, messageText) {
|
||||
|
||||
function phoneIncomingToNearbyPlayers(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().phoneSpeakerDistance && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
|
||||
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().phoneSpeakerDistance && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
|
||||
messagePlayerNormal(`[#CCCCCC]${getCharacterFullName(client)} {ALTCOLOUR}(from phone): {MAINCOLOUR}${messageText}`);
|
||||
}
|
||||
}
|
||||
@@ -235,9 +235,9 @@ function phoneIncomingToNearbyPlayers(client, messageText) {
|
||||
|
||||
function whisperToNearbyPlayers(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().whisperDistance && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
|
||||
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().whisperDistance && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
|
||||
messagePlayerWhisper(clients[i], client, messageText);
|
||||
}
|
||||
}
|
||||
@@ -248,9 +248,9 @@ function whisperToNearbyPlayers(client, messageText) {
|
||||
|
||||
function shoutToNearbyPlayers(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().shoutDistance && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
|
||||
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().shoutDistance && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
|
||||
messagePlayerShout(clients[i], client, messageText);
|
||||
}
|
||||
}
|
||||
@@ -261,9 +261,9 @@ function shoutToNearbyPlayers(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]))) {
|
||||
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]))) {
|
||||
messagePlayerMegaPhone(clients[i], client, messageText);
|
||||
}
|
||||
}
|
||||
@@ -274,35 +274,37 @@ function megaPhoneToNearbyPlayers(client, messageText) {
|
||||
|
||||
function doActionToNearbyPlayers(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().doActionDistance && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
|
||||
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().doActionDistance && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
|
||||
messagePlayerDoAction(clients[i], client, messageText);
|
||||
}
|
||||
}
|
||||
}
|
||||
messageDiscordChatChannel(`🙋 *${messageText} (${getCharacterFullName(client)})*`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function meActionToNearbyPlayers(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().meActionDistance && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
|
||||
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().meActionDistance && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
|
||||
messagePlayerMeAction(clients[i], client, messageText);
|
||||
}
|
||||
}
|
||||
}
|
||||
messageDiscordChatChannel(`🙋 *${getCharacterFullName(client)} ${messageText}*`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function clanChat(client, messageText) {
|
||||
let clients = getClients();
|
||||
for(let i in clients) {
|
||||
if(isPlayerSpawned(clients[i])) {
|
||||
if(hasBitFlag(getPlayerData(clients[i]).accountData.flags.moderation, getModerationFlagValue("CanHearEverything")) || arePlayersInSameClan(client, clients[i])) {
|
||||
for (let i in clients) {
|
||||
if (isPlayerSpawned(clients[i])) {
|
||||
if (hasBitFlag(getPlayerData(clients[i]).accountData.flags.moderation, getModerationFlagValue("CanHearEverything")) || arePlayersInSameClan(client, clients[i])) {
|
||||
messagePlayerClanChat(clients[i], client, messageText);
|
||||
}
|
||||
}
|
||||
@@ -312,14 +314,14 @@ function clanChat(client, messageText) {
|
||||
// ===========================================================================
|
||||
|
||||
function canPlayerUseMegaphone(client) {
|
||||
if(getPlayerFirstItemSlotByUseType(client, VRR_ITEM_USETYPE_MEGAPHONE) != -1) {
|
||||
if(isPlayerActiveItemEnabled(client)) {
|
||||
if (getPlayerFirstItemSlotByUseType(client, VRR_ITEM_USETYPE_MEGAPHONE) != -1) {
|
||||
if (isPlayerActiveItemEnabled(client)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if(getPlayerVehicle(client)) {
|
||||
if(doesVehicleHaveMegaphone(getPlayerVehicle(client))) {
|
||||
if (getPlayerVehicle(client)) {
|
||||
if (doesVehicleHaveMegaphone(getPlayerVehicle(client))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,6 +216,7 @@ let globalConfig = {
|
||||
passwordRequiredSymbols: 0,
|
||||
minChatLines: 1,
|
||||
maxChatLines: 6,
|
||||
vehicleTrunkDistance: 2.0,
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -172,12 +172,12 @@ function onPedEnteringVehicle(event, ped, vehicle, seat) {
|
||||
if (getVehicleData(vehicle).locked) {
|
||||
if (doesPlayerHaveVehicleKeys(client, vehicle)) {
|
||||
if (!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "lock")) {
|
||||
messagePlayerTip(client, `🔒 This ${getVehicleName(vehicle)} is locked. Press {ALTCOLOUR}${toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "lock").key))} {MAINCOLOUR}to unlock it.`);
|
||||
messagePlayerTip(client, getLocaleString(client, "VehicleLockedCommandTip", `{vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR}`, `{ALTCOLOUR}${toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "lock").key))}{MAINCOLOUR}`));
|
||||
} else {
|
||||
messagePlayerNormal(client, `🔒 This ${getVehicleName(vehicle)} is locked. Use /lock to unlock it`);
|
||||
messagePlayerTip(client, getLocaleString(client, "VehicleLockedCommandTip", `{vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR}`, `{ALTCOLOUR}/lock{MAINCOLOUR}`));
|
||||
}
|
||||
} else {
|
||||
messagePlayerNormal(client, `🔒 This ${getVehicleName(vehicle)} is locked and you don't have the keys to unlock it`);
|
||||
messagePlayerNormal(client, messagePlayerTip(client, getLocaleString(client, "VehicleLockedCantUnlock", `{vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR}`)));
|
||||
}
|
||||
|
||||
//getPlayerData(client).enteringVehicle = null;
|
||||
@@ -287,38 +287,38 @@ async function onPlayerEnteredVehicle(client, clientVehicle, seat) {
|
||||
messagePlayerAlert(client, getLocaleString(client, "VehicleForRent", getVehicleName(vehicle), `{ALTCOLOUR}$${makeLargeNumberReadable(getVehicleData(vehicle).rentPrice)}{MAINCOLOUR}`, `{ALTCOLOUR}/vehrent{MAINCOLOUR}`));
|
||||
resetVehiclePosition(vehicle);
|
||||
} else {
|
||||
messagePlayerAlert(client, `You are renting this ${getVehicleName(vehicle)} for {ALTCOLOUR}$${makeLargeNumberReadable(getVehicleData(vehicle).rentPrice)} per minute. {MAINCOLOUR}Use {ALTCOLOUR}/stoprent {MAINCOLOUR}if you want to stop renting it.`);
|
||||
messagePlayerAlert(client, getLocaleString(client, "CurrentlyRentingThisVehicle", `{vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR}`, `{ALTCOLOUR}$${makeLargeNumberReadable(getVehicleData(vehicle).rentPrice)}`, `{ALTCOLOUR}/stoprent{MAINCOLOUR}`));
|
||||
}
|
||||
} else {
|
||||
let ownerName = "Nobody";
|
||||
let ownerType = "None";
|
||||
let ownerType = getLocaleString(client, "NotOwned");
|
||||
ownerType = toLowerCase(getVehicleOwnerTypeText(getVehicleData(vehicle).ownerType));
|
||||
switch (getVehicleData(vehicle).ownerType) {
|
||||
case VRR_VEHOWNER_CLAN:
|
||||
ownerName = getClanData(getClanIdFromDatabaseId(getVehicleData(vehicle).ownerId)).name;
|
||||
ownerType = "clan";
|
||||
ownerType = getLocaleString(client, "Clan");
|
||||
break;
|
||||
|
||||
case VRR_VEHOWNER_JOB:
|
||||
ownerName = getJobData(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)).name;
|
||||
ownerType = "job";
|
||||
ownerType = getLocaleString(client, "Job");
|
||||
break;
|
||||
|
||||
case VRR_VEHOWNER_PLAYER:
|
||||
let subAccountData = loadSubAccountFromId(getVehicleData(vehicle).ownerId);
|
||||
ownerName = `${subAccountData.firstName} ${subAccountData.lastName}`;
|
||||
ownerType = "player";
|
||||
ownerType = getLocaleString(client, "Player");
|
||||
break;
|
||||
|
||||
case VRR_VEHOWNER_BIZ:
|
||||
ownerName = getBusinessData(getVehicleData(vehicle).ownerId).name;
|
||||
ownerType = "business";
|
||||
ownerType = getLocaleString(client, "Business");
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
messagePlayerAlert(client, `This ${getVehicleName(vehicle)} belongs to {ALTCOLOUR}${ownerName} (${ownerType})`);
|
||||
messagePlayerAlert(client, getLocaleString(client, "VehicleBelongsTo", `{vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR}`, `{ALTCOLOUR}${ownerName}{MAINCOLOUR}`, `{ALTCOLOUR}${ownerType}{MAINCOLOUR}`));
|
||||
}
|
||||
|
||||
if (!getVehicleData(vehicle).engine) {
|
||||
@@ -513,12 +513,6 @@ async function onPlayerSpawn(client) {
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player data is valid. Continuing spawn processing ...`);
|
||||
|
||||
if (getGame() == VRR_GAME_GTA_IV) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped body parts and props`);
|
||||
setEntityData(getPlayerPed(client), "vrr.bodyParts", getPlayerCurrentSubAccount(client).bodyParts, true);
|
||||
setEntityData(getPlayerPed(client), "vrr.bodyProps", getPlayerCurrentSubAccount(client).bodyProps, true);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped scale (${getPlayerCurrentSubAccount(client).pedScale})`);
|
||||
setEntityData(getPlayerPed(client), "vrr.scale", getPlayerCurrentSubAccount(client).pedScale, true);
|
||||
|
||||
@@ -527,7 +521,7 @@ async function onPlayerSpawn(client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isCustomCameraSupported()) {
|
||||
if (isCustomCameraSupported() && getGame() != VRR_GAME_GTA_IV && getGame() != VRR_GAME_GTA_IV_EFLC) {
|
||||
restorePlayerCamera(client);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,14 +48,12 @@ let randomTips = [
|
||||
// ===========================================================================
|
||||
|
||||
function helpCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
if (areParamsEmpty(params)) {
|
||||
showMainHelpMessage(client);
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
|
||||
switch(toLowerCase(getParam(params, " ", 1))) {
|
||||
switch (toLowerCase(getParam(params, " ", 1))) {
|
||||
case "account":
|
||||
showAccountHelpMessage(client);
|
||||
break;
|
||||
@@ -328,7 +326,7 @@ function showRadioHelpMessage(client) {
|
||||
|
||||
function showWealthAndTaxHelpMessage(client) {
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderWealthandTaxHelp")));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "WealthAndTaxHelp", 0, `{ALTCOLOUR}${100*getGlobalConfig().economy.incomeTaxRate}%{MAINCOLOUR}`));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "WealthAndTaxHelp", 0, `{ALTCOLOUR}${100 * getGlobalConfig().economy.incomeTaxRate}%{MAINCOLOUR}`));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "WealthAndTaxHelp", 1));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "WealthAndTaxHelp", 2, `{ALTCOLOUR}${getGlobalConfig().economy.upKeepCosts.upKeepPerVehicle}{MAINCOLOUR}`, `{ALTCOLOUR}${getGlobalConfig().economy.upKeepCosts.upKeepPerHouse}{MAINCOLOUR}`, `{ALTCOLOUR}${getGlobalConfig().economy.upKeepCosts.upKeepPerBusiness}{MAINCOLOUR}`));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "WealthAndTaxHelp", 3, `{ALTCOLOUR}/wealth{MAINCOLOUR}`, `{ALTCOLOUR}/tax{MAINCOLOUR}`));
|
||||
@@ -337,7 +335,7 @@ function showWealthAndTaxHelpMessage(client) {
|
||||
// ===========================================================================
|
||||
|
||||
function showCommandHelpMessage(client, commandName) {
|
||||
if(!commandName) {
|
||||
if (!commandName) {
|
||||
messagePlayerSyntax(client, `${getCommandSyntaxText("help")}command <command name>`);
|
||||
return false;
|
||||
}
|
||||
@@ -345,7 +343,7 @@ function showCommandHelpMessage(client, commandName) {
|
||||
commandName = toLowerCase(commandName);
|
||||
commandName = commandName.trim();
|
||||
|
||||
if(commandName.slice(0, 1) == "/") {
|
||||
if (commandName.slice(0, 1) == "/") {
|
||||
commandName = commandName.slice(1);
|
||||
}
|
||||
|
||||
@@ -355,7 +353,7 @@ function showCommandHelpMessage(client, commandName) {
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderCommandInfo", commandName)));
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Description: ${command.helpDescription}`);
|
||||
|
||||
if(aliases.length > 0) {
|
||||
if (aliases.length > 0) {
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Aliases: ${aliases.join(", ")}`);
|
||||
} else {
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Aliases: (None)`);
|
||||
@@ -394,7 +392,7 @@ function helpGetCarCommand(command, params, client) {
|
||||
* @return {bool} Whether or not the command was successful
|
||||
*
|
||||
*/
|
||||
function helpGetSkinCommand(command, params, client) {
|
||||
function helpGetSkinCommand(command, params, client) {
|
||||
messagePlayerAlert(client, getLocaleString(client, "SkinCommandHelp", `{ALTCOLOUR}/info skin{MAINCOLOUR}`));
|
||||
messagePlayerAlert(client, ``);
|
||||
}
|
||||
|
||||
@@ -328,8 +328,6 @@ function createGroundItemObject(itemId) {
|
||||
//setEntityData(getItemData(itemId).object, "vrr.scale", getItemTypeData(getItemData(itemId).itemTypeIndex).dropScale, true);
|
||||
addToWorld(getItemData(itemId).object);
|
||||
}
|
||||
|
||||
getServerData().groundItemCache.push(itemId);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -519,26 +517,26 @@ function pickupItemCommand(command, params, client) {
|
||||
|
||||
if (!getItemData(itemId)) {
|
||||
//messagePlayerError(client, `The item you're trying to pick up is bugged. A bug report has been sent to the server developers.`);
|
||||
messagePlayerError(client, getPlayerLocale(client, "NoItemCloseEnough"));
|
||||
messagePlayerError(client, getLocaleString(client, "NoItemCloseEnough"));
|
||||
submitBugReport(client, `(AUTOMATED REPORT) Pickup Item: Getting item data for item ${itemId} on ground returned false.`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!getItemTypeData(getItemData(itemId).itemTypeIndex)) {
|
||||
//messagePlayerError(client, `The item you're trying to pick up is bugged. A bug report has been sent to the server developers.`);
|
||||
messagePlayerError(client, getPlayerLocale(client, "NoItemCloseEnough"));
|
||||
messagePlayerError(client, getLocaleString(client, "NoItemCloseEnough"));
|
||||
submitBugReport(client, `(AUTOMATED REPORT) Pickup Item: Getting item type ${getItemData(itemId).itemType} data for item ${itemId}/${getItemData(itemId).databaseId} on ground returned false.`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (getDistance(getPlayerPosition(client), getItemData(itemId).position) > getGlobalConfig().droppedItemPickupRange) {
|
||||
messagePlayerError(client, getPlayerLocale(client, "NoItemCloseEnough"));
|
||||
messagePlayerError(client, getLocaleString(client, "NoItemCloseEnough"));
|
||||
return false;
|
||||
}
|
||||
|
||||
let firstSlot = getPlayerFirstEmptyHotBarSlot(client);
|
||||
if (firstSlot == -1) {
|
||||
messagePlayerError(client, getPlayerLocale(client, "NoSpaceSelfInventory"));
|
||||
messagePlayerError(client, getLocaleString(client, "NoSpaceSelfInventory"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -682,8 +680,8 @@ function putItemCommand(command, params, client) {
|
||||
forcePlayerPlayAnimation(client, getItemTypeData(getItemData(itemId).itemTypeIndex).putAnimationIndex, 0.0);
|
||||
}
|
||||
|
||||
getPlayerData(client).itemActionItem = hotBarSlot;
|
||||
getPlayerData(client).itemActionState = VRR_ITEM_ACTION_PUT;
|
||||
getPlayerData(client).itemActionItem = hotBarSlot;
|
||||
showPlayerItemPutDelay(client, hotBarSlot);
|
||||
|
||||
//clearPlayerItemActionStateAfterDelay(client, getGlobalConfig().itemActionStateReset);
|
||||
@@ -1013,7 +1011,7 @@ function playerUseItem(client, hotBarSlot) {
|
||||
case VRR_ITEM_USETYPE_FOOD: {
|
||||
meActionToNearbyPlayers(client, `eats some of their ${itemTypeData.name}`);
|
||||
givePlayerHealth(client, itemTypeData.useValue);
|
||||
itemData.value = itemData.value - tempItemTypeData.useValue;
|
||||
itemData.value = itemData.value - itemTypeData.useValue;
|
||||
if (getItemData(itemIndex).value <= 0) {
|
||||
deleteItem(itemIndex);
|
||||
switchPlayerActiveHotBarSlot(client, -1);
|
||||
@@ -1338,10 +1336,12 @@ function playerDropItem(client, hotBarSlot) {
|
||||
|
||||
getItemData(itemId).ownerType = VRR_ITEM_OWNER_GROUND;
|
||||
getItemData(itemId).ownerId = 0;
|
||||
getItemData(itemId).position = getPlayerPosition(client);
|
||||
getItemData(itemId).position = getPosInFrontOfPos(getPlayerPosition(client), getPlayerHeading(client), getItemTypeData(getItemData(itemId).itemTypeIndex).dropFrontDistance);
|
||||
getItemData(itemId).dimension = getPlayerDimension(client);
|
||||
//getItemData(itemId).interior = getPlayerInterior(client);
|
||||
createGroundItemObject(itemId);
|
||||
getItemData(itemId).needsSaved = true;
|
||||
getServerData().groundItemCache.push(itemId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1352,9 +1352,12 @@ function playerPutItem(client, hotBarSlot) {
|
||||
|
||||
let bestNewOwner = getBestNewOwnerToPutItem(client);
|
||||
|
||||
if (bestNewOwner[0] == VRR_ITEM_OWNER_NONE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
getItemData(itemId).ownerType = bestNewOwner[0];
|
||||
getItemData(itemId).ownerId = bestNewOwner[1];
|
||||
getItemData(itemId).position = toVector(0.0, 0.0, 0.0);
|
||||
getItemData(itemId).position = toVector3(0.0, 0.0, 0.0);
|
||||
getItemData(itemId).dimension = 0;
|
||||
getItemData(itemId).needsSaved = true;
|
||||
|
||||
@@ -1366,19 +1369,33 @@ function playerPutItem(client, hotBarSlot) {
|
||||
|
||||
switch (bestNewOwner[0]) {
|
||||
case VRR_ITEM_OWNER_HOUSE:
|
||||
meActionToNearbyPlayers(client, `places ${getProperDeterminerForName(getItemName(itemId))} ${getItemName(itemId)} in the house`);
|
||||
getItemData(itemId).ownerId = getHouseData(bestNewOwner[1]).databaseId;
|
||||
meActionToNearbyPlayers(client, `puts ${getProperDeterminerForName(getItemName(itemId))} ${getItemName(itemId)} in the house`);
|
||||
break;
|
||||
|
||||
case VRR_ITEM_OWNER_BIZFLOOR:
|
||||
meActionToNearbyPlayers(client, `places ${getProperDeterminerForName(getItemName(itemId))} ${getItemName(itemId)} for sale in the business`);
|
||||
getItemData(itemId).ownerId = getBusinessData(bestNewOwner[1]).databaseId;
|
||||
meActionToNearbyPlayers(client, `puts ${getProperDeterminerForName(getItemName(itemId))} ${getItemName(itemId)} for sale in the business`);
|
||||
break;
|
||||
|
||||
case VRR_ITEM_OWNER_BIZSTORAGE:
|
||||
meActionToNearbyPlayers(client, `places ${getProperDeterminerForName(getItemName(itemId))} ${getItemName(itemId)} in the business storage room`);
|
||||
getItemData(itemId).ownerId = getBusinessData(bestNewOwner[1]).databaseId;
|
||||
meActionToNearbyPlayers(client, `puts ${getProperDeterminerForName(getItemName(itemId))} ${getItemName(itemId)} in the business storage room`);
|
||||
break;
|
||||
|
||||
case VRR_ITEM_OWNER_VEHTRUNK:
|
||||
meActionToNearbyPlayers(client, `places ${getProperDeterminerForName(getItemName(itemId))} ${getItemName(itemId)} in the ${getVehicleName(getVehicleFromDatabaseId(bestNewOwner[1]))}'s trunk`);
|
||||
getItemData(itemId).ownerId = getVehicleData(bestNewOwner[1]).databaseId;
|
||||
meActionToNearbyPlayers(client, `puts ${getProperDeterminerForName(getItemName(itemId))} ${getItemName(itemId)} in the ${getVehicleName(getVehicleFromDatabaseId(bestNewOwner[1]))}'s trunk`);
|
||||
break;
|
||||
|
||||
case VRR_ITEM_OWNER_VEHDASH:
|
||||
getItemData(itemId).ownerId = getVehicleData(bestNewOwner[1]).databaseId;
|
||||
meActionToNearbyPlayers(client, `puts ${getProperDeterminerForName(getItemName(itemId))} ${getItemName(itemId)} in the ${getVehicleName(getVehicleFromDatabaseId(bestNewOwner[1]))}'s dash compartment`);
|
||||
break;
|
||||
|
||||
case VRR_ITEM_OWNER_ITEM:
|
||||
getItemData(itemId).ownerId = getItemData(bestNewOwner[1]).databaseId;
|
||||
meActionToNearbyPlayers(client, `puts ${getProperDeterminerForName(getItemName(itemId))} ${getItemName(itemId)} in the ${getItemName(bestNewOwner[1])}`);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1587,15 +1604,19 @@ function playerSwitchHotBarSlotCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function getClosestItemOnGround(position) {
|
||||
let items = getServerData().groundItemCache;
|
||||
let closest = 0;
|
||||
for (let i in items) {
|
||||
if (getDistance(getItemData(items[i]).position, position) <= getDistance(getItemData(items[closest]).position, position)) {
|
||||
closest = i;
|
||||
let groundItems = getServerData().groundItemCache;
|
||||
if (groundItems.length != 0) {
|
||||
let closest = 0;
|
||||
for (let i in groundItems) {
|
||||
if (getDistance(getItemData(groundItems[i]).position, position) <= getDistance(getItemData(groundItems[closest]).position, position)) {
|
||||
closest = i;
|
||||
}
|
||||
}
|
||||
|
||||
return groundItems[closest];
|
||||
}
|
||||
|
||||
return items[closest];
|
||||
return -1;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1768,22 +1789,34 @@ function deleteItem(itemId, whoDeleted = -1) {
|
||||
// ===========================================================================
|
||||
|
||||
function getBestNewOwnerToPutItem(client) {
|
||||
let closestDistance = 100.0;
|
||||
let position = getPlayerPosition(client);
|
||||
|
||||
let possibleHouse = getPlayerHouse(client);
|
||||
if (getHouseData(possibleHouse)) {
|
||||
return [VRR_ITEM_OWNER_HOUSE, possibleHouse];
|
||||
if (possibleHouse != -1) {
|
||||
if (getHouseData(possibleHouse) != false) {
|
||||
return [VRR_ITEM_OWNER_HOUSE, possibleHouse];
|
||||
}
|
||||
}
|
||||
|
||||
let possibleBusiness = getPlayerBusiness(client);
|
||||
if (getBusinessData(possibleBusiness)) {
|
||||
return [VRR_ITEM_OWNER_BIZSTORAGE, possibleBusiness];
|
||||
if (possibleBusiness != -1) {
|
||||
if (getBusinessData(possibleBusiness) != false) {
|
||||
return [VRR_ITEM_OWNER_BIZSTORAGE, possibleBusiness];
|
||||
}
|
||||
}
|
||||
|
||||
let possibleVehicle = getClosestVehicle(position);
|
||||
if (getDistance(getVehicleTrunkPosition(possibleVehicle), position) <= closestDistance) {
|
||||
return [VRR_ITEM_OWNER_VEHTRUNK, possibleVehicle];
|
||||
if (possibleVehicle != false) {
|
||||
if (getVehicleData(possibleVehicle) != false && getDistance(getVehicleTrunkPosition(possibleVehicle), position) <= getGlobalConfig().vehicleTrunkDistance) {
|
||||
return [VRR_ITEM_OWNER_VEHTRUNK, possibleVehicle];
|
||||
}
|
||||
}
|
||||
|
||||
let possibleItem = getClosestItemOnGround(position);
|
||||
if (possibleItem != -1) {
|
||||
if (getDistance(getItemPosition(possibleItem), position) <= getGlobalConfig().itemContainerDistance) {
|
||||
return [VRR_ITEM_OWNER_ITEM, possibleItem];
|
||||
}
|
||||
}
|
||||
|
||||
return [VRR_ITEM_OWNER_NONE, 0];
|
||||
@@ -2036,6 +2069,8 @@ function saveItemToDatabase(itemId) {
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[VRR.Item]: Saving item '${itemData.index}' to database ...`);
|
||||
|
||||
let position = getItemPosition(itemId);
|
||||
|
||||
let dbConnection = connectToDatabase();
|
||||
if (dbConnection) {
|
||||
let data = [
|
||||
@@ -2044,9 +2079,9 @@ function saveItemToDatabase(itemId) {
|
||||
["item_owner_type", itemData.ownerType],
|
||||
["item_owner_id", itemData.ownerId],
|
||||
["item_amount", itemData.amount],
|
||||
["item_pos_x", itemData.position.x],
|
||||
["item_pos_y", itemData.position.y],
|
||||
["item_pos_z", itemData.position.z],
|
||||
["item_pos_x", position.x],
|
||||
["item_pos_y", position.y],
|
||||
["item_pos_z", position.z],
|
||||
["item_int", itemData.interior],
|
||||
["item_vw", itemData.dimension],
|
||||
["item_buy_price", itemData.buyPrice],
|
||||
@@ -2115,6 +2150,7 @@ function saveItemTypeToDatabase(itemTypeId) {
|
||||
["item_type_drop_rot_x", itemTypeData.dropRotation.x],
|
||||
["item_type_drop_rot_y", itemTypeData.dropRotation.y],
|
||||
["item_type_drop_rot_z", itemTypeData.dropRotation.z],
|
||||
["item_type_drop_front_distance", itemTypeData.dropFrontDistance],
|
||||
["item_type_drop_scale_x", itemTypeData.dropScale.x],
|
||||
["item_type_drop_scale_y", itemTypeData.dropScale.y],
|
||||
["item_type_drop_scale_z", itemTypeData.dropScale.z],
|
||||
@@ -2577,7 +2613,7 @@ function showItemInventoryToPlayer(client, itemId) {
|
||||
}
|
||||
}
|
||||
|
||||
messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderItemItemsList")));
|
||||
messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderItemItemList", getItemName(itemId))));
|
||||
|
||||
let chunkedList = splitArrayIntoChunks(itemDisplay, 5);
|
||||
for (let i in chunkedList) {
|
||||
@@ -2724,4 +2760,15 @@ function getPlayerFirstAmmoItemForWeapon(client, weaponId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getItemPosition(itemId) {
|
||||
if (getItemData(itemId).ownerType == VRR_ITEM_OWNER_GROUND) {
|
||||
if (getItemData(itemId).object != null) {
|
||||
return getElementPosition(getItemData(itemId).object);
|
||||
}
|
||||
}
|
||||
return getItemData(itemId).position;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -16,14 +16,14 @@ function initLocaleScript() {
|
||||
|
||||
function getLocaleString(client, stringName, ...args) {
|
||||
let tempString = getRawLocaleString(stringName, getPlayerData(client).locale);
|
||||
if(tempString == "" || tempString == null || typeof tempString == "undefined") {
|
||||
if (tempString == "" || tempString == null || typeof tempString == "undefined") {
|
||||
logToConsole(LOG_WARN, `[VRR.Locale] Locale string missing for ${stringName} on language ${getLocaleData(getPlayerData(client).locale).englishName}`);
|
||||
submitBugReport(client, `(AUTOMATED REPORT) Locale string "${stringName}" is missing for "${getPlayerLocaleName(client)}"`);
|
||||
return "";
|
||||
}
|
||||
|
||||
for(let i = 1; i <= args.length; i++) {
|
||||
tempString = tempString.replace(`{${i}}`, args[i-1]);
|
||||
for (let i = 1; i <= args.length; i++) {
|
||||
tempString = tempString.replace(`{${i}}`, args[i - 1]);
|
||||
}
|
||||
|
||||
return tempString;
|
||||
@@ -33,13 +33,13 @@ function getLocaleString(client, stringName, ...args) {
|
||||
|
||||
function getLanguageLocaleString(localeId, stringName, ...args) {
|
||||
let tempString = getRawLocaleString(stringName, localeId);
|
||||
if(tempString == "" || tempString == null || typeof tempString == "undefined") {
|
||||
if (tempString == "" || tempString == null || typeof tempString == "undefined") {
|
||||
logToConsole(LOG_WARN, `[VRR.Locale] Locale string missing for ${stringName} on language ${getLocaleData(getPlayerData(client).locale).englishName}`);
|
||||
submitBugReport(client, `(AUTOMATED REPORT) Locale string "${stringName}" is missing for "${getPlayerLocaleName(client)}"`);
|
||||
}
|
||||
|
||||
for(let i = 1; i <= args.length; i++) {
|
||||
tempString = tempString.replace(`{${i}}`, args[i-1]);
|
||||
for (let i = 1; i <= args.length; i++) {
|
||||
tempString = tempString.replace(`{${i}}`, args[i - 1]);
|
||||
}
|
||||
|
||||
return tempString;
|
||||
@@ -50,8 +50,8 @@ function getLanguageLocaleString(localeId, stringName, ...args) {
|
||||
function getGroupedLocaleString(client, stringName, index, ...args) {
|
||||
let tempString = getRawGroupedLocaleString(stringName, getPlayerData(client).locale, index);
|
||||
|
||||
for(let i = 1; i <= args.length; i++) {
|
||||
tempString = tempString.replace(`{${i}}`, args[i-1]);
|
||||
for (let i = 1; i <= args.length; i++) {
|
||||
tempString = tempString.replace(`{${i}}`, args[i - 1]);
|
||||
}
|
||||
|
||||
return tempString;
|
||||
@@ -100,7 +100,7 @@ function loadAllLocaleStrings() {
|
||||
let tempLocaleStrings = {};
|
||||
|
||||
let locales = getGlobalConfig().locale.locales;
|
||||
for(let i in locales) {
|
||||
for (let i in locales) {
|
||||
let localeData = locales[i];
|
||||
let localeFile = JSON.parse(loadTextFile(`locale/${localeData.stringsFile}`));
|
||||
tempLocaleStrings[i] = localeFile;
|
||||
@@ -119,13 +119,13 @@ function getLocaleStrings() {
|
||||
|
||||
function getLocaleFromParams(params) {
|
||||
let locales = getLocales();
|
||||
if(isNaN(params)) {
|
||||
for(let i in locales) {
|
||||
if(toLowerCase(locales[i].isoCode).indexOf(toLowerCase(params)) != -1) {
|
||||
if (isNaN(params)) {
|
||||
for (let i in locales) {
|
||||
if (toLowerCase(locales[i].isoCode).indexOf(toLowerCase(params)) != -1) {
|
||||
return i;
|
||||
}
|
||||
|
||||
if(toLowerCase(locales[i].englishName).indexOf(toLowerCase(params)) != -1) {
|
||||
if (toLowerCase(locales[i].englishName).indexOf(toLowerCase(params)) != -1) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -143,11 +143,11 @@ function getLocales() {
|
||||
// ===========================================================================
|
||||
|
||||
function showLocaleListCommand(command, params, client) {
|
||||
let localeList = getLocales().map(function(x) { return x[0]; });
|
||||
let localeList = getLocales().map(function (x) { return x[0]; });
|
||||
let chunkedList = splitArrayIntoChunks(localeList, 10);
|
||||
|
||||
messagePlayerInfo(client, getLocaleString(client, "HeaderLocaleList"));
|
||||
for(let i in chunkedList) {
|
||||
for (let i in chunkedList) {
|
||||
messagePlayerInfo(client, chunkedList[i].join(", "));
|
||||
}
|
||||
}
|
||||
@@ -155,14 +155,14 @@ function showLocaleListCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function setLocaleCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
if (areParamsEmpty(params)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
|
||||
let localeId = getLocaleFromParams(params);
|
||||
|
||||
if(!getLocaleData(localeId)) {
|
||||
if (!getLocaleData(localeId)) {
|
||||
messagePlayerInfo(client, getLocaleString(client, "InvalidLocale"));
|
||||
return false;
|
||||
}
|
||||
@@ -170,13 +170,14 @@ function setLocaleCommand(command, params, client) {
|
||||
getPlayerData(client).accountData.locale = localeId;
|
||||
getPlayerData(client).locale = localeId;
|
||||
messagePlayerSuccess(client, getLocaleString(client, "LocaleChanged1", getLocaleString(client, "LocaleNativeName")));
|
||||
sendPlayerLocaleStrings(client);
|
||||
//sendPlayerLocaleStrings(client);
|
||||
sendPlayerLocaleId(client, localeId);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getLocaleData(localeId) {
|
||||
if(typeof getLocales()[localeId] != "undefined") {
|
||||
if (typeof getLocales()[localeId] != "undefined") {
|
||||
return getLocales()[localeId];
|
||||
}
|
||||
|
||||
@@ -204,12 +205,12 @@ function reloadLocaleConfigurationCommand(command, params, client) {
|
||||
|
||||
async function translateMessage(messageText, translateFrom = getGlobalConfig().locale.defaultLanguageId, translateTo = getGlobalConfig().locale.defaultLanguageId) {
|
||||
return new Promise(resolve => {
|
||||
if(translateFrom == translateTo) {
|
||||
if (translateFrom == translateTo) {
|
||||
resolve(messageText);
|
||||
}
|
||||
|
||||
for(let i in cachedTranslations[translateFrom][translateTo]) {
|
||||
if(cachedTranslations[translateFrom][translateTo][i][0] == messageText) {
|
||||
for (let i in cachedTranslations[translateFrom][translateTo]) {
|
||||
if (cachedTranslations[translateFrom][translateTo][i][0] == messageText) {
|
||||
logToConsole(LOG_DEBUG, `[Translate]: Using existing translation for ${getGlobalConfig().locale.locales[translateFrom].englishName} to ${getGlobalConfig().locale.locales[translateTo].englishName} - (${messageText}), (${cachedTranslations[translateFrom][translateTo][i][1]})`);
|
||||
resolve(cachedTranslations[translateFrom][translateTo][i][1]);
|
||||
return true;
|
||||
@@ -220,13 +221,13 @@ async function translateMessage(messageText, translateFrom = getGlobalConfig().l
|
||||
httpGet(
|
||||
thisTranslationURL,
|
||||
"",
|
||||
function(data) {
|
||||
function (data) {
|
||||
data = ArrayBufferToString(data);
|
||||
let translationData = JSON.parse(data);
|
||||
cachedTranslations[translateFrom][translateTo].push([messageText, translationData.responseData.translatedText]);
|
||||
resolve(translationData.responseData.translatedText);
|
||||
},
|
||||
function(data) {
|
||||
function (data) {
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
@@ -16,7 +16,7 @@ function initMessagingScript() {
|
||||
|
||||
function announceAdminAction(localeString, ...args) {
|
||||
let clients = getClients();
|
||||
for(let i in clients) {
|
||||
for (let i in clients) {
|
||||
let argsArray = [clients[i], localeString];
|
||||
argsArray = argsArray.concat(args);
|
||||
let messageText = getLocaleString.apply(null, argsArray);
|
||||
@@ -61,8 +61,8 @@ function messageAdmins(messageText, colour = getColourByName("softRed")) {
|
||||
//logToConsole(LOG_WARN, `🛡️ ${plainMessage}`);
|
||||
|
||||
let clients = getClients();
|
||||
for(let i in clients) {
|
||||
if(doesPlayerHaveStaffPermission(clients[i], getStaffFlagValue("BasicModeration"))) {
|
||||
for (let i in clients) {
|
||||
if (doesPlayerHaveStaffPermission(clients[i], getStaffFlagValue("BasicModeration"))) {
|
||||
messagePlayerNormal(clients[i], `🛡️ ${messageText}`, colour);
|
||||
}
|
||||
}
|
||||
@@ -74,12 +74,12 @@ function messageAdmins(messageText, colour = getColourByName("softRed")) {
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerError(client, messageText) {
|
||||
if(isConsole(client)) {
|
||||
if (isConsole(client)) {
|
||||
logToConsole(LOG_INFO, `❌ ${messageText}`);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!isClientFromDiscord(client)) {
|
||||
if (!isClientFromDiscord(client)) {
|
||||
messagePlayerNormal(client, `❌ ${messageText}`, getColourByName("white"));
|
||||
} else {
|
||||
messageDiscordUser(client, `❌ ${messageText}`);
|
||||
@@ -89,12 +89,12 @@ function messagePlayerError(client, messageText) {
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerSyntax(client, messageText) {
|
||||
if(isConsole(client)) {
|
||||
if (isConsole(client)) {
|
||||
logToConsole(LOG_INFO, `⌨️ ${messageText}`);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!isClientFromDiscord(client)) {
|
||||
if (!isClientFromDiscord(client)) {
|
||||
messagePlayerNormal(client, `⌨️ USAGE: {MAINCOLOUR} ${messageText}`, getColourByType("syntaxMessage"));
|
||||
} else {
|
||||
messageDiscordUser(client, `⌨️ ${messageText}`);
|
||||
@@ -104,12 +104,12 @@ function messagePlayerSyntax(client, messageText) {
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerAlert(client, messageText) {
|
||||
if(isConsole(client)) {
|
||||
if (isConsole(client)) {
|
||||
logToConsole(LOG_INFO, `⚠️ ${messageText}`);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!isClientFromDiscord(client)) {
|
||||
if (!isClientFromDiscord(client)) {
|
||||
messagePlayerNormal(client, `⚠️ ${messageText}`, getColourByName("white"));
|
||||
} else {
|
||||
messageDiscordUser(client, `⚠️ ${messageText}`);
|
||||
@@ -119,12 +119,12 @@ function messagePlayerAlert(client, messageText) {
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerSuccess(client, messageText) {
|
||||
if(isConsole(client)) {
|
||||
if (isConsole(client)) {
|
||||
logToConsole(LOG_INFO, `✔️ ${messageText}`);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!isClientFromDiscord(client)) {
|
||||
if (!isClientFromDiscord(client)) {
|
||||
messagePlayerNormal(client, `✔️ ${messageText}`, getColourByName("white"));
|
||||
} else {
|
||||
messageDiscordUser(client, `✔️ ${messageText}`);
|
||||
@@ -134,12 +134,12 @@ function messagePlayerSuccess(client, messageText) {
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerInfo(client, messageText) {
|
||||
if(isConsole(client)) {
|
||||
if (isConsole(client)) {
|
||||
logToConsole(LOG_INFO, `ℹ️ ${messageText}`);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!isClientFromDiscord(client)) {
|
||||
if (!isClientFromDiscord(client)) {
|
||||
messagePlayerNormal(client, `ℹ️ ${messageText}`, getColourByName("white"));
|
||||
} else {
|
||||
messageDiscordUser(client, `:information_source: ${messageText}`);
|
||||
@@ -149,12 +149,12 @@ function messagePlayerInfo(client, messageText) {
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerTip(client, messageText) {
|
||||
if(isConsole(client)) {
|
||||
if (isConsole(client)) {
|
||||
logToConsole(LOG_INFO, `ℹ️ ${messageText}`);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!isClientFromDiscord(client)) {
|
||||
if (!isClientFromDiscord(client)) {
|
||||
messagePlayerNormal(client, `ℹ️ ${messageText}`, getColourByName("white"));
|
||||
} else {
|
||||
messageDiscordUser(client, `:information_source: ${messageText}`);
|
||||
@@ -188,7 +188,7 @@ function messagePlayerShout(client, shoutingClient, messageText) {
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerDoAction(client, doingActionClient, messageText) {
|
||||
if(!isClientFromDiscord(client)) {
|
||||
if (!isClientFromDiscord(client)) {
|
||||
messagePlayerNormal(client, `${messageText} * (${getClientSubAccountName(doingActionClient)})`, getColourByType("doActionMessage"));
|
||||
}
|
||||
}
|
||||
@@ -214,7 +214,7 @@ function messagePlayerAdminChat(client, adminChattingClient, messageText) {
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerNewbieTip(client, message) {
|
||||
if(!hasBitFlag(getPlayerData(client).accountData.settings, getAccountSettingsFlagValue("NoActionTips"))) {
|
||||
if (!hasBitFlag(getPlayerData(client).accountData.settings, getAccountSettingsFlagValue("NoActionTips"))) {
|
||||
messagePlayerNormal(client, `💡 ${message}`);
|
||||
}
|
||||
}
|
||||
@@ -222,8 +222,8 @@ function messagePlayerNewbieTip(client, message) {
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerTimedRandomTip(client, message) {
|
||||
if(isPlayerLoggedIn(client) && isPlayerSpawned(client)) {
|
||||
if(!hasBitFlag(getPlayerData(client).accountData.settings, getAccountSettingsFlagValue("NoRandomTips"))) {
|
||||
if (isPlayerLoggedIn(client) && isPlayerSpawned(client)) {
|
||||
if (!hasBitFlag(getPlayerData(client).accountData.settings, getAccountSettingsFlagValue("NoRandomTips"))) {
|
||||
messagePlayerNormal(client, `💡 ${message}`);
|
||||
}
|
||||
}
|
||||
@@ -233,7 +233,7 @@ function messagePlayerTimedRandomTip(client, message) {
|
||||
|
||||
function makeChatBoxSectionHeader(name) {
|
||||
let resultString = `{clanOrange}== {jobYellow}${name} `;
|
||||
let endFiller = fillStringWithCharacter("=", getGlobalConfig().chatSectionHeaderLength-resultString.length);
|
||||
let endFiller = fillStringWithCharacter("=", getGlobalConfig().chatSectionHeaderLength - resultString.length);
|
||||
return `${resultString} {clanOrange}${endFiller}`;
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ function makeChatBoxSectionHeader(name) {
|
||||
|
||||
function clearChatBox(client) {
|
||||
//game.messages.clear();
|
||||
for(let i = 0; i <= 20; i++) {
|
||||
for (let i = 0; i <= 20; i++) {
|
||||
messageClient(" ", client, COLOUR_WHITE);
|
||||
}
|
||||
}
|
||||
@@ -255,8 +255,8 @@ function messagePlayerHelpContent(client, messageString) {
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayersInRace(raceId, message) {
|
||||
for(let i in clients) {
|
||||
if(getPlayerRace(clients[i]) == raceId) {
|
||||
for (let i in clients) {
|
||||
if (getPlayerRace(clients[i]) == raceId) {
|
||||
messagePlayerNormal(clients[i], message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1382,4 +1382,15 @@ function createAttachedGameBlip(element, type, size, colour = toColour(255, 255,
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function deletePlayerPed(client) {
|
||||
if (areServerElementsSupported()) {
|
||||
destroyElement(client.player);
|
||||
} else {
|
||||
sendNetworkEventToPlayer("vrr.deleteLocalPlayerPed", client);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -242,7 +242,7 @@ function showRandomTipToAllPlayers() {
|
||||
if (isClientInitialized(clients[i])) {
|
||||
if (isPlayerLoggedIn(clients[i]) && isPlayerSpawned(clients[i])) {
|
||||
if (!doesPlayerHaveRandomTipsDisabled(clients[i])) {
|
||||
let localeId = getPlayerLocaleId(clients[i]);
|
||||
let localeId = getPlayerData(clients[i]).locale;
|
||||
let tipId = getRandom(0, getServerData().localeStrings[localeId]["RandomTips"].length - 1);
|
||||
messagePlayerTip(clients[i], getGroupedLocaleString(clients[i], "RandomTips", tipId));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user