Merge branch 'nightly' into patch-1
This commit is contained in:
@@ -782,5 +782,13 @@
|
||||
"ResetActionTipsConfirm": "Are you sure you want to reset all seen action tips?",
|
||||
"ActionTipsReset": "All seen action tips have been reset.",
|
||||
"NormalChatDisabled": "Normal chat is disabled by server admin. Use chat commands instead.",
|
||||
"GlobalChatDisabled": "Global out-of-character chat is disabled by server admin"
|
||||
"GlobalChatDisabled": "Global out-of-character chat is disabled by server admin",
|
||||
"CantEditJobUniforms": "You can't edit job uniforms!",
|
||||
"PlayerNotSurrendered": "The player must be surrendered (hands up, be knocked out, or tazed)!",
|
||||
"PlayerRemovedFromJob": "You removed {1} from the job",
|
||||
"RemovedFromJob": "You were removed from the job by {1}",
|
||||
"UnableToCallPlayer": "{1} can't be called right now",
|
||||
"NoRadioToUse": "You must have a radio, or be in a vehicle with a radio!",
|
||||
"FrequencyMustBeNumber": "The radio channel must be a number!",
|
||||
"FrequencyMustBeBetween": "The radio channel must be between {1} and {2}!"
|
||||
}
|
||||
@@ -780,5 +780,13 @@
|
||||
"ResetActionTipsConfirm": "Are you sure you want to reset all seen action tips?",
|
||||
"ActionTipsReset": "All seen action tips have been reset.",
|
||||
"NormalChatDisabled": "Normal chat is disabled by server admin. Use chat commands instead.",
|
||||
"GlobalChatDisabled": "Global out-of-character chat is disabled by server admin"
|
||||
"GlobalChatDisabled": "Global out-of-character chat is disabled by server admin",
|
||||
"CantEditJobUniforms": "You can't edit job uniforms!",
|
||||
"PlayerNotSurrendered": "The player must be surrendered (hands up, be knocked out, or tazed)!",
|
||||
"PlayerRemovedFromJob": "You removed {1} from the job",
|
||||
"RemovedFromJob": "You were removed from the job by {1}",
|
||||
"UnableToCallPlayer": "{1} can't be called right now",
|
||||
"NoRadioToUse": "You must have a radio, or be in a vehicle with a radio!",
|
||||
"FrequencyMustBeNumber": "The radio channel must be a number!",
|
||||
"FrequencyMustBeBetween": "The radio channel must be between {1} and {2}!"
|
||||
}
|
||||
@@ -778,5 +778,13 @@
|
||||
"ResetActionTipsConfirm": "Are you sure you want to reset all seen action tips?",
|
||||
"ActionTipsReset": "All seen action tips have been reset.",
|
||||
"NormalChatDisabled": "Normal chat is disabled by server admin. Use chat commands instead.",
|
||||
"GlobalChatDisabled": "Global out-of-character chat is disabled by server admin"
|
||||
"GlobalChatDisabled": "Global out-of-character chat is disabled by server admin",
|
||||
"CantEditJobUniforms": "You can't edit job uniforms!",
|
||||
"PlayerNotSurrendered": "The player must be surrendered (hands up, be knocked out, or tazed)!",
|
||||
"PlayerRemovedFromJob": "You removed {1} from the job",
|
||||
"RemovedFromJob": "You were removed from the job by {1}",
|
||||
"UnableToCallPlayer": "{1} can't be called right now",
|
||||
"NoRadioToUse": "You must have a radio, or be in a vehicle with a radio!",
|
||||
"FrequencyMustBeNumber": "The radio channel must be a number!",
|
||||
"FrequencyMustBeBetween": "The radio channel must be between {1} and {2}!"
|
||||
}
|
||||
|
||||
@@ -789,5 +789,13 @@
|
||||
"JobInviteAlreadyHasJob": "That player already has a job!",
|
||||
"JobInviteRequest": "{1} invited you to the {2} job.",
|
||||
"CantAddJobMembers": "You can't invite new members to the job!",
|
||||
"CantRemoveJobMembers": "You can't remove members from the job!"
|
||||
"CantRemoveJobMembers": "You can't remove members from the job!",
|
||||
"CantEditJobUniforms": "You can't edit job uniforms!",
|
||||
"PlayerNotSurrendered": "The player must be surrendered (hands up, be knocked out, or tazed)!",
|
||||
"PlayerRemovedFromJob": "You removed {1} from the job",
|
||||
"RemovedFromJob": "You were removed from the job by {1}",
|
||||
"UnableToCallPlayer": "{1} can't be called right now",
|
||||
"NoRadioToUse": "You must have a radio, or be in a vehicle with a radio!",
|
||||
"FrequencyMustBeNumber": "The radio channel must be a number!",
|
||||
"FrequencyMustBeBetween": "The radio channel must be between {1} and {2}!"
|
||||
}
|
||||
|
||||
@@ -777,5 +777,13 @@
|
||||
"ResetActionTipsConfirm": "Are you sure you want to reset all seen action tips?",
|
||||
"ActionTipsReset": "All seen action tips have been reset.",
|
||||
"NormalChatDisabled": "Normal chat is disabled by server admin. Use chat commands instead.",
|
||||
"GlobalChatDisabled": "Global out-of-character chat is disabled by server admin"
|
||||
"GlobalChatDisabled": "Global out-of-character chat is disabled by server admin",
|
||||
"CantEditJobUniforms": "You can't edit job uniforms!",
|
||||
"PlayerNotSurrendered": "The player must be surrendered (hands up, be knocked out, or tazed)!",
|
||||
"PlayerRemovedFromJob": "You removed {1} from the job",
|
||||
"RemovedFromJob": "You were removed from the job by {1}",
|
||||
"UnableToCallPlayer": "{1} can't be called right now",
|
||||
"NoRadioToUse": "You must have a radio, or be in a vehicle with a radio!",
|
||||
"FrequencyMustBeNumber": "The radio channel must be a number!",
|
||||
"FrequencyMustBeBetween": "The radio channel must be between {1} and {2}!"
|
||||
}
|
||||
|
||||
@@ -778,5 +778,13 @@
|
||||
"ResetActionTipsConfirm": "Are you sure you want to reset all seen action tips?",
|
||||
"ActionTipsReset": "All seen action tips have been reset.",
|
||||
"NormalChatDisabled": "Normal chat is disabled by server admin. Use chat commands instead.",
|
||||
"GlobalChatDisabled": "Global out-of-character chat is disabled by server admin"
|
||||
"GlobalChatDisabled": "Global out-of-character chat is disabled by server admin",
|
||||
"CantEditJobUniforms": "You can't edit job uniforms!",
|
||||
"PlayerNotSurrendered": "The player must be surrendered (hands up, be knocked out, or tazed)!",
|
||||
"PlayerRemovedFromJob": "You removed {1} from the job",
|
||||
"RemovedFromJob": "You were removed from the job by {1}",
|
||||
"UnableToCallPlayer": "{1} can't be called right now",
|
||||
"NoRadioToUse": "You must have a radio, or be in a vehicle with a radio!",
|
||||
"FrequencyMustBeNumber": "The radio channel must be a number!",
|
||||
"FrequencyMustBeBetween": "The radio channel must be between {1} and {2}!"
|
||||
}
|
||||
@@ -777,5 +777,13 @@
|
||||
"ResetActionTipsConfirm": "Are you sure you want to reset all seen action tips?",
|
||||
"ActionTipsReset": "All seen action tips have been reset.",
|
||||
"NormalChatDisabled": "Normal chat is disabled by server admin. Use chat commands instead.",
|
||||
"GlobalChatDisabled": "Global out-of-character chat is disabled by server admin"
|
||||
"GlobalChatDisabled": "Global out-of-character chat is disabled by server admin",
|
||||
"CantEditJobUniforms": "You can't edit job uniforms!",
|
||||
"PlayerNotSurrendered": "The player must be surrendered (hands up, be knocked out, or tazed)!",
|
||||
"PlayerRemovedFromJob": "You removed {1} from the job",
|
||||
"RemovedFromJob": "You were removed from the job by {1}",
|
||||
"UnableToCallPlayer": "{1} can't be called right now",
|
||||
"NoRadioToUse": "You must have a radio, or be in a vehicle with a radio!",
|
||||
"FrequencyMustBeNumber": "The radio channel must be a number!",
|
||||
"FrequencyMustBeBetween": "The radio channel must be between {1} and {2}!"
|
||||
}
|
||||
@@ -778,5 +778,13 @@
|
||||
"ResetActionTipsConfirm": "Are you sure you want to reset all seen action tips?",
|
||||
"ActionTipsReset": "All seen action tips have been reset.",
|
||||
"NormalChatDisabled": "Normal chat is disabled by server admin. Use chat commands instead.",
|
||||
"GlobalChatDisabled": "Global out-of-character chat is disabled by server admin"
|
||||
"GlobalChatDisabled": "Global out-of-character chat is disabled by server admin",
|
||||
"CantEditJobUniforms": "You can't edit job uniforms!",
|
||||
"PlayerNotSurrendered": "The player must be surrendered (hands up, be knocked out, or tazed)!",
|
||||
"PlayerRemovedFromJob": "You removed {1} from the job",
|
||||
"RemovedFromJob": "You were removed from the job by {1}",
|
||||
"UnableToCallPlayer": "{1} can't be called right now",
|
||||
"NoRadioToUse": "You must have a radio, or be in a vehicle with a radio!",
|
||||
"FrequencyMustBeNumber": "The radio channel must be a number!",
|
||||
"FrequencyMustBeBetween": "The radio channel must be between {1} and {2}!"
|
||||
}
|
||||
@@ -780,5 +780,13 @@
|
||||
"ResetActionTipsConfirm": "Are you sure you want to reset all seen action tips?",
|
||||
"ActionTipsReset": "All seen action tips have been reset.",
|
||||
"NormalChatDisabled": "Normal chat is disabled by server admin. Use chat commands instead.",
|
||||
"GlobalChatDisabled": "Global out-of-character chat is disabled by server admin"
|
||||
"GlobalChatDisabled": "Global out-of-character chat is disabled by server admin",
|
||||
"CantEditJobUniforms": "You can't edit job uniforms!",
|
||||
"PlayerNotSurrendered": "The player must be surrendered (hands up, be knocked out, or tazed)!",
|
||||
"PlayerRemovedFromJob": "You removed {1} from the job",
|
||||
"RemovedFromJob": "You were removed from the job by {1}",
|
||||
"UnableToCallPlayer": "{1} can't be called right now",
|
||||
"NoRadioToUse": "You must have a radio, or be in a vehicle with a radio!",
|
||||
"FrequencyMustBeNumber": "The radio channel must be a number!",
|
||||
"FrequencyMustBeBetween": "The radio channel must be between {1} and {2}!"
|
||||
}
|
||||
@@ -779,5 +779,13 @@
|
||||
"ResetActionTipsConfirm": "Are you sure you want to reset all seen action tips?",
|
||||
"ActionTipsReset": "All seen action tips have been reset.",
|
||||
"NormalChatDisabled": "Normal chat is disabled by server admin. Use chat commands instead.",
|
||||
"GlobalChatDisabled": "Global out-of-character chat is disabled by server admin"
|
||||
"GlobalChatDisabled": "Global out-of-character chat is disabled by server admin",
|
||||
"CantEditJobUniforms": "You can't edit job uniforms!",
|
||||
"PlayerNotSurrendered": "The player must be surrendered (hands up, be knocked out, or tazed)!",
|
||||
"PlayerRemovedFromJob": "You removed {1} from the job",
|
||||
"RemovedFromJob": "You were removed from the job by {1}",
|
||||
"UnableToCallPlayer": "{1} can't be called right now",
|
||||
"NoRadioToUse": "You must have a radio, or be in a vehicle with a radio!",
|
||||
"FrequencyMustBeNumber": "The radio channel must be a number!",
|
||||
"FrequencyMustBeBetween": "The radio channel must be between {1} and {2}!"
|
||||
}
|
||||
|
||||
@@ -779,5 +779,13 @@
|
||||
"ResetActionTipsConfirm": "Are you sure you want to reset all seen action tips?",
|
||||
"ActionTipsReset": "All seen action tips have been reset.",
|
||||
"NormalChatDisabled": "Normal chat is disabled by server admin. Use chat commands instead.",
|
||||
"GlobalChatDisabled": "Global out-of-character chat is disabled by server admin"
|
||||
"GlobalChatDisabled": "Global out-of-character chat is disabled by server admin",
|
||||
"CantEditJobUniforms": "You can't edit job uniforms!",
|
||||
"PlayerNotSurrendered": "The player must be surrendered (hands up, be knocked out, or tazed)!",
|
||||
"PlayerRemovedFromJob": "You removed {1} from the job",
|
||||
"RemovedFromJob": "You were removed from the job by {1}",
|
||||
"UnableToCallPlayer": "{1} can't be called right now",
|
||||
"NoRadioToUse": "You must have a radio, or be in a vehicle with a radio!",
|
||||
"FrequencyMustBeNumber": "The radio channel must be a number!",
|
||||
"FrequencyMustBeBetween": "The radio channel must be between {1} and {2}!"
|
||||
}
|
||||
@@ -778,4 +778,12 @@
|
||||
"ActionTipsReset": "Wszystkie zobaczone wskazówki dotyczące akcji zostały zresetowane.",
|
||||
"NormalChatDisabled": "Normalny czat jest wyłączony przez administratora serwera. Zamiast tego należy użyć komend czatu.",
|
||||
"GlobalChatDisabled": "Globalny czat poza postacią jest wyłączony przez administratora serwera"
|
||||
"CantEditJobUniforms": "You can't edit job uniforms!",
|
||||
"PlayerNotSurrendered": "The player must be surrendered (hands up, be knocked out, or tazed)!",
|
||||
"PlayerRemovedFromJob": "You removed {1} from the job",
|
||||
"RemovedFromJob": "You were removed from the job by {1}",
|
||||
"UnableToCallPlayer": "{1} can't be called right now",
|
||||
"NoRadioToUse": "You must have a radio, or be in a vehicle with a radio!",
|
||||
"FrequencyMustBeNumber": "The radio channel must be a number!",
|
||||
"FrequencyMustBeBetween": "The radio channel must be between {1} and {2}!"
|
||||
}
|
||||
|
||||
@@ -778,5 +778,13 @@
|
||||
"ResetActionTipsConfirm": "Are you sure you want to reset all seen action tips?",
|
||||
"ActionTipsReset": "All seen action tips have been reset.",
|
||||
"NormalChatDisabled": "Normal chat is disabled by server admin. Use chat commands instead.",
|
||||
"GlobalChatDisabled": "Global out-of-character chat is disabled by server admin"
|
||||
"GlobalChatDisabled": "Global out-of-character chat is disabled by server admin",
|
||||
"CantEditJobUniforms": "You can't edit job uniforms!",
|
||||
"PlayerNotSurrendered": "The player must be surrendered (hands up, be knocked out, or tazed)!",
|
||||
"PlayerRemovedFromJob": "You removed {1} from the job",
|
||||
"RemovedFromJob": "You were removed from the job by {1}",
|
||||
"UnableToCallPlayer": "{1} can't be called right now",
|
||||
"NoRadioToUse": "You must have a radio, or be in a vehicle with a radio!",
|
||||
"FrequencyMustBeNumber": "The radio channel must be a number!",
|
||||
"FrequencyMustBeBetween": "The radio channel must be between {1} and {2}!"
|
||||
}
|
||||
|
||||
@@ -778,5 +778,13 @@
|
||||
"ResetActionTipsConfirm": "Are you sure you want to reset all seen action tips?",
|
||||
"ActionTipsReset": "All seen action tips have been reset.",
|
||||
"NormalChatDisabled": "Normal chat is disabled by server admin. Use chat commands instead.",
|
||||
"GlobalChatDisabled": "Global out-of-character chat is disabled by server admin"
|
||||
"GlobalChatDisabled": "Global out-of-character chat is disabled by server admin",
|
||||
"CantEditJobUniforms": "You can't edit job uniforms!",
|
||||
"PlayerNotSurrendered": "The player must be surrendered (hands up, be knocked out, or tazed)!",
|
||||
"PlayerRemovedFromJob": "You removed {1} from the job",
|
||||
"RemovedFromJob": "You were removed from the job by {1}",
|
||||
"UnableToCallPlayer": "{1} can't be called right now",
|
||||
"NoRadioToUse": "You must have a radio, or be in a vehicle with a radio!",
|
||||
"FrequencyMustBeNumber": "The radio channel must be a number!",
|
||||
"FrequencyMustBeBetween": "The radio channel must be between {1} and {2}!"
|
||||
}
|
||||
@@ -784,5 +784,13 @@
|
||||
"ResetActionTipsConfirm": "Are you sure you want to reset all seen action tips?",
|
||||
"ActionTipsReset": "All seen action tips have been reset.",
|
||||
"NormalChatDisabled": "Normal chat is disabled by server admin. Use chat commands instead.",
|
||||
"GlobalChatDisabled": "Global out-of-character chat is disabled by server admin"
|
||||
"GlobalChatDisabled": "Global out-of-character chat is disabled by server admin",
|
||||
"CantEditJobUniforms": "You can't edit job uniforms!",
|
||||
"PlayerNotSurrendered": "The player must be surrendered (hands up, be knocked out, or tazed)!",
|
||||
"PlayerRemovedFromJob": "You removed {1} from the job",
|
||||
"RemovedFromJob": "You were removed from the job by {1}",
|
||||
"UnableToCallPlayer": "{1} can't be called right now",
|
||||
"NoRadioToUse": "You must have a radio, or be in a vehicle with a radio!",
|
||||
"FrequencyMustBeNumber": "The radio channel must be a number!",
|
||||
"FrequencyMustBeBetween": "The radio channel must be between {1} and {2}!"
|
||||
}
|
||||
|
||||
@@ -104,7 +104,6 @@ let serverData = {
|
||||
};
|
||||
|
||||
let localPlayerMoney = 0;
|
||||
let localPlayerMoneyInterval = null;
|
||||
|
||||
let currencyString = "${AMOUNT}";
|
||||
|
||||
|
||||
@@ -16,9 +16,6 @@ function initEventScript() {
|
||||
// ===========================================================================
|
||||
|
||||
function addAllEventHandlers() {
|
||||
addEventHandler("OnResourceStart", onResourceStart);
|
||||
addEventHandler("OnResourceReady", onResourceReady);
|
||||
addEventHandler("OnResourceStop", onResourceStop);
|
||||
addEventHandler("OnProcess", onProcess);
|
||||
addEventHandler("OnKeyUp", onKeyUp);
|
||||
addEventHandler("OnDrawnHUD", onDrawnHUD);
|
||||
@@ -94,8 +91,11 @@ function onResourceStop(event, resource) {
|
||||
function onResourceReady(event, resource) {
|
||||
if (resource == thisResource) {
|
||||
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.Event] onResourceReady called - Sending signal to server`);
|
||||
loadLocaleConfig();
|
||||
sendResourceReadySignalToServer();
|
||||
|
||||
setTimeout(function () {
|
||||
initClientScripts();
|
||||
sendResourceReadySignalToServer();
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
// ===========================================================================
|
||||
|
||||
class HouseData {
|
||||
constructor(houseId, description, entrancePosition, blipModel, pickupModel, hasInterior) {
|
||||
constructor(houseId, description, entrancePosition, blipModel, pickupModel, hasInterior, locked) {
|
||||
this.index = -1;
|
||||
this.houseId = houseId;
|
||||
this.description = description;
|
||||
@@ -19,14 +19,21 @@ class HouseData {
|
||||
this.rentPrice = 0;
|
||||
this.buyPrice = 0;
|
||||
this.blipId = -1;
|
||||
this.locked = false;
|
||||
this.locked = locked;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initHouseScript() {
|
||||
logToConsole(LOG_DEBUG, "[V.RP.House]: Initializing house script ...");
|
||||
logToConsole(LOG_DEBUG, "[V.RP.House]: House script initialized!");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function receiveHouseFromServer(houseId, isDeleted, description, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.House] Received house ${houseId} (${name}) from server`);
|
||||
logToConsole(LOG_DEBUG, `[V.RP.House] Received house ${houseId} (${description}) from server`);
|
||||
|
||||
if (!areServerElementsSupported() || getGame() == V_GAME_MAFIA_ONE || getGame() == V_GAME_GTA_IV) {
|
||||
if (isDeleted == true) {
|
||||
@@ -96,7 +103,7 @@ function receiveHouseFromServer(houseId, isDeleted, description, entrancePositio
|
||||
}
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.House] House ${houseId} doesn't exist. Adding ...`);
|
||||
let tempHouseData = new HouseData(houseId, description, entrancePosition, blipModel, pickupModel, hasInterior);
|
||||
let tempHouseData = new HouseData(houseId, description, entrancePosition, blipModel, pickupModel, hasInterior, locked);
|
||||
if (blipModel != -1) {
|
||||
let blipId = createGameBlip(tempHouseData.blipModel, tempHouseData.entrancePosition, "House");
|
||||
if (blipId != -1) {
|
||||
|
||||
@@ -18,10 +18,11 @@ let payPhoneRingingSound = null;
|
||||
let payPhoneDialingSound = null;
|
||||
let payPhonePickupSound = null;
|
||||
let payPhoneHangupSound = null;
|
||||
let payPhoneRingingSoundFilePath = "files/sounds/payphone/old-payphone-ring.mp3";
|
||||
let payPhoneDialingSoundFilePath = "files/sounds/payphone/old-payphone-dial.mp3";
|
||||
let payPhonePickupSoundFilePath = "files/sounds/payphone/old-payphone-pickup.mp3";
|
||||
let payPhoneHangupSoundFilePath = "files/sounds/payphone/old-payphone-hangup.mp3";
|
||||
|
||||
let payPhoneRingingSoundFilePath = "";
|
||||
let payPhoneDialingSoundFilePath = "";
|
||||
let payPhonePickupSoundFilePath = "";
|
||||
let payPhoneHangupSoundFilePath = "";
|
||||
|
||||
let ringingPayPhone = -1;
|
||||
|
||||
@@ -40,6 +41,21 @@ class PayPhoneData {
|
||||
|
||||
function initPayPhoneScript() {
|
||||
logToConsole(LOG_DEBUG, "[V.RP.PayPhone]: Initializing payphone script ...");
|
||||
|
||||
if (getGame() == V_GAME_MAFIA_ONE) {
|
||||
payPhoneRingingSoundFilePath = "files/sounds/payphone/old-payphone-ring.mp3";
|
||||
payPhoneDialingSoundFilePath = "files/sounds/payphone/old-payphone-dial.mp3";
|
||||
payPhonePickupSoundFilePath = "files/sounds/payphone/old-payphone-pickup.mp3";
|
||||
payPhoneHangupSoundFilePath = "files/sounds/payphone/old-payphone-hangup.mp3";
|
||||
} else {
|
||||
if (getGame() != V_GAME_GTA_SA) {
|
||||
payPhoneRingingSoundFilePath = "files/sounds/payphone/old-payphone-ring.mp3";
|
||||
payPhoneDialingSoundFilePath = "files/sounds/payphone/old-payphone-dial.mp3";
|
||||
payPhonePickupSoundFilePath = "files/sounds/payphone/old-payphone-pickup.mp3";
|
||||
payPhoneHangupSoundFilePath = "files/sounds/payphone/old-payphone-hangup.mp3";
|
||||
}
|
||||
}
|
||||
|
||||
//payPhoneRingingIndicatorImage = loadPayPhoneRingingIndicatorImage();
|
||||
payPhoneRingingSound = loadPayPhoneRingingSound();
|
||||
payPhoneDialingSound = loadPayPhoneDialingSound();
|
||||
@@ -51,6 +67,10 @@ function initPayPhoneScript() {
|
||||
// ===========================================================================
|
||||
|
||||
function loadPayPhoneRingingIndicatorImage() {
|
||||
if (payPhoneRingingIndicatorImagePath == "") {
|
||||
return null;
|
||||
}
|
||||
|
||||
let imageStream = openFile(payPhoneRingingIndicatorImagePath);
|
||||
let tempImage = null;
|
||||
if (imageStream != null) {
|
||||
@@ -64,6 +84,10 @@ function loadPayPhoneRingingIndicatorImage() {
|
||||
// ===========================================================================
|
||||
|
||||
function loadPayPhoneRingingSound() {
|
||||
if (payPhoneRingingSoundFilePath == "") {
|
||||
return null;
|
||||
}
|
||||
|
||||
let soundStream = openFile(payPhoneRingingSoundFilePath);
|
||||
let tempSound = null;
|
||||
if (soundStream != null) {
|
||||
@@ -77,6 +101,10 @@ function loadPayPhoneRingingSound() {
|
||||
// ===========================================================================
|
||||
|
||||
function loadPayPhoneDialingSound() {
|
||||
if (payPhoneDialingSoundFilePath == "") {
|
||||
return null;
|
||||
}
|
||||
|
||||
let soundStream = openFile(payPhoneDialingSoundFilePath);
|
||||
let tempSound = null;
|
||||
if (soundStream != null) {
|
||||
@@ -94,6 +122,10 @@ function loadPayPhoneDialingSound() {
|
||||
// ===========================================================================
|
||||
|
||||
function loadPayPhonePickupSound() {
|
||||
if (payPhonePickupSoundFilePath == "") {
|
||||
return null;
|
||||
}
|
||||
|
||||
let soundStream = openFile(payPhonePickupSoundFilePath);
|
||||
let tempSound = null;
|
||||
if (soundStream != null) {
|
||||
@@ -111,6 +143,10 @@ function loadPayPhonePickupSound() {
|
||||
// ===========================================================================
|
||||
|
||||
function loadPayPhoneHangupSound() {
|
||||
if (payPhoneHangupSoundFilePath == "") {
|
||||
return null;
|
||||
}
|
||||
|
||||
let soundStream = openFile(payPhoneHangupSoundFilePath);
|
||||
let tempSound = null;
|
||||
if (soundStream != null) {
|
||||
@@ -128,6 +164,10 @@ function loadPayPhoneHangupSound() {
|
||||
// ===========================================================================
|
||||
|
||||
function processPayPhonesDistance() {
|
||||
if (payPhoneRingingSound == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let tempRingingPhone = -1;
|
||||
for (let i in getServerData().payPhones) {
|
||||
if (getServerData().payPhones[i].state == V_PAYPHONE_STATE_RINGING) {
|
||||
@@ -231,6 +271,11 @@ function removePayPhonesFromClient() {
|
||||
// ===========================================================================
|
||||
|
||||
function payPhoneDial() {
|
||||
if (payPhoneDialingSound == null) {
|
||||
logToConsole(LOG_DEBUG | LOG_ERROR, "[V.RP.PayPhone]: Attempted to play payphone dial sound, but sound object is null");
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, "[V.RP.PayPhone]: Playing payphone dial sound");
|
||||
payPhoneDialingSound.play();
|
||||
}
|
||||
@@ -238,6 +283,11 @@ function payPhoneDial() {
|
||||
// ===========================================================================
|
||||
|
||||
function payPhoneHangup() {
|
||||
if (payPhoneHangupSound == null) {
|
||||
logToConsole(LOG_DEBUG | LOG_ERROR, "[V.RP.PayPhone]: Attempted to play payphone hangup sound, but sound object is null");
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, "[V.RP.PayPhone]: Playing payphone hangup sound");
|
||||
payPhoneHangupSound.play();
|
||||
}
|
||||
@@ -245,6 +295,11 @@ function payPhoneHangup() {
|
||||
// ===========================================================================
|
||||
|
||||
function payPhonePickup() {
|
||||
if (payPhonePickupSound == null) {
|
||||
logToConsole(LOG_DEBUG | LOG_ERROR, "[V.RP.PayPhone]: Attempted to play payphone pickup sound, but sound object is null");
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, "[V.RP.PayPhone]: Playing payphone pickup sound");
|
||||
payPhonePickupSound.play();
|
||||
}
|
||||
|
||||
@@ -25,6 +25,11 @@ function initClientScripts() {
|
||||
initPayPhoneScript();
|
||||
initTimersScript();
|
||||
initJobScript();
|
||||
initItemScript();
|
||||
initBusinessScript();
|
||||
initHouseScript();
|
||||
|
||||
loadLocaleConfig();
|
||||
|
||||
addAllNetworkHandlers();
|
||||
|
||||
@@ -203,6 +208,8 @@ function setUpInitialGame() {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
initClientScripts();
|
||||
addEventHandler("OnResourceStart", onResourceStart);
|
||||
addEventHandler("OnResourceReady", onResourceReady);
|
||||
addEventHandler("OnResourceStop", onResourceStop);
|
||||
|
||||
// ===========================================================================
|
||||
// ===========================================================================
|
||||
@@ -7,6 +7,10 @@
|
||||
// TYPE: Client (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
let localPlayerMoneyInterval = null;
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initTimersScript() {
|
||||
logToConsole(LOG_DEBUG, "[V.RP.Timers]: Initializing timer script ...");
|
||||
logToConsole(LOG_DEBUG, "[V.RP.Timers]: Timers script initialized!");
|
||||
@@ -15,6 +19,7 @@ function initTimersScript() {
|
||||
// ===========================================================================
|
||||
|
||||
function initTimers() {
|
||||
localPlayerMoneyInterval = setInterval(updateLocalPlayerMoney, 1000 * 5);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -95,6 +95,9 @@ class BusinessData {
|
||||
|
||||
this.labelHelpType = V_PROPLABEL_INFO_NONE;
|
||||
|
||||
this.whoAdded = 0;
|
||||
this.whenAdded = 0;
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = toInteger(dbAssoc["biz_id"]);
|
||||
this.name = toString(dbAssoc["biz_name"]);
|
||||
@@ -124,9 +127,10 @@ class BusinessData {
|
||||
|
||||
this.entranceFee = toInteger(dbAssoc["biz_entrance_fee"]);
|
||||
this.till = toInteger(dbAssoc["biz_till"]);
|
||||
|
||||
this.labelHelpType = toInteger(dbAssoc["biz_label_help_type"]);
|
||||
this.streamingRadioStation = toInteger(dbAssoc["biz_radio_station"]);
|
||||
this.whoAdded = toInteger(dbAssoc["biz_who_added"]);
|
||||
this.whenAdded = toInteger(dbAssoc["biz_when_added"]);
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -315,7 +319,9 @@ function createBusinessCommand(command, params, client) {
|
||||
-1,
|
||||
getPlayerInterior(client),
|
||||
getPlayerDimension(client),
|
||||
getPlayerData(client).interiorScene);
|
||||
getPlayerData(client).interiorScene,
|
||||
getPlayerData(client).accountData.databaseId
|
||||
);
|
||||
|
||||
messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created business: {businessBlue}${params}`, true);
|
||||
}
|
||||
@@ -357,7 +363,7 @@ function createBusinessLocationCommand(command, params, client) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function createBusiness(name, entrancePosition, exitPosition, entrancePickupModel = -1, entranceBlipModel = -1, entranceInterior = 0, entranceDimension = 0, entranceScene = -1) {
|
||||
function createBusiness(name, entrancePosition, exitPosition, entrancePickupModel = -1, entranceBlipModel = -1, entranceInterior = 0, entranceDimension = 0, entranceScene = -1, whoAdded = defaultNoAccountId) {
|
||||
let tempBusinessData = new BusinessData(false);
|
||||
tempBusinessData.name = name;
|
||||
|
||||
@@ -377,6 +383,9 @@ function createBusiness(name, entrancePosition, exitPosition, entrancePickupMode
|
||||
tempBusinessData.exitDimension = 0;
|
||||
tempBusinessData.exitScene = -1;
|
||||
|
||||
tempBusinessData.whoAdded = whoAdded;
|
||||
tempBusinessData.whenAdded = getCurrentUnixTimestamp();
|
||||
|
||||
tempBusinessData.needsSaved = true;
|
||||
let businessId = getServerData().businesses.push(tempBusinessData);
|
||||
setBusinessDataIndexes();
|
||||
@@ -1933,6 +1942,8 @@ function saveBusinessToDatabase(businessId) {
|
||||
["biz_radio_station", (getRadioStationData(tempBusinessData.streamingRadioStationIndex) != false) ? toInteger(getRadioStationData(tempBusinessData.streamingRadioStationIndex).databaseId) : -1],
|
||||
["biz_custom_interior", boolToInt(tempBusinessData.customInterior)],
|
||||
["biz_buy_price", tempBusinessData.buyPrice],
|
||||
["biz_who_added", tempBusinessData.whoAdded],
|
||||
["biz_when_added", tempBusinessData.whenAdded],
|
||||
//["biz_rent_price", tempBusinessData.rentPrice],
|
||||
];
|
||||
|
||||
|
||||
@@ -207,9 +207,11 @@ function resetClientStuff(client) {
|
||||
|
||||
function kickAllClients() {
|
||||
getClients().forEach((client) => {
|
||||
getPlayerData(client).customDisconnectReason = "ServerRestarting";
|
||||
if (getPlayerData(client) != false) {
|
||||
getPlayerData(client).customDisconnectReason = "ServerRestarting";
|
||||
}
|
||||
disconnectPlayer(client);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -348,9 +348,10 @@ function loadCommands() {
|
||||
new CommandData("use", useItemCommand, "", getStaffFlagValue("None"), true, false, "Uses the currently equipped item"),
|
||||
new CommandData("inv", listPlayerInventoryCommand, "", getStaffFlagValue("None"), true, false, "Shows the items in your inventory"),
|
||||
new CommandData("inventory", listPlayerInventoryCommand, "", getStaffFlagValue("None"), true, false, "Shows the items in your inventory"),
|
||||
new CommandData("search", listOtherPlayerInventoryCommand, "<player name/id>", getStaffFlagValue("None"), true, false, "Shows the items in a player's inventory"),
|
||||
|
||||
new CommandData("items", listItemInventoryCommand, "", getStaffFlagValue("None"), true, false, "Shows the items stored in a container item"),
|
||||
new CommandData("vehtrunk", listVehicleTrunkInventoryCommand, "", getStaffFlagValue("None"), true, false, "Shows the items in a vehicle's trunk"),
|
||||
//new CommandData("vehtrunk", listVehicleTrunkInventoryCommand, "", getStaffFlagValue("None"), true, false, "Shows the items in a vehicle's trunk"),
|
||||
new CommandData("houseitems", listHouseInventoryCommand, "", getStaffFlagValue("None"), true, false, "Shows the items in the house's storage"),
|
||||
new CommandData("bizstorage", listBusinessStorageInventoryCommand, "", getStaffFlagValue("None"), true, false, "Shows the items in the business's extra storage (not buyable)"),
|
||||
new CommandData("bizfloor", listBusinessFloorInventoryCommand, "", getStaffFlagValue("None"), true, false, "Shows the items that can be bought from the business"),
|
||||
@@ -359,11 +360,11 @@ function loadCommands() {
|
||||
new CommandData("buylist", listBusinessFloorInventoryCommand, "", getStaffFlagValue("None"), true, false, "Shows the items that can be bought from the business"),
|
||||
|
||||
new CommandData("power", toggleItemEnabledCommand, "", getStaffFlagValue("None"), true, false, "Turns on or off an item"),
|
||||
new CommandData("freq", setWalkieTalkieFrequencyCommand, "[frequncy number]", getStaffFlagValue("None"), true, false, "Sets a radio item's frequency"),
|
||||
//new CommandData("freq", setRadioFrequencyCommand, "[frequency number]", getStaffFlagValue("None"), true, false, "Sets a vehicle or item radio frequency"),
|
||||
//new CommandData("call", callWithPhoneCommand, "[number]", getStaffFlagValue("None"), true, false),
|
||||
//new CommandData("speakerphone", togglePhoneSpeakerCommand, "", getStaffFlagValue("None"), true, false),
|
||||
new CommandData("radio", walkieTalkieChatCommand, "", getStaffFlagValue("None"), true, false, "Chat over a radio item (item must be able to transmit)"),
|
||||
new CommandData("r", walkieTalkieChatCommand, "", getStaffFlagValue("None"), true, false, "Chat over a radio item (item must be able to transmit)"),
|
||||
new CommandData("radio", radioTransmitCommand, "", getStaffFlagValue("None"), true, false, "Chat over a radio (vehicle radio or item)"),
|
||||
new CommandData("r", radioTransmitCommand, "", getStaffFlagValue("None"), true, false, "Chat over a radio (vehicle radio or item)"),
|
||||
|
||||
new CommandData("additemtype", createItemTypeCommand, "<name>", getStaffFlagValue("ManageItems"), true, false, "Adds a new item type"),
|
||||
new CommandData("itemtypeusetype", setItemTypeUseTypeCommand, "<item type> <use type>", getStaffFlagValue("ManageItems"), true, false, "Sets an item type's use-type (what kind of action is performed when using it)"),
|
||||
@@ -428,6 +429,8 @@ function loadCommands() {
|
||||
new CommandData("deljobroute", deleteJobRouteCommand, "", getStaffFlagValue("ManageJobs"), true, false),
|
||||
new CommandData("deljobrouteloc", deleteJobRouteLocationCommand, "", getStaffFlagValue("ManageJobs"), true, false),
|
||||
new CommandData("deljobroutelocation", deleteJobRouteLocationCommand, "", getStaffFlagValue("ManageJobs"), true, false),
|
||||
new CommandData("jobuniformname", setJobUniformNameCommand, "<uniform id> <name>", getStaffFlagValue("ManageJobs"), true, false),
|
||||
new CommandData("jobuniformrank", setJobUniformMinimumRankCommand, "<uniform id> <rank level>", getStaffFlagValue("ManageJobs"), true, false),
|
||||
new CommandData("jobroutelocpos", setJobRouteLocationPositionCommand, "", getStaffFlagValue("ManageJobs"), true, false),
|
||||
new CommandData("jobroutename", setJobRouteNameCommand, "<name>", getStaffFlagValue("ManageJobs"), true, false),
|
||||
new CommandData("jobroutepay", setJobRoutePayCommand, "<amount>", getStaffFlagValue("ManageJobs"), true, false),
|
||||
|
||||
@@ -211,8 +211,8 @@ let globalConfig = {
|
||||
houseDimensionStart: 100,
|
||||
buyVehicleDriveAwayDistance: 25.0,
|
||||
returnToJobVehicleTime: 30,
|
||||
walkieTalkieSpeakerDistance: 15,
|
||||
walkieTalkieTalkDistance: 15,
|
||||
radioTransmitSpeakerDistance: 15,
|
||||
radioTransmitTalkDistance: 15,
|
||||
phoneSpeakerDistance: 15,
|
||||
phoneTalkDistance: 15,
|
||||
tazerEffectDuration: 15000,
|
||||
@@ -283,6 +283,7 @@ let globalConfig = {
|
||||
nightMapEndHour: 7,
|
||||
payPhoneGiveDistance: 2.5,
|
||||
payPhoneAnswerDistance: 2.5,
|
||||
vehicleTransmitRadioUseDistance: 2.5,
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -593,11 +593,10 @@ function togglePauseSavingToDatabaseCommand(command, params, client) {
|
||||
|
||||
function createAccountDataForNewServer(serverId) {
|
||||
let dbConnection = connectToDatabase();
|
||||
let dbQuery = false;
|
||||
if (dbConnection) {
|
||||
dbQuery = queryDatabase(dbConnection, `SELECT * FROM acct_main`);
|
||||
if (dbQuery) {
|
||||
let dbQueryString = `INSERT INTO acct_svr (acct_svr_acct, acct_svr_svr) VALUES (${accountDatabaseId}, ${serverId})`;
|
||||
let accounts = fetchQueryAssoc(dbConnection, `SELECT * FROM acct_main`);
|
||||
for (let i in accounts) {
|
||||
let dbQueryString = `INSERT INTO acct_svr (acct_svr_acct, acct_svr_svr) VALUES (${accounts[i]["acct_id"]}, ${serverId})`;
|
||||
quickDatabaseQuery(dbQueryString);
|
||||
}
|
||||
}
|
||||
@@ -605,6 +604,60 @@ function createAccountDataForNewServer(serverId) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function fixMissingAccountServerData() {
|
||||
let dbConnection = connectToDatabase();
|
||||
console.log(`Connection: ${dbConnection}`);
|
||||
if (dbConnection != false) {
|
||||
let accounts = fetchQueryAssoc(dbConnection, `SELECT * FROM acct_main WHERE acct_id > 12`);
|
||||
console.log(`Accounts: ${accounts.length}`);
|
||||
let servers = fetchQueryAssoc(dbConnection, `SELECT * FROM svr_main`);
|
||||
console.log(`Servers: ${servers.length}`);
|
||||
|
||||
for (let i in accounts) {
|
||||
let serverAccounts = fetchQueryAssoc(dbConnection, `SELECT * FROM acct_svr WHERE acct_svr_acct = ${accounts[i]["acct_id"]}`)
|
||||
console.log(`Server accounts for ${accounts[i]["acct_id"]}: ${serverAccounts.length}`);
|
||||
for (let k in servers) {
|
||||
let check = serverAccounts.find((sa) => sa["acct_svr_svr"] == servers[k]["svr_id"]);
|
||||
console.log(`Check server: ${servers[k]["svr_id"]}. Amount ${check}`);
|
||||
if (typeof check == "undefined") {
|
||||
let dbQueryString = `INSERT INTO acct_svr (acct_svr_acct, acct_svr_svr) VALUES (${accounts[i]["acct_id"]}, ${servers[k]["svr_id"]})`;
|
||||
//console.log(dbQueryString);
|
||||
quickDatabaseQuery(dbQueryString);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function fixMissingSubAccountServerData() {
|
||||
let dbConnection = connectToDatabase();
|
||||
console.log(`Connection: ${dbConnection}`);
|
||||
if (dbConnection != false) {
|
||||
let subAccounts = fetchQueryAssoc(dbConnection, `SELECT * FROM sacct_main`);
|
||||
console.log(`SubAccounts: ${subAccounts.length}`);
|
||||
let servers = fetchQueryAssoc(dbConnection, `SELECT * FROM svr_main`);
|
||||
console.log(`Servers: ${servers.length}`);
|
||||
|
||||
for (let i in subAccounts) {
|
||||
let serverAccounts = fetchQueryAssoc(dbConnection, `SELECT * FROM sacct_svr WHERE sacct_svr_sacct = ${subAccounts[i]["sacct_id"]}`)
|
||||
console.log(`Server accounts for ${subAccounts[i]["sacct_id"]}: ${serverAccounts.length}`);
|
||||
for (let k in servers) {
|
||||
let check = serverAccounts.find((sa) => sa["sacct_svr_server"] == servers[k]["svr_id"]);
|
||||
console.log(`Check server: ${servers[k]["svr_id"]}. Amount ${check}`);
|
||||
if (typeof check == "undefined") {
|
||||
let dbQueryString = `INSERT INTO sacct_svr (sacct_svr_sacct, sacct_svr_server) VALUES (${subAccounts[i]["sacct_id"]}, ${servers[k]["svr_id"]})`;
|
||||
//console.log(dbQueryString);
|
||||
quickDatabaseQuery(dbQueryString);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function streamAudioURLToAllPlayersCommand(command, params, client) {
|
||||
if (areParamsEmpty(params)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
|
||||
@@ -1801,9 +1801,21 @@ function updateHousePickupLabelData(houseId) {
|
||||
|
||||
if (!areServerElementsSupported() || getGame() == V_GAME_MAFIA_ONE || getGame() == V_GAME_GTA_IV) {
|
||||
if (houseData == false) {
|
||||
sendHouseToPlayer(null, houseId, true, "", false, -1, -1, 0, 0, false, false, false);
|
||||
sendHouseToPlayer(null, houseId, true, "", false, -1, -1, 0, 0, false, false);
|
||||
} else {
|
||||
sendHouseToPlayer(null, houseId, false, houseData.description, houseData.entrancePosition, getHouseEntranceBlipModelForNetworkEvent(houseId), getHouseEntrancePickupModelForNetworkEvent(houseId), houseData.buyPrice, houseData.rentPrice, houseData.hasInterior, houseData.locked);
|
||||
sendHouseToPlayer(
|
||||
null,
|
||||
houseId,
|
||||
false,
|
||||
houseData.description,
|
||||
houseData.entrancePosition,
|
||||
getHouseEntranceBlipModelForNetworkEvent(houseId),
|
||||
getHouseEntrancePickupModelForNetworkEvent(houseId),
|
||||
houseData.buyPrice,
|
||||
houseData.rentPrice,
|
||||
houseData.hasInterior,
|
||||
houseData.locked
|
||||
);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2400,26 +2400,46 @@ function getBestItemToTake(client, slot) {
|
||||
*
|
||||
*/
|
||||
function listPlayerInventoryCommand(command, params, client) {
|
||||
//let targetClient = client;
|
||||
//if(!areParamsEmpty(client)) {
|
||||
// if(doesPlayerHaveStaffPermission(client, getStaffFlagValue("BasicModeration"))) {
|
||||
// if(targetClient == false) {
|
||||
// sendMessageToPlayer(client, getLocaleString(client, "InvalidPlayer"));
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// targetClient = getPlayerFromParams(params);
|
||||
// }
|
||||
//}
|
||||
//showPlayerInventoryToPlayer(client, targetClient);
|
||||
|
||||
showPlayerInventoryToPlayer(client, client);
|
||||
|
||||
markPlayerActionTipSeen(client, "ViewInventory");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* This is a command handler function.
|
||||
*
|
||||
* @param {string} command - The command name used by the player
|
||||
* @param {string} params - The parameters/args string used with the command by the player
|
||||
* @param {Client} client - The client/player that used the command
|
||||
* @return {bool} Whether or not the command was successful
|
||||
*
|
||||
*/
|
||||
function listOtherPlayerInventoryCommand(command, params, client) {
|
||||
if (areParamsEmpty(params)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(client, command));
|
||||
return false;
|
||||
}
|
||||
|
||||
let targetClient = getPlayerFromParams(params);
|
||||
|
||||
if (!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageItems"))) {
|
||||
if (!isPlayerSurrendered(targetClient)) {
|
||||
messagePlayerError(client, getLocaleString(client, "MustBeSurrendered"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
showPlayerInventoryToPlayer(client, targetClient);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* This is a command handler function.
|
||||
*
|
||||
|
||||
@@ -5,135 +5,4 @@
|
||||
// FILE: walkie-talkie.js
|
||||
// DESC: Provides features and usage for the walkie-talkie item type
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerActiveWalkieTalkieFrequency(client) {
|
||||
let walkieTalkieSlot = getPlayerFirstItemSlotByUseType(client, V_ITEM_USE_TYPE_WALKIETALKIE);
|
||||
|
||||
if (walkieTalkieSlot != -1) {
|
||||
if (getItemData(getPlayerData(client).hotBarItems[walkieTalkieSlot])) {
|
||||
if (getItemData(getPlayerData(client).hotBarItems[walkieTalkieSlot]).enabled) {
|
||||
return getItemData(getPlayerData(client).hotBarItems[walkieTalkieSlot]).value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function walkieTalkieTransmit(radioFrequency, messageText, transmittingPlayer) {
|
||||
walkieTalkieOutgoingToNearbyPlayers(transmittingPlayer, messageText);
|
||||
|
||||
//let clients = getServerData().items;
|
||||
//for(let i in clients) {
|
||||
// if(isPlayerSpawned(clients[i])) {
|
||||
// if(!isSamePlayer(transmittingPlayer, clients[i])) {
|
||||
// if(getPlayerActiveWalkieTalkieFrequency(clients[i]) == radioFrequency) {
|
||||
// if(getItemData(getPlayerData(clients[i]).hotBarItems[getPlayerFirstItemSlotByUseType(clients[i], V_ITEM_USE_TYPE_WALKIETALKIE)]).enabled) {
|
||||
// walkieTalkieIncomingToNearbyPlayers(clients[i], messageText);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
let items = getServerData().items;
|
||||
for (let i in items) {
|
||||
if (items[i].enabled) {
|
||||
if (getItemTypeData(items[i].itemTypeIndex).useType == V_ITEM_USE_TYPE_WALKIETALKIE) {
|
||||
if (items[i].value == radioFrequency) {
|
||||
walkieTalkieIncomingToNearbyPlayers(null, messageText, getItemPosition(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function walkieTalkieOutgoingToNearbyPlayers(client, messageText) {
|
||||
let clients = getPlayersInRange(getPlayerPosition(client), getGlobalConfig().talkDistance);
|
||||
for (let i in clients) {
|
||||
messagePlayerNormal(clients[i], `[#CCCCCC]${getCharacterFullName(client)} {ALTCOLOUR}(to radio): {MAINCOLOUR}${messageText}`);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function walkieTalkieIncomingToNearbyPlayers(client, messageText, position = null) {
|
||||
let prefix = `{ALTCOLOUR}(Nearby radio)`;
|
||||
if (client != null) {
|
||||
prefix = `${getCharacterFullName(client)} {ALTCOLOUR}(from radio)`;
|
||||
}
|
||||
|
||||
let clients = getPlayersInRange(getPlayerPosition(client), getGlobalConfig().walkieTalkieSpeakerDistance);
|
||||
for (let i in clients) {
|
||||
messagePlayerNormal(clients[i], `[#CCCCCC]${prefix}: {MAINCOLOUR}${messageText}`);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setWalkieTalkieFrequencyCommand(command, params, client) {
|
||||
if (areParamsEmpty(params)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isNaN(params)) {
|
||||
messagePlayerError(client, `The frequency channel must be a number!`);
|
||||
return false;
|
||||
}
|
||||
|
||||
params = toInteger(params);
|
||||
|
||||
if (params < 100 || params > 500) {
|
||||
messagePlayerError(client, `The frequency channel must be between 100 and 500!`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!getPlayerActiveItem(client)) {
|
||||
messagePlayerError(client, `You aren't holding a walkie talkie!`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!getItemData(getPlayerActiveItem(client))) {
|
||||
messagePlayerError(client, `You aren't holding a walkie talkie!`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (getItemData(getPlayerActiveItem(client)).enabled) {
|
||||
if (!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "use")) {
|
||||
messagePlayerError(client, `Your walkie talkie is turned off. Press ${toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "use")).key)} to turn it on`);
|
||||
} else {
|
||||
messagePlayerError(client, `Your walkie talkie is turned off. Type {ALTCOLOUR}/use {MAINCOLOUR}to turn it on`);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
getItemData(getPlayerActiveItem(client)).value = params * 100;
|
||||
messagePlayerSuccess(client, getLocaleString(client, "FrequencyChannelChanged", `Walkie Talkie`, `${getPlayerData(client).activeHotBarSlot + 1}`, `${getItemValueDisplayForItem(getPlayerActiveItem(client))}`));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function walkieTalkieChatCommand(command, params, client) {
|
||||
if (areParamsEmpty(params)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
|
||||
let walkieTalkieSlot = getPlayerFirstItemSlotByUseType(client, V_ITEM_USE_TYPE_WALKIETALKIE);
|
||||
if (!getItemData(getPlayerData(client).hotBarItems[walkieTalkieSlot]).enabled) {
|
||||
messagePlayerError(client, "Please turn on a walkie talkie first!");
|
||||
return false;
|
||||
}
|
||||
|
||||
walkieTalkieTransmit(getPlayerActiveWalkieTalkieFrequency(client), params, client);
|
||||
|
||||
markPlayerActionTipSeen(client, "RadioCommandAfterEnablingWalkieTalkie");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -57,11 +57,11 @@ class JobData {
|
||||
this.colour = toColour(0, 0, 0, 255);
|
||||
this.whiteListEnabled = false;
|
||||
this.blackListEnabled = false;
|
||||
this.walkieTalkieFrequency = 0;
|
||||
this.radioFrequency = 0;
|
||||
this.index = -1;
|
||||
this.needsSaved = false;
|
||||
this.whoCreated = 0;
|
||||
this.whenCreated = 0;
|
||||
this.whoAdded = 0;
|
||||
this.whenAdded = 0;
|
||||
|
||||
/** @type {Array.<JobEquipmentData>} */
|
||||
this.equipment = [];
|
||||
@@ -95,9 +95,9 @@ class JobData {
|
||||
this.colour = toColour(dbAssoc["job_colour_r"], dbAssoc["job_colour_g"], dbAssoc["job_colour_b"], 255);
|
||||
this.whiteListEnabled = dbAssoc["job_wl"];
|
||||
this.blackListEnabled = dbAssoc["job_bl"];
|
||||
this.walkieTalkieFrequency = dbAssoc["job_walkietalkiefreq"];
|
||||
this.whoCreated = dbAssoc["job_who_added"];
|
||||
this.whenCreated = dbAssoc["job_when_added"];
|
||||
this.radioFrequency = dbAssoc["job_radio_freq"];
|
||||
this.whoAdded = dbAssoc["job_who_added"];
|
||||
this.whenAdded = dbAssoc["job_when_added"];
|
||||
|
||||
this.equipment = [];
|
||||
this.uniforms = [];
|
||||
@@ -136,8 +136,8 @@ class JobRouteData {
|
||||
//this.failedMessage = "";
|
||||
this.locationArriveMessage = "";
|
||||
this.locationGotoMessage = "";
|
||||
this.whoCreated = 0;
|
||||
this.whenCreated = 0;
|
||||
this.whoAdded = 0;
|
||||
this.whenAdded = 0;
|
||||
this.sphere = null;
|
||||
|
||||
/** @type {Array.<JobRouteLocationData>} */
|
||||
@@ -158,8 +158,8 @@ class JobRouteData {
|
||||
this.vehicleColour1 = toInteger(dbAssoc["job_route_veh_colour1"]);
|
||||
this.vehicleColour2 = toInteger(dbAssoc["job_route_veh_colour2"]);
|
||||
this.detail = toInteger(dbAssoc["job_route_detail"]);
|
||||
this.whoCreated = dbAssoc["job_route_who_added"];
|
||||
this.whenCreated = dbAssoc["job_route_when_added"];
|
||||
this.whoAdded = dbAssoc["job_route_who_added"];
|
||||
this.whenAdded = dbAssoc["job_route_when_added"];
|
||||
this.sphere = null;
|
||||
}
|
||||
}
|
||||
@@ -186,8 +186,8 @@ class JobRouteLocationData {
|
||||
this.type = V_JOB_ROUTE_LOC_TYPE_NONE;
|
||||
this.gotoMessage = "";
|
||||
this.departMessage = "";
|
||||
this.whoCreated = 0;
|
||||
this.whenCreated = 0;
|
||||
this.whoAdded = 0;
|
||||
this.whenAdded = 0;
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = toInteger(dbAssoc["job_route_loc_id"]);
|
||||
@@ -199,8 +199,8 @@ class JobRouteLocationData {
|
||||
this.pay = toInteger(dbAssoc["job_route_loc_pay"]);
|
||||
this.arriveMessage = toInteger(dbAssoc["job_route_loc_arrive_msg"]);
|
||||
this.gotoMessage = toInteger(dbAssoc["job_route_loc_goto_msg"]);
|
||||
this.whoCreated = dbAssoc["job_route_loc_who_added"];
|
||||
this.whenCreated = dbAssoc["job_route_loc_when_added"];
|
||||
this.whoAdded = dbAssoc["job_route_loc_who_added"];
|
||||
this.whenAdded = dbAssoc["job_route_loc_when_added"];
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -221,8 +221,8 @@ class JobEquipmentData {
|
||||
this.index = -1;
|
||||
this.jobIndex = -1;
|
||||
this.needsSaved = false;
|
||||
this.whoCreated = 0;
|
||||
this.whenCreated = 0;
|
||||
this.whoAdded = 0;
|
||||
this.whenAdded = 0;
|
||||
|
||||
/** @type {Array.<JobEquipmentItemData>} */
|
||||
this.items = [];
|
||||
@@ -233,8 +233,8 @@ class JobEquipmentData {
|
||||
this.name = dbAssoc["job_equip_name"];
|
||||
this.requiredRank = dbAssoc["job_equip_minrank"];
|
||||
this.enabled = dbAssoc["job_equip_enabled"];
|
||||
this.whoCreated = dbAssoc["job_equip_who_added"];
|
||||
this.whenCreated = dbAssoc["job_equip_when_added"];
|
||||
this.whoAdded = dbAssoc["job_equip_who_added"];
|
||||
this.whenAdded = dbAssoc["job_equip_when_added"];
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -254,8 +254,8 @@ class JobEquipmentItemData {
|
||||
this.index = -1;
|
||||
this.jobIndex = -1;
|
||||
this.needsSaved = false;
|
||||
this.whoCreated = 0;
|
||||
this.whenCreated = 0;
|
||||
this.whoAdded = 0;
|
||||
this.whenAdded = 0;
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = dbAssoc["job_equip_item_id"];
|
||||
@@ -263,8 +263,8 @@ class JobEquipmentItemData {
|
||||
this.itemType = dbAssoc["job_equip_item_type"];
|
||||
this.value = dbAssoc["job_equip_item_value"];
|
||||
this.enabled = dbAssoc["job_equip_item_enabled"];
|
||||
this.whoCreated = dbAssoc["job_equip_item_who_added"];
|
||||
this.whenCreated = dbAssoc["job_equip_item_when_added"];
|
||||
this.whoAdded = dbAssoc["job_equip_item_who_added"];
|
||||
this.whenAdded = dbAssoc["job_equip_item_when_added"];
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -285,8 +285,8 @@ class JobUniformData {
|
||||
this.index = -1;
|
||||
this.jobIndex = -1;
|
||||
this.needsSaved = false;
|
||||
this.whoCreated = 0;
|
||||
this.whenCreated = 0;
|
||||
this.whoAdded = 0;
|
||||
this.whenAdded = 0;
|
||||
|
||||
/*
|
||||
this.bodyParts = {
|
||||
@@ -317,8 +317,8 @@ class JobUniformData {
|
||||
this.requiredRank = dbAssoc["job_uniform_minrank"];
|
||||
this.skin = dbAssoc["job_uniform_skin"];
|
||||
this.enabled = intToBool(dbAssoc["job_uniform_enabled"]);
|
||||
this.whoCreated = dbAssoc["job_uniform_who_added"];
|
||||
this.whenCreated = dbAssoc["job_uniform_when_added"];
|
||||
this.whoAdded = dbAssoc["job_uniform_who_added"];
|
||||
this.whenAdded = dbAssoc["job_uniform_when_added"];
|
||||
|
||||
/*
|
||||
this.bodyParts = {
|
||||
@@ -364,8 +364,8 @@ class JobLocationData {
|
||||
this.jobIndex = -1;
|
||||
this.needsSaved = false;
|
||||
this.routeCache = [];
|
||||
this.whoCreated = 0;
|
||||
this.whenCreated = 0;
|
||||
this.whoAdded = 0;
|
||||
this.whenAdded = 0;
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = dbAssoc["job_loc_id"];
|
||||
@@ -376,8 +376,8 @@ class JobLocationData {
|
||||
this.enabled = intToBool(dbAssoc["job_loc_enabled"]);
|
||||
this.interior = dbAssoc["job_loc_int"];
|
||||
this.dimension = dbAssoc["job_loc_vw"];
|
||||
this.whoCreated = dbAssoc["job_loc_who_added"];
|
||||
this.whenCreated = dbAssoc["job_loc_when_added"];
|
||||
this.whoAdded = dbAssoc["job_loc_who_added"];
|
||||
this.whenAdded = dbAssoc["job_loc_when_added"];
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -397,8 +397,8 @@ class JobRankData {
|
||||
this.level = 0;
|
||||
this.enabled = false;
|
||||
this.pay = 0;
|
||||
this.whoCreated = 0;
|
||||
this.whenCreated = 0;
|
||||
this.whoAdded = 0;
|
||||
this.whenAdded = 0;
|
||||
this.flags = 0;
|
||||
this.needsSaved = false;
|
||||
this.public = false;
|
||||
@@ -410,8 +410,8 @@ class JobRankData {
|
||||
this.level = toInteger(dbAssoc["job_rank_level"]);
|
||||
this.enabled = intToBool(dbAssoc["job_rank_enabled"]);
|
||||
this.pay = toInteger(dbAssoc["job_rank_pay"]);
|
||||
this.whoCreated = toInteger(dbAssoc["job_rank_who_added"]);
|
||||
this.whenCreated = toInteger(dbAssoc["job_rank_when_added"]);
|
||||
this.whoAdded = toInteger(dbAssoc["job_rank_who_added"]);
|
||||
this.whenAdded = toInteger(dbAssoc["job_rank_when_added"]);
|
||||
this.flags = toInteger(dbAssoc["job_rank_flags"]);
|
||||
this.public = intToBool(dbAssoc["job_rank_public"]);
|
||||
}
|
||||
@@ -429,16 +429,16 @@ class JobWhiteListData {
|
||||
this.index = -1;
|
||||
this.jobIndex = -1;
|
||||
this.needsSaved = false;
|
||||
this.whoCreated = 0;
|
||||
this.whenCreated = 0;
|
||||
this.whoAdded = 0;
|
||||
this.whenAdded = 0;
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = dbAssoc["job_wl_id"];
|
||||
this.job = dbAssoc["job_wl_job"];
|
||||
this.subAccount = dbAssoc["job_wl_sacct"]
|
||||
this.enabled = dbAssoc["job_wl_enabled"];
|
||||
this.whoCreated = dbAssoc["job_wl_who_added"];
|
||||
this.whenCreated = dbAssoc["job_wl_when_added"];
|
||||
this.whoAdded = dbAssoc["job_wl_who_added"];
|
||||
this.whenAdded = dbAssoc["job_wl_when_added"];
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -454,16 +454,16 @@ class JobBlackListData {
|
||||
this.index = -1;
|
||||
this.jobIndex = -1;
|
||||
this.needsSaved = false;
|
||||
this.whoCreated = 0;
|
||||
this.whenCreated = 0;
|
||||
this.whoAdded = 0;
|
||||
this.whenAdded = 0;
|
||||
|
||||
if (dbAssoc) {
|
||||
this.databaseId = dbAssoc["job_bl_id"];
|
||||
this.job = dbAssoc["job_bl_job"];
|
||||
this.subAccount = dbAssoc["job_bl_sacct"]
|
||||
this.enabled = dbAssoc["job_bl_enabled"];
|
||||
this.whoCreated = dbAssoc["job_bl_who_added"];
|
||||
this.whenCreated = dbAssoc["job_bl_when_added"];
|
||||
this.whoAdded = dbAssoc["job_bl_who_added"];
|
||||
this.whenAdded = dbAssoc["job_bl_when_added"];
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1148,7 +1148,7 @@ function givePlayerJobEquipment(client, equipmentId) {
|
||||
for (let i in getJobData(jobId).equipment[equipmentId].items) {
|
||||
let value = getJobData(jobId).equipment[equipmentId].items[i].value
|
||||
if (getItemTypeData(getItemTypeIndexFromDatabaseId(getJobData(jobId).equipment[equipmentId].items[i].itemType)).useType == V_ITEM_USE_TYPE_WALKIETALKIE) {
|
||||
value = getJobData(jobId).walkieTalkieFrequency;
|
||||
value = getJobData(jobId).radioFrequency;
|
||||
}
|
||||
let itemId = createItem(getItemTypeIndexFromDatabaseId(getJobData(jobId).equipment[equipmentId].items[i].itemType), value, V_ITEM_OWNER_PLAYER, getPlayerCurrentSubAccount(client).databaseId);
|
||||
getItemData(itemId).needsSaved = false;
|
||||
@@ -1818,7 +1818,9 @@ function setPlayerJobRankCommand(command, params, client) {
|
||||
}
|
||||
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let rankIndex = getJobRankFromParams(jobIndex, params.split(" ").slice(2).join(" "));
|
||||
let rankParam = getJobRankFromParams(jobIndex, params.split(" ").slice(2).join(" "));
|
||||
|
||||
let rankIndex = getJobRankFromParams(jobIndex, rankParam);
|
||||
|
||||
if (!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
@@ -2763,7 +2765,7 @@ function setAllJobDataIndexes() {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function createJobLocation(jobId, position, interior, dimension, whoCreated) {
|
||||
function createJobLocation(jobId, position, interior, dimension, whoAdded) {
|
||||
let jobLocationData = new JobLocationData(false);
|
||||
jobLocationData.position = position;
|
||||
jobLocationData.jobId = getJobData(jobId).databaseId;
|
||||
@@ -2772,8 +2774,8 @@ function createJobLocation(jobId, position, interior, dimension, whoCreated) {
|
||||
jobLocationData.enabled = true;
|
||||
jobLocationData.jobIndex = jobId;
|
||||
jobLocationData.needsSaved = true;
|
||||
jobLocationData.whoCreated = whoCreated;
|
||||
jobLocationData.whenCreated = getCurrentUnixTimestamp();
|
||||
jobLocationData.whoAdded = whoAdded;
|
||||
jobLocationData.whenAdded = getCurrentUnixTimestamp();
|
||||
|
||||
getServerData().jobs[jobId].locations.push(jobLocationData);
|
||||
let newSlot = getServerData().jobs[jobId].locations.length - 1;
|
||||
@@ -2811,11 +2813,11 @@ function saveJobToDatabase(jobData) {
|
||||
["job_colour_r", colour[0]],
|
||||
["job_colour_g", colour[1]],
|
||||
["job_colour_b", colour[2]],
|
||||
["job_walkietalkiefreq", jobData.walkieTalkieFrequency],
|
||||
["job_radio_freq", jobData.radioFrequency],
|
||||
["job_wl", jobData.whiteListEnabled],
|
||||
["job_bl", jobData.blackListEnabled],
|
||||
["job_who_added", jobData.whoCreated],
|
||||
["job_when_added", jobData.whenCreated],
|
||||
["job_who_added", jobData.whoAdded],
|
||||
["job_when_added", jobData.whenAdded],
|
||||
];
|
||||
|
||||
let dbQuery = null;
|
||||
@@ -2863,8 +2865,8 @@ function saveJobRankToDatabase(jobRankData) {
|
||||
["job_rank_flags", jobRankData.flags],
|
||||
["job_rank_pay", jobRankData.pay],
|
||||
["job_rank_level", jobRankData.level],
|
||||
["job_rank_who_added", jobRankData.whoCreated],
|
||||
["job_rank_when_added", jobRankData.whenCreated],
|
||||
["job_rank_who_added", jobRankData.whoAdded],
|
||||
["job_rank_when_added", jobRankData.whenAdded],
|
||||
["job_rank_public", boolToInt(jobRankData.public)],
|
||||
];
|
||||
|
||||
@@ -2930,8 +2932,8 @@ function saveJobRouteToDatabase(jobRouteData) {
|
||||
["job_route_loc_goto_msg", safeLocationNextMessage],
|
||||
["job_route_pay", jobRouteData.pay],
|
||||
["job_route_detail", jobRouteData.detail],
|
||||
["job_route_who_added", jobRouteData.whoCreated],
|
||||
["job_route_when_added", jobRouteData.whenCreated],
|
||||
["job_route_who_added", jobRouteData.whoAdded],
|
||||
["job_route_when_added", jobRouteData.whenAdded],
|
||||
];
|
||||
|
||||
let dbQuery = null;
|
||||
@@ -2987,8 +2989,8 @@ function saveJobRouteLocationToDatabase(jobRouteLocationData) {
|
||||
["job_route_loc_z", jobRouteLocationData.position.z],
|
||||
["job_route_loc_pay", jobRouteLocationData.pay],
|
||||
["job_route_loc_delay", jobRouteLocationData.stopDelay],
|
||||
["job_route_loc_who_added", jobRouteLocationData.whoCreated],
|
||||
["job_route_loc_when_added", jobRouteLocationData.whenCreated],
|
||||
["job_route_loc_who_added", jobRouteLocationData.whoAdded],
|
||||
["job_route_loc_when_added", jobRouteLocationData.whenAdded],
|
||||
];
|
||||
|
||||
let dbQuery = null;
|
||||
@@ -3042,8 +3044,8 @@ function saveJobLocationToDatabase(jobLocationData) {
|
||||
["job_loc_pos_z", jobLocationData.position.z],
|
||||
["job_loc_int", jobLocationData.interior],
|
||||
["job_loc_vw", jobLocationData.dimension],
|
||||
["job_loc_who_added", jobLocationData.whoCreated],
|
||||
["job_loc_when_added", jobLocationData.whenCreated],
|
||||
["job_loc_who_added", jobLocationData.whoAdded],
|
||||
["job_loc_when_added", jobLocationData.whenAdded],
|
||||
];
|
||||
|
||||
let dbQuery = null;
|
||||
@@ -3097,12 +3099,12 @@ function saveJobEquipmentToDatabase(jobEquipmentData) {
|
||||
["job_equip_enabled", boolToInt(jobEquipmentData.enabled)],
|
||||
["job_equip_minrank", jobLocationData.requiredRank],
|
||||
["job_equip_name", safeName],
|
||||
["job_equip_who_added", jobEquipmentData.whoCreated],
|
||||
["job_equip_when_added", jobEquipmentData.whenCreated],
|
||||
["job_equip_who_added", jobEquipmentData.whoAdded],
|
||||
["job_equip_when_added", jobEquipmentData.whenAdded],
|
||||
];
|
||||
|
||||
let dbQuery = null;
|
||||
if (tempJobRouteData.databaseId == 0) {
|
||||
if (jobEquipmentData.databaseId == 0) {
|
||||
let queryString = createDatabaseInsertQuery("job_equip", data);
|
||||
dbQuery = queryDatabase(dbConnection, queryString);
|
||||
jobEquipmentData.databaseId = getDatabaseInsertId(dbConnection);
|
||||
@@ -3150,12 +3152,12 @@ function saveJobEquipmentItemToDatabase(jobEquipmentItemData) {
|
||||
["job_equip_item_enabled", boolToInt(jobEquipmentItemData.enabled)],
|
||||
["job_equip_item_type", jobEquipmentItemData.itemType],
|
||||
["job_equip_item_value", jobEquipmentItemData.value],
|
||||
["job_equip_item_who_added", jobEquipmentItemData.whoCreated],
|
||||
["job_equip_item_when_added", jobEquipmentItemData.whenCreated],
|
||||
["job_equip_item_who_added", jobEquipmentItemData.whoAdded],
|
||||
["job_equip_item_when_added", jobEquipmentItemData.whenAdded],
|
||||
];
|
||||
|
||||
let dbQuery = null;
|
||||
if (tempJobRouteData.databaseId == 0) {
|
||||
if (jobEquipmentItemData.databaseId == 0) {
|
||||
let queryString = createDatabaseInsertQuery("job_equip_item", data);
|
||||
dbQuery = queryDatabase(dbConnection, queryString);
|
||||
jobEquipmentItemData.databaseId = getDatabaseInsertId(dbConnection);
|
||||
@@ -3199,17 +3201,17 @@ function saveJobUniformToDatabase(jobUniformData) {
|
||||
if (dbConnection) {
|
||||
let safeName = escapeDatabaseString(dbConnection, jobUniformData.name);
|
||||
let data = [
|
||||
["job_uniform_job", jobUniformData.jobId],
|
||||
["job_uniform_job", jobUniformData.job],
|
||||
["job_uniform_enabled", boolToInt(jobUniformData.enabled)],
|
||||
["job_uniform_minrank", jobUniformData.requiredRank],
|
||||
["job_uniform_name", safeName],
|
||||
["job_uniform_model", jobUniformData.skin],
|
||||
["job_uniform_who_added", jobUniformData.whoCreated],
|
||||
["job_uniform_when_added", jobUniformData.whenCreated],
|
||||
["job_uniform_skin", jobUniformData.skin],
|
||||
["job_uniform_who_added", jobUniformData.whoAdded],
|
||||
["job_uniform_when_added", jobUniformData.whenAdded],
|
||||
];
|
||||
|
||||
let dbQuery = null;
|
||||
if (tempJobRouteData.databaseId == 0) {
|
||||
if (jobUniformData.databaseId == 0) {
|
||||
let queryString = createDatabaseInsertQuery("job_uniform", data);
|
||||
dbQuery = queryDatabase(dbConnection, queryString);
|
||||
jobUniformData.databaseId = getDatabaseInsertId(dbConnection);
|
||||
@@ -3686,14 +3688,14 @@ function createJobUniformCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
createJobUniform(jobId, skinIndex);
|
||||
createJobUniform(jobId, skinIndex, getPlayerData(client).accountData.databaseId);
|
||||
messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created uniform with skin {ALTCOLOUR}${getSkinNameFromIndex(skinIndex)} (${getGameConfig().skins[getGame()][skinIndex][0]}){MAINCOLOUR} for job {jobYellow}${getJobData(jobId).name}`);
|
||||
return true;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function createJobRoute(routeName, closestJobLocation, whoCreated = defaultNoAccountId) {
|
||||
function createJobRoute(routeName, closestJobLocation, whoAdded = defaultNoAccountId) {
|
||||
let tempJobRouteData = new JobRouteData(false);
|
||||
tempJobRouteData.name = routeName;
|
||||
tempJobRouteData.jobId = closestJobLocation.jobId;
|
||||
@@ -3708,8 +3710,8 @@ function createJobRoute(routeName, closestJobLocation, whoCreated = defaultNoAcc
|
||||
tempJobRouteData.finishMessage = `You have finished the {ALTCOLOUR}{JOBROUTENAME}{MAINCOLOUR} route and {ALTCOLOUR}{JOBROUTEPAY}{MAINCOLOUR} has been added to your next paycheck!`;
|
||||
tempJobRouteData.locationArriveMessage = `You arrived at a stop.`;
|
||||
tempJobRouteData.locationGotoMessage = `Drive to the next stop.`;
|
||||
tempJobRouteData.whoCreated = whoCreated;
|
||||
tempJobRouteData.whenCreated = getCurrentUnixTimestamp();
|
||||
tempJobRouteData.whoAdded = whoAdded;
|
||||
tempJobRouteData.whenAdded = getCurrentUnixTimestamp();
|
||||
|
||||
let routeId = getJobData(closestJobLocation.jobIndex).routes.push(tempJobRouteData);
|
||||
saveJobRouteToDatabase(tempJobRouteData);
|
||||
@@ -3719,7 +3721,7 @@ function createJobRoute(routeName, closestJobLocation, whoCreated = defaultNoAcc
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function createJobRouteLocation(routeLocationName, position, jobRouteData, whoCreated = defaultNoAccountId, delay = 0, arriveMessage = "", gotoMessage = "", type = V_JOB_ROUTE_LOC_TYPE_NONE) {
|
||||
function createJobRouteLocation(routeLocationName, position, jobRouteData, whoAdded = defaultNoAccountId, delay = 0, arriveMessage = "", gotoMessage = "", type = V_JOB_ROUTE_LOC_TYPE_NONE) {
|
||||
let tempJobRouteLocationData = new JobRouteLocationData(false);
|
||||
tempJobRouteLocationData.name = routeLocationName;
|
||||
tempJobRouteLocationData.routeId = jobRouteData.databaseId;
|
||||
@@ -3731,8 +3733,8 @@ function createJobRouteLocation(routeLocationName, position, jobRouteData, whoCr
|
||||
tempJobRouteLocationData.arriveMessage = arriveMessage;
|
||||
tempJobRouteLocationData.gotoMessage = gotoMessage;
|
||||
tempJobRouteLocationData.type = type;
|
||||
tempJobRouteLocationData.whoCreated = whoCreated;
|
||||
tempJobRouteLocationData.whenCreated = getCurrentUnixTimestamp();
|
||||
tempJobRouteLocationData.whoAdded = whoAdded;
|
||||
tempJobRouteLocationData.whenAdded = getCurrentUnixTimestamp();
|
||||
|
||||
getJobData(jobRouteData.jobIndex).routes[jobRouteData.index].locations.push(tempJobRouteLocationData);
|
||||
//saveJobRouteLocationToDatabase(tempJobRouteLocationData);
|
||||
@@ -3741,13 +3743,16 @@ function createJobRouteLocation(routeLocationName, position, jobRouteData, whoCr
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function createJobUniform(jobId, skinIndex) {
|
||||
function createJobUniform(jobId, skinIndex, whoAdded = defaultNoAccountId) {
|
||||
let tempJobUniformData = new JobUniformData(false);
|
||||
tempJobUniformData.skin = skinIndex;
|
||||
tempJobUniformData.jobIndex = jobId;
|
||||
tempJobUniformData.job = getJobData(jobId).databaseId;
|
||||
tempJobUniformData.name = getGameConfig().skins[getGame()][skinIndex][1];
|
||||
tempJobUniformData.whoAdded = whoAdded;
|
||||
tempJobUniformData.whenAdded = getCurrentUnixTimestamp();
|
||||
tempJobUniformData.needsSaved = true;
|
||||
tempJobUniformData.enabled = true;
|
||||
|
||||
getJobData(jobId).uniforms.push(tempJobUniformData);
|
||||
|
||||
@@ -3822,6 +3827,11 @@ function deleteJobUniformCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (doesPlayerHaveJobPermission(client, getJobFlagValue("ManageUniforms"))) {
|
||||
messagePlayerError(client, "You can't edit job uniforms!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isNaN(uniformIndex)) {
|
||||
messagePlayerError(client, getLocaleString(client, "MustBeNumber"));
|
||||
return false;
|
||||
@@ -3841,6 +3851,82 @@ function deleteJobUniformCommand(command, params, client) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setJobUniformMinimumRankCommand(command, params, client) {
|
||||
let uniformIndex = getParam(params, " ", 1);
|
||||
let newRankLevel = getParam(params, " ", 2);
|
||||
|
||||
if (!getJobData(jobId)) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidJob"));
|
||||
return false;
|
||||
}
|
||||
|
||||
let jobIndex = getPlayerJob(client);
|
||||
|
||||
if (doesPlayerHaveJobPermission(client, getJobFlagValue("ManageUniforms"))) {
|
||||
messagePlayerError(client, "You can't edit job uniforms!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isNaN(uniformIndex)) {
|
||||
messagePlayerError(client, getLocaleString(client, "MustBeNumber"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isNaN(newRankLevel)) {
|
||||
messagePlayerError(client, getLocaleString(client, "MustBeNumber"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (typeof getJobData(jobId).uniforms[uniformIndex] == "undefined") {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidJobUniform"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (newRankLevel < 0) {
|
||||
messagePlayerError(client, "The rank can't be negative!");
|
||||
return false;
|
||||
}
|
||||
|
||||
getJobData(jobIndex).uniforms[uniformIndex].requiredRank = newRankLevel;
|
||||
getJobData(jobIndex).uniforms[uniformIndex].needsSaved = true;
|
||||
messagePlayerSuccess(client, `You set job uniform ${getJobUniformData(jobIndex, uniformIndex).name}'s minimum rank to ${newRankLevel}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setJobUniformNameCommand(command, params, client) {
|
||||
let uniformIndex = getParam(params, " ", 1);
|
||||
let newName = params.slice(1).join(" ");
|
||||
|
||||
if (!getJobData(jobId)) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidJob"));
|
||||
return false;
|
||||
}
|
||||
|
||||
let jobIndex = getPlayerJob(client);
|
||||
|
||||
if (doesPlayerHaveJobPermission(client, getJobFlagValue("ManageUniforms"))) {
|
||||
messagePlayerError(client, "You can't edit job uniforms!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isNaN(uniformIndex)) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidJobUniform"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (typeof getJobData(jobId).uniforms[uniformIndex] == "undefined") {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidJobUniform"));
|
||||
return false;
|
||||
}
|
||||
|
||||
getJobData(jobIndex).uniforms[uniformIndex].name = newName;
|
||||
getJobData(jobIndex).uniforms[uniformIndex].needsSaved = true;
|
||||
messagePlayerSuccess(client, `You set job uniform ${getJobUniformData(jobIndex, uniformIndex).name}'s name to ${newName}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getJobFromParams(params) {
|
||||
if (isNaN(params)) {
|
||||
for (let i in getServerData().jobs) {
|
||||
@@ -4315,6 +4401,31 @@ function getJobRankFromParams(jobIndex, params) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* @param {Number} jobIndex - The job index to search uniforms for
|
||||
* @param {String} params - The params to search for
|
||||
* @return {Number} The data index of a matching job
|
||||
*/
|
||||
function getJobUniformFromParams(jobIndex, params) {
|
||||
if (isNaN(params)) {
|
||||
for (let i in getJobData(jobIndex).uniforms) {
|
||||
if ((toLowerCase(getJobData(jobIndex).uniforms[i].name).indexOf(toLowerCase(params)) != -1)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (let i in getJobData(jobIndex).uniforms) {
|
||||
if (getJobData(jobIndex).uniforms[i].level == toInteger(params)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getJobRoutesCommand(command, params, client) {
|
||||
let closestJobLocation = getClosestJobLocation(getPlayerPosition(client));
|
||||
|
||||
@@ -4326,7 +4437,7 @@ function getJobRoutesCommand(command, params, client) {
|
||||
let jobData = getJobData(closestJobLocation.jobIndex);
|
||||
|
||||
let jobRoutesList = jobData.routes.map(function (r) {
|
||||
return `{chatBoxListIndex}${r.index}: ${(r.enabled) ? "{softGreen}" : "{softRed}"}${r.name} {ALTCOLOUR}(${r.locations.length} stops, added ${getTimeDifferenceDisplay(getCurrentUnixTimestamp(), r.whenCreated)} ago)`;
|
||||
return `{chatBoxListIndex}${r.index}: ${(r.enabled) ? "{softGreen}" : "{softRed}"}${r.name} {ALTCOLOUR}(${r.locations.length} stops, added ${getTimeDifferenceDisplay(getCurrentUnixTimestamp(), r.whenAdded)} ago)`;
|
||||
});
|
||||
let chunkedList = splitArrayIntoChunks(jobRoutesList, 2);
|
||||
|
||||
@@ -4368,8 +4479,8 @@ function getJobRouteInfoCommand(command, params, client) {
|
||||
[`ID`, `${jobRouteData.index}/${jobRouteData.databaseId}`],
|
||||
[`Job`, `${jobData.name}`],
|
||||
[`Name`, `${jobRouteData.name}`],
|
||||
[`Added By`, `${loadAccountFromId(jobRouteData.whoCreated).name}`],
|
||||
[`Added On`, `${new Date(jobRouteData.whenCreated * 1000).toLocaleDateString("en-GB")}`],
|
||||
[`Added By`, `${loadAccountFromId(jobRouteData.whoAdded).name}`],
|
||||
[`Added On`, `${new Date(jobRouteData.whenAdded * 1000).toLocaleDateString("en-GB")}`],
|
||||
[`Enabled`, `${getYesNoFromBool(jobRouteData.enabled)}`],
|
||||
[`Stops`, `${jobRouteData.locations.length}`],
|
||||
[`Pay`, `${getCurrencyString(jobRouteData.pay)}`],
|
||||
@@ -4462,4 +4573,62 @@ function jobUninviteCommand(command, params, client) {
|
||||
getPlayerCurrentSubAccount(targetClient).jobRankIndex = -1;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function addPlayerToJobBlackList(client, jobIndex, whoAdded = defaultNoAccountId) {
|
||||
let tempJobBlackListData = new JobBlackListData(false);
|
||||
tempJobBlackListData.subAccount = getPlayerCurrentSubAccount(client).databaseId;
|
||||
tempJobBlackListData.jobIndex = jobIndex;
|
||||
tempJobBlackListData.job = getJobData(jobIndex).databaseId;
|
||||
tempJobBlackListData.whoAdded = whoAdded;
|
||||
tempJobBlackListData.whenAdded = getCurrentUnixTimestamp();
|
||||
tempJobBlackListData.needsSaved = true;
|
||||
|
||||
getJobData(jobIndex).blackList.push(tempJobBlackListData);
|
||||
setAllJobDataIndexes();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function addPlayerToJobWhiteList(client, jobIndex, whoAdded = defaultNoAccountId) {
|
||||
let tempJobWhiteListData = new JobWhiteListData(false);
|
||||
tempJobWhiteListData.subAccount = getPlayerCurrentSubAccount(client).databaseId;
|
||||
tempJobWhiteListData.jobIndex = jobIndex;
|
||||
tempJobWhiteListData.job = getJobData(jobIndex).databaseId;
|
||||
tempJobWhiteListData.whoAdded = whoAdded;
|
||||
tempJobWhiteListData.whenAdded = getCurrentUnixTimestamp();
|
||||
tempJobWhiteListData.needsSaved = true;
|
||||
|
||||
getJobData(jobIndex).whiteList.push(tempJobWhiteListData);
|
||||
setAllJobDataIndexes();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function removePlayerFromJobBlackList(client, jobIndex, whoDeleted = defaultNoAccountId) {
|
||||
quickDatabaseQuery(`UPDATE job_bl SET job_bl_deleted = 1, job_bl_who_deleted = ${whoDeleted}, job_bl_when_deleted = UNIX_TIMESTAMP() WHERE job_bl_sacct = ${getPlayerCurrentSubAccount(client).databaseId}`)
|
||||
|
||||
for (let i in getServerData().jobs[jobIndex].blackList) {
|
||||
if (getServerData().jobs[jobIndex].blackList[i].subAccount == getPlayerCurrentSubAccount(client).databaseId) {
|
||||
getServerData().jobs[jobIndex].splice(i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
setAllJobDataIndexes();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function removePlayerFromJobWhiteList(client, jobIndex, whoDeleted = defaultNoAccountId) {
|
||||
quickDatabaseQuery(`UPDATE job_wl SET job_wl_deleted = 1, job_wl_who_deleted = ${whoDeleted}, job_wl_when_deleted = UNIX_TIMESTAMP() WHERE job_wl_sacct = ${getPlayerCurrentSubAccount(client).databaseId}`)
|
||||
|
||||
for (let i in getServerData().jobs[jobIndex].whiteList) {
|
||||
if (getServerData().jobs[jobIndex].whiteList[i].subAccount == getPlayerCurrentSubAccount(client).databaseId) {
|
||||
getServerData().jobs[jobIndex].splice(i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
setAllJobDataIndexes();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -62,8 +62,19 @@ function getPlayerPosition(client) {
|
||||
if (!areServerElementsSupported()) {
|
||||
return getPlayerData(client).syncPosition;
|
||||
} else {
|
||||
if (getPlayerPed(client) != null) {
|
||||
return getPlayerPed(client).position;
|
||||
// Check if Mafia 1, player position is bugged when in a vehicle
|
||||
if (getGame() == V_GAME_MAFIA_ONE) {
|
||||
if (isPlayerInAnyVehicle(client)) {
|
||||
return getPlayerVehicle(client).position;
|
||||
} else {
|
||||
return getPlayerPed(client).position;
|
||||
}
|
||||
} else {
|
||||
if (getPlayerPed(client) != null) {
|
||||
return getPlayerPed(client).position;
|
||||
} else {
|
||||
return toVector3(0.0, 0.0, 0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -166,6 +177,10 @@ function isPlayerInAnyVehicle(client) {
|
||||
if (!areServerElementsSupported()) {
|
||||
return (getPlayerData().syncVehicle != null);
|
||||
} else {
|
||||
if (getPlayerPed(client) == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (getPlayerPed(client).vehicle != null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,14 +219,14 @@ function callPayPhoneCommand(command, params, client) {
|
||||
}
|
||||
|
||||
if (getPlayerData(targetClient).usingPayPhone != -1 || isPlayerRestrained(targetClient) || isPlayerSurrendered(targetClient) || isPlayerMuted(targetClient) || !isPlayerSpawned(targetClient)) {
|
||||
messagePlayerError(client, getLocaleString(client, "UnableToCallPlayer"));
|
||||
messagePlayerError(client, getLocaleString(client, "UnableToCallPlayer", getCharacterFullName(targetClient)));
|
||||
return false;
|
||||
}
|
||||
|
||||
let closestPayPhoneTarget = getClosestPayPhone(getPlayerPosition(targetClient));
|
||||
|
||||
if (closestPayPhoneTarget == closestPayPhone) {
|
||||
messagePlayerError(client, getLocaleString(client, "UnableToCallPlayer"));
|
||||
messagePlayerError(client, getLocaleString(client, "UnableToCallPlayer", getCharacterFullName(targetClient)));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -329,4 +329,146 @@ function getRadioStationData(radioStationIndex) {
|
||||
return getServerData().radioStations[radioStationIndex];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function radioTransmitCommand(command, params, client) {
|
||||
let possibleRadio = getPlayerFirstItemSlotByUseType(client, V_ITEM_USE_TYPE_WALKIETALKIE);
|
||||
|
||||
let frequency = -1;
|
||||
|
||||
if (possibleRadio != -1) {
|
||||
if (getItemData(possibleRadio).enabled) {
|
||||
frequency = getItemData(possibleRadio).value;
|
||||
}
|
||||
} else {
|
||||
let vehicle = null;
|
||||
|
||||
if (isPlayerInAnyVehicle(client)) {
|
||||
vehicle = getPlayerVehicle(client);
|
||||
} else {
|
||||
let tempVehicle = getClosestVehicle(getPlayerPosition(client));
|
||||
if (getDistance(getPlayerPosition(client), getVehiclePosition(tempVehicle)) <= getGlobalConfig().vehicleTrunkDistance) {
|
||||
vehicle = tempVehicle;
|
||||
}
|
||||
}
|
||||
|
||||
if (vehicle == null) {
|
||||
messagePlayerError(client, getLocaleString(client, "NoRadioToUse"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!doesVehicleHaveTransmitRadio(vehicle)) {
|
||||
messagePlayerError(client, getLocaleString(client, "NoRadioToUse"));
|
||||
return false;
|
||||
}
|
||||
|
||||
frequency = getVehicleData(vehicle).radioFrequency;
|
||||
}
|
||||
|
||||
if (frequency == -1) {
|
||||
messagePlayerError(client, getLocaleString(client, "NoRadioToUse"));
|
||||
return false;
|
||||
}
|
||||
|
||||
sendRadioTransmission(frequency, params, client);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendRadioTransmission(frequency, messageText, sentFromClient) {
|
||||
let seenClients = [];
|
||||
seenClients.push(sentFromClient);
|
||||
|
||||
let clients = getClients();
|
||||
|
||||
for (let i in clients) {
|
||||
if (seenClients.indexOf(clients[i]) == -1) {
|
||||
if (getDistance(getPlayerPosition(clients[i]), getPlayerPosition(sentFromClient)) <= getGlobalConfig().talkDistance) {
|
||||
seenClients.push(clients[i]);
|
||||
messagePlayerNormal(`[#CCCCCC]${getCharacterFullName(client)} {ALTCOLOUR}(to radio): {MAINCOLOUR}${messageText}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let vehicles = getServerData().vehicles;
|
||||
for (let i in vehicles) {
|
||||
if (getVehicleData(vehicles[i]).radioFrequency == frequency) {
|
||||
for (let j in clients) {
|
||||
if (seenClients.indexOf(clients[j]) == -1) {
|
||||
if (getDistance(getPlayerPosition(clients[j]), getVehiclePosition(getServerData().vehicles[j].vehicle)) <= getGlobalConfig().transmitRadioSpeakerDistance) {
|
||||
seenClients.push(clients[j]);
|
||||
messagePlayerNormal(clients[j], `📻 {ALTCOLOUR}(On Radio): {MAINCOLOUR}${messageText}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let items = getServerData().items;
|
||||
for (let i in items) {
|
||||
if (items[i].enabled) {
|
||||
if (getItemTypeData(items[i].itemTypeIndex).useType == V_ITEM_USE_TYPE_WALKIETALKIE) {
|
||||
if (items[i].value == frequency) {
|
||||
for (let j in clients) {
|
||||
if (seenClients.indexOf(clients[j]) == -1) {
|
||||
if (getDistance(getPlayerPosition(clients[j], getItemPosition(i))) <= getGlobalConfig().transmitRadioSpeakerDistance) {
|
||||
seenClients.push(clients[j]);
|
||||
messagePlayerNormal(clients[j], `📻 {ALTCOLOUR}(On Radio): {MAINCOLOUR}${messageText}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setRadioFrequencyCommand(command, params, client) {
|
||||
// Needs finished
|
||||
return false;
|
||||
|
||||
/*
|
||||
if (areParamsEmpty(params)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isNaN(params)) {
|
||||
messagePlayerError(client, ``);
|
||||
return false;
|
||||
}
|
||||
|
||||
params = toInteger(params);
|
||||
|
||||
if (params < 100 || params > 500) {
|
||||
messagePlayerError(client, `The frequency channel must be between 100 and 500!`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!getPlayerActiveItem(client)) {
|
||||
messagePlayerError(client, `You aren't holding a walkie talkie!`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!getItemData(getPlayerActiveItem(client))) {
|
||||
messagePlayerError(client, `You aren't holding a walkie talkie!`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (getItemData(getPlayerActiveItem(client)).enabled) {
|
||||
if (!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "use")) {
|
||||
messagePlayerError(client, `Your walkie talkie is turned off. Press ${toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "use")).key)} to turn it on`);
|
||||
} else {
|
||||
messagePlayerError(client, `Your walkie talkie is turned off. Type {ALTCOLOUR}/use {MAINCOLOUR}to turn it on`);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
getItemData(getPlayerActiveItem(client)).value = params * 100;
|
||||
messagePlayerSuccess(client, getLocaleString(client, "FrequencyChannelChanged", `Walkie Talkie`, `${getPlayerData(client).activeHotBarSlot + 1}`, `${getItemValueDisplayForItem(getPlayerActiveItem(client))}`));
|
||||
*/
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -172,6 +172,7 @@ function setAllServerDataIndexes() {
|
||||
setAllRaceDataIndexes();
|
||||
setAllRadioStationIndexes();
|
||||
setAllPayPhoneIndexes();
|
||||
setAllVehicleRadioTransmitFrequencies();
|
||||
cacheAllGroundItems();
|
||||
cacheAllBusinessItems();
|
||||
cacheAllItemItems();
|
||||
|
||||
@@ -208,8 +208,20 @@ function loadSubAccountsFromAccount(accountId) {
|
||||
let clanRankIndex = getClanRankIndexFromDatabaseId(clanIndex, tempSubAccount.clanRank);
|
||||
if (!getClanRankData(clanIndex, clanRankIndex)) {
|
||||
let newClanRankIndex = getLowestClanRank(clanIndex);
|
||||
tempSubAccount.clanRank = getClanRankData(clanIndex, newClanRankIndex).databaseId
|
||||
tempSubAccount.clanRankIndex = newClanRankIndex;
|
||||
if (getClanRankData(clanIndex, newClanRankIndex) != false) {
|
||||
console.log(LOG_DEBUG | LOG_WARN, `[V.RP.SubAccount]: Clan ${clanIndex} has no rank ${tempSubAccount.clanRank}! Using lowest rank ${newClanRankIndex} instead.`);
|
||||
tempSubAccount.clanRank = getClanRankData(clanIndex, newClanRankIndex).databaseId;
|
||||
tempSubAccount.clanRankIndex = newClanRankIndex;
|
||||
} else {
|
||||
// Somethings fucked. Clan rank invalid, and no other rank to use. Removing from clan.
|
||||
logToConsole(LOG_DEBUG | LOG_ERROR, `[V.RP.SubAccount]: Clan ${clanIndex} has no rank ${tempSubAccount.clanRank}, and no other rank to use. Removing from clan ...`);
|
||||
tempSubAccount.clan = 0;
|
||||
tempSubAccount.clanRank = 0;
|
||||
tempSubAccount.clanIndex = -1;
|
||||
tempSubAccount.clanRankIndex = -1;
|
||||
tempSubAccount.clanTitle = "";
|
||||
tempSubAccount.clanFlags = 0;
|
||||
}
|
||||
} else {
|
||||
tempSubAccount.clanRankIndex = clanRankIndex;
|
||||
}
|
||||
@@ -231,7 +243,19 @@ function loadSubAccountsFromAccount(accountId) {
|
||||
let jobRankIndex = getJobRankIndexFromDatabaseId(jobIndex, tempSubAccount.jobRank);
|
||||
if (!getJobRankData(jobIndex, jobRankIndex)) {
|
||||
let newJobRankIndex = getLowestJobRank(jobIndex);
|
||||
console.log(`[V.RP.SubAccount]: Job ${jobIndex} has no rank ${tempSubAccount.jobRank}! Using lowest rank ${newJobRankIndex} instead.`);
|
||||
if (getJobRankData(jobIndex, newJobRankIndex) != false) {
|
||||
console.log(LOG_DEBUG | LOG_WARN, `[V.RP.SubAccount]: Job ${jobIndex} has no rank ${tempSubAccount.jobRank}! Using lowest rank ${newJobRankIndex} instead.`);
|
||||
tempSubAccount.jobRank = getJobRankData(jobIndex, newJobRankIndex).databaseId;
|
||||
tempSubAccount.jobRankIndex = newJobRankIndex;
|
||||
} else {
|
||||
// Somethings fucked. Job rank invalid, and no other rank to use. Removing from Job.
|
||||
logToConsole(LOG_DEBUG | LOG_ERROR, `[V.RP.SubAccount]: Job ${jobIndex} has no rank ${tempSubAccount.jobRank}, and no other rank to use. Removing from job ...`);
|
||||
tempSubAccount.job = 0;
|
||||
tempSubAccount.jobRank = 0;
|
||||
tempSubAccount.jobIndex = -1;
|
||||
tempSubAccount.jobRankIndex = -1;
|
||||
}
|
||||
|
||||
tempSubAccount.jobRank = getJobRankData(jobIndex, newJobRankIndex).databaseId;
|
||||
tempSubAccount.jobRankIndex = newJobRankIndex;
|
||||
} else {
|
||||
|
||||
@@ -87,6 +87,7 @@ class VehicleData {
|
||||
this.whoAdded = 0;
|
||||
this.whenAdded = 0;
|
||||
this.licensePlate = "";
|
||||
this.radioFrequency = -1;
|
||||
|
||||
this.lastActiveTime = false;
|
||||
|
||||
@@ -160,6 +161,9 @@ class VehicleData {
|
||||
this.whenAdded = toInteger(dbAssoc["veh_when_added"]);
|
||||
this.licensePlate = toInteger(dbAssoc["veh_license_plate"]);
|
||||
this.rank = toInteger(dbAssoc["veh_rank"]);
|
||||
this.radioFrequency = toInteger(dbAssoc["veh_radio_freq"]);
|
||||
this.whoAdded = toInteger(dbAssoc["veh_who_added"]);
|
||||
this.whenAdded = toInteger(dbAssoc["veh_when_added"]);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1988,4 +1992,36 @@ function getVehicleDataIndexFromVehicle(vehicle) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function doesVehicleHaveTransmitRadio(vehicle) {
|
||||
if (getVehicleData(vehicle).ownerType == V_VEHOWNER_JOB) {
|
||||
if (getJobType(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)) == V_JOB_POLICE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (getJobType(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)) == V_JOB_FIRE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (getJobType(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)) == V_JOB_MEDICAL) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setAllVehicleRadioTransmitFrequencies() {
|
||||
for (let i in getServerData().vehicles) {
|
||||
if (getServerData().vehicles[i].ownerType == V_VEHOWNER_JOB) {
|
||||
if (getJobData(getJobIdFromDatabaseId(getServerData().vehicles[i].ownerId)) != false) {
|
||||
getServerData().vehicles[i].radioFrequency = getJobData(getJobIdFromDatabaseId(getServerData().vehicles[i].ownerId)).radioFrequency;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
Reference in New Issue
Block a user