Prefix
This commit is contained in:
@@ -22,7 +22,7 @@ function makePedPlayAnimation(pedId, animationSlot, positionOffset) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let animationData = getAnimationData(animationSlot);
|
let animationData = getAnimationData(animationSlot);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Animation] Playing animation ${animationData[0]} for ped ${pedId}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Animation] Playing animation ${animationData[0]} for ped ${pedId}`);
|
||||||
|
|
||||||
let freezePlayer = false;
|
let freezePlayer = false;
|
||||||
switch (animationData.moveType) {
|
switch (animationData.moveType) {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ function initBusinessScript() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked, hasItems, entranceFee) {
|
function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked, hasItems, entranceFee) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Business] Received business ${businessId} (${name}) from server`);
|
logToConsole(LOG_DEBUG, `[V.RP.Business] Received business ${businessId} (${name}) from server`);
|
||||||
|
|
||||||
if (!areServerElementsSupported() || getGame() == V_GAME_MAFIA_ONE || getGame() == V_GAME_GTA_IV) {
|
if (!areServerElementsSupported() || getGame() == V_GAME_MAFIA_ONE || getGame() == V_GAME_GTA_IV) {
|
||||||
if (getBusinessData(businessId) != false) {
|
if (getBusinessData(businessId) != false) {
|
||||||
@@ -62,10 +62,10 @@ function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Business] Business ${businessId} already exists. Checking blip ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Business] Business ${businessId} already exists. Checking blip ...`);
|
||||||
if (blipModel == -1) {
|
if (blipModel == -1) {
|
||||||
if (businessData.blipId != -1) {
|
if (businessData.blipId != -1) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Business] Business ${businessId}'s blip has been removed by the server`);
|
logToConsole(LOG_DEBUG, `[V.RP.Business] Business ${businessId}'s blip has been removed by the server`);
|
||||||
if (getGame() == V_GAME_GTA_IV) {
|
if (getGame() == V_GAME_GTA_IV) {
|
||||||
natives.removeBlipAndClearIndex(getBusinessData(businessId).blipId);
|
natives.removeBlipAndClearIndex(getBusinessData(businessId).blipId);
|
||||||
} else {
|
} else {
|
||||||
@@ -75,11 +75,11 @@ function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel
|
|||||||
//businesses.splice(businessData.index, 1);
|
//businesses.splice(businessData.index, 1);
|
||||||
//setAllBusinessDataIndexes();
|
//setAllBusinessDataIndexes();
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Business] Business ${businessId}'s blip is unchanged`);
|
logToConsole(LOG_DEBUG, `[V.RP.Business] Business ${businessId}'s blip is unchanged`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (businessData.blipId != -1) {
|
if (businessData.blipId != -1) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Business] Business ${businessId}'s blip has been changed by the server`);
|
logToConsole(LOG_DEBUG, `[V.RP.Business] Business ${businessId}'s blip has been changed by the server`);
|
||||||
if (getGame() == V_GAME_GTA_IV) {
|
if (getGame() == V_GAME_GTA_IV) {
|
||||||
natives.setBlipCoordinates(businessData.blipId, businessData.entrancePosition);
|
natives.setBlipCoordinates(businessData.blipId, businessData.entrancePosition);
|
||||||
natives.changeBlipSprite(businessData.blipId, businessData.blipModel);
|
natives.changeBlipSprite(businessData.blipId, businessData.blipModel);
|
||||||
@@ -92,20 +92,20 @@ function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel
|
|||||||
if (blipId != -1) {
|
if (blipId != -1) {
|
||||||
tempBusinessData.blipId = blipId;
|
tempBusinessData.blipId = blipId;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Business] Business ${businessId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Business] Business ${businessId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Business] Business ${businessId} doesn't exist. Adding ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Business] Business ${businessId} doesn't exist. Adding ...`);
|
||||||
let tempBusinessData = new BusinessData(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems);
|
let tempBusinessData = new BusinessData(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems);
|
||||||
if (blipModel != -1) {
|
if (blipModel != -1) {
|
||||||
let blipId = createGameBlip(tempBusinessData.blipModel, tempBusinessData.entrancePosition, tempBusinessData.name);
|
let blipId = createGameBlip(tempBusinessData.blipModel, tempBusinessData.entrancePosition, tempBusinessData.name);
|
||||||
if (blipId != -1) {
|
if (blipId != -1) {
|
||||||
tempBusinessData.blipId = blipId;
|
tempBusinessData.blipId = blipId;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Business] Business ${businessId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Business] Business ${businessId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Business] Business ${businessId} has no blip.`);
|
logToConsole(LOG_DEBUG, `[V.RP.Business] Business ${businessId} has no blip.`);
|
||||||
}
|
}
|
||||||
getServerData().businesses.push(tempBusinessData);
|
getServerData().businesses.push(tempBusinessData);
|
||||||
setAllBusinessDataIndexes();
|
setAllBusinessDataIndexes();
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ function unBindChatBoxKeys() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function receiveChatBoxMessageFromServer(messageString, colour, hour, minute, second) {
|
function receiveChatBoxMessageFromServer(messageString, colour, hour, minute, second) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Chat]: Received chatbox message from server: ${messageString}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Chat]: Received chatbox message from server: ${messageString}`);
|
||||||
|
|
||||||
// Just in case it's hidden by auto hide
|
// Just in case it's hidden by auto hide
|
||||||
//setChatWindowEnabled(true);
|
//setChatWindowEnabled(true);
|
||||||
@@ -77,16 +77,16 @@ function receiveChatBoxMessageFromServer(messageString, colour, hour, minute, se
|
|||||||
outputString = `${timeStampString}${messageString}`;
|
outputString = `${timeStampString}${messageString}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Chat]: Changed colours in string: ${outputString}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Chat]: Changed colours in string: ${outputString}`);
|
||||||
outputString = replaceColoursInMessage(`${outputString}`);
|
outputString = replaceColoursInMessage(`${outputString}`);
|
||||||
|
|
||||||
if (chatEmojiEnabled == true) {
|
if (chatEmojiEnabled == true) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Chat]: Enabled emoji in string: ${outputString}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Chat]: Enabled emoji in string: ${outputString}`);
|
||||||
outputString = replaceEmojiInMessage(outputString);
|
outputString = replaceEmojiInMessage(outputString);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (profanityFilterEnabled == true) {
|
if (profanityFilterEnabled == true) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Chat]: Removed profanity in string: ${outputString}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Chat]: Removed profanity in string: ${outputString}`);
|
||||||
outputString = replaceProfanityInMessage(outputString);
|
outputString = replaceProfanityInMessage(outputString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ function onResourceStart(event, resource) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (resource == thisResource) {
|
if (resource == thisResource) {
|
||||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.Event] onResourceStart called - Sending signal to server`);
|
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.Event] onResourceStart called - Sending signal to server`);
|
||||||
localPlayerMoneyInterval = setInterval(updateLocalPlayerMoney, 1000 * 5);
|
localPlayerMoneyInterval = setInterval(updateLocalPlayerMoney, 1000 * 5);
|
||||||
sendResourceStartedSignalToServer();
|
sendResourceStartedSignalToServer();
|
||||||
}
|
}
|
||||||
@@ -83,7 +83,7 @@ function onResourceStart(event, resource) {
|
|||||||
|
|
||||||
function onResourceStop(event, resource) {
|
function onResourceStop(event, resource) {
|
||||||
if (resource == thisResource) {
|
if (resource == thisResource) {
|
||||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.Event] onResourceStop called - Sending signal to server`);
|
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.Event] onResourceStop called - Sending signal to server`);
|
||||||
sendResourceStoppedSignalToServer();
|
sendResourceStoppedSignalToServer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -92,7 +92,7 @@ function onResourceStop(event, resource) {
|
|||||||
|
|
||||||
function onResourceReady(event, resource) {
|
function onResourceReady(event, resource) {
|
||||||
if (resource == thisResource) {
|
if (resource == thisResource) {
|
||||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.Event] onResourceReady called - Sending signal to server`);
|
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.Event] onResourceReady called - Sending signal to server`);
|
||||||
loadLocaleConfig();
|
loadLocaleConfig();
|
||||||
sendResourceReadySignalToServer();
|
sendResourceReadySignalToServer();
|
||||||
}
|
}
|
||||||
@@ -101,7 +101,7 @@ function onResourceReady(event, resource) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onProcess(event, deltaTime) {
|
function onProcess(event, deltaTime) {
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Event] onProcess`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Event] onProcess`);
|
||||||
if (localPlayer == null) {
|
if (localPlayer == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -136,7 +136,7 @@ function onKeyUp(event, keyCode, scanCode, keyModifiers) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onDrawnHUD(event) {
|
function onDrawnHUD(event) {
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Event] HUD drawn`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Event] HUD drawn`);
|
||||||
processMouseCursorRendering();
|
processMouseCursorRendering();
|
||||||
|
|
||||||
if (!renderHUD) {
|
if (!renderHUD) {
|
||||||
@@ -160,7 +160,7 @@ function onDrawnHUD(event) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPedWasted(event, wastedPed, killerPed, weapon, pedPiece) {
|
function onPedWasted(event, wastedPed, killerPed, weapon, pedPiece) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Ped ${wastedPed.name} died`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Ped ${wastedPed.name} died`);
|
||||||
wastedPed.clearWeapons();
|
wastedPed.clearWeapons();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,7 +173,7 @@ function onElementStreamIn(event, element) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPedExitedVehicle(event, ped, vehicle, seat) {
|
function onPedExitedVehicle(event, ped, vehicle, seat) {
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Event] Local player exited vehicle`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Event] Local player exited vehicle`);
|
||||||
//sendNetworkEventToServer("v.rp.onPlayerExitVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
//sendNetworkEventToServer("v.rp.onPlayerExitVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
||||||
|
|
||||||
cruiseControlEnabled = false;
|
cruiseControlEnabled = false;
|
||||||
@@ -197,7 +197,7 @@ function onPedExitedVehicle(event, ped, vehicle, seat) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPedExitingVehicle(event, ped, vehicle, seat) {
|
function onPedExitingVehicle(event, ped, vehicle, seat) {
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Event] Local player exited vehicle`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Event] Local player exited vehicle`);
|
||||||
//sendNetworkEventToServer("v.rp.onPlayerExitVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
//sendNetworkEventToServer("v.rp.onPlayerExitVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
||||||
|
|
||||||
if (localPlayer != null) {
|
if (localPlayer != null) {
|
||||||
@@ -211,7 +211,7 @@ function onPedExitingVehicle(event, ped, vehicle, seat) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPedEnteredVehicle(event, ped, vehicle, seat) {
|
function onPedEnteredVehicle(event, ped, vehicle, seat) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Ped entered vehicle`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Ped entered vehicle`);
|
||||||
//sendNetworkEventToServer("v.rp.onPlayerEnterVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
//sendNetworkEventToServer("v.rp.onPlayerEnterVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
||||||
|
|
||||||
cruiseControlEnabled = false;
|
cruiseControlEnabled = false;
|
||||||
@@ -239,7 +239,7 @@ function onPedEnteredVehicle(event, ped, vehicle, seat) {
|
|||||||
function onPedInflictDamage(event, damagedEntity, damagerEntity, weaponId, healthLoss, pedPiece) {
|
function onPedInflictDamage(event, damagedEntity, damagerEntity, weaponId, healthLoss, pedPiece) {
|
||||||
//let damagerEntityString = (!isNull(damagedEntity)) ? `${damagerEntity.name} (${damagerEntity.name}, ${damagerEntity.type} - ${typeof damagerEntity})` : `Unknown ped`;
|
//let damagerEntityString = (!isNull(damagedEntity)) ? `${damagerEntity.name} (${damagerEntity.name}, ${damagerEntity.type} - ${typeof damagerEntity})` : `Unknown ped`;
|
||||||
//let damagedEntityString = (!isNull(damagedEntity)) ? `${damagedEntity.name} (${damagedEntity.name}, ${damagedEntity.type} - ${typeof damagedEntity})` : `Unknown ped`;
|
//let damagedEntityString = (!isNull(damagedEntity)) ? `${damagedEntity.name} (${damagedEntity.name}, ${damagedEntity.type} - ${typeof damagedEntity})` : `Unknown ped`;
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Event] ${damagerEntityString} damaged ${damagedEntityString}'s '${pedPiece} with weapon ${weaponId}`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Event] ${damagerEntityString} damaged ${damagedEntityString}'s '${pedPiece} with weapon ${weaponId}`);
|
||||||
if (!isNull(damagedEntity) && !isNull(damagerEntity)) {
|
if (!isNull(damagedEntity) && !isNull(damagerEntity)) {
|
||||||
if (damagedEntity.isType(ELEMENT_PLAYER)) {
|
if (damagedEntity.isType(ELEMENT_PLAYER)) {
|
||||||
if (damagedEntity == localPlayer) {
|
if (damagedEntity == localPlayer) {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ let gpsBlipBlinkTimer = null;
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showGPSLocation(position, colour) {
|
function showGPSLocation(position, colour) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GPS] Showing gps location`);
|
logToConsole(LOG_DEBUG, `[V.RP.GPS] Showing gps location`);
|
||||||
if (getMultiplayerMod() == V_MPMOD_GTAC) {
|
if (getMultiplayerMod() == V_MPMOD_GTAC) {
|
||||||
if (getGame() == V_GAME_GTA_SA) {
|
if (getGame() == V_GAME_GTA_SA) {
|
||||||
// Server-side spheres don't show in GTA SA for some reason.
|
// Server-side spheres don't show in GTA SA for some reason.
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ function initGUIScript() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initGUI() {
|
function initGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Initializing GUI ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Initializing GUI ...`);
|
||||||
|
|
||||||
initLoginGUI();
|
initLoginGUI();
|
||||||
initRegisterGUI();
|
initRegisterGUI();
|
||||||
@@ -73,7 +73,7 @@ function initGUI() {
|
|||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
guiReady = true;
|
guiReady = true;
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] All GUI created successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] All GUI created successfully!`);
|
||||||
|
|
||||||
sendNetworkEventToServer("v.rp.guiReady", true);
|
sendNetworkEventToServer("v.rp.guiReady", true);
|
||||||
};
|
};
|
||||||
@@ -81,7 +81,7 @@ function initGUI() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function closeAllWindows() {
|
function closeAllWindows() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Closing all GUI windows`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Closing all GUI windows`);
|
||||||
infoDialog.window.shown = false;
|
infoDialog.window.shown = false;
|
||||||
yesNoDialog.window.shown = false;
|
yesNoDialog.window.shown = false;
|
||||||
errorDialog.window.shown = false;
|
errorDialog.window.shown = false;
|
||||||
@@ -208,7 +208,7 @@ function isAnyGUIActive() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setGUIColours(red1, green1, blue1, red2, green2, blue2, red3, green3, blue3) {
|
function setGUIColours(red1, green1, blue1, red2, green2, blue2, red3, green3, blue3) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Received new GUI colours from server: ${red1}, ${green1}, ${blue1} / ${red2}, ${green2}, ${blue2} / ${red3}, ${green3}, ${blue3}`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Received new GUI colours from server: ${red1}, ${green1}, ${blue1} / ${red2}, ${green2}, ${blue2} / ${red3}, ${green3}, ${blue3}`);
|
||||||
primaryColour = [red1, green1, blue1];
|
primaryColour = [red1, green1, blue1];
|
||||||
secondaryColour = [red2, green2, blue2];
|
secondaryColour = [red2, green2, blue2];
|
||||||
primaryTextColour = [red3, green3, blue3];
|
primaryTextColour = [red3, green3, blue3];
|
||||||
@@ -228,45 +228,45 @@ function hideAllGUI() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function processGUIKeyPress(keyCode) {
|
function processGUIKeyPress(keyCode) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Processing key press: ${keyCode}`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Processing key press: ${keyCode}`);
|
||||||
|
|
||||||
if (!guiReady) {
|
if (!guiReady) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isAnyGUIActive()) {
|
if (!isAnyGUIActive()) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] GUI is not active. Cancelling keypress processing.`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] GUI is not active. Cancelling keypress processing.`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keyCode == SDLK_RETURN || keyCode == SDLK_RETURN2) {
|
if (keyCode == SDLK_RETURN || keyCode == SDLK_RETURN2) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Key press is submit (${guiSubmitKey})`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Key press is submit (${guiSubmitKey})`);
|
||||||
if (guiSubmitKey != false) {
|
if (guiSubmitKey != false) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Calling submit key function`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Calling submit key function`);
|
||||||
guiSubmitKey.call();
|
guiSubmitKey.call();
|
||||||
}
|
}
|
||||||
} else if (keyCode == getKeyIdFromParams("left") || keyCode == getKeyIdFromParams("a")) {
|
} else if (keyCode == getKeyIdFromParams("left") || keyCode == getKeyIdFromParams("a")) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Key press is left (${guiLeftKey})`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Key press is left (${guiLeftKey})`);
|
||||||
if (guiLeftKey != false) {
|
if (guiLeftKey != false) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Calling left key function`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Calling left key function`);
|
||||||
guiLeftKey.call();
|
guiLeftKey.call();
|
||||||
}
|
}
|
||||||
} else if (keyCode == getKeyIdFromParams("right") || keyCode == getKeyIdFromParams("d")) {
|
} else if (keyCode == getKeyIdFromParams("right") || keyCode == getKeyIdFromParams("d")) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Key press is right (${guiRightKey})`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Key press is right (${guiRightKey})`);
|
||||||
if (guiRightKey != false) {
|
if (guiRightKey != false) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Calling right key function`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Calling right key function`);
|
||||||
guiRightKey.call();
|
guiRightKey.call();
|
||||||
}
|
}
|
||||||
} else if (keyCode == getKeyIdFromParams("down") || keyCode == getKeyIdFromParams("s")) {
|
} else if (keyCode == getKeyIdFromParams("down") || keyCode == getKeyIdFromParams("s")) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Key press is down (${guiDownKey})`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Key press is down (${guiDownKey})`);
|
||||||
if (guiDownKey != false) {
|
if (guiDownKey != false) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Calling down key function`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Calling down key function`);
|
||||||
guiDownKey.call();
|
guiDownKey.call();
|
||||||
}
|
}
|
||||||
} else if (keyCode == getKeyIdFromParams("up") || keyCode == getKeyIdFromParams("w")) {
|
} else if (keyCode == getKeyIdFromParams("up") || keyCode == getKeyIdFromParams("w")) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Key press is up (${guiUpKey})`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Key press is up (${guiUpKey})`);
|
||||||
if (guiUpKey != false) {
|
if (guiUpKey != false) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Calling up key function`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Calling up key function`);
|
||||||
guiUpKey.call();
|
guiUpKey.call();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ let twoFactorAuth = {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initTwoFactorAuthenticationGUI() {
|
function initTwoFactorAuthenticationGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating two factor auth GUI ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating two factor auth GUI ...`);
|
||||||
twoFactorAuth.window = mexui.window(game.width / 2 - 150, game.height / 2 - 129, 300, 258, 'LOGIN', {
|
twoFactorAuth.window = mexui.window(game.width / 2 - 150, game.height / 2 - 129, 300, 258, 'LOGIN', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||||
@@ -94,14 +94,14 @@ function initTwoFactorAuthenticationGUI() {
|
|||||||
},
|
},
|
||||||
}, checkTwoFactorAuth);
|
}, checkTwoFactorAuth);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created two factor auth GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created two factor auth GUI`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showTwoFactorAuthGUI() {
|
function showTwoFactorAuthGUI() {
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing two-factor authentication window`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing two-factor authentication window`);
|
||||||
setChatWindowEnabled(false);
|
setChatWindowEnabled(false);
|
||||||
mexui.setInput(true);
|
mexui.setInput(true);
|
||||||
twoFactorAuth.window.shown = true;
|
twoFactorAuth.window.shown = true;
|
||||||
@@ -112,7 +112,7 @@ function showTwoFactorAuthGUI() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function twoFactorAuthFailed(errorMessage) {
|
function twoFactorAuthFailed(errorMessage) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports two-factor authentication failed. Reason: ${errorMessage}`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Server reports two-factor authentication failed. Reason: ${errorMessage}`);
|
||||||
twoFactorAuth.messageLabel.text = errorMessage;
|
twoFactorAuth.messageLabel.text = errorMessage;
|
||||||
twoFactorAuth.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
twoFactorAuth.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
||||||
twoFactorAuth.codeInput.text = "";
|
twoFactorAuth.codeInput.text = "";
|
||||||
@@ -121,14 +121,14 @@ function twoFactorAuthFailed(errorMessage) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function twoFactorAuthSuccess() {
|
function twoFactorAuthSuccess() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports two-factor authentication was successful`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Server reports two-factor authentication was successful`);
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function checkTwoFactorAuth() {
|
function checkTwoFactorAuth() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Checking two-factor authentication with server ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Checking two-factor authentication with server ...`);
|
||||||
sendNetworkEventToServer("v.rp.2fa", twoFactorAuth.codeInput.lines[0]);
|
sendNetworkEventToServer("v.rp.2fa", twoFactorAuth.codeInput.lines[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ let passwordChange = {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initChangePasswordGUI() {
|
function initChangePasswordGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating password change GUI ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating password change GUI ...`);
|
||||||
passwordChange.window = mexui.window(game.width / 2 - 130, game.height / 2 - 125, 300, 250, 'Change Password', {
|
passwordChange.window = mexui.window(game.width / 2 - 130, game.height / 2 - 125, 300, 250, 'Change Password', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||||
@@ -110,13 +110,13 @@ function initChangePasswordGUI() {
|
|||||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||||
},
|
},
|
||||||
}, checkChangePassword);
|
}, checkChangePassword);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created change password GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created change password GUI`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function passwordChangeFailed(errorMessage) {
|
function passwordChangeFailed(errorMessage) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports change password failed. Reason: ${errorMessage}`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Server reports change password failed. Reason: ${errorMessage}`);
|
||||||
passwordChange.messageLabel.text = errorMessage;
|
passwordChange.messageLabel.text = errorMessage;
|
||||||
passwordChange.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
passwordChange.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
||||||
passwordChange.passwordInput.text = "";
|
passwordChange.passwordInput.text = "";
|
||||||
@@ -127,14 +127,14 @@ function passwordChangeFailed(errorMessage) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function checkChangePassword() {
|
function checkChangePassword() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Checking password change with server ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Checking password change with server ...`);
|
||||||
sendNetworkEventToServer("v.rp.checkChangePassword", passwordChange.passwordInput.lines[0], passwordChange.confirmPasswordInput.lines[0]);
|
sendNetworkEventToServer("v.rp.checkChangePassword", passwordChange.passwordInput.lines[0], passwordChange.confirmPasswordInput.lines[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showChangePasswordGUI(errorMessage) {
|
function showChangePasswordGUI(errorMessage) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing change password window`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing change password window`);
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
setChatWindowEnabled(false);
|
setChatWindowEnabled(false);
|
||||||
mexui.setInput(true);
|
mexui.setInput(true);
|
||||||
@@ -149,7 +149,7 @@ function showChangePasswordGUI(errorMessage) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function passwordChangeSuccess() {
|
function passwordChangeSuccess() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports password change was successful`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Server reports password change was successful`);
|
||||||
guiSubmitKey = false;
|
guiSubmitKey = false;
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ let characterSelect = {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initCharacterSelectGUI() {
|
function initCharacterSelectGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating character select GUI ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating character select GUI ...`);
|
||||||
characterSelect.window = mexui.window(game.width / 2 - 215, game.height / 2 - 83, 430, 190, 'SELECT CHARACTER', {
|
characterSelect.window = mexui.window(game.width / 2 - 215, game.height / 2 - 83, 430, 190, 'SELECT CHARACTER', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||||
@@ -150,14 +150,14 @@ function initCharacterSelectGUI() {
|
|||||||
borderColour: toColour(0, 0, 0, 0),
|
borderColour: toColour(0, 0, 0, 0),
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created character select GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created character select GUI`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showCharacterSelectGUI(firstName, lastName, cash, clan, lastPlayed, skinId) {
|
function showCharacterSelectGUI(firstName, lastName, cash, clan, lastPlayed, skinId) {
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing character selection window`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing character selection window`);
|
||||||
setChatWindowEnabled(false);
|
setChatWindowEnabled(false);
|
||||||
mexui.setInput(true);
|
mexui.setInput(true);
|
||||||
characterSelect.nameText.text = `${firstName} ${lastName}`;
|
characterSelect.nameText.text = `${firstName} ${lastName}`;
|
||||||
@@ -178,35 +178,35 @@ function showCharacterSelectGUI(firstName, lastName, cash, clan, lastPlayed, ski
|
|||||||
|
|
||||||
function showNewCharacter() {
|
function showNewCharacter() {
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing new character dialog window`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing new character dialog window`);
|
||||||
showNewCharacterGUI();
|
showNewCharacterGUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function selectNextCharacter() {
|
function selectNextCharacter() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Requesting next character info from server for character select window`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Requesting next character info from server for character select window`);
|
||||||
sendNetworkEventToServer("v.rp.nextCharacter");
|
sendNetworkEventToServer("v.rp.nextCharacter");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function selectPreviousCharacter() {
|
function selectPreviousCharacter() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Requesting previous character info from server for character select window`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Requesting previous character info from server for character select window`);
|
||||||
sendNetworkEventToServer("v.rp.previousCharacter");
|
sendNetworkEventToServer("v.rp.previousCharacter");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function selectThisCharacter() {
|
function selectThisCharacter() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Tell server the current shown character was selected in character select window`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Tell server the current shown character was selected in character select window`);
|
||||||
sendNetworkEventToServer("v.rp.selectCharacter");
|
sendNetworkEventToServer("v.rp.selectCharacter");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function switchCharacterSelectGUI(firstName, lastName, cash, clan, lastPlayed, skinId) {
|
function switchCharacterSelectGUI(firstName, lastName, cash, clan, lastPlayed, skinId) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Updating character info with data from server`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Updating character info with data from server`);
|
||||||
setChatWindowEnabled(false);
|
setChatWindowEnabled(false);
|
||||||
characterSelect.window.shown = false;
|
characterSelect.window.shown = false;
|
||||||
characterSelect.nameText.text = `${firstName} ${lastName}`;
|
characterSelect.nameText.text = `${firstName} ${lastName}`;
|
||||||
@@ -229,7 +229,7 @@ function switchCharacterSelectGUI(firstName, lastName, cash, clan, lastPlayed, s
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function characterSelectSuccess() {
|
function characterSelectSuccess() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports character selection was successful`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Server reports character selection was successful`);
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ let errorDialog = {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initErrorDialogGUI() {
|
function initErrorDialogGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating error GUI ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating error GUI ...`);
|
||||||
errorDialog.window = mexui.window(getScreenWidth() / 2 - 200, getScreenHeight() / 2 - 70, 400, 140, 'ERROR', {
|
errorDialog.window = mexui.window(getScreenWidth() / 2 - 200, getScreenHeight() / 2 - 70, 400, 140, 'ERROR', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||||
@@ -58,14 +58,14 @@ function initErrorDialogGUI() {
|
|||||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
|
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
|
||||||
},
|
},
|
||||||
}, closeErrorDialog);
|
}, closeErrorDialog);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created error GUI ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created error GUI ...`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showErrorGUI(errorMessage, errorTitle, buttonText) {
|
function showErrorGUI(errorMessage, errorTitle, buttonText) {
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing error window. Error: ${errorTitle} - ${errorMessage}`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing error window. Error: ${errorTitle} - ${errorMessage}`);
|
||||||
setChatWindowEnabled(false);
|
setChatWindowEnabled(false);
|
||||||
mexui.setInput(true);
|
mexui.setInput(true);
|
||||||
errorDialog.messageLabel.text = errorMessage;
|
errorDialog.messageLabel.text = errorMessage;
|
||||||
@@ -77,7 +77,7 @@ function showErrorGUI(errorMessage, errorTitle, buttonText) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function closeErrorDialog() {
|
function closeErrorDialog() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Closing error dialog`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Closing error dialog`);
|
||||||
errorDialog.window.shown = false;
|
errorDialog.window.shown = false;
|
||||||
mexui.setInput(false);
|
mexui.setInput(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ let fiveCardPokerGUI = {
|
|||||||
|
|
||||||
function initFiveCardPokerGUI() {
|
function initFiveCardPokerGUI() {
|
||||||
// Render a five card poker game in MexUI
|
// Render a five card poker game in MexUI
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating five-card poker GUI ...`);
|
//logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating five-card poker GUI ...`);
|
||||||
fiveCardPokerGUI.window = mexui.window(game.width / 2 - 200, game.height - 150, 400, 400, 'Five Card Poker', {
|
fiveCardPokerGUI.window = mexui.window(game.width / 2 - 200, game.height - 150, 400, 400, 'Five Card Poker', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], 0),
|
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], 0),
|
||||||
@@ -33,7 +33,7 @@ function initFiveCardPokerGUI() {
|
|||||||
|
|
||||||
fiveCardPokerGUI.window.shown = false;
|
fiveCardPokerGUI.window.shown = false;
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created five card poker GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created five card poker GUI`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -22,7 +22,7 @@ let dealerCards = [];
|
|||||||
|
|
||||||
function initBlackJackGUI() {
|
function initBlackJackGUI() {
|
||||||
// Render a blackjack game in MexUI
|
// Render a blackjack game in MexUI
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating blackjack GUI ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating blackjack GUI ...`);
|
||||||
blackJackGUI.window = mexui.window(game.width / 2 - 200, game.height - 150, 400, 400, 'Blackjack', {
|
blackJackGUI.window = mexui.window(game.width / 2 - 200, game.height - 150, 400, 400, 'Blackjack', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], 0),
|
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], 0),
|
||||||
@@ -42,7 +42,7 @@ function initBlackJackGUI() {
|
|||||||
|
|
||||||
blackJackGUI.window.shown = false;
|
blackJackGUI.window.shown = false;
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created blackjack GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created blackjack GUI`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -16,7 +16,7 @@ let infoDialog = {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initInfoDialogGUI() {
|
function initInfoDialogGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating info dialog GUI ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating info dialog GUI ...`);
|
||||||
infoDialog.window = mexui.window(getScreenWidth() / 2 - 200, getScreenHeight() / 2 - 70, 400, 140, 'Information', {
|
infoDialog.window = mexui.window(getScreenWidth() / 2 - 200, getScreenHeight() / 2 - 70, 400, 140, 'Information', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||||
@@ -57,13 +57,13 @@ function initInfoDialogGUI() {
|
|||||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
|
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
|
||||||
},
|
},
|
||||||
}, closeInfoDialog);
|
}, closeInfoDialog);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created info dialog GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created info dialog GUI`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function closeInfoDialog() {
|
function closeInfoDialog() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Closing info dialog`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Closing info dialog`);
|
||||||
infoDialog.window.shown = false;
|
infoDialog.window.shown = false;
|
||||||
mexui.setInput(false);
|
mexui.setInput(false);
|
||||||
}
|
}
|
||||||
@@ -72,7 +72,7 @@ function closeInfoDialog() {
|
|||||||
|
|
||||||
function showInfoGUI(infoMessage, infoTitle, buttonText) {
|
function showInfoGUI(infoMessage, infoTitle, buttonText) {
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing info dialog window. Info: ${infoTitle} - ${infoMessage}`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing info dialog window. Info: ${infoTitle} - ${infoMessage}`);
|
||||||
mexui.setInput(true);
|
mexui.setInput(true);
|
||||||
infoDialog.messageLabel.text = infoMessage;
|
infoDialog.messageLabel.text = infoMessage;
|
||||||
infoDialog.okayButton.text = buttonText;
|
infoDialog.okayButton.text = buttonText;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ function initInventoryGUI() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function closeAllInventoryGUI() {
|
function closeAllInventoryGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Closing all inventory GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Closing all inventory GUI`);
|
||||||
for (let i in inventoryGUI) {
|
for (let i in inventoryGUI) {
|
||||||
inventoryGUI[i].window.shown = false;
|
inventoryGUI[i].window.shown = false;
|
||||||
}
|
}
|
||||||
@@ -36,7 +36,7 @@ function closeAllInventoryGUI() {
|
|||||||
|
|
||||||
function showInventoryGUI(inventoryIndex, items) {
|
function showInventoryGUI(inventoryIndex, items) {
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing inventory window. Index: ${inventoryIndex}`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing inventory window. Index: ${inventoryIndex}`);
|
||||||
inventoryGUI[inventoryIndex].window.shown = true;
|
inventoryGUI[inventoryIndex].window.shown = true;
|
||||||
mexui.setInput(true);
|
mexui.setInput(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ function initInventoryBulkGUI() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function closeAllInventoryBulkGUI() {
|
function closeAllInventoryBulkGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Closing all bulk inventory GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Closing all bulk inventory GUI`);
|
||||||
for (let i in inventoryBulkGUI) {
|
for (let i in inventoryBulkGUI) {
|
||||||
inventoryBulkGUI[i].window.shown = false;
|
inventoryBulkGUI[i].window.shown = false;
|
||||||
}
|
}
|
||||||
@@ -36,7 +36,7 @@ function closeAllInventoryBulkGUI() {
|
|||||||
|
|
||||||
function showInventoryBulkGUI(inventoryIndex, items) {
|
function showInventoryBulkGUI(inventoryIndex, items) {
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing bulk inventory window. Index: ${inventoryIndex}`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing bulk inventory window. Index: ${inventoryIndex}`);
|
||||||
inventoryBulkGUI[inventoryIndex].window.shown = true;
|
inventoryBulkGUI[inventoryIndex].window.shown = true;
|
||||||
mexui.setInput(true);
|
mexui.setInput(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ let listDialog = {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initListGUI() {
|
function initListGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating list dialog GUI ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating list dialog GUI ...`);
|
||||||
listDialog.window = mexui.window(game.width / 2 - 200, game.height / 2 - 70, 400, 500, 'List', {
|
listDialog.window = mexui.window(game.width / 2 - 200, game.height / 2 - 70, 400, 500, 'List', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||||
@@ -72,14 +72,14 @@ function initListGUI() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created list dialog GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created list dialog GUI`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showListGUI() {
|
function showListGUI() {
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing list window`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing list window`);
|
||||||
setChatWindowEnabled(false);
|
setChatWindowEnabled(false);
|
||||||
mexui.setInput(true);
|
mexui.setInput(true);
|
||||||
listDialog.window.shown = true;
|
listDialog.window.shown = true;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ let flagImageGap = toVector2(5, 5);
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initLocaleChooserGUI() {
|
function initLocaleChooserGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating locale chooser GUI ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating locale chooser GUI ...`);
|
||||||
localeChooser.window = mexui.window(game.width / 2 - 200, game.height - 150, 60, 60, 'Choose a language', {
|
localeChooser.window = mexui.window(game.width / 2 - 200, game.height - 150, 60, 60, 'Choose a language', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], 0),
|
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], 0),
|
||||||
@@ -39,13 +39,13 @@ function initLocaleChooserGUI() {
|
|||||||
|
|
||||||
localeChooser.window.shown = false;
|
localeChooser.window.shown = false;
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created locale chooser GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created locale chooser GUI`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function closeLocaleChooserGUI() {
|
function closeLocaleChooserGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Closing locale chooser window`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Closing locale chooser window`);
|
||||||
localeChooser.window.shown = false;
|
localeChooser.window.shown = false;
|
||||||
for (let i in localeChooser.flagImages) {
|
for (let i in localeChooser.flagImages) {
|
||||||
localeChooser.flagImages[i].shown = false;
|
localeChooser.flagImages[i].shown = false;
|
||||||
@@ -63,7 +63,7 @@ function showLocaleChooserGUI(position = toVector2(0.0, 0.0)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//closeAllWindows();
|
//closeAllWindows();
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing locale chooser window`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing locale chooser window`);
|
||||||
mexui.setInput(true);
|
mexui.setInput(true);
|
||||||
localeChooser.window.shown = true;
|
localeChooser.window.shown = true;
|
||||||
|
|
||||||
@@ -85,14 +85,14 @@ function toggleLocaleChooserGUI() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function localeChooserSetLocale(localeId) {
|
function localeChooserSetLocale(localeId) {
|
||||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.GUI] Asking server to change locale to ${localeId}`);
|
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.GUI] Asking server to change locale to ${localeId}`);
|
||||||
sendLocaleSelectToServer(localeId);
|
sendLocaleSelectToServer(localeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function resetLocaleChooserOptions() {
|
function resetLocaleChooserOptions() {
|
||||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.GUI] Resetting locale chooser options`);
|
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.GUI] Resetting locale chooser options`);
|
||||||
|
|
||||||
// let tempLocaleOptions = getServerData().localeOptions; // getAvailableLocaleOptions();
|
// let tempLocaleOptions = getServerData().localeOptions; // getAvailableLocaleOptions();
|
||||||
let tempLocaleOptions = getAvailableLocaleOptions();
|
let tempLocaleOptions = getAvailableLocaleOptions();
|
||||||
@@ -116,7 +116,7 @@ function resetLocaleChooserOptions() {
|
|||||||
|
|
||||||
localeChooser.flagImages[i].shown = false;
|
localeChooser.flagImages[i].shown = false;
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.GUI] Created locale chooser option ${tempLocaleOptions[i].englishName} with image ${imagePath}`);
|
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.GUI] Created locale chooser option ${tempLocaleOptions[i].englishName} with image ${imagePath}`);
|
||||||
|
|
||||||
//localeChooser.activeRingImages.push(activeRingImage);
|
//localeChooser.activeRingImages.push(activeRingImage);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ let loginHTML =
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initLoginGUI() {
|
function initLoginGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating login GUI ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating login GUI ...`);
|
||||||
login.window = mexui.window(getScreenWidth() / 2 - 150, getScreenHeight() / 2 - 135, 300, 275, 'LOGIN', {
|
login.window = mexui.window(getScreenWidth() / 2 - 150, getScreenHeight() / 2 - 135, 300, 275, 'LOGIN', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||||
@@ -143,14 +143,14 @@ function initLoginGUI() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created login GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created login GUI`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showLoginGUI() {
|
function showLoginGUI() {
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing login window`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing login window`);
|
||||||
setChatWindowEnabled(false);
|
setChatWindowEnabled(false);
|
||||||
mexui.setInput(true);
|
mexui.setInput(true);
|
||||||
login.window.shown = true;
|
login.window.shown = true;
|
||||||
@@ -164,14 +164,14 @@ function showLoginGUI() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function checkLogin() {
|
function checkLogin() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Checking login with server ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Checking login with server ...`);
|
||||||
sendNetworkEventToServer("v.rp.checkLogin", login.passwordInput.lines[0]);
|
sendNetworkEventToServer("v.rp.checkLogin", login.passwordInput.lines[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loginFailed(errorMessage) {
|
function loginFailed(errorMessage) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports login failed`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Server reports login failed`);
|
||||||
login.messageLabel.text = errorMessage;
|
login.messageLabel.text = errorMessage;
|
||||||
login.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
login.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
||||||
login.passwordInput.text = "";
|
login.passwordInput.text = "";
|
||||||
@@ -180,7 +180,7 @@ function loginFailed(errorMessage) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loginSuccess() {
|
function loginSuccess() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports login was successful`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Server reports login was successful`);
|
||||||
guiSubmitKey = false;
|
guiSubmitKey = false;
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
}
|
}
|
||||||
@@ -189,7 +189,7 @@ function loginSuccess() {
|
|||||||
|
|
||||||
function switchToPasswordResetGUI() {
|
function switchToPasswordResetGUI() {
|
||||||
//closeAllWindows();
|
//closeAllWindows();
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing password reset dialog window`);
|
//logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing password reset dialog window`);
|
||||||
//showResetPasswordGUI();
|
//showResetPasswordGUI();
|
||||||
sendNetworkEventToServer("v.rp.checkResetPassword", "");
|
sendNetworkEventToServer("v.rp.checkResetPassword", "");
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ let newCharacter = {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initNewCharacterGUI() {
|
function initNewCharacterGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating new character GUI ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating new character GUI ...`);
|
||||||
newCharacter.window = mexui.window(getScreenWidth() / 2 - 150, getScreenHeight() / 2 - 115, 300, 230, 'NEW CHARACTER', {
|
newCharacter.window = mexui.window(getScreenWidth() / 2 - 150, getScreenHeight() / 2 - 115, 300, 230, 'NEW CHARACTER', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||||
@@ -110,13 +110,13 @@ function initNewCharacterGUI() {
|
|||||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||||
},
|
},
|
||||||
}, checkNewCharacter);
|
}, checkNewCharacter);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created new character GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created new character GUI`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function newCharacterFailed(errorMessage) {
|
function newCharacterFailed(errorMessage) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports new character creation failed. Reason: ${errorMessage}`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Server reports new character creation failed. Reason: ${errorMessage}`);
|
||||||
newCharacter.messageLabel.text = errorMessage;
|
newCharacter.messageLabel.text = errorMessage;
|
||||||
newCharacter.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
newCharacter.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
||||||
newCharacter.firstNameInput.text = "";
|
newCharacter.firstNameInput.text = "";
|
||||||
@@ -134,7 +134,7 @@ function newCharacterFailed(errorMessage) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function checkNewCharacter() {
|
function checkNewCharacter() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Checking new character with server ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Checking new character with server ...`);
|
||||||
if (newCharacter.firstNameInput.lines[0].length < 2) {
|
if (newCharacter.firstNameInput.lines[0].length < 2) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -152,7 +152,7 @@ function checkNewCharacter() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showNewCharacterGUI() {
|
function showNewCharacterGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing new character window`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing new character window`);
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
setChatWindowEnabled(false);
|
setChatWindowEnabled(false);
|
||||||
mexui.setInput(true);
|
mexui.setInput(true);
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ let register = {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initRegisterGUI() {
|
function initRegisterGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating register GUI ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating register GUI ...`);
|
||||||
register.window = mexui.window(getScreenWidth() / 2 - 150, getScreenHeight() / 2 - 150, 300, 300, 'Register', {
|
register.window = mexui.window(getScreenWidth() / 2 - 150, getScreenHeight() / 2 - 150, 300, 300, 'Register', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||||
@@ -130,13 +130,13 @@ function initRegisterGUI() {
|
|||||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||||
},
|
},
|
||||||
}, checkRegistration);
|
}, checkRegistration);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created register GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created register GUI`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function registrationFailed(errorMessage) {
|
function registrationFailed(errorMessage) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports registration failed. Reason: ${errorMessage}`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Server reports registration failed. Reason: ${errorMessage}`);
|
||||||
register.messageLabel.text = errorMessage;
|
register.messageLabel.text = errorMessage;
|
||||||
register.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
register.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
||||||
register.passwordInput.text = "";
|
register.passwordInput.text = "";
|
||||||
@@ -147,14 +147,14 @@ function registrationFailed(errorMessage) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function checkRegistration() {
|
function checkRegistration() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Checking registration with server ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Checking registration with server ...`);
|
||||||
sendNetworkEventToServer("v.rp.checkRegistration", register.passwordInput.lines[0], register.confirmPasswordInput.lines[0], register.emailInput.lines[0]);
|
sendNetworkEventToServer("v.rp.checkRegistration", register.passwordInput.lines[0], register.confirmPasswordInput.lines[0], register.emailInput.lines[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showRegistrationGUI() {
|
function showRegistrationGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing registration window`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing registration window`);
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
setChatWindowEnabled(false);
|
setChatWindowEnabled(false);
|
||||||
mexui.setInput(true);
|
mexui.setInput(true);
|
||||||
@@ -170,7 +170,7 @@ function showRegistrationGUI() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function registrationSuccess() {
|
function registrationSuccess() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports registration was successful`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Server reports registration was successful`);
|
||||||
guiSubmitKey = false;
|
guiSubmitKey = false;
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ let passwordReset = {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initResetPasswordGUI() {
|
function initResetPasswordGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating password reset GUI ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating password reset GUI ...`);
|
||||||
passwordReset.window = mexui.window(getScreenWidth() / 2 - 150, getScreenHeight() / 2 - 135, 300, 275, 'RESET PASSWORD', {
|
passwordReset.window = mexui.window(getScreenWidth() / 2 - 150, getScreenHeight() / 2 - 135, 300, 275, 'RESET PASSWORD', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||||
@@ -120,14 +120,14 @@ function initResetPasswordGUI() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created password reset GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created password reset GUI`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showResetPasswordGUI() {
|
function showResetPasswordGUI() {
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing password reset window`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing password reset window`);
|
||||||
setChatWindowEnabled(false);
|
setChatWindowEnabled(false);
|
||||||
mexui.setInput(true);
|
mexui.setInput(true);
|
||||||
passwordReset.window.shown = true;
|
passwordReset.window.shown = true;
|
||||||
@@ -141,14 +141,14 @@ function showResetPasswordGUI() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function checkResetPassword() {
|
function checkResetPassword() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Checking password reset with server (${passwordReset.emailInput.lines[0]}) ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Checking password reset with server (${passwordReset.emailInput.lines[0]}) ...`);
|
||||||
sendNetworkEventToServer("v.rp.checkResetPassword", passwordReset.emailInput.lines[0]);
|
sendNetworkEventToServer("v.rp.checkResetPassword", passwordReset.emailInput.lines[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function resetPasswordFailed(errorMessage) {
|
function resetPasswordFailed(errorMessage) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports password reset failed`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Server reports password reset failed`);
|
||||||
passwordReset.messageLabel.text = errorMessage;
|
passwordReset.messageLabel.text = errorMessage;
|
||||||
passwordReset.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
passwordReset.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
||||||
passwordReset.emailInput.text = "";
|
passwordReset.emailInput.text = "";
|
||||||
@@ -157,7 +157,7 @@ function resetPasswordFailed(errorMessage) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function resetPasswordCodeInputGUI() {
|
function resetPasswordCodeInputGUI() {
|
||||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.GUI] Server reports password reset email confirmation was successful. Asking for code ...`);
|
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.GUI] Server reports password reset email confirmation was successful. Asking for code ...`);
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
|
|
||||||
passwordReset.messageLabel.text = getLocaleString("GUIResetPasswordCodeInputLabel");
|
passwordReset.messageLabel.text = getLocaleString("GUIResetPasswordCodeInputLabel");
|
||||||
@@ -172,7 +172,7 @@ function resetPasswordCodeInputGUI() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function resetPasswordEmailInputGUI() {
|
function resetPasswordEmailInputGUI() {
|
||||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.GUI] Server reports password reset request was approved. Asking for email ...`);
|
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.GUI] Server reports password reset request was approved. Asking for email ...`);
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
|
|
||||||
passwordReset.messageLabel.text = getLocaleString("GUIResetPasswordConfirmEmailLabel");
|
passwordReset.messageLabel.text = getLocaleString("GUIResetPasswordConfirmEmailLabel");
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ let yesNoDialog = {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initYesNoDialogGUI() {
|
function initYesNoDialogGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created prompt GUI ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created prompt GUI ...`);
|
||||||
yesNoDialog.window = mexui.window(game.width / 2 - 200, game.height / 2 - 70, 400, 140, 'Question', {
|
yesNoDialog.window = mexui.window(game.width / 2 - 200, game.height / 2 - 70, 400, 140, 'Question', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||||
@@ -73,14 +73,14 @@ function initYesNoDialogGUI() {
|
|||||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
|
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
|
||||||
},
|
},
|
||||||
}, yesNoDialogAnswerNo);
|
}, yesNoDialogAnswerNo);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created prompt GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created prompt GUI`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showYesNoPromptGUI(promptMessage, promptTitle, yesButtonText, noButtonText) {
|
function showYesNoPromptGUI(promptMessage, promptTitle, yesButtonText, noButtonText) {
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing prompt window. Prompt: ${promptTitle} - ${promptMessage}`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing prompt window. Prompt: ${promptTitle} - ${promptMessage}`);
|
||||||
mexui.setInput(true);
|
mexui.setInput(true);
|
||||||
|
|
||||||
yesNoDialog.messageLabel.text = "";
|
yesNoDialog.messageLabel.text = "";
|
||||||
@@ -99,7 +99,7 @@ function showYesNoPromptGUI(promptMessage, promptTitle, yesButtonText, noButtonT
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function yesNoDialogAnswerNo() {
|
function yesNoDialogAnswerNo() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Responding with answer NO to server prompt`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Responding with answer NO to server prompt`);
|
||||||
sendNetworkEventToServer("v.rp.promptAnswerNo");
|
sendNetworkEventToServer("v.rp.promptAnswerNo");
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
}
|
}
|
||||||
@@ -107,7 +107,7 @@ function yesNoDialogAnswerNo() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function yesNoDialogAnswerYes() {
|
function yesNoDialogAnswerYes() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Responding with answer YES to server prompt`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Responding with answer YES to server prompt`);
|
||||||
sendNetworkEventToServer("v.rp.promptAnswerYes");
|
sendNetworkEventToServer("v.rp.promptAnswerYes");
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class HouseData {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function receiveHouseFromServer(houseId, description, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked) {
|
function receiveHouseFromServer(houseId, description, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.House] Received house ${houseId} (${name}) from server`);
|
logToConsole(LOG_DEBUG, `[V.RP.House] Received house ${houseId} (${name}) from server`);
|
||||||
|
|
||||||
if (!areServerElementsSupported() || getGame() == V_GAME_MAFIA_ONE || getGame() == V_GAME_GTA_IV) {
|
if (!areServerElementsSupported() || getGame() == V_GAME_MAFIA_ONE || getGame() == V_GAME_GTA_IV) {
|
||||||
if (getHouseData(houseId) != false) {
|
if (getHouseData(houseId) != false) {
|
||||||
@@ -50,10 +50,10 @@ function receiveHouseFromServer(houseId, description, entrancePosition, blipMode
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.House] House ${houseId} already exists. Checking blip ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.House] House ${houseId} already exists. Checking blip ...`);
|
||||||
if (blipModel == -1) {
|
if (blipModel == -1) {
|
||||||
if (houseData.blipId != -1) {
|
if (houseData.blipId != -1) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.House] House ${houseId}'s blip has been removed by the server`);
|
logToConsole(LOG_DEBUG, `[V.RP.House] House ${houseId}'s blip has been removed by the server`);
|
||||||
if (getGame() == V_GAME_GTA_IV) {
|
if (getGame() == V_GAME_GTA_IV) {
|
||||||
natives.removeBlipAndClearIndex(getHouseData(houseId).blipId);
|
natives.removeBlipAndClearIndex(getHouseData(houseId).blipId);
|
||||||
} else {
|
} else {
|
||||||
@@ -61,11 +61,11 @@ function receiveHouseFromServer(houseId, description, entrancePosition, blipMode
|
|||||||
}
|
}
|
||||||
houseData.blipId = -1;
|
houseData.blipId = -1;
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.House] House ${houseId}'s blip is unchanged`);
|
logToConsole(LOG_DEBUG, `[V.RP.House] House ${houseId}'s blip is unchanged`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (houseData.blipId != -1) {
|
if (houseData.blipId != -1) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.House] House ${houseId}'s blip has been changed by the server`);
|
logToConsole(LOG_DEBUG, `[V.RP.House] House ${houseId}'s blip has been changed by the server`);
|
||||||
if (getGame() == V_GAME_GTA_IV) {
|
if (getGame() == V_GAME_GTA_IV) {
|
||||||
natives.setBlipCoordinates(houseData.blipId, houseData.entrancePosition);
|
natives.setBlipCoordinates(houseData.blipId, houseData.entrancePosition);
|
||||||
natives.changeBlipSprite(houseData.blipId, houseData.blipModel);
|
natives.changeBlipSprite(houseData.blipId, houseData.blipModel);
|
||||||
@@ -78,20 +78,20 @@ function receiveHouseFromServer(houseId, description, entrancePosition, blipMode
|
|||||||
if (blipId != -1) {
|
if (blipId != -1) {
|
||||||
houseData.blipId = blipId;
|
houseData.blipId = blipId;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.House] House ${houseId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
logToConsole(LOG_DEBUG, `[V.RP.House] House ${houseId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.House] House ${houseId} doesn't exist. Adding ...`);
|
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);
|
||||||
if (blipModel != -1) {
|
if (blipModel != -1) {
|
||||||
let blipId = createGameBlip(tempHouseData.blipModel, tempHouseData.entrancePosition, "House");
|
let blipId = createGameBlip(tempHouseData.blipModel, tempHouseData.entrancePosition, "House");
|
||||||
if (blipId != -1) {
|
if (blipId != -1) {
|
||||||
tempHouseData.blipId = blipId;
|
tempHouseData.blipId = blipId;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.House] House ${houseId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
logToConsole(LOG_DEBUG, `[V.RP.House] House ${houseId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.House] House ${houseId} has no blip.`);
|
logToConsole(LOG_DEBUG, `[V.RP.House] House ${houseId} has no blip.`);
|
||||||
}
|
}
|
||||||
getServerData().houses.push(tempHouseData);
|
getServerData().houses.push(tempHouseData);
|
||||||
setAllHouseDataIndexes();
|
setAllHouseDataIndexes();
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ function processItemActionRendering() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function updatePlayerHotBar(activeSlot, itemsArray) {
|
function updatePlayerHotBar(activeSlot, itemsArray) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Main] Updating hotbar`);
|
logToConsole(LOG_DEBUG, `[V.RP.Main] Updating hotbar`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -42,21 +42,21 @@ function initJobScript() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocalPlayerJobType(tempJobType) {
|
function setLocalPlayerJobType(tempJobType) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Set local player job type to ${tempJobType}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] Set local player job type to ${tempJobType}`);
|
||||||
localPlayerJobType = tempJobType;
|
localPlayerJobType = tempJobType;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocalPlayerWorkingState(tempWorking) {
|
function setLocalPlayerWorkingState(tempWorking) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Setting working state to ${tempWorking}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] Setting working state to ${tempWorking}`);
|
||||||
localPlayerWorking = tempWorking;
|
localPlayerWorking = tempWorking;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showJobRouteLocation(position, colour) {
|
function showJobRouteLocation(position, colour) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Showing job route location at ${position.x}, ${position.y}, ${position.z}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] Showing job route location at ${position.x}, ${position.y}, ${position.z}`);
|
||||||
hideJobRouteLocation();
|
hideJobRouteLocation();
|
||||||
if (getMultiplayerMod() == V_MPMOD_GTAC) {
|
if (getMultiplayerMod() == V_MPMOD_GTAC) {
|
||||||
if (getGame() == V_GAME_GTA_SA) {
|
if (getGame() == V_GAME_GTA_SA) {
|
||||||
@@ -80,7 +80,7 @@ function showJobRouteLocation(position, colour) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function enteredJobRouteSphere() {
|
function enteredJobRouteSphere() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Entered job route sphere`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] Entered job route sphere`);
|
||||||
hideJobRouteLocation();
|
hideJobRouteLocation();
|
||||||
tellServerPlayerArrivedAtJobRouteLocation();
|
tellServerPlayerArrivedAtJobRouteLocation();
|
||||||
}
|
}
|
||||||
@@ -114,7 +114,7 @@ function blinkJobRouteLocationBlip(times, position, colour) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function hideJobRouteLocation() {
|
function hideJobRouteLocation() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Hiding job route location`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] Hiding job route location`);
|
||||||
|
|
||||||
if (jobRouteLocationBlip != null) {
|
if (jobRouteLocationBlip != null) {
|
||||||
destroyElement(jobRouteLocationBlip);
|
destroyElement(jobRouteLocationBlip);
|
||||||
@@ -137,7 +137,7 @@ function hideJobRouteLocation() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function receiveJobFromServer(jobId, jobLocationId, name, position, blipModel, pickupModel) {
|
function receiveJobFromServer(jobId, jobLocationId, name, position, blipModel, pickupModel) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Received job ${jobId} (${name}) from server`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] Received job ${jobId} (${name}) from server`);
|
||||||
|
|
||||||
if (!areServerElementsSupported() || getGame() == V_GAME_MAFIA_ONE || getGame() == V_GAME_GTA_IV) {
|
if (!areServerElementsSupported() || getGame() == V_GAME_MAFIA_ONE || getGame() == V_GAME_GTA_IV) {
|
||||||
if (getJobData(jobId) != false) {
|
if (getJobData(jobId) != false) {
|
||||||
@@ -148,10 +148,10 @@ function receiveJobFromServer(jobId, jobLocationId, name, position, blipModel, p
|
|||||||
jobData.blipModel = blipModel;
|
jobData.blipModel = blipModel;
|
||||||
jobData.pickupModel = pickupModel;
|
jobData.pickupModel = pickupModel;
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Job ${jobId} already exists. Checking blip ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] Job ${jobId} already exists. Checking blip ...`);
|
||||||
if (blipModel == -1) {
|
if (blipModel == -1) {
|
||||||
if (jobData.blipId != -1) {
|
if (jobData.blipId != -1) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Job ${jobId}'s blip has been removed by the server`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] Job ${jobId}'s blip has been removed by the server`);
|
||||||
if (getGame() == V_GAME_GTA_IV) {
|
if (getGame() == V_GAME_GTA_IV) {
|
||||||
natives.removeBlipAndClearIndex(getJobData(jobId).blipId);
|
natives.removeBlipAndClearIndex(getJobData(jobId).blipId);
|
||||||
} else {
|
} else {
|
||||||
@@ -159,11 +159,11 @@ function receiveJobFromServer(jobId, jobLocationId, name, position, blipModel, p
|
|||||||
}
|
}
|
||||||
jobData.blipId = -1;
|
jobData.blipId = -1;
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Job ${jobId}'s blip is unchanged`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] Job ${jobId}'s blip is unchanged`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (jobData.blipId != -1) {
|
if (jobData.blipId != -1) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Job ${jobId}'s blip has been changed by the server`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] Job ${jobId}'s blip has been changed by the server`);
|
||||||
if (getGame() == V_GAME_GTA_IV) {
|
if (getGame() == V_GAME_GTA_IV) {
|
||||||
natives.setBlipCoordinates(jobData.blipId, jobData.position);
|
natives.setBlipCoordinates(jobData.blipId, jobData.position);
|
||||||
natives.changeBlipSprite(jobData.blipId, jobData.blipModel);
|
natives.changeBlipSprite(jobData.blipId, jobData.blipModel);
|
||||||
@@ -176,20 +176,20 @@ function receiveJobFromServer(jobId, jobLocationId, name, position, blipModel, p
|
|||||||
if (blipId != -1) {
|
if (blipId != -1) {
|
||||||
jobData.blipId = blipId;
|
jobData.blipId = blipId;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Job ${jobId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] Job ${jobId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Job ${jobId} doesn't exist. Adding ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] Job ${jobId} doesn't exist. Adding ...`);
|
||||||
let tempJobData = new JobData(jobId, jobLocationId, name, position, blipModel, pickupModel);
|
let tempJobData = new JobData(jobId, jobLocationId, name, position, blipModel, pickupModel);
|
||||||
if (blipModel != -1) {
|
if (blipModel != -1) {
|
||||||
let blipId = createGameBlip(blipModel, tempJobData.position, tempJobData.name);
|
let blipId = createGameBlip(blipModel, tempJobData.position, tempJobData.name);
|
||||||
if (blipId != -1) {
|
if (blipId != -1) {
|
||||||
tempJobData.blipId = blipId;
|
tempJobData.blipId = blipId;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Job ${jobId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] Job ${jobId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Job ${jobId} has no blip.`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] Job ${jobId} has no blip.`);
|
||||||
}
|
}
|
||||||
getServerData().jobs.push(tempJobData);
|
getServerData().jobs.push(tempJobData);
|
||||||
setAllJobDataIndexes();
|
setAllJobDataIndexes();
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ function initKeyBindScript() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function bindAccountKey(key, keyState) {
|
function bindAccountKey(key, keyState) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.KeyBind]: Binded key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
logToConsole(LOG_DEBUG, `[V.RP.KeyBind]: Binded key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
||||||
keyBinds.push(toInteger(key));
|
keyBinds.push(toInteger(key));
|
||||||
bindKey(toInteger(key), keyState, function (event) {
|
bindKey(toInteger(key), keyState, function (event) {
|
||||||
if (isAnyGUIActive()) {
|
if (isAnyGUIActive()) {
|
||||||
@@ -32,14 +32,14 @@ function bindAccountKey(key, keyState) {
|
|||||||
|
|
||||||
if (hasKeyBindDelayElapsed()) {
|
if (hasKeyBindDelayElapsed()) {
|
||||||
if (canLocalPlayerUseKeyBinds()) {
|
if (canLocalPlayerUseKeyBinds()) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.KeyBind]: Using keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
logToConsole(LOG_DEBUG, `[V.RP.KeyBind]: Using keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
||||||
lastKeyBindUse = sdl.ticks;
|
lastKeyBindUse = sdl.ticks;
|
||||||
tellServerPlayerUsedKeyBind(key);
|
tellServerPlayerUsedKeyBind(key);
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.KeyBind]: Failed to use keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key}) - Not allowed to use keybinds!`);
|
logToConsole(LOG_DEBUG, `[V.RP.KeyBind]: Failed to use keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key}) - Not allowed to use keybinds!`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.KeyBind]: Failed to use keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key}) - Not enough time has passed since last keybind use!`);
|
logToConsole(LOG_DEBUG, `[V.RP.KeyBind]: Failed to use keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key}) - Not enough time has passed since last keybind use!`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -47,7 +47,7 @@ function bindAccountKey(key, keyState) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function unBindAccountKey(key) {
|
function unBindAccountKey(key) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.KeyBind]: Unbinded key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
logToConsole(LOG_DEBUG, `[V.RP.KeyBind]: Unbinded key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
||||||
unbindKey(key);
|
unbindKey(key);
|
||||||
keyBinds.splice(keyBinds.indexOf(key), 1);
|
keyBinds.splice(keyBinds.indexOf(key), 1);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ function renderPropertyEntranceLabel(name, position, locked, isBusiness, price,
|
|||||||
screenPosition = getScreenFromWorldPosition(position);
|
screenPosition = getScreenFromWorldPosition(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Label] World [${position.x}, ${position.y}, ${position.z}] to screen [${screenPosition.x}, ${screenPosition.y}, ${screenPosition.z}]`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Label] World [${position.x}, ${position.y}, ${position.z}] to screen [${screenPosition.x}, ${screenPosition.y}, ${screenPosition.z}]`);
|
||||||
|
|
||||||
if (screenPosition.x < 0 || screenPosition.x > game.width) {
|
if (screenPosition.x < 0 || screenPosition.x > game.width) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ function loadLocaleConfig() {
|
|||||||
function loadAllLocaleStrings() {
|
function loadAllLocaleStrings() {
|
||||||
let localeOptions = getServerData().localeOptions;
|
let localeOptions = getServerData().localeOptions;
|
||||||
for (let i in localeOptions) {
|
for (let i in localeOptions) {
|
||||||
logToConsole(LOG_INFO, `[AGRP.Locale] Loading locale strings for ${localeOptions[i].englishName} (${i})`);
|
logToConsole(LOG_INFO, `[V.RP.Locale] Loading locale strings for ${localeOptions[i].englishName} (${i})`);
|
||||||
let localeStringFile = loadTextFile(`locale/${localeOptions[i].stringsFile}`);
|
let localeStringFile = loadTextFile(`locale/${localeOptions[i].stringsFile}`);
|
||||||
let localeStringData = JSON.parse(localeStringFile);
|
let localeStringData = JSON.parse(localeStringFile);
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ function loadAllLocaleStrings() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocale(tempLocaleId) {
|
function setLocale(tempLocaleId) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Locale] Setting locale to ${tempLocaleId} (${getServerData().localeOptions[tempLocaleId].englishName})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Locale] Setting locale to ${tempLocaleId} (${getServerData().localeOptions[tempLocaleId].englishName})`);
|
||||||
localLocaleId = tempLocaleId;
|
localLocaleId = tempLocaleId;
|
||||||
resetGUIStrings();
|
resetGUIStrings();
|
||||||
}
|
}
|
||||||
@@ -53,7 +53,7 @@ function processLogoRendering() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setServerLogoRenderState(state) {
|
function setServerLogoRenderState(state) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Main] Server logo ${(state) ? "enabled" : "disabled"}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Main] Server logo ${(state) ? "enabled" : "disabled"}`);
|
||||||
renderLogo = state;
|
renderLogo = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ function processSmallGameMessageRendering() {
|
|||||||
logToConsole(LOG_VERBOSE, "[V.RP.Messaging]: Processing small game message rendering ...");
|
logToConsole(LOG_VERBOSE, "[V.RP.Messaging]: Processing small game message rendering ...");
|
||||||
if (renderSmallGameMessage) {
|
if (renderSmallGameMessage) {
|
||||||
if (smallGameMessageText != "") {
|
if (smallGameMessageText != "") {
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Messaging]: Rendering small game message: ${smallGameMessageText}`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Messaging]: Rendering small game message: ${smallGameMessageText}`);
|
||||||
if (smallGameMessageFonts[smallGameMessageFontName] != null) {
|
if (smallGameMessageFonts[smallGameMessageFontName] != null) {
|
||||||
smallGameMessageFonts[smallGameMessageFontName].render(smallGameMessageText, [0, game.height - 90], game.width, 0.5, 0.0, smallGameMessageFonts[smallGameMessageFontName].size, smallGameMessageColour, true, true, false, true);
|
smallGameMessageFonts[smallGameMessageFontName].render(smallGameMessageText, [0, game.height - 90], game.width, 0.5, 0.0, smallGameMessageFonts[smallGameMessageFontName].size, smallGameMessageColour, true, true, false, true);
|
||||||
}
|
}
|
||||||
@@ -89,7 +89,7 @@ function processSmallGameMessageRendering() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showSmallGameMessage(text, colour, duration, fontName) {
|
function showSmallGameMessage(text, colour, duration, fontName) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Messaging] Showing small game message '${text}' using font ${fontName} for ${duration}ms`);
|
logToConsole(LOG_DEBUG, `[V.RP.Messaging] Showing small game message '${text}' using font ${fontName} for ${duration}ms`);
|
||||||
if (smallGameMessageText != "") {
|
if (smallGameMessageText != "") {
|
||||||
clearTimeout(smallGameMessageTimer);
|
clearTimeout(smallGameMessageTimer);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ function sendResourceStoppedSignalToServer() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function set2DRendering(hudState, labelState, smallGameMessageState, scoreboardState, hotBarState, itemActionDelayState) {
|
function set2DRendering(hudState, labelState, smallGameMessageState, scoreboardState, hotBarState, itemActionDelayState) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Main] Updating render states (HUD: ${hudState}, Labels: ${labelState}, Bottom Text: ${smallGameMessageState}, Scoreboard: ${scoreboardState}, HotBar: ${hotBarState}, Item Action Delay: ${itemActionDelayState})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Main] Updating render states (HUD: ${hudState}, Labels: ${labelState}, Bottom Text: ${smallGameMessageState}, Scoreboard: ${scoreboardState}, HotBar: ${hotBarState}, Item Action Delay: ${itemActionDelayState})`);
|
||||||
renderHUD = hudState;
|
renderHUD = hudState;
|
||||||
|
|
||||||
if (getGame() == V_GAME_GTA_IV) {
|
if (getGame() == V_GAME_GTA_IV) {
|
||||||
@@ -213,7 +213,7 @@ function set2DRendering(hudState, labelState, smallGameMessageState, scoreboardS
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onServerSpawnedLocalPlayer(state) {
|
function onServerSpawnedLocalPlayer(state) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Main] Setting spawned state to ${state}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Main] Setting spawned state to ${state}`);
|
||||||
isSpawned = state;
|
isSpawned = state;
|
||||||
setUpInitialGame();
|
setUpInitialGame();
|
||||||
if (state) {
|
if (state) {
|
||||||
@@ -336,7 +336,7 @@ function setLocalPlayerInfiniteRun(state) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocalPlayerSkin(skinId) {
|
function setLocalPlayerSkin(skinId) {
|
||||||
logToConsole(LOG_INFO, `[AGRP.Server] Setting locale player skin to ${skinId}`);
|
logToConsole(LOG_INFO, `[V.RP.Server] Setting locale player skin to ${skinId}`);
|
||||||
if (getGame() == V_GAME_GTA_IV) {
|
if (getGame() == V_GAME_GTA_IV) {
|
||||||
if (natives.isModelInCdimage(skinId)) {
|
if (natives.isModelInCdimage(skinId)) {
|
||||||
natives.requestModel(skinId);
|
natives.requestModel(skinId);
|
||||||
|
|||||||
@@ -8,14 +8,14 @@
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocalPlayerFrozenState(state) {
|
function setLocalPlayerFrozenState(state) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Setting frozen state to ${state}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Setting frozen state to ${state}`);
|
||||||
gui.showCursor(state, !state);
|
gui.showCursor(state, !state);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocalPlayerControlState(controlState, cursorState = false) {
|
function setLocalPlayerControlState(controlState, cursorState = false) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Setting control state to ${controlState} (Cursor: ${cursorState})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Setting control state to ${controlState} (Cursor: ${cursorState})`);
|
||||||
controlsEnabled = controlState;
|
controlsEnabled = controlState;
|
||||||
game.setPlayerControl(controlState);
|
game.setPlayerControl(controlState);
|
||||||
if (getGame() == V_GAME_GTA_III || getGame() == V_GAME_GTA_VC) {
|
if (getGame() == V_GAME_GTA_III || getGame() == V_GAME_GTA_VC) {
|
||||||
@@ -29,7 +29,7 @@ function setLocalPlayerControlState(controlState, cursorState = false) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function fadeLocalCamera(state, duration, colour) {
|
function fadeLocalCamera(state, duration, colour) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Fading camera ${(state) ? "in" : "out"} for ${time}ms`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Fading camera ${(state) ? "in" : "out"} for ${time}ms`);
|
||||||
|
|
||||||
cameraFadeDuration = duration;
|
cameraFadeDuration = duration;
|
||||||
cameraFadeStart = sdl.ticks;
|
cameraFadeStart = sdl.ticks;
|
||||||
@@ -48,7 +48,7 @@ function removeLocalPlayerFromVehicle() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function restoreLocalCamera() {
|
function restoreLocalCamera() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Camera restored`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Camera restored`);
|
||||||
if (isGameFeatureSupported("customCamera")) {
|
if (isGameFeatureSupported("customCamera")) {
|
||||||
game.restoreCamera(true);
|
game.restoreCamera(true);
|
||||||
}
|
}
|
||||||
@@ -57,7 +57,7 @@ function restoreLocalCamera() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocalCameraLookAt(cameraPosition, cameraLookAt) {
|
function setLocalCameraLookAt(cameraPosition, cameraLookAt) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Set camera to look at [${cameraLookAt.x}, ${cameraLookAt.y}, ${cameraLookAt.z}] from [${cameraPosition.x}, ${cameraPosition.y}, ${cameraPosition.z}]`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Set camera to look at [${cameraLookAt.x}, ${cameraLookAt.y}, ${cameraLookAt.z}] from [${cameraPosition.x}, ${cameraPosition.y}, ${cameraPosition.z}]`);
|
||||||
if (isCustomCameraSupported()) {
|
if (isCustomCameraSupported()) {
|
||||||
game.setCameraLookAt(cameraPosition, cameraLookAt, true);
|
game.setCameraLookAt(cameraPosition, cameraLookAt, true);
|
||||||
}
|
}
|
||||||
@@ -66,15 +66,15 @@ function setLocalCameraLookAt(cameraPosition, cameraLookAt) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function clearLocalPlayerOwnedPeds() {
|
function clearLocalPlayerOwnedPeds() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Clearing all self-owned peds ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Clearing all self-owned peds ...`);
|
||||||
clearSelfOwnedPeds();
|
clearSelfOwnedPeds();
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] All self-owned peds cleared`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] All self-owned peds cleared`);
|
||||||
};
|
};
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setCityAmbienceState(state, clearElements = false) {
|
function setCityAmbienceState(state, clearElements = false) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Ambient civilians and traffic ${(state) ? "enabled" : "disabled"}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Ambient civilians and traffic ${(state) ? "enabled" : "disabled"}`);
|
||||||
game.setTrafficEnabled(state);
|
game.setTrafficEnabled(state);
|
||||||
|
|
||||||
if (getMultiplayerMod() == V_MPMOD_GTAC) {
|
if (getMultiplayerMod() == V_MPMOD_GTAC) {
|
||||||
@@ -134,7 +134,7 @@ function enterVehicleAsPassenger() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function giveLocalPlayerWeapon(weaponId, ammo, active) {
|
function giveLocalPlayerWeapon(weaponId, ammo, active) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Giving weapon ${weaponId} with ${ammo} ammo`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Giving weapon ${weaponId} with ${ammo} ammo`);
|
||||||
forceWeapon = weaponId;
|
forceWeapon = weaponId;
|
||||||
if (getGame() == V_GAME_MAFIA_ONE) {
|
if (getGame() == V_GAME_MAFIA_ONE) {
|
||||||
localPlayer.giveWeapon(weaponId, 0, ammo);
|
localPlayer.giveWeapon(weaponId, 0, ammo);
|
||||||
@@ -155,7 +155,7 @@ function giveLocalPlayerWeapon(weaponId, ammo, active) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function clearLocalPlayerWeapons(clearData) {
|
function clearLocalPlayerWeapons(clearData) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Clearing weapons`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Clearing weapons`);
|
||||||
localPlayer.clearWeapons();
|
localPlayer.clearWeapons();
|
||||||
if (clearData == true) {
|
if (clearData == true) {
|
||||||
forceWeapon = 0;
|
forceWeapon = 0;
|
||||||
@@ -173,7 +173,7 @@ function getClosestVehicle(pos) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocalPlayerPosition(position) {
|
function setLocalPlayerPosition(position) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Setting position to ${position.x}, ${position.y}, ${position.z}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Setting position to ${position.x}, ${position.y}, ${position.z}`);
|
||||||
if (typeof localPlayer.velocity != "undefined") {
|
if (typeof localPlayer.velocity != "undefined") {
|
||||||
localPlayer.velocity = toVector3(0.0, 0.0, 0.0);
|
localPlayer.velocity = toVector3(0.0, 0.0, 0.0);
|
||||||
}
|
}
|
||||||
@@ -186,7 +186,7 @@ function setLocalPlayerPosition(position) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocalPlayerHeading(heading) {
|
function setLocalPlayerHeading(heading) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Setting heading to ${heading}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Setting heading to ${heading}`);
|
||||||
if (typeof localPlayer.heading != "undefined") {
|
if (typeof localPlayer.heading != "undefined") {
|
||||||
localPlayer.heading = heading;
|
localPlayer.heading = heading;
|
||||||
}
|
}
|
||||||
@@ -195,7 +195,7 @@ function setLocalPlayerHeading(heading) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocalPlayerInterior(interior) {
|
function setLocalPlayerInterior(interior) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Setting interior to ${interior}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Setting interior to ${interior}`);
|
||||||
if (getMultiplayerMod() == V_MPMOD_GTAC) {
|
if (getMultiplayerMod() == V_MPMOD_GTAC) {
|
||||||
if (!isGTAIV()) {
|
if (!isGTAIV()) {
|
||||||
localPlayer.interior = interior;
|
localPlayer.interior = interior;
|
||||||
@@ -224,7 +224,7 @@ function setLocalPlayerInterior(interior) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setSnowState(falling, ground, forceGround) {
|
function setSnowState(falling, ground, forceGround) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Setting falling snow to ${falling} and ground snow to ${ground}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Setting falling snow to ${falling} and ground snow to ${ground}`);
|
||||||
snowing = falling;
|
snowing = falling;
|
||||||
//snow.force = ground;
|
//snow.force = ground;
|
||||||
//if (forceGround == true) {
|
//if (forceGround == true) {
|
||||||
@@ -244,7 +244,7 @@ function setLocalPlayerHealth(health) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function playPedSpeech(pedName, speechId) {
|
function playPedSpeech(pedName, speechId) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Making ${pedName}'s ped talk (${speechId})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Making ${pedName}'s ped talk (${speechId})`);
|
||||||
if (getMultiplayerMod() == V_MPMOD_GTAC) {
|
if (getMultiplayerMod() == V_MPMOD_GTAC) {
|
||||||
game.SET_CHAR_SAY(int, int);
|
game.SET_CHAR_SAY(int, int);
|
||||||
}
|
}
|
||||||
@@ -253,7 +253,7 @@ function playPedSpeech(pedName, speechId) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function clearLocalPedState() {
|
function clearLocalPedState() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Clearing local ped state`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Clearing local ped state`);
|
||||||
localPlayer.clearObjective();
|
localPlayer.clearObjective();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,7 +267,7 @@ function getWeaponSlot(weaponId) {
|
|||||||
|
|
||||||
function setLocalPlayerDrunkEffect(amount, duration) {
|
function setLocalPlayerDrunkEffect(amount, duration) {
|
||||||
if (getMultiplayerMod() == V_MPMOD_GTAC) {
|
if (getMultiplayerMod() == V_MPMOD_GTAC) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Drunk effect set to ${amount} for ${duration} ms`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Drunk effect set to ${amount} for ${duration} ms`);
|
||||||
drunkEffectAmount = 0;
|
drunkEffectAmount = 0;
|
||||||
drunkEffectDurationTimer = setInterval(function () {
|
drunkEffectDurationTimer = setInterval(function () {
|
||||||
drunkEffectAmount = drunkEffectAmount;
|
drunkEffectAmount = drunkEffectAmount;
|
||||||
@@ -319,7 +319,7 @@ function clearSelfOwnedVehicles() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setMouseCameraState(state) {
|
function setMouseCameraState(state) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] ${(state) ? "Enabled" : "Disabled"} mouse camera`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] ${(state) ? "Enabled" : "Disabled"} mouse camera`);
|
||||||
mouseCameraEnabled = state;
|
mouseCameraEnabled = state;
|
||||||
SetStandardControlsEnabled(!mouseCameraEnabled);
|
SetStandardControlsEnabled(!mouseCameraEnabled);
|
||||||
}
|
}
|
||||||
@@ -327,28 +327,28 @@ function setMouseCameraState(state) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function toggleMouseCursor() {
|
function toggleMouseCursor() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] ${(!gui.cursorEnabled) ? "Enabled" : "Disabled"} mouse cursor`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] ${(!gui.cursorEnabled) ? "Enabled" : "Disabled"} mouse cursor`);
|
||||||
gui.showCursor(!gui.cursorEnabled, gui.cursorEnabled);
|
gui.showCursor(!gui.cursorEnabled, gui.cursorEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function toggleMouseCursor() {
|
function toggleMouseCursor() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] ${(!gui.cursorEnabled) ? "Enabled" : "Disabled"} mouse cursor`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] ${(!gui.cursorEnabled) ? "Enabled" : "Disabled"} mouse cursor`);
|
||||||
setMouseCameraState(!mouseCameraEnabled);
|
setMouseCameraState(!mouseCameraEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setPlayerWeaponDamageEvent(clientName, eventType) {
|
function setPlayerWeaponDamageEvent(clientName, eventType) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Set ${clientName} damage event type to ${eventType}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Set ${clientName} damage event type to ${eventType}`);
|
||||||
weaponDamageEvent[clientName] = eventType;
|
weaponDamageEvent[clientName] = eventType;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setPlayerWeaponDamageEnabled(clientName, state) {
|
function setPlayerWeaponDamageEnabled(clientName, state) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] ${(state) ? "Enabled" : "Disabled"} damage from ${clientName}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] ${(state) ? "Enabled" : "Disabled"} damage from ${clientName}`);
|
||||||
weaponDamageEnabled[clientName] = state;
|
weaponDamageEnabled[clientName] = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -472,7 +472,7 @@ function getVehicleForNetworkEvent(vehicle) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setMinuteDuration(minuteDuration) {
|
function setMinuteDuration(minuteDuration) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Setting minute duration to ${minuteDuration}ms`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Setting minute duration to ${minuteDuration}ms`);
|
||||||
|
|
||||||
if (isTimeSupported()) {
|
if (isTimeSupported()) {
|
||||||
game.time.minuteDuration = minuteDuration;
|
game.time.minuteDuration = minuteDuration;
|
||||||
@@ -617,7 +617,7 @@ function updateLocalPlayerMoney() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocalPlayerMoney(amount) {
|
function setLocalPlayerMoney(amount) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Setting local player money`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Setting local player money`);
|
||||||
localPlayerMoney = amount;
|
localPlayerMoney = amount;
|
||||||
updateLocalPlayerMoney();
|
updateLocalPlayerMoney();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class VehicleData {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function receiveVehicleFromServer(vehicleId, position, model, colour1, colour2, colour3 = 0, colour4 = 0, locked = false, lights = false, engine = false, licensePlate = "") {
|
function receiveVehicleFromServer(vehicleId, position, model, colour1, colour2, colour3 = 0, colour4 = 0, locked = false, lights = false, engine = false, licensePlate = "") {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Vehicle] Received vehicle ${vehicleId} (${getVehicleNameFromModel(model, getGame())}) from server`);
|
logToConsole(LOG_DEBUG, `[V.RP.Vehicle] Received vehicle ${vehicleId} (${getVehicleNameFromModel(model, getGame())}) from server`);
|
||||||
|
|
||||||
if (getGame() != V_GAME_GTA_IV) {
|
if (getGame() != V_GAME_GTA_IV) {
|
||||||
return false;
|
return false;
|
||||||
@@ -52,7 +52,7 @@ function receiveVehicleFromServer(vehicleId, position, model, colour1, colour2,
|
|||||||
|
|
||||||
let vehicle = natives.getVehicleFromNetworkId(vehicleId.ivNetworkId);
|
let vehicle = natives.getVehicleFromNetworkId(vehicleId.ivNetworkId);
|
||||||
} else {
|
} else {
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Vehicle] Vehicle ${vehicleId} doesn't exist. Adding ...`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Vehicle] Vehicle ${vehicleId} doesn't exist. Adding ...`);
|
||||||
//let tempVehicleData = new VehicleData(vehicleId, name, position, blipModel, pickupModel);
|
//let tempVehicleData = new VehicleData(vehicleId, name, position, blipModel, pickupModel);
|
||||||
|
|
||||||
//vehicles.push(tempVehicleData);
|
//vehicles.push(tempVehicleData);
|
||||||
|
|||||||
@@ -284,31 +284,31 @@ function toggleAccountGUICommand(command, params, client) {
|
|||||||
if (doesPlayerHaveGUIEnabled(client)) {
|
if (doesPlayerHaveGUIEnabled(client)) {
|
||||||
getPlayerData(client).accountData.settings = addBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
getPlayerData(client).accountData.settings = addBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
||||||
messagePlayerNormal(client, getLocaleString(client, "GUIAccountSettingToggle", `{softRed}${toUpperCase(getLocaleString(client, "Off"))}{MAINCOLOUR}`));
|
messagePlayerNormal(client, getLocaleString(client, "GUIAccountSettingToggle", `{softRed}${toUpperCase(getLocaleString(client, "Off"))}{MAINCOLOUR}`));
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has toggled GUI for their account OFF.`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} has toggled GUI for their account OFF.`);
|
||||||
} else {
|
} else {
|
||||||
getPlayerData(client).accountData.settings = removeBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
getPlayerData(client).accountData.settings = removeBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
||||||
messagePlayerNormal(client, getLocaleString(client, "GUIAccountSettingToggle", `{softGreen}${toUpperCase(getLocaleString(client, "On"))}{MAINCOLOUR}`));
|
messagePlayerNormal(client, getLocaleString(client, "GUIAccountSettingToggle", `{softGreen}${toUpperCase(getLocaleString(client, "On"))}{MAINCOLOUR}`));
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has toggled GUI for their account ON.`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} has toggled GUI for their account ON.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isPlayerLoggedIn(client)) {
|
if (!isPlayerLoggedIn(client)) {
|
||||||
if (getPlayerData().accountData.databaseId != 0) {
|
if (getPlayerData().accountData.databaseId != 0) {
|
||||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
showPlayerLoginGUI(client);
|
showPlayerLoginGUI(client);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI`);
|
||||||
} else {
|
} else {
|
||||||
hideAllPlayerGUI(client);
|
hideAllPlayerGUI(client);
|
||||||
messagePlayerNormal(client, getLocaleString(client, "WelcomeBack", getServerName(), getPlayerName(client), "{ALTCOLOUR}/login{MAINCOLOUR}"));
|
messagePlayerNormal(client, getLocaleString(client, "WelcomeBack", getServerName(), getPlayerName(client), "{ALTCOLOUR}/login{MAINCOLOUR}"));
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled)`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
showPlayerRegistrationGUI(client);
|
showPlayerRegistrationGUI(client);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI`);
|
||||||
} else {
|
} else {
|
||||||
hideAllPlayerGUI(client);
|
hideAllPlayerGUI(client);
|
||||||
messagePlayerNormal(client, getLocaleString(client, "WelcomeNewPlayer", getServerName(), getPlayerName(client), "{ALTCOLOUR}/register{MAINCOLOUR}"));
|
messagePlayerNormal(client, getLocaleString(client, "WelcomeNewPlayer", getServerName(), getPlayerName(client), "{ALTCOLOUR}/register{MAINCOLOUR}"));
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register message (GUI disabled)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register message (GUI disabled)`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -323,11 +323,11 @@ function toggleAccountLoginAttemptNotificationsCommand(command, params, client)
|
|||||||
if (doesPlayerHaveLoginAlertsEnabled(client)) {
|
if (doesPlayerHaveLoginAlertsEnabled(client)) {
|
||||||
getPlayerData(client).accountData.settings = removeBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
getPlayerData(client).accountData.settings = removeBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
||||||
messagePlayerNormal(client, `⚙️ You turned ${getBoolRedGreenInlineColour(false)}OFF{MAINCOLOUR} notification by email when somebody tries to login to your account`);
|
messagePlayerNormal(client, `⚙️ You turned ${getBoolRedGreenInlineColour(false)}OFF{MAINCOLOUR} notification by email when somebody tries to login to your account`);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has toggled the login attempt email notifications OFF for their account`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} has toggled the login attempt email notifications OFF for their account`);
|
||||||
} else {
|
} else {
|
||||||
getPlayerData(client).accountData.settings = addBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
getPlayerData(client).accountData.settings = addBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
||||||
messagePlayerNormal(client, `⚙️ You turned ${getBoolRedGreenInlineColour(true)}ON{MAINCOLOUR} notification by email when somebody tries to login to your account`);
|
messagePlayerNormal(client, `⚙️ You turned ${getBoolRedGreenInlineColour(true)}ON{MAINCOLOUR} notification by email when somebody tries to login to your account`);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has toggled the login attempt email notifications OFF for their account`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} has toggled the login attempt email notifications OFF for their account`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -341,14 +341,14 @@ function toggleAccountServerLogoCommand(command, params, client) {
|
|||||||
if (!doesPlayerHaveLogoEnabled(client)) {
|
if (!doesPlayerHaveLogoEnabled(client)) {
|
||||||
getPlayerData(client).accountData.settings = removeBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
getPlayerData(client).accountData.settings = removeBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
||||||
messagePlayerSuccess(client, getLocaleString(client, "AccountServerLogoSet", `${getBoolRedGreenInlineColour(true)}${getLocaleString(client, "On")}{MAINCOLOUR}`));
|
messagePlayerSuccess(client, getLocaleString(client, "AccountServerLogoSet", `${getBoolRedGreenInlineColour(true)}${getLocaleString(client, "On")}{MAINCOLOUR}`));
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has toggled the server logo ON for their account`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} has toggled the server logo ON for their account`);
|
||||||
if (getServerConfig().showLogo) {
|
if (getServerConfig().showLogo) {
|
||||||
updatePlayerShowLogoState(client, true);
|
updatePlayerShowLogoState(client, true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
getPlayerData(client).accountData.settings = addBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
getPlayerData(client).accountData.settings = addBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
||||||
messagePlayerSuccess(client, getLocaleString(client, "AccountServerLogoSet", `${getBoolRedGreenInlineColour(false)}${getLocaleString(client, "Off")}{MAINCOLOUR}`));
|
messagePlayerSuccess(client, getLocaleString(client, "AccountServerLogoSet", `${getBoolRedGreenInlineColour(false)}${getLocaleString(client, "Off")}{MAINCOLOUR}`));
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has toggled the server logo OFF for their account`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} has toggled the server logo OFF for their account`);
|
||||||
updatePlayerShowLogoState(client, false);
|
updatePlayerShowLogoState(client, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -377,11 +377,11 @@ function toggleAccountTwoFactorAuthCommand(command, params, client) {
|
|||||||
if (!doesPlayerHaveTwoFactorAuthEnabled(client)) {
|
if (!doesPlayerHaveTwoFactorAuthEnabled(client)) {
|
||||||
getPlayerData(client).accountData.settings = addBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
getPlayerData(client).accountData.settings = addBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
||||||
messagePlayerSuccess(client, getLocaleString(client, "TwoFactorAuthSet", `${getBoolRedGreenInlineColour(true)}${getLocaleString(client, "On")}{MAINCOLOUR}`));
|
messagePlayerSuccess(client, getLocaleString(client, "TwoFactorAuthSet", `${getBoolRedGreenInlineColour(true)}${getLocaleString(client, "On")}{MAINCOLOUR}`));
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has toggled two-factor authentication ON for their account`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} has toggled two-factor authentication ON for their account`);
|
||||||
} else {
|
} else {
|
||||||
getPlayerData(client).accountData.settings = removeBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
getPlayerData(client).accountData.settings = removeBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
||||||
messagePlayerSuccess(client, getLocaleString(client, "TwoFactorAuthSet", `${getBoolRedGreenInlineColour(false)}${toUpperCase(getLocaleString(client, "Off"))}{MAINCOLOUR}`));
|
messagePlayerSuccess(client, getLocaleString(client, "TwoFactorAuthSet", `${getBoolRedGreenInlineColour(false)}${toUpperCase(getLocaleString(client, "Off"))}{MAINCOLOUR}`));
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has toggled two-factor authentication OFF for their account`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} has toggled two-factor authentication OFF for their account`);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -828,7 +828,7 @@ function saltAccountInfo(name, password) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loginSuccess(client) {
|
function loginSuccess(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} successfully logged in.`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} successfully logged in.`);
|
||||||
getPlayerData(client).loggedIn = true;
|
getPlayerData(client).loggedIn = true;
|
||||||
|
|
||||||
if (getPlayerData(client).loginTimeout != null) {
|
if (getPlayerData(client).loginTimeout != null) {
|
||||||
@@ -839,7 +839,7 @@ function loginSuccess(client) {
|
|||||||
updateConnectionLogOnAuth(client, getPlayerData(client).accountData.databaseId);
|
updateConnectionLogOnAuth(client, getPlayerData(client).accountData.databaseId);
|
||||||
|
|
||||||
if (doesPlayerHaveStaffPermission(client, "Developer") || doesPlayerHaveStaffPermission(client, "ManageServer")) {
|
if (doesPlayerHaveStaffPermission(client, "Developer") || doesPlayerHaveStaffPermission(client, "ManageServer")) {
|
||||||
logToConsole(LOG_WARN, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has needed permissions and is being given administrator access`);
|
logToConsole(LOG_WARN, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} has needed permissions and is being given administrator access`);
|
||||||
setPlayerNativeAdminState(client, true);
|
setPlayerNativeAdminState(client, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -851,11 +851,11 @@ function loginSuccess(client) {
|
|||||||
}, 3500);
|
}, 3500);
|
||||||
|
|
||||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the error GUI (not a tester).`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the error GUI (not a tester).`);
|
||||||
showPlayerErrorGUI(client, getLocaleString(client, "NotATester"), getLocaleString(client, "AccessDenied"));
|
showPlayerErrorGUI(client, getLocaleString(client, "NotATester"), getLocaleString(client, "AccessDenied"));
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the "not a tester" error message (GUI disabled).`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the "not a tester" error message (GUI disabled).`);
|
||||||
messagePlayerError(client, getLocaleString(client, "NotATester"));
|
messagePlayerError(client, getLocaleString(client, "NotATester"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -866,10 +866,10 @@ function loginSuccess(client) {
|
|||||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
showPlayerPrompt(client, getLocaleString(client, "NoCharactersGUIMessage"), getLocaleString(client, "NoCharactersGUIWindowTitle"), getLocaleString(client, "Yes"), getLocaleString(client, "No"));
|
showPlayerPrompt(client, getLocaleString(client, "NoCharactersGUIMessage"), getLocaleString(client, "NoCharactersGUIWindowTitle"), getLocaleString(client, "Yes"), getLocaleString(client, "No"));
|
||||||
getPlayerData(client).promptType = V_PROMPT_CREATEFIRSTCHAR;
|
getPlayerData(client).promptType = V_PROMPT_CREATEFIRSTCHAR;
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the no characters prompt GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the no characters prompt GUI`);
|
||||||
} else {
|
} else {
|
||||||
messagePlayerAlert(client, getLocaleString(client, "NoCharactersChatMessage", `{ALTCOLOUR}/newchar{MAINCOLOUR}`));
|
messagePlayerAlert(client, getLocaleString(client, "NoCharactersChatMessage", `{ALTCOLOUR}/newchar{MAINCOLOUR}`));
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the no characters message (GUI disabled)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the no characters message (GUI disabled)`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
showCharacterSelectToClient(client);
|
showCharacterSelectToClient(client);
|
||||||
@@ -1068,7 +1068,7 @@ function checkLogin(client, password) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isPlayerLoggedIn(client)) {
|
if (isPlayerLoggedIn(client)) {
|
||||||
logToConsole(LOG_WARN, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} attempted to login but is already logged in`);
|
logToConsole(LOG_WARN, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} attempted to login but is already logged in`);
|
||||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
showPlayerLoginSuccessGUI(client);
|
showPlayerLoginSuccessGUI(client);
|
||||||
} else {
|
} else {
|
||||||
@@ -1079,25 +1079,25 @@ function checkLogin(client, password) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isPlayerRegistered(client)) {
|
if (!isPlayerRegistered(client)) {
|
||||||
logToConsole(LOG_WARN, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} attempted to login but is not registered`);
|
logToConsole(LOG_WARN, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} attempted to login but is not registered`);
|
||||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
showPlayerRegistrationGUI(client);
|
showPlayerRegistrationGUI(client);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI`);
|
||||||
} else {
|
} else {
|
||||||
messagePlayerError(client, "Your name is not registered! Use /register to make an account.");
|
messagePlayerError(client, "Your name is not registered! Use /register to make an account.");
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register message (GUI disabled)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register message (GUI disabled)`);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (areParamsEmpty(password)) {
|
if (areParamsEmpty(password)) {
|
||||||
logToConsole(LOG_WARN, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} attempted to login but failed (empty password). ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining`);
|
logToConsole(LOG_WARN, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} attempted to login but failed (empty password). ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining`);
|
||||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
showPlayerLoginFailedGUI(client, getLocaleString(client, "LoginFailedInvalidPassword", getPlayerData(client).loginAttemptsRemaining));
|
showPlayerLoginFailedGUI(client, getLocaleString(client, "LoginFailedInvalidPassword", getPlayerData(client).loginAttemptsRemaining));
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
|
||||||
} else {
|
} else {
|
||||||
messagePlayerError(client, getLocaleString(client, "LoginFailedNoPassword", getPlayerData(client).loginAttemptsRemaining));
|
messagePlayerError(client, getLocaleString(client, "LoginFailedNoPassword", getPlayerData(client).loginAttemptsRemaining));
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled) with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled) with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disabling email login alerts for now. It hangs the server for a couple seconds. Need a way to thread it.
|
// Disabling email login alerts for now. It hangs the server for a couple seconds. Need a way to thread it.
|
||||||
@@ -1108,13 +1108,13 @@ function checkLogin(client, password) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isAccountPasswordCorrect(getPlayerData(client).accountData, hashAccountPassword(getPlayerName(client), password))) {
|
if (!isAccountPasswordCorrect(getPlayerData(client).accountData, hashAccountPassword(getPlayerName(client), password))) {
|
||||||
logToConsole(LOG_WARN, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} attempted to login but failed (wrong password). ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining`);
|
logToConsole(LOG_WARN, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} attempted to login but failed (wrong password). ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining`);
|
||||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
showPlayerLoginFailedGUI(client, getLocaleString(client, "LoginFailedInvalidPassword", getPlayerData(client).loginAttemptsRemaining));
|
showPlayerLoginFailedGUI(client, getLocaleString(client, "LoginFailedInvalidPassword", getPlayerData(client).loginAttemptsRemaining));
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
|
||||||
} else {
|
} else {
|
||||||
messagePlayerError(client, getLocaleString(client, "LoginFailedInvalidPassword", getPlayerData(client).loginAttemptsRemaining));
|
messagePlayerError(client, getLocaleString(client, "LoginFailedInvalidPassword", getPlayerData(client).loginAttemptsRemaining));
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled) with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled) with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disabling email login alerts for now. It hangs the server for a couple seconds. Need a way to thread it.
|
// Disabling email login alerts for now. It hangs the server for a couple seconds. Need a way to thread it.
|
||||||
@@ -1147,7 +1147,7 @@ function checkLogin(client, password) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function checkRegistration(client, password, confirmPassword = "", emailAddress = "") {
|
function checkRegistration(client, password, confirmPassword = "", emailAddress = "") {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: Checking registration for ${getPlayerName(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account]: Checking registration for ${getPlayerName(client)}`);
|
||||||
|
|
||||||
if (isPlayerRegistered(client)) {
|
if (isPlayerRegistered(client)) {
|
||||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
@@ -1268,11 +1268,11 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
|
|||||||
}, 5000);
|
}, 5000);
|
||||||
|
|
||||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the error GUI (not a tester).`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the error GUI (not a tester).`);
|
||||||
showPlayerErrorGUI(client, getLocaleString(client, "NotATester"), getLocaleString(client, "AccessDenied"));
|
showPlayerErrorGUI(client, getLocaleString(client, "NotATester"), getLocaleString(client, "AccessDenied"));
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the "not a tester" error message (GUI disabled).`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the "not a tester" error message (GUI disabled).`);
|
||||||
messagePlayerError(client, getLocaleString(client, "NotATester"));
|
messagePlayerError(client, getLocaleString(client, "NotATester"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1421,7 +1421,7 @@ function savePlayerToDatabase(client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: Saving client ${getPlayerName(client)} to database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account]: Saving client ${getPlayerName(client)} to database ...`);
|
||||||
saveAccountToDatabase(getPlayerData(client).accountData);
|
saveAccountToDatabase(getPlayerData(client).accountData);
|
||||||
|
|
||||||
if (getPlayerData(client).currentSubAccount != -1) {
|
if (getPlayerData(client).currentSubAccount != -1) {
|
||||||
@@ -1443,7 +1443,7 @@ function savePlayerToDatabase(client) {
|
|||||||
|
|
||||||
saveSubAccountToDatabase(getPlayerCurrentSubAccount(client));
|
saveSubAccountToDatabase(getPlayerCurrentSubAccount(client));
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: Saved client ${getPlayerDisplayForConsole(client)} to database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account]: Saved client ${getPlayerDisplayForConsole(client)} to database successfully!`);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1477,7 +1477,7 @@ function createDefaultAccountServerData(accountDatabaseId) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadAccountKeybindsFromDatabase(accountDatabaseID) {
|
function loadAccountKeybindsFromDatabase(accountDatabaseID) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: Loading account keybinds for account ${accountDatabaseID} from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account]: Loading account keybinds for account ${accountDatabaseID} from database ...`);
|
||||||
|
|
||||||
let tempAccountKeybinds = [];
|
let tempAccountKeybinds = [];
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
@@ -1500,21 +1500,21 @@ function loadAccountKeybindsFromDatabase(accountDatabaseID) {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempAccountKeyBindData = new KeyBindData(dbAssoc[i]);
|
let tempAccountKeyBindData = new KeyBindData(dbAssoc[i]);
|
||||||
tempAccountKeybinds.push(tempAccountKeyBindData);
|
tempAccountKeybinds.push(tempAccountKeyBindData);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: Account keybind '${tempAccountKeyBindData.databaseId}' (Key ${tempAccountKeyBindData.key} '${toUpperCase(getKeyNameFromId(tempAccountKeyBindData.key))}') loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account]: Account keybind '${tempAccountKeyBindData.databaseId}' (Key ${tempAccountKeyBindData.key} '${toUpperCase(getKeyNameFromId(tempAccountKeyBindData.key))}') loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: ${tempAccountKeybinds.length} account keybinds for account ${accountDatabaseID} loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account]: ${tempAccountKeybinds.length} account keybinds for account ${accountDatabaseID} loaded from database successfully!`);
|
||||||
return tempAccountKeybinds;
|
return tempAccountKeybinds;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadAccountStaffNotesFromDatabase(accountDatabaseID) {
|
function loadAccountStaffNotesFromDatabase(accountDatabaseID) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: Loading account staff notes for account ${accountDatabaseID} from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account]: Loading account staff notes for account ${accountDatabaseID} from database ...`);
|
||||||
|
|
||||||
let tempAccountStaffNotes = [];
|
let tempAccountStaffNotes = [];
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
@@ -1527,20 +1527,20 @@ function loadAccountStaffNotesFromDatabase(accountDatabaseID) {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempAccountStaffNoteData = new AccountStaffNoteData(dbAssoc[i]);
|
let tempAccountStaffNoteData = new AccountStaffNoteData(dbAssoc[i]);
|
||||||
tempAccountStaffNotes.push(tempAccountStaffNoteData);
|
tempAccountStaffNotes.push(tempAccountStaffNoteData);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: Account staff note '${tempAccountStaffNoteData.databaseId}' loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account]: Account staff note '${tempAccountStaffNoteData.databaseId}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: ${tempAccountStaffNotes.length} account staff notes for account ${accountDatabaseID} loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account]: ${tempAccountStaffNotes.length} account staff notes for account ${accountDatabaseID} loaded from database successfully!`);
|
||||||
return tempAccountStaffNotes;
|
return tempAccountStaffNotes;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadAccountContactsFromDatabase(accountDatabaseID) {
|
function loadAccountContactsFromDatabase(accountDatabaseID) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: Loading account contacts for account ${accountDatabaseID} from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account]: Loading account contacts for account ${accountDatabaseID} from database ...`);
|
||||||
|
|
||||||
let tempAccountContacts = [];
|
let tempAccountContacts = [];
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
@@ -1553,20 +1553,20 @@ function loadAccountContactsFromDatabase(accountDatabaseID) {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempAccountContactData = new AccountContactData(dbAssoc[i]);
|
let tempAccountContactData = new AccountContactData(dbAssoc[i]);
|
||||||
tempAccountContacts.push(tempAccountContactData);
|
tempAccountContacts.push(tempAccountContactData);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: Account contact '${tempAccountContactData.databaseId}' loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account]: Account contact '${tempAccountContactData.databaseId}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: ${tempAccountContacts.length} account contacts for account ${accountDatabaseID} loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account]: ${tempAccountContacts.length} account contacts for account ${accountDatabaseID} loaded from database successfully!`);
|
||||||
return tempAccountContacts;
|
return tempAccountContacts;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadAccountMessagesFromDatabase(accountDatabaseID) {
|
function loadAccountMessagesFromDatabase(accountDatabaseID) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: Loading account messages for account ${accountDatabaseID} from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account]: Loading account messages for account ${accountDatabaseID} from database ...`);
|
||||||
|
|
||||||
let tempAccountMessages = [];
|
let tempAccountMessages = [];
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
@@ -1579,13 +1579,13 @@ function loadAccountMessagesFromDatabase(accountDatabaseID) {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempAccountMessageData = new AccountContactData(dbAssoc[i]);
|
let tempAccountMessageData = new AccountContactData(dbAssoc[i]);
|
||||||
tempAccountMessages.push(tempAccountMessageData);
|
tempAccountMessages.push(tempAccountMessageData);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: Account contact '${tempAccountMessageData.databaseId}' loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account]: Account contact '${tempAccountMessageData.databaseId}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: ${tempAccountMessages.length} account messages for account ${accountDatabaseID} loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account]: ${tempAccountMessages.length} account messages for account ${accountDatabaseID} loaded from database successfully!`);
|
||||||
return tempAccountMessages;
|
return tempAccountMessages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ function accountBanCommand(command, params, client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_WARN, `[AGRP.Ban]: ${getPlayerDisplayForConsole(targetClient)} (${getPlayerData(targetClient).accountData.name}) account was banned by ${getPlayerDisplayForConsole(client)}. Reason: ${reason}`);
|
logToConsole(LOG_WARN, `[V.RP.Ban]: ${getPlayerDisplayForConsole(targetClient)} (${getPlayerData(targetClient).accountData.name}) account was banned by ${getPlayerDisplayForConsole(client)}. Reason: ${reason}`);
|
||||||
|
|
||||||
announceAdminAction(`PlayerAccountBanned`, `{ALTCOLOUR}${getPlayerName(targetClient)}{MAINCOLOUR}`);
|
announceAdminAction(`PlayerAccountBanned`, `{ALTCOLOUR}${getPlayerName(targetClient)}{MAINCOLOUR}`);
|
||||||
banAccount(getPlayerData(targetClient).accountData.databaseId, getPlayerData(client).accountData.databaseId, reason);
|
banAccount(getPlayerData(targetClient).accountData.databaseId, getPlayerData(client).accountData.databaseId, reason);
|
||||||
@@ -97,7 +97,7 @@ function subAccountBanCommand(command, params, client, fromDiscord) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_WARN, `[AGRP.Ban]: ${getPlayerDisplayForConsole(targetClient)} (${getPlayerData(targetClient).accountData.name})'s subaccount was banned by ${getPlayerDisplayForConsole(client)}. Reason: ${reason}`);
|
logToConsole(LOG_WARN, `[V.RP.Ban]: ${getPlayerDisplayForConsole(targetClient)} (${getPlayerData(targetClient).accountData.name})'s subaccount was banned by ${getPlayerDisplayForConsole(client)}. Reason: ${reason}`);
|
||||||
|
|
||||||
announceAdminAction(`PlayerCharacterBanned`, `{ALTCOLOUR}${getPlayerName(targetClient)}{MAINCOLOUR}`);
|
announceAdminAction(`PlayerCharacterBanned`, `{ALTCOLOUR}${getPlayerName(targetClient)}{MAINCOLOUR}`);
|
||||||
banSubAccount(getPlayerData(targetClient).currentSubAccountData.databaseId, getPlayerData(client).accountData.databaseId, reason);
|
banSubAccount(getPlayerData(targetClient).currentSubAccountData.databaseId, getPlayerData(client).accountData.databaseId, reason);
|
||||||
|
|||||||
@@ -227,21 +227,21 @@ function loadBusinessesFromDatabase() {
|
|||||||
tempBusinessData.locations = loadBusinessLocationsFromDatabase(tempBusinessData.databaseId);
|
tempBusinessData.locations = loadBusinessLocationsFromDatabase(tempBusinessData.databaseId);
|
||||||
//tempBusinessData.gameScripts = loadBusinessGameScriptsFromDatabase(tempBusinessData.databaseId);
|
//tempBusinessData.gameScripts = loadBusinessGameScriptsFromDatabase(tempBusinessData.databaseId);
|
||||||
tempBusinesses.push(tempBusinessData);
|
tempBusinesses.push(tempBusinessData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Business]: Business '${tempBusinessData.name}' (ID ${tempBusinessData.databaseId}) loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Business]: Business '${tempBusinessData.name}' (ID ${tempBusinessData.databaseId}) loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_INFO, `[AGRP.Business]: ${tempBusinesses.length} businesses loaded from database successfully!`);
|
logToConsole(LOG_INFO, `[V.RP.Business]: ${tempBusinesses.length} businesses loaded from database successfully!`);
|
||||||
return tempBusinesses;
|
return tempBusinesses;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadBusinessLocationsFromDatabase(businessId) {
|
function loadBusinessLocationsFromDatabase(businessId) {
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Business]: Loading business locations for business ${businessId} from database ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Business]: Loading business locations for business ${businessId} from database ...`);
|
||||||
|
|
||||||
let tempBusinessLocations = [];
|
let tempBusinessLocations = [];
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
@@ -255,13 +255,13 @@ function loadBusinessLocationsFromDatabase(businessId) {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempBusinessLocationData = new BusinessLocationData(dbAssoc[i]);
|
let tempBusinessLocationData = new BusinessLocationData(dbAssoc[i]);
|
||||||
tempBusinessLocations.push(tempBusinessLocationData);
|
tempBusinessLocations.push(tempBusinessLocationData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Business]: Location '${tempBusinessLocationData.name}' loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Business]: Location '${tempBusinessLocationData.name}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Business]: ${tempBusinessLocations.length} location for business ${businessId} loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Business]: ${tempBusinessLocations.length} location for business ${businessId} loaded from database successfully!`);
|
||||||
return tempBusinessLocations;
|
return tempBusinessLocations;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -269,7 +269,7 @@ function loadBusinessLocationsFromDatabase(businessId) {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
function loadBusinessGameScriptsFromDatabase(businessId) {
|
function loadBusinessGameScriptsFromDatabase(businessId) {
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Business]: Loading business game scripts for business ${businessId} from database ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Business]: Loading business game scripts for business ${businessId} from database ...`);
|
||||||
|
|
||||||
let tempBusinessGameScripts = [];
|
let tempBusinessGameScripts = [];
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
@@ -284,13 +284,13 @@ function loadBusinessGameScriptsFromDatabase(businessId) {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempBusinessGameScriptData = new BusinessGameScriptData(dbAssoc[i]);
|
let tempBusinessGameScriptData = new BusinessGameScriptData(dbAssoc[i]);
|
||||||
tempBusinessGameScripts.push(tempBusinessGameScriptData);
|
tempBusinessGameScripts.push(tempBusinessGameScriptData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Business]: Game script '${tempBusinessGameScriptData.name}' loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Business]: Game script '${tempBusinessGameScriptData.name}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Business]: ${tempBusinessGameScripts.length} game scripts for business ${businessId} loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Business]: ${tempBusinessGameScripts.length} game scripts for business ${businessId} loaded from database successfully!`);
|
||||||
return tempBusinessGameScripts;
|
return tempBusinessGameScripts;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
@@ -1554,7 +1554,7 @@ function orderItemForBusinessCommand(command, params, client) {
|
|||||||
let value = getItemTypeData(itemType).orderValue;
|
let value = getItemTypeData(itemType).orderValue;
|
||||||
let businessId = getPlayerBusiness(client);
|
let businessId = getPlayerBusiness(client);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Business] ${getPlayerDisplayForConsole(client)} is ordering ${amount} ${splitParams.slice(0, -2).join(" ")}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Business] ${getPlayerDisplayForConsole(client)} is ordering ${amount} ${splitParams.slice(0, -2).join(" ")}`);
|
||||||
|
|
||||||
if (!getBusinessData(businessId)) {
|
if (!getBusinessData(businessId)) {
|
||||||
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
|
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
|
||||||
@@ -1893,7 +1893,7 @@ function saveBusinessToDatabase(businessId) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Business]: Saving business '${tempBusinessData.name}' to database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Business]: Saving business '${tempBusinessData.name}' to database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
let safeBusinessName = escapeDatabaseString(dbConnection, tempBusinessData.name);
|
let safeBusinessName = escapeDatabaseString(dbConnection, tempBusinessData.name);
|
||||||
@@ -1949,7 +1949,7 @@ function saveBusinessToDatabase(businessId) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Business]: Saved business '${tempBusinessData.name}' to database!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Business]: Saved business '${tempBusinessData.name}' to database!`);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2019,7 +2019,7 @@ function createBusinessEntrancePickup(businessId) {
|
|||||||
// return false;
|
// return false;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating entrance pickup for business ${businessData.name}`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Creating entrance pickup for business ${businessData.name}`);
|
||||||
|
|
||||||
if (areServerElementsSupported() && getGame() != V_GAME_MAFIA_ONE && getGame() != V_GAME_GTA_IV) {
|
if (areServerElementsSupported() && getGame() != V_GAME_MAFIA_ONE && getGame() != V_GAME_GTA_IV) {
|
||||||
let entrancePickup = null;
|
let entrancePickup = null;
|
||||||
@@ -2096,7 +2096,7 @@ function createBusinessEntranceBlip(businessId) {
|
|||||||
blipModelId = businessData.entranceBlipModel;
|
blipModelId = businessData.entranceBlipModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating entrance blip for business ${businessData.name} (model ${blipModelId})`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Creating entrance blip for business ${businessData.name} (model ${blipModelId})`);
|
||||||
|
|
||||||
if (areServerElementsSupported() && getGame() != V_GAME_MAFIA_ONE && getGame() != V_GAME_GTA_IV) {
|
if (areServerElementsSupported() && getGame() != V_GAME_MAFIA_ONE && getGame() != V_GAME_GTA_IV) {
|
||||||
let entranceBlip = createGameBlip(businessData.entrancePosition, blipModelId, 1, getColourByType("businessBlue"));
|
let entranceBlip = createGameBlip(businessData.entrancePosition, blipModelId, 1, getColourByType("businessBlue"));
|
||||||
@@ -2148,7 +2148,7 @@ function createBusinessExitPickup(businessId) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating exit pickup for business ${businessData.name}`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Creating exit pickup for business ${businessData.name}`);
|
||||||
|
|
||||||
let exitPickup = null;
|
let exitPickup = null;
|
||||||
if (isGameFeatureSupported("pickup")) {
|
if (isGameFeatureSupported("pickup")) {
|
||||||
@@ -2220,7 +2220,7 @@ function createBusinessExitBlip(businessId) {
|
|||||||
blipModelId = businessData.exitBlipModel;
|
blipModelId = businessData.exitBlipModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating exit blip for business ${businessData.name} (model ${blipModelId})`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Creating exit blip for business ${businessData.name} (model ${blipModelId})`);
|
||||||
|
|
||||||
let exitBlip = createGameBlip(businessData.exitPosition, blipModelId, 1, getColourByName("businessBlue"));
|
let exitBlip = createGameBlip(businessData.exitPosition, blipModelId, 1, getColourByName("businessBlue"));
|
||||||
if (exitBlip != null) {
|
if (exitBlip != null) {
|
||||||
@@ -2842,11 +2842,11 @@ function cacheBusinessItems(businessId) {
|
|||||||
clearArray(getBusinessData(businessId).storageItemCache);
|
clearArray(getBusinessData(businessId).storageItemCache);
|
||||||
|
|
||||||
//let businessData = getBusinessData(businessId);
|
//let businessData = getBusinessData(businessId);
|
||||||
//logToConsole(LOG_VERBOSE, `[AGRP.Business] Caching business items for business ${businessId} (${businessData.name}) ...`);
|
//logToConsole(LOG_VERBOSE, `[V.RP.Business] Caching business items for business ${businessId} (${businessData.name}) ...`);
|
||||||
//getBusinessData(businessId).floorItemCache = getServerData().items.filter(item => item.ownerType == V_ITEM_OWNER_BIZFLOOR && item.ownerId == businessData.databaseId).map(i => i.index);
|
//getBusinessData(businessId).floorItemCache = getServerData().items.filter(item => item.ownerType == V_ITEM_OWNER_BIZFLOOR && item.ownerId == businessData.databaseId).map(i => i.index);
|
||||||
//getBusinessData(businessId).storageItemCache = getServerData().items.filter(item => item.ownerType == V_ITEM_OWNER_BIZSTORAGE && item.ownerId == businessData.databaseId);
|
//getBusinessData(businessId).storageItemCache = getServerData().items.filter(item => item.ownerType == V_ITEM_OWNER_BIZSTORAGE && item.ownerId == businessData.databaseId);
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Business] Caching business items for business ${businessId} (${getBusinessData(businessId).name}) ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Business] Caching business items for business ${businessId} (${getBusinessData(businessId).name}) ...`);
|
||||||
for (let i in getServerData().items) {
|
for (let i in getServerData().items) {
|
||||||
if (getItemData(i).ownerType == V_ITEM_OWNER_BIZFLOOR && getItemData(i).ownerId == getBusinessData(businessId).databaseId) {
|
if (getItemData(i).ownerType == V_ITEM_OWNER_BIZFLOOR && getItemData(i).ownerId == getBusinessData(businessId).databaseId) {
|
||||||
getBusinessData(businessId).floorItemCache.push(i);
|
getBusinessData(businessId).floorItemCache.push(i);
|
||||||
@@ -2855,7 +2855,7 @@ function cacheBusinessItems(businessId) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Business] Successfully cached ${getBusinessData(businessId).floorItemCache.length} floor items and ${getBusinessData(businessId).storageItemCache} storage items for business ${businessId} (${getBusinessData(businessId).name})!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Business] Successfully cached ${getBusinessData(businessId).floorItemCache.length} floor items and ${getBusinessData(businessId).storageItemCache} storage items for business ${businessId} (${getBusinessData(businessId).name})!`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -132,13 +132,13 @@ function loadClansFromDatabase() {
|
|||||||
//tempClanData.members = loadClanMembersFromDatabase(tempClanData.databaseId);
|
//tempClanData.members = loadClanMembersFromDatabase(tempClanData.databaseId);
|
||||||
tempClanData.ranks = loadClanRanksFromDatabase(tempClanData.databaseId);
|
tempClanData.ranks = loadClanRanksFromDatabase(tempClanData.databaseId);
|
||||||
tempClans.push(tempClanData);
|
tempClans.push(tempClanData);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Clan]: Clan '${tempClanData.name}' loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Clan]: Clan '${tempClanData.name}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_INFO, `[AGRP.Clan]: ${tempClans.length} clans loaded from database successfully!`);
|
logToConsole(LOG_INFO, `[V.RP.Clan]: ${tempClans.length} clans loaded from database successfully!`);
|
||||||
return tempClans;
|
return tempClans;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,20 +158,20 @@ function loadClanMembersFromDatabase() {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempClanData = new ClanData(dbAssoc[i]);
|
let tempClanData = new ClanData(dbAssoc[i]);
|
||||||
tempClans.push(tempClanData);
|
tempClans.push(tempClanData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Clan]: Clan '${tempClanData.name}' loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Clan]: Clan '${tempClanData.name}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_INFO, `[AGRP.Clan]: ${tempClans.length} clans loaded from database successfully!`);
|
logToConsole(LOG_INFO, `[V.RP.Clan]: ${tempClans.length} clans loaded from database successfully!`);
|
||||||
return tempClans;
|
return tempClans;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadClanRanksFromDatabase(clanDatabaseId) {
|
function loadClanRanksFromDatabase(clanDatabaseId) {
|
||||||
logToConsole(LOG_INFO, `[AGRP.Clan]: Loading ranks for clan ${clanDatabaseId} from database ...`);
|
logToConsole(LOG_INFO, `[V.RP.Clan]: Loading ranks for clan ${clanDatabaseId} from database ...`);
|
||||||
|
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
let dbAssoc = [];
|
let dbAssoc = [];
|
||||||
@@ -184,13 +184,13 @@ function loadClanRanksFromDatabase(clanDatabaseId) {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempClanRankData = new ClanRankData(dbAssoc[i]);
|
let tempClanRankData = new ClanRankData(dbAssoc[i]);
|
||||||
tempClanRanks.push(tempClanRankData);
|
tempClanRanks.push(tempClanRankData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Clan]: Clan rank '${tempClanRankData.name}' loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Clan]: Clan rank '${tempClanRankData.name}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_INFO, `[AGRP.Clan]: Loaded ranks for clan ${clanDatabaseId} from database successfully!`);
|
logToConsole(LOG_INFO, `[V.RP.Clan]: Loaded ranks for clan ${clanDatabaseId} from database successfully!`);
|
||||||
return tempClanRanks;
|
return tempClanRanks;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1285,10 +1285,10 @@ function setClanRankTitle(clanId, rankId, title) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function saveAllClansToDatabase() {
|
function saveAllClansToDatabase() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Clan]: Saving all server clans to database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Clan]: Saving all server clans to database ...`);
|
||||||
|
|
||||||
if (getServerConfig().devServer) {
|
if (getServerConfig().devServer) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Clan]: Aborting save all clans to database, dev server is enabled.`);
|
logToConsole(LOG_DEBUG, `[V.RP.Clan]: Aborting save all clans to database, dev server is enabled.`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1296,7 +1296,7 @@ function saveAllClansToDatabase() {
|
|||||||
saveClanToDatabase(i);
|
saveClanToDatabase(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_INFO, `[AGRP.Clan]: Saved all server clans to database`);
|
logToConsole(LOG_INFO, `[V.RP.Clan]: Saved all server clans to database`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ function initClientScript() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function resetClientStuff(client) {
|
function resetClientStuff(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Resetting client data for ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Resetting client data for ${getPlayerDisplayForConsole(client)}`);
|
||||||
|
|
||||||
if (!getPlayerData(client)) {
|
if (!getPlayerData(client)) {
|
||||||
return false;
|
return false;
|
||||||
@@ -207,15 +207,15 @@ function kickAllClients() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initClient(client) {
|
function initClient(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] Initializing client ${getPlayerDisplayForConsole(client)} ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] Initializing client ${getPlayerDisplayForConsole(client)} ...`);
|
||||||
|
|
||||||
if (isConsole(client)) {
|
if (isConsole(client)) {
|
||||||
logToConsole(LOG_DEBUG | LOG_ERROR, `[AGRP.Account] Client initialization failed for ${getPlayerDisplayForConsole(client)}! (is console client)`);
|
logToConsole(LOG_DEBUG | LOG_ERROR, `[V.RP.Account] Client initialization failed for ${getPlayerDisplayForConsole(client)}! (is console client)`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerInitialized[client.index] == true) {
|
if (playerInitialized[client.index] == true) {
|
||||||
logToConsole(LOG_DEBUG | LOG_ERROR, `[AGRP.Account] Client initialization failed for ${getPlayerDisplayForConsole(client)}! (already initialized)`);
|
logToConsole(LOG_DEBUG | LOG_ERROR, `[V.RP.Account] Client initialization failed for ${getPlayerDisplayForConsole(client)}! (already initialized)`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,25 +223,25 @@ function initClient(client) {
|
|||||||
|
|
||||||
//setEntityData(client, "v.rp.isInitialized", true, false);
|
//setEntityData(client, "v.rp.isInitialized", true, false);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] Initializing GUI for ${getPlayerDisplayForConsole(client)} ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] Initializing GUI for ${getPlayerDisplayForConsole(client)} ...`);
|
||||||
sendPlayerCurrencyString(client);
|
sendPlayerCurrencyString(client);
|
||||||
sendPlayerGUIColours(client);
|
sendPlayerGUIColours(client);
|
||||||
sendPlayerGUIInit(client);
|
sendPlayerGUIInit(client);
|
||||||
updatePlayerSnowState(client, getServerConfig().groundSnow);
|
updatePlayerSnowState(client, getServerConfig().groundSnow);
|
||||||
|
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Account] Showing connect camera to ${getPlayerDisplayForConsole(client)} ...`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Account] Showing connect camera to ${getPlayerDisplayForConsole(client)} ...`);
|
||||||
//showConnectCameraToPlayer(client);
|
//showConnectCameraToPlayer(client);
|
||||||
|
|
||||||
messageClient(`Please wait ...`, client, getColourByName("softGreen"));
|
messageClient(`Please wait ...`, client, getColourByName("softGreen"));
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] Waiting for 2.5 seconds to prevent race attack ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] Waiting for 2.5 seconds to prevent race attack ...`);
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
if (client != null) {
|
if (client != null) {
|
||||||
clearChatBox(client);
|
clearChatBox(client);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] Loading account for ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] Loading account for ${getPlayerDisplayForConsole(client)}`);
|
||||||
let tempAccountData = loadAccountFromName(getPlayerName(client), true);
|
let tempAccountData = loadAccountFromName(getPlayerName(client), true);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] Loading subaccounts for ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] Loading subaccounts for ${getPlayerDisplayForConsole(client)}`);
|
||||||
let tempSubAccounts = loadSubAccountsFromAccount(tempAccountData.databaseId);
|
let tempSubAccounts = loadSubAccountsFromAccount(tempAccountData.databaseId);
|
||||||
|
|
||||||
getServerData().clients[getPlayerId(client)] = new ClientData(client, tempAccountData, tempSubAccounts);
|
getServerData().clients[getPlayerId(client)] = new ClientData(client, tempAccountData, tempSubAccounts);
|
||||||
@@ -258,10 +258,10 @@ function initClient(client) {
|
|||||||
playRadioStreamForPlayer(client, getServerIntroMusicURL(), true, getPlayerStreamingRadioVolume(client));
|
playRadioStreamForPlayer(client, getServerIntroMusicURL(), true, getPlayerStreamingRadioVolume(client));
|
||||||
} else {
|
} else {
|
||||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI.`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI.`);
|
||||||
showPlayerLoginGUI(client);
|
showPlayerLoginGUI(client);
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled).`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled).`);
|
||||||
messagePlayerNormal(client, getLocaleString(client, "WelcomeBack", getServerName(), getPlayerName(client), "/login"), getColourByName("softGreen"));
|
messagePlayerNormal(client, getLocaleString(client, "WelcomeBack", getServerName(), getPlayerName(client), "/login"), getColourByName("softGreen"));
|
||||||
|
|
||||||
if (checkForGeoIPModule()) {
|
if (checkForGeoIPModule()) {
|
||||||
@@ -281,10 +281,10 @@ function initClient(client) {
|
|||||||
} else {
|
} else {
|
||||||
sendPlayerLocaleId(client, 0);
|
sendPlayerLocaleId(client, 0);
|
||||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI.`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI.`);
|
||||||
showPlayerRegistrationGUI(client);
|
showPlayerRegistrationGUI(client);
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register message (GUI disabled).`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register message (GUI disabled).`);
|
||||||
messagePlayerNormal(client, getLocaleString(client, "WelcomeNewPlayer", getServerName(), getPlayerName(client), "/register"), getColourByName("softGreen"));
|
messagePlayerNormal(client, getLocaleString(client, "WelcomeNewPlayer", getServerName(), getPlayerName(client), "/register"), getColourByName("softGreen"));
|
||||||
}
|
}
|
||||||
playRadioStreamForPlayer(client, getServerIntroMusicURL(), true, getPlayerStreamingRadioVolume(client));
|
playRadioStreamForPlayer(client, getServerIntroMusicURL(), true, getPlayerStreamingRadioVolume(client));
|
||||||
|
|||||||
@@ -707,7 +707,7 @@ function addAllCommandHandlers() {
|
|||||||
let commands = getCommands();
|
let commands = getCommands();
|
||||||
for (let i in commands) {
|
for (let i in commands) {
|
||||||
for (let j in commands[i]) {
|
for (let j in commands[i]) {
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Command] Adding command handler for ${i} - ${commands[i][j].command}`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Command] Adding command handler for ${i} - ${commands[i][j].command}`);
|
||||||
addCommandHandler(commands[i][j].command, processPlayerCommand);
|
addCommandHandler(commands[i][j].command, processPlayerCommand);
|
||||||
commandCount++;
|
commandCount++;
|
||||||
}
|
}
|
||||||
@@ -716,7 +716,7 @@ function addAllCommandHandlers() {
|
|||||||
removeCommandHandler("help");
|
removeCommandHandler("help");
|
||||||
addCommandHandler("help", helpCommand);
|
addCommandHandler("help", helpCommand);
|
||||||
|
|
||||||
logToConsole(LOG_INFO, `[AGRP.Command] ${commandCount} command handlers added!`);
|
logToConsole(LOG_INFO, `[V.RP.Command] ${commandCount} command handlers added!`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -890,7 +890,7 @@ function processPlayerCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!doesCommandExist(toLowerCase(command))) {
|
if (!doesCommandExist(toLowerCase(command))) {
|
||||||
logToConsole(LOG_WARN, `[AGRP.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (invalid command): /${command} ${paramsDisplay}`);
|
logToConsole(LOG_WARN, `[V.RP.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (invalid command): /${command} ${paramsDisplay}`);
|
||||||
|
|
||||||
let possibleCommand = getCommandFromParams(command);
|
let possibleCommand = getCommandFromParams(command);
|
||||||
if (possibleCommand != false && doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(toLowerCase(possibleCommand.command)))) {
|
if (possibleCommand != false && doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(toLowerCase(possibleCommand.command)))) {
|
||||||
@@ -902,7 +902,7 @@ function processPlayerCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!commandData.enabled) {
|
if (!commandData.enabled) {
|
||||||
logToConsole(LOG_WARN, `[AGRP.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (command is disabled): /${command} ${paramsDisplay}`);
|
logToConsole(LOG_WARN, `[V.RP.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (command is disabled): /${command} ${paramsDisplay}`);
|
||||||
messagePlayerError(client, `The command {ALTCOLOUR}/${command}{MAINCOLOUR} is disabled!`);
|
messagePlayerError(client, `The command {ALTCOLOUR}/${command}{MAINCOLOUR} is disabled!`);
|
||||||
messagePlayerError(client, getLocaleString(client, "CommandDisabled", `{ALTCOLOUR}/${command}{MAINCOLOUR}`));
|
messagePlayerError(client, getLocaleString(client, "CommandDisabled", `{ALTCOLOUR}/${command}{MAINCOLOUR}`));
|
||||||
return false;
|
return false;
|
||||||
@@ -910,7 +910,7 @@ function processPlayerCommand(command, params, client) {
|
|||||||
|
|
||||||
if (doesCommandRequireLogin(toLowerCase(command))) {
|
if (doesCommandRequireLogin(toLowerCase(command))) {
|
||||||
if (!isPlayerLoggedIn(client)) {
|
if (!isPlayerLoggedIn(client)) {
|
||||||
logToConsole(LOG_WARN, `[AGRP.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (requires login first): /${command} ${paramsDisplay}`);
|
logToConsole(LOG_WARN, `[V.RP.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (requires login first): /${command} ${paramsDisplay}`);
|
||||||
messagePlayerError(client, getLocaleString(client, "CommandRequiresLogin", `{ALTCOLOUR}/${command}{MAINCOLOUR}`));
|
messagePlayerError(client, getLocaleString(client, "CommandRequiresLogin", `{ALTCOLOUR}/${command}{MAINCOLOUR}`));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -918,7 +918,7 @@ function processPlayerCommand(command, params, client) {
|
|||||||
|
|
||||||
if (isClientFromDiscord(client)) {
|
if (isClientFromDiscord(client)) {
|
||||||
if (!isCommandAllowedOnDiscord(command)) {
|
if (!isCommandAllowedOnDiscord(command)) {
|
||||||
logToConsole(LOG_WARN, `[AGRP.Command] ${getPlayerDisplayForConsole(client)} attempted to use command from discord, but failed (not available on discord): /${command} ${paramsDisplay}`);
|
logToConsole(LOG_WARN, `[V.RP.Command] ${getPlayerDisplayForConsole(client)} attempted to use command from discord, but failed (not available on discord): /${command} ${paramsDisplay}`);
|
||||||
messagePlayerError(client, `The {ALTCOLOUR}/${command}{MAINCOLOUR} command isn't available on discord!`);
|
messagePlayerError(client, `The {ALTCOLOUR}/${command}{MAINCOLOUR} command isn't available on discord!`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -926,13 +926,13 @@ function processPlayerCommand(command, params, client) {
|
|||||||
|
|
||||||
if (!isConsole(client)) {
|
if (!isConsole(client)) {
|
||||||
if (!doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(toLowerCase(command)))) {
|
if (!doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(toLowerCase(command)))) {
|
||||||
logToConsole(LOG_WARN, `[AGRP.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (no permission): /${command} ${paramsDisplay}`);
|
logToConsole(LOG_WARN, `[V.RP.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (no permission): /${command} ${paramsDisplay}`);
|
||||||
messagePlayerError(client, getLocaleString(client, "CommandNoPermissions", `{ALTCOLOUR}/${toLowerCase(command)}{MAINCOLOUR}`));
|
messagePlayerError(client, getLocaleString(client, "CommandNoPermissions", `{ALTCOLOUR}/${toLowerCase(command)}{MAINCOLOUR}`));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Command] ${getPlayerDisplayForConsole(client)} used command: /${command} ${paramsDisplay}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Command] ${getPlayerDisplayForConsole(client)} used command: /${command} ${paramsDisplay}`);
|
||||||
commandData.handlerFunction(toLowerCase(command), params, client);
|
commandData.handlerFunction(toLowerCase(command), params, client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -266,49 +266,49 @@ function loadGlobalConfig() {
|
|||||||
try {
|
try {
|
||||||
getGlobalConfig().database = loadDatabaseConfig();
|
getGlobalConfig().database = loadDatabaseConfig();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logToConsole(LOG_ERROR, `[AGRP.Config] Failed to load global configuration. Error: ${error}`);
|
logToConsole(LOG_ERROR, `[V.RP.Config] Failed to load global configuration. Error: ${error}`);
|
||||||
thisResource.stop();
|
thisResource.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
getGlobalConfig().economy = loadEconomyConfig();
|
getGlobalConfig().economy = loadEconomyConfig();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logToConsole(LOG_ERROR, `[AGRP.Config] Failed to load economy configuration. Error: ${error}`);
|
logToConsole(LOG_ERROR, `[V.RP.Config] Failed to load economy configuration. Error: ${error}`);
|
||||||
thisResource.stop();
|
thisResource.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
getGlobalConfig().locale = loadLocaleConfig();
|
getGlobalConfig().locale = loadLocaleConfig();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logToConsole(LOG_ERROR, `[AGRP.Config] Failed to load locale configuration. Error: ${error}`);
|
logToConsole(LOG_ERROR, `[V.RP.Config] Failed to load locale configuration. Error: ${error}`);
|
||||||
thisResource.stop();
|
thisResource.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
getGlobalConfig().accents = loadAccentConfig();
|
getGlobalConfig().accents = loadAccentConfig();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logToConsole(LOG_ERROR, `[AGRP.Config] Failed to load accent configuration. Error: ${error}`);
|
logToConsole(LOG_ERROR, `[V.RP.Config] Failed to load accent configuration. Error: ${error}`);
|
||||||
thisResource.stop();
|
thisResource.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
getGlobalConfig().discord = loadDiscordConfig();
|
getGlobalConfig().discord = loadDiscordConfig();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logToConsole(LOG_ERROR, `[AGRP.Config] Failed to load discord configuration. Error: ${error}`);
|
logToConsole(LOG_ERROR, `[V.RP.Config] Failed to load discord configuration. Error: ${error}`);
|
||||||
thisResource.stop();
|
thisResource.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
getGlobalConfig().keyBind = loadKeyBindConfig();
|
getGlobalConfig().keyBind = loadKeyBindConfig();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logToConsole(LOG_ERROR, `[AGRP.Config] Failed to load keybind configuration. Error: ${error}`);
|
logToConsole(LOG_ERROR, `[V.RP.Config] Failed to load keybind configuration. Error: ${error}`);
|
||||||
thisResource.stop();
|
thisResource.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
getGlobalConfig().email = loadEmailConfig();
|
getGlobalConfig().email = loadEmailConfig();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logToConsole(LOG_ERROR, `[AGRP.Config] Failed to load email configuration. Error: ${error}`);
|
logToConsole(LOG_ERROR, `[V.RP.Config] Failed to load email configuration. Error: ${error}`);
|
||||||
thisResource.stop();
|
thisResource.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -379,12 +379,12 @@ function applyConfigToServer(tempServerConfig) {
|
|||||||
updateServerGameTime();
|
updateServerGameTime();
|
||||||
|
|
||||||
//if (isTimeSupported()) {
|
//if (isTimeSupported()) {
|
||||||
// logToConsole(LOG_DEBUG, `[AGRP.Config]: Setting time to to ${tempServerConfig.hour}:${tempServerConfig.minute} with minute duration of ${tempServerConfig.minuteDuration}`);
|
// logToConsole(LOG_DEBUG, `[V.RP.Config]: Setting time to to ${tempServerConfig.hour}:${tempServerConfig.minute} with minute duration of ${tempServerConfig.minuteDuration}`);
|
||||||
// setGameTime(tempServerConfig.hour, tempServerConfig.minute, tempServerConfig.minuteDuration);
|
// setGameTime(tempServerConfig.hour, tempServerConfig.minute, tempServerConfig.minuteDuration);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if (isWeatherSupported()) {
|
if (isWeatherSupported()) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Config]: Setting weather to ${tempServerConfig.weather}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Config]: Setting weather to ${tempServerConfig.weather}`);
|
||||||
game.forceWeather(getWeatherData(tempServerConfig.weather).weatherId);
|
game.forceWeather(getWeatherData(tempServerConfig.weather).weatherId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -394,7 +394,7 @@ function applyConfigToServer(tempServerConfig) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function saveServerConfigToDatabase() {
|
function saveServerConfigToDatabase() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Config]: Saving server ${getServerConfig().databaseId} configuration to database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Config]: Saving server ${getServerConfig().databaseId} configuration to database ...`);
|
||||||
if (getServerConfig().needsSaved) {
|
if (getServerConfig().needsSaved) {
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
@@ -458,7 +458,7 @@ function saveServerConfigToDatabase() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Config]: Server ${getServerConfig().databaseId} configuration saved to database!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Config]: Server ${getServerConfig().databaseId} configuration saved to database!`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -932,7 +932,7 @@ function reloadEmailConfigurationCommand(command, params, client) {
|
|||||||
*/
|
*/
|
||||||
function reloadDatabaseConfigurationCommand(command, params, client) {
|
function reloadDatabaseConfigurationCommand(command, params, client) {
|
||||||
if (getDatabaseConfig().usePersistentConnection && isDatabaseConnected(persistentDatabaseConnection)) {
|
if (getDatabaseConfig().usePersistentConnection && isDatabaseConnected(persistentDatabaseConnection)) {
|
||||||
logToConsole(LOG_WARN, `[AGRP.Database] Closing persistent database connection`);
|
logToConsole(LOG_WARN, `[V.RP.Database] Closing persistent database connection`);
|
||||||
persistentDatabaseConnection.close();
|
persistentDatabaseConnection.close();
|
||||||
persistentDatabaseConnection = null;
|
persistentDatabaseConnection = null;
|
||||||
}
|
}
|
||||||
@@ -1132,14 +1132,14 @@ function loadServerConfig() {
|
|||||||
serverConfig = loadServerConfigFromGame(getGame());
|
serverConfig = loadServerConfigFromGame(getGame());
|
||||||
|
|
||||||
if (serverConfig == false) {
|
if (serverConfig == false) {
|
||||||
logToConsole(LOG_ERROR, `[AGRP.Config] Could not load server configuration for game ${getGame()}`);
|
logToConsole(LOG_ERROR, `[V.RP.Config] Could not load server configuration for game ${getGame()}`);
|
||||||
server.shutdown();
|
server.shutdown();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
serverConfig = loadServerConfigFromGameAndPort(getGame(), getServerPort());
|
serverConfig = loadServerConfigFromGameAndPort(getGame(), getServerPort());
|
||||||
|
|
||||||
if (serverConfig == false) {
|
if (serverConfig == false) {
|
||||||
logToConsole(LOG_ERROR, `[AGRP.Config] Could not load server configuration for game ${getGame()} and port ${getServerPort()}`);
|
logToConsole(LOG_ERROR, `[V.RP.Config] Could not load server configuration for game ${getGame()} and port ${getServerPort()}`);
|
||||||
server.shutdown();
|
server.shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ function addAllEventHandlers() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPlayerConnect(event, ipAddress, port) {
|
function onPlayerConnect(event, ipAddress, port) {
|
||||||
logToConsole(LOG_INFO, `[AGRP.Event] onPlayerConnect - Client connecting (IP: ${ipAddress})`);
|
logToConsole(LOG_INFO, `[V.RP.Event] onPlayerConnect - Client connecting (IP: ${ipAddress})`);
|
||||||
//if(isIpAddressBanned(ipAddress)) {
|
//if(isIpAddressBanned(ipAddress)) {
|
||||||
// messagePlayerError(client, "You are banned from this server!");
|
// messagePlayerError(client, "You are banned from this server!");
|
||||||
// return false;
|
// return false;
|
||||||
@@ -56,7 +56,7 @@ function onPlayerConnect(event, ipAddress, port) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPlayerJoin(event, client) {
|
function onPlayerJoin(event, client) {
|
||||||
logToConsole(LOG_INFO, `[AGRP.Event] onPlayerJoin - Client ${getPlayerDisplayForConsole(client)} joining from ${getPlayerIP(client)}`);
|
logToConsole(LOG_INFO, `[V.RP.Event] onPlayerJoin - Client ${getPlayerDisplayForConsole(client)} joining from ${getPlayerIP(client)}`);
|
||||||
|
|
||||||
playerResourceReady[getPlayerId(client)] = false;
|
playerResourceReady[getPlayerId(client)] = false;
|
||||||
playerResourceStarted[getPlayerId(client)] = false;
|
playerResourceStarted[getPlayerId(client)] = false;
|
||||||
@@ -77,7 +77,7 @@ function onPlayerJoin(event, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPlayerJoined(event, client) {
|
function onPlayerJoined(event, client) {
|
||||||
logToConsole(LOG_INFO, `[AGRP.Event] onPlayerJoined - Client ${getPlayerDisplayForConsole(client)} joined from ${getPlayerIP(client)}`);
|
logToConsole(LOG_INFO, `[V.RP.Event] onPlayerJoined - Client ${getPlayerDisplayForConsole(client)} joined from ${getPlayerIP(client)}`);
|
||||||
//initClient(client);
|
//initClient(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,7 +214,7 @@ function onPedExitingVehicle(event, ped, vehicle) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onResourceStart(event, resource) {
|
function onResourceStart(event, resource) {
|
||||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Resource ${resource.name} started!`);
|
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Resource ${resource.name} started!`);
|
||||||
|
|
||||||
if (resource == thisResource) {
|
if (resource == thisResource) {
|
||||||
//messageAdmins(`{MAINCOLOUR}Resource {ALTCOLOUR}${resource.name}{MAINCOLOUR} started!`);
|
//messageAdmins(`{MAINCOLOUR}Resource {ALTCOLOUR}${resource.name}{MAINCOLOUR} started!`);
|
||||||
@@ -225,7 +225,7 @@ function onResourceStart(event, resource) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onResourceStop(event, resource) {
|
function onResourceStop(event, resource) {
|
||||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Resource ${resource.name} stopped!`);
|
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Resource ${resource.name} stopped!`);
|
||||||
|
|
||||||
//if(resource != thisResource) {
|
//if(resource != thisResource) {
|
||||||
// messageAdmins(`{MAINCOLOUR}Resource {ALTCOLOUR}${resource.name}{MAINCOLOUR} stopped!`);
|
// messageAdmins(`{MAINCOLOUR}Resource {ALTCOLOUR}${resource.name}{MAINCOLOUR} stopped!`);
|
||||||
@@ -252,7 +252,7 @@ function onPedEnteredSphere(event, ped, sphere) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} entered sphere ${sphere.id}!`);
|
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Ped ${ped.id} entered sphere ${sphere.id}!`);
|
||||||
//if (ped.isType(ELEMENT_PLAYER)) {
|
//if (ped.isType(ELEMENT_PLAYER)) {
|
||||||
// let client = getClientFromPlayerElement(ped);
|
// let client = getClientFromPlayerElement(ped);
|
||||||
|
|
||||||
@@ -276,7 +276,7 @@ function onPedExitedSphere(event, ped, sphere) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} exited sphere ${sphere.id}!`);
|
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Ped ${ped.id} exited sphere ${sphere.id}!`);
|
||||||
//if (ped.isType(ELEMENT_PLAYER)) {
|
//if (ped.isType(ELEMENT_PLAYER)) {
|
||||||
// let client = getClientFromPlayerElement(ped);
|
// let client = getClientFromPlayerElement(ped);
|
||||||
//}
|
//}
|
||||||
@@ -293,7 +293,7 @@ function onPedPickupPickedUp(event, ped, pickup) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} picked up pickup ${pickup.id}!`);
|
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Ped ${ped.id} picked up pickup ${pickup.id}!`);
|
||||||
|
|
||||||
if (ped.isType(ELEMENT_PLAYER)) {
|
if (ped.isType(ELEMENT_PLAYER)) {
|
||||||
let client = getClientFromPlayerElement(ped);
|
let client = getClientFromPlayerElement(ped);
|
||||||
@@ -310,7 +310,7 @@ function onPedPickupPickedUp(event, ped, pickup) {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
function onPedWasted(event, ped, killerPed, weapon, pedPiece) {
|
function onPedWasted(event, ped, killerPed, weapon, pedPiece) {
|
||||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} wasted by ped ${killerPed.id}!`);
|
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Ped ${ped.id} wasted by ped ${killerPed.id}!`);
|
||||||
|
|
||||||
if (ped.isType(ELEMENT_PLAYER)) {
|
if (ped.isType(ELEMENT_PLAYER)) {
|
||||||
let killerClient = null;
|
let killerClient = null;
|
||||||
@@ -325,7 +325,7 @@ function onPedWasted(event, ped, killerPed, weapon, pedPiece) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPlayerDeath(client, killer, weapon, pedPiece) {
|
function onPlayerDeath(client, killer, weapon, pedPiece) {
|
||||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Player ${getPlayerDisplayForConsole(client)} died!`);
|
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Player ${getPlayerDisplayForConsole(client)} died!`);
|
||||||
|
|
||||||
logToConsole(LOG_INFO, `${getPlayerDisplayForConsole(client)} died.`);
|
logToConsole(LOG_INFO, `${getPlayerDisplayForConsole(client)} died.`);
|
||||||
getPlayerData(client).pedState = V_PEDSTATE_DEAD;
|
getPlayerData(client).pedState = V_PEDSTATE_DEAD;
|
||||||
@@ -418,7 +418,7 @@ function onPlayerDeath(client, killer, weapon, pedPiece) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPedSpawn(ped) {
|
function onPedSpawn(ped) {
|
||||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} spawned!`);
|
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Ped ${ped.id} spawned!`);
|
||||||
|
|
||||||
//if (ped.type == ELEMENT_PLAYER) {
|
//if (ped.type == ELEMENT_PLAYER) {
|
||||||
// if (getGame() != V_GAME_MAFIA_ONE) {
|
// if (getGame() != V_GAME_MAFIA_ONE) {
|
||||||
@@ -431,14 +431,14 @@ function onPedSpawn(ped) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
async function onPlayerSpawn(client) {
|
async function onPlayerSpawn(client) {
|
||||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Player ${getPlayerDisplayForConsole(client)} spawned!`);
|
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Player ${getPlayerDisplayForConsole(client)} spawned!`);
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Event] Checking for ${getPlayerDisplayForConsole(client)}'s player ped`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Event] Checking for ${getPlayerDisplayForConsole(client)}'s player ped`);
|
||||||
//if(getPlayerPed(client) == null) {
|
//if(getPlayerPed(client) == null) {
|
||||||
// logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)}'s player element not set yet. Rechecking ...`);
|
// logToConsole(LOG_DEBUG, `[V.RP.Event] ${getPlayerDisplayForConsole(client)}'s player element not set yet. Rechecking ...`);
|
||||||
// setTimeout(onPlayerSpawn, 500, client);
|
// setTimeout(onPlayerSpawn, 500, client);
|
||||||
// return false;
|
// return false;
|
||||||
//}
|
//}
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)}'s player ped is valid. Continuing spawn processing ...`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Event] ${getPlayerDisplayForConsole(client)}'s player ped is valid. Continuing spawn processing ...`);
|
||||||
|
|
||||||
if (areServerElementsSupported()) {
|
if (areServerElementsSupported()) {
|
||||||
await waitUntil(() => client != null && getPlayerPed(client) != null);
|
await waitUntil(() => client != null && getPlayerPed(client) != null);
|
||||||
@@ -446,53 +446,53 @@ async function onPlayerSpawn(client) {
|
|||||||
|
|
||||||
stopRadioStreamForPlayer(client);
|
stopRadioStreamForPlayer(client);
|
||||||
|
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Event] Checking ${getPlayerDisplayForConsole(client)}'s player data`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Event] Checking ${getPlayerDisplayForConsole(client)}'s player data`);
|
||||||
if (!getPlayerData(client)) {
|
if (!getPlayerData(client)) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)}'s player data is invalid. Kicking them from server.`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] ${getPlayerDisplayForConsole(client)}'s player data is invalid. Kicking them from server.`);
|
||||||
getPlayerData(targetClient).customDisconnectReason = "Desync";
|
getPlayerData(targetClient).customDisconnectReason = "Desync";
|
||||||
disconnectPlayer(client);
|
disconnectPlayer(client);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Event] Checking ${getPlayerDisplayForConsole(client)}'s login status`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Event] Checking ${getPlayerDisplayForConsole(client)}'s login status`);
|
||||||
if (!isPlayerLoggedIn(client)) {
|
if (!isPlayerLoggedIn(client)) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)} is NOT logged in. Despawning their player.`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] ${getPlayerDisplayForConsole(client)} is NOT logged in. Despawning their player.`);
|
||||||
getPlayerData(targetClient).customDisconnectReason = "Desync";
|
getPlayerData(targetClient).customDisconnectReason = "Desync";
|
||||||
disconnectPlayer(client);
|
disconnectPlayer(client);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Event] Checking ${getPlayerDisplayForConsole(client)}'s selected character status`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Event] Checking ${getPlayerDisplayForConsole(client)}'s selected character status`);
|
||||||
if (getPlayerData(client).currentSubAccount == -1) {
|
if (getPlayerData(client).currentSubAccount == -1) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)} has NOT selected a character. Despawning their player.`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] ${getPlayerDisplayForConsole(client)} has NOT selected a character. Despawning their player.`);
|
||||||
getPlayerData(targetClient).customDisconnectReason = "Desync";
|
getPlayerData(targetClient).customDisconnectReason = "Desync";
|
||||||
disconnectPlayer(client);
|
disconnectPlayer(client);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)}'s player data is valid. Continuing spawn processing ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] ${getPlayerDisplayForConsole(client)}'s player data is valid. Continuing spawn processing ...`);
|
||||||
|
|
||||||
if (isGameFeatureSupported("pedScale")) {
|
if (isGameFeatureSupported("pedScale")) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped scale (${getPlayerCurrentSubAccount(client).pedScale})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped scale (${getPlayerCurrentSubAccount(client).pedScale})`);
|
||||||
setEntityData(getPlayerPed(client), "v.rp.scale", getPlayerCurrentSubAccount(client).pedScale, true);
|
setEntityData(getPlayerPed(client), "v.rp.scale", getPlayerCurrentSubAccount(client).pedScale, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (isPlayerSwitchingCharacter(client) || isPlayerCreatingCharacter(client)) {
|
//if (isPlayerSwitchingCharacter(client) || isPlayerCreatingCharacter(client)) {
|
||||||
// logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)}'s ped is being used for character selection/creation. No further spawn processing needed'`);
|
// logToConsole(LOG_DEBUG, `[V.RP.Event] ${getPlayerDisplayForConsole(client)}'s ped is being used for character selection/creation. No further spawn processing needed'`);
|
||||||
// return false;
|
// return false;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if (isCustomCameraSupported()) {
|
if (isCustomCameraSupported()) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Restoring ${getPlayerDisplayForConsole(client)}'s camera`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Restoring ${getPlayerDisplayForConsole(client)}'s camera`);
|
||||||
restorePlayerCamera(client);
|
restorePlayerCamera(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (areServerElementsSupported()) {
|
if (areServerElementsSupported()) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Storing ${getPlayerDisplayForConsole(client)} ped in client data `);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Storing ${getPlayerDisplayForConsole(client)} ped in client data `);
|
||||||
getPlayerData(client).ped = getPlayerPed(client);
|
getPlayerData(client).ped = getPlayerPed(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Sending ${getPlayerDisplayForConsole(client)} the 'now playing as' message`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Sending ${getPlayerDisplayForConsole(client)} the 'now playing as' message`);
|
||||||
messagePlayerAlert(client, `You are now playing as: {businessBlue}${getCharacterFullName(client)}`, getColourByName("white"));
|
messagePlayerAlert(client, `You are now playing as: {businessBlue}${getCharacterFullName(client)}`, getColourByName("white"));
|
||||||
//messagePlayerNormal(client, "This server is in early development and may restart at any time for updates.", getColourByName("orange"));
|
//messagePlayerNormal(client, "This server is in early development and may restart at any time for updates.", getColourByName("orange"));
|
||||||
//messagePlayerNormal(client, "Please report any bugs using /bug and suggestions using /idea", getColourByName("yellow"));
|
//messagePlayerNormal(client, "Please report any bugs using /bug and suggestions using /idea", getColourByName("yellow"));
|
||||||
@@ -506,65 +506,65 @@ async function onPlayerSpawn(client) {
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
if (isGameFeatureSupported("interior")) {
|
if (isGameFeatureSupported("interior")) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Setting player interior for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).interior}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Setting player interior for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).interior}`);
|
||||||
setPlayerInterior(client, getPlayerCurrentSubAccount(client).interior);
|
setPlayerInterior(client, getPlayerCurrentSubAccount(client).interior);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Setting player dimension for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).dimension}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Setting player dimension for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).dimension}`);
|
||||||
setPlayerDimension(client, getPlayerCurrentSubAccount(client).dimension);
|
setPlayerDimension(client, getPlayerCurrentSubAccount(client).dimension);
|
||||||
|
|
||||||
//if(getPlayerCurrentSubAccount(client).interior != 0 || getPlayerCurrentSubAccount(client).dimension != 0) {
|
//if(getPlayerCurrentSubAccount(client).interior != 0 || getPlayerCurrentSubAccount(client).dimension != 0) {
|
||||||
// updateAllInteriorVehiclesForPlayer(client, getPlayerCurrentSubAccount(client).interior, getPlayerCurrentSubAccount(client).dimension);
|
// updateAllInteriorVehiclesForPlayer(client, getPlayerCurrentSubAccount(client).interior, getPlayerCurrentSubAccount(client).dimension);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Setting player health for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).health}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Setting player health for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).health}`);
|
||||||
setPlayerHealth(client, getPlayerCurrentSubAccount(client).health);
|
setPlayerHealth(client, getPlayerCurrentSubAccount(client).health);
|
||||||
|
|
||||||
if (isGameFeatureSupported("pedArmour")) {
|
if (isGameFeatureSupported("pedArmour")) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Setting player armour for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).armour}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Setting player armour for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).armour}`);
|
||||||
setPlayerArmour(client, getPlayerCurrentSubAccount(client).armour);
|
setPlayerArmour(client, getPlayerCurrentSubAccount(client).armour);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Sending ${getPlayerDisplayForConsole(client)}'s job type to their client (${getJobIndexFromDatabaseId(getPlayerCurrentSubAccount(client))})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Sending ${getPlayerDisplayForConsole(client)}'s job type to their client (${getJobIndexFromDatabaseId(getPlayerCurrentSubAccount(client))})`);
|
||||||
sendPlayerJobType(client, getPlayerCurrentSubAccount(client).job);
|
sendPlayerJobType(client, getPlayerCurrentSubAccount(client).job);
|
||||||
|
|
||||||
if (isGameFeatureSupported("rendering2D")) {
|
if (isGameFeatureSupported("rendering2D")) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Enabling all rendering states for ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Enabling all rendering states for ${getPlayerDisplayForConsole(client)}`);
|
||||||
setPlayer2DRendering(client, true, true, true, true, true, true);
|
setPlayer2DRendering(client, true, true, true, true, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (isGameFeatureSupported("snow")) {
|
//if (isGameFeatureSupported("snow")) {
|
||||||
// logToConsole(LOG_DEBUG, `[AGRP.Event] Sending snow states to ${getPlayerDisplayForConsole(client)}`);
|
// logToConsole(LOG_DEBUG, `[V.RP.Event] Sending snow states to ${getPlayerDisplayForConsole(client)}`);
|
||||||
// updatePlayerSnowState(client, true);
|
// updatePlayerSnowState(client, true);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if (areServerElementsSupported() && isGameFeatureSupported("walkStyle")) {
|
if (areServerElementsSupported() && isGameFeatureSupported("walkStyle")) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Setting player walking style for ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Setting player walking style for ${getPlayerDisplayForConsole(client)}`);
|
||||||
setEntityData(getPlayerPed(client), "v.rp.walkStyle", getPlayerCurrentSubAccount(client).walkStyle, true);
|
setEntityData(getPlayerPed(client), "v.rp.walkStyle", getPlayerCurrentSubAccount(client).walkStyle, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isGameFeatureSupported("fightStyle")) {
|
if (isGameFeatureSupported("fightStyle")) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Setting player fighting style for ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Setting player fighting style for ${getPlayerDisplayForConsole(client)}`);
|
||||||
setPlayerFightStyle(client, getPlayerCurrentSubAccount(client).fightStyle);
|
setPlayerFightStyle(client, getPlayerCurrentSubAccount(client).fightStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isGameFeatureSupported("rendering2D")) {
|
if (isGameFeatureSupported("rendering2D")) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Updating logo state for ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Updating logo state for ${getPlayerDisplayForConsole(client)}`);
|
||||||
updatePlayerShowLogoState(client, (getServerConfig().showLogo && doesPlayerHaveLogoEnabled(client)));
|
updatePlayerShowLogoState(client, (getServerConfig().showLogo && doesPlayerHaveLogoEnabled(client)));
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Caching ${getPlayerDisplayForConsole(client)}'s hotbar items`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Caching ${getPlayerDisplayForConsole(client)}'s hotbar items`);
|
||||||
cachePlayerHotBarItems(client);
|
cachePlayerHotBarItems(client);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Syncing ${getPlayerDisplayForConsole(client)}'s hotbar`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Syncing ${getPlayerDisplayForConsole(client)}'s hotbar`);
|
||||||
updatePlayerHotBar(client);
|
updatePlayerHotBar(client);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Setting ${getPlayerDisplayForConsole(client)}'s switchchar state to false`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Setting ${getPlayerDisplayForConsole(client)}'s switchchar state to false`);
|
||||||
getPlayerData(client).switchingCharacter = false;
|
getPlayerData(client).switchingCharacter = false;
|
||||||
|
|
||||||
if (!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "enter")) {
|
if (!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "enter")) {
|
||||||
let keyId = getPlayerKeyBindForCommand(client, "enter");
|
let keyId = getPlayerKeyBindForCommand(client, "enter");
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendPlayerEnterPropertyKey(client, keyId.key);
|
sendPlayerEnterPropertyKey(client, keyId.key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -595,7 +595,7 @@ async function onPlayerSpawn(client) {
|
|||||||
//sendPlayerPedPartsAndProps(client);
|
//sendPlayerPedPartsAndProps(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped state to ready`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped state to ready`);
|
||||||
getPlayerData(client).pedState = V_PEDSTATE_READY;
|
getPlayerData(client).pedState = V_PEDSTATE_READY;
|
||||||
|
|
||||||
if (areServerElementsSupported()) {
|
if (areServerElementsSupported()) {
|
||||||
@@ -605,16 +605,16 @@ async function onPlayerSpawn(client) {
|
|||||||
//}, 1000);
|
//}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Syncing ${getPlayerDisplayForConsole(client)}'s cash ${getPlayerCurrentSubAccount(client).cash}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Syncing ${getPlayerDisplayForConsole(client)}'s cash ${getPlayerCurrentSubAccount(client).cash}`);
|
||||||
updatePlayerCash(client);
|
updatePlayerCash(client);
|
||||||
|
|
||||||
if (isGameFeatureSupported("customNametag")) {
|
if (isGameFeatureSupported("customNametag")) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Sending player nametag distance to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Sending player nametag distance to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNameTagDistanceToClient(client, getServerConfig().nameTagDistance);
|
sendNameTagDistanceToClient(client, getServerConfig().nameTagDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!areServerElementsSupported() || getGame() == V_GAME_MAFIA_ONE || getGame() == V_GAME_GTA_IV) {
|
if (!areServerElementsSupported() || getGame() == V_GAME_MAFIA_ONE || getGame() == V_GAME_GTA_IV) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Sending properties, jobs, and vehicles to ${getPlayerDisplayForConsole(client)} (no server elements)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Sending properties, jobs, and vehicles to ${getPlayerDisplayForConsole(client)} (no server elements)`);
|
||||||
sendAllBusinessesToPlayer(client);
|
sendAllBusinessesToPlayer(client);
|
||||||
sendAllHousesToPlayer(client);
|
sendAllHousesToPlayer(client);
|
||||||
if (getGame() != V_GAME_GTA_IV) {
|
if (getGame() != V_GAME_GTA_IV) {
|
||||||
@@ -627,7 +627,7 @@ async function onPlayerSpawn(client) {
|
|||||||
sendAllVehiclesToPlayer(client);
|
sendAllVehiclesToPlayer(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Updating spawned state for ${getPlayerDisplayForConsole(client)} to true`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Updating spawned state for ${getPlayerDisplayForConsole(client)} to true`);
|
||||||
updatePlayerSpawnedState(client, true);
|
updatePlayerSpawnedState(client, true);
|
||||||
|
|
||||||
getPlayerData(client).payDayTickStart = sdl.ticks;
|
getPlayerData(client).payDayTickStart = sdl.ticks;
|
||||||
@@ -635,7 +635,7 @@ async function onPlayerSpawn(client) {
|
|||||||
// Locales are handled via resource files now. No need to send anymore, but kept in case revert is needed.
|
// Locales are handled via resource files now. No need to send anymore, but kept in case revert is needed.
|
||||||
//sendPlayerLocaleStrings(client);
|
//sendPlayerLocaleStrings(client);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Updating all player name tags`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Updating all player name tags`);
|
||||||
updateAllPlayerNameTags();
|
updateAllPlayerNameTags();
|
||||||
|
|
||||||
setPlayerWeaponDamageEvent(client, V_WEAPON_DAMAGE_EVENT_NORMAL);
|
setPlayerWeaponDamageEvent(client, V_WEAPON_DAMAGE_EVENT_NORMAL);
|
||||||
@@ -692,7 +692,7 @@ async function onPlayerSpawn(client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPlayerCommand(event, client, command, params) {
|
function onPlayerCommand(event, client, command, params) {
|
||||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Player used command ${command}!`);
|
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Player used command ${command}!`);
|
||||||
|
|
||||||
if (!doesCommandExist(command)) {
|
if (!doesCommandExist(command)) {
|
||||||
processPlayerCommand(command, params, client);
|
processPlayerCommand(command, params, client);
|
||||||
@@ -710,7 +710,7 @@ function onPedExitedVehicle(event, ped, vehicle, seat) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} exited vehicle ${vehicle.id} from seat ${seat}!`);
|
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Ped ${ped.id} exited vehicle ${vehicle.id} from seat ${seat}!`);
|
||||||
|
|
||||||
if (getVehicleData(vehicle) == false) {
|
if (getVehicleData(vehicle) == false) {
|
||||||
return false;
|
return false;
|
||||||
@@ -743,7 +743,7 @@ function onPedExitedVehicle(event, ped, vehicle, seat) {
|
|||||||
|
|
||||||
getVehicleData(vehicle).lastActiveTime = getCurrentUnixTimestamp();
|
getVehicleData(vehicle).lastActiveTime = getCurrentUnixTimestamp();
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)} exited a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("v.rp.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] ${getPlayerDisplayForConsole(client)} exited a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("v.rp.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -752,31 +752,31 @@ function onPedExitedVehicle(event, ped, vehicle, seat) {
|
|||||||
|
|
||||||
function onPedEnteredVehicle(event, ped, vehicle, seat) {
|
function onPedEnteredVehicle(event, ped, vehicle, seat) {
|
||||||
if (ped == null) {
|
if (ped == null) {
|
||||||
logToConsole(LOG_ERROR | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} entered vehicle ${vehicle.id} in seat ${seat}, but ped is null`);
|
logToConsole(LOG_ERROR | LOG_DEBUG, `[V.RP.Event] Ped ${ped.id} entered vehicle ${vehicle.id} in seat ${seat}, but ped is null`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vehicle == null) {
|
if (vehicle == null) {
|
||||||
logToConsole(LOG_ERROR | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} entered vehicle ${vehicle.id} in seat ${seat}, but vehicle is null`);
|
logToConsole(LOG_ERROR | LOG_DEBUG, `[V.RP.Event] Ped ${ped.id} entered vehicle ${vehicle.id} in seat ${seat}, but vehicle is null`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} entered vehicle ${vehicle.id} in seat ${seat}!`);
|
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Ped ${ped.id} entered vehicle ${vehicle.id} in seat ${seat}!`);
|
||||||
|
|
||||||
if (ped.isType(ELEMENT_PLAYER)) {
|
if (ped.isType(ELEMENT_PLAYER)) {
|
||||||
let client = getClientFromPlayerElement(ped);
|
let client = getClientFromPlayerElement(ped);
|
||||||
if (client != null) {
|
if (client != null) {
|
||||||
if (getPlayerData(client) == false) {
|
if (getPlayerData(client) == false) {
|
||||||
logToConsole(LOG_ERROR | LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)} entered vehicle ${vehicle.id} in seat ${seat}, but player data is false`);
|
logToConsole(LOG_ERROR | LOG_DEBUG, `[V.RP.Event] ${getPlayerDisplayForConsole(client)} entered vehicle ${vehicle.id} in seat ${seat}, but player data is false`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!getVehicleData(vehicle)) {
|
if (!getVehicleData(vehicle)) {
|
||||||
logToConsole(LOG_ERROR | LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)} entered vehicle ${vehicle.id} in seat ${seat}, but vehicle data is false`);
|
logToConsole(LOG_ERROR | LOG_DEBUG, `[V.RP.Event] ${getPlayerDisplayForConsole(client)} entered vehicle ${vehicle.id} in seat ${seat}, but vehicle data is false`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)} entered a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("v.rp.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] ${getPlayerDisplayForConsole(client)} entered a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("v.rp.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
|
||||||
|
|
||||||
getPlayerData(client).lastVehicle = vehicle;
|
getPlayerData(client).lastVehicle = vehicle;
|
||||||
getVehicleData(vehicle).lastActiveTime = getCurrentUnixTimestamp();
|
getVehicleData(vehicle).lastActiveTime = getCurrentUnixTimestamp();
|
||||||
@@ -887,7 +887,7 @@ function onPedEnteringVehicle(event, ped, vehicle, seat) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} is entering vehicle ${vehicle.id} in seat ${seat}!`);
|
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Ped ${ped.id} is entering vehicle ${vehicle.id} in seat ${seat}!`);
|
||||||
|
|
||||||
if (ped.isType(ELEMENT_PLAYER)) {
|
if (ped.isType(ELEMENT_PLAYER)) {
|
||||||
let client = getClientFromPlayerElement(ped);
|
let client = getClientFromPlayerElement(ped);
|
||||||
@@ -911,7 +911,7 @@ function onPedExitingVehicle(event, ped, vehicle, seat) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} is exiting vehicle ${vehicle.id} in seat ${seat}!`);
|
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Ped ${ped.id} is exiting vehicle ${vehicle.id} in seat ${seat}!`);
|
||||||
|
|
||||||
if (ped.isType(ELEMENT_PLAYER)) {
|
if (ped.isType(ELEMENT_PLAYER)) {
|
||||||
let client = getClientFromPlayerElement(ped);
|
let client = getClientFromPlayerElement(ped);
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ class GateData {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initGateScript() {
|
function initGateScript() {
|
||||||
logToConsole(LOG_INFO, `[AGRP.Gate]: Initializing gate script ...`);
|
logToConsole(LOG_INFO, `[V.RP.Gate]: Initializing gate script ...`);
|
||||||
logToConsole(LOG_INFO, `[AGRP.Gate]: Gate script initialized successfully!`);
|
logToConsole(LOG_INFO, `[V.RP.Gate]: Gate script initialized successfully!`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -193,7 +193,7 @@ function saveGateToDatabase(gateId) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Gate]: Saving gate ${tempGateData.databaseId} to database ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Gate]: Saving gate ${tempGateData.databaseId} to database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
let safeGateName = escapeDatabaseString(tempGateData.name);
|
let safeGateName = escapeDatabaseString(tempGateData.name);
|
||||||
@@ -227,7 +227,7 @@ function saveGateToDatabase(gateId) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Gate]: Saved gate ${gateDataId} to database!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Gate]: Saved gate ${gateDataId} to database!`);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -248,13 +248,13 @@ function loadGatesFromDatabase() {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempGateData = new GateData(dbAssoc[i]);
|
let tempGateData = new GateData(dbAssoc[i]);
|
||||||
tempGates.push(tempGateData);
|
tempGates.push(tempGateData);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Gate]: Gate '${tempGateData.name}' loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Gate]: Gate '${tempGateData.name}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_INFO, `[AGRP.Gate]: ${tempGates.length} gates loaded from database successfully!`);
|
logToConsole(LOG_INFO, `[V.RP.Gate]: ${tempGates.length} gates loaded from database successfully!`);
|
||||||
return tempGates;
|
return tempGates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initHelpScript() {
|
function initHelpScript() {
|
||||||
logToConsole(LOG_INFO, `[AGRP.Help]: Initializing help script ...`);
|
logToConsole(LOG_INFO, `[V.RP.Help]: Initializing help script ...`);
|
||||||
logToConsole(LOG_INFO, `[AGRP.Help]: Help script initialized successfully!`);
|
logToConsole(LOG_INFO, `[V.RP.Help]: Help script initialized successfully!`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -187,12 +187,12 @@ function loadHousesFromDatabase() {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempHouseData = new HouseData(dbAssoc[i]);
|
let tempHouseData = new HouseData(dbAssoc[i]);
|
||||||
tempHouses.push(tempHouseData);
|
tempHouses.push(tempHouseData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.House]: House '${tempHouseData.description}' (ID ${tempHouseData.databaseId}) loaded!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.House]: House '${tempHouseData.description}' (ID ${tempHouseData.databaseId}) loaded!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
logToConsole(LOG_INFO, `[AGRP.House]: ${tempHouses.length} houses loaded from database successfully!`);
|
logToConsole(LOG_INFO, `[V.RP.House]: ${tempHouses.length} houses loaded from database successfully!`);
|
||||||
return tempHouses;
|
return tempHouses;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -877,9 +877,9 @@ function getPlayerHouse(client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function saveAllHousesToDatabase() {
|
function saveAllHousesToDatabase() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.House]: Saving all server houses to database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.House]: Saving all server houses to database ...`);
|
||||||
if (getServerConfig().devServer) {
|
if (getServerConfig().devServer) {
|
||||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.House]: Aborting save all houses to database, dev server is enabled.`);
|
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.House]: Aborting save all houses to database, dev server is enabled.`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -888,7 +888,7 @@ function saveAllHousesToDatabase() {
|
|||||||
saveHouseToDatabase(i);
|
saveHouseToDatabase(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logToConsole(LOG_INFO, `[AGRP.House]: Saved all server houses to database`);
|
logToConsole(LOG_INFO, `[V.RP.House]: Saved all server houses to database`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -900,7 +900,7 @@ function saveHouseToDatabase(houseId) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.House]: Saving house '${tempHouseData.description}' to database ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.House]: Saving house '${tempHouseData.description}' to database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
let safeHouseDescription = escapeDatabaseString(dbConnection, tempHouseData.description);
|
let safeHouseDescription = escapeDatabaseString(dbConnection, tempHouseData.description);
|
||||||
@@ -954,7 +954,7 @@ function saveHouseToDatabase(houseId) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.House]: Saved house '${tempHouseData.description}' to database!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.House]: Saved house '${tempHouseData.description}' to database!`);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -968,7 +968,7 @@ function saveHouseLocationToDatabase(houseId, locationId) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.House]: Saving house location ${locationId} for house ${houseId} to database ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.House]: Saving house location ${locationId} for house ${houseId} to database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
let data = [
|
let data = [
|
||||||
@@ -1009,7 +1009,7 @@ function saveHouseLocationToDatabase(houseId, locationId) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.House]: Saved location ${locationId} for house ${houseId} to database`);
|
logToConsole(LOG_VERBOSE, `[V.RP.House]: Saved location ${locationId} for house ${houseId} to database`);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -288,7 +288,7 @@ function initItemScript() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadItemsFromDatabase() {
|
function loadItemsFromDatabase() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Item]: Loading items from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Item]: Loading items from database ...`);
|
||||||
let tempItems = [];
|
let tempItems = [];
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
let dbAssoc = [];
|
let dbAssoc = [];
|
||||||
@@ -299,19 +299,19 @@ function loadItemsFromDatabase() {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempItemData = new ItemData(dbAssoc[i]);
|
let tempItemData = new ItemData(dbAssoc[i]);
|
||||||
tempItems.push(tempItemData);
|
tempItems.push(tempItemData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Item]: Loaded item ${tempItemData.databaseId} (type ${tempItemData.itemType})} from database`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Item]: Loaded item ${tempItemData.databaseId} (type ${tempItemData.itemType})} from database`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Item]: Loaded ${tempItems.length} items from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Item]: Loaded ${tempItems.length} items from database ...`);
|
||||||
return tempItems;
|
return tempItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadItemTypesFromDatabase() {
|
function loadItemTypesFromDatabase() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Item]: Loading item types from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Item]: Loading item types from database ...`);
|
||||||
let tempItemTypes = [];
|
let tempItemTypes = [];
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
let dbAssoc = [];
|
let dbAssoc = [];
|
||||||
@@ -323,13 +323,13 @@ function loadItemTypesFromDatabase() {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempItemTypeData = new ItemTypeData(dbAssoc[i]);
|
let tempItemTypeData = new ItemTypeData(dbAssoc[i]);
|
||||||
tempItemTypes.push(tempItemTypeData);
|
tempItemTypes.push(tempItemTypeData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Item]: Loaded item type ${tempItemTypeData.name} (id ${tempItemTypeData.databaseId}} from database`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Item]: Loaded item type ${tempItemTypeData.name} (id ${tempItemTypeData.databaseId}} from database`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Item]: Loaded ${tempItemTypes.length} item types from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Item]: Loaded ${tempItemTypes.length} item types from database ...`);
|
||||||
return tempItemTypes;
|
return tempItemTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1352,7 +1352,7 @@ function playerUseItem(client, hotBarSlot) {
|
|||||||
let itemIndex = getPlayerData(client).hotBarItems[hotBarSlot];
|
let itemIndex = getPlayerData(client).hotBarItems[hotBarSlot];
|
||||||
|
|
||||||
if (itemIndex == -1) {
|
if (itemIndex == -1) {
|
||||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.Item] ${getPlayerDisplayForConsole(client)} tried to use an empty hotbar slot ${hotBarSlot}`);
|
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.Item] ${getPlayerDisplayForConsole(client)} tried to use an empty hotbar slot ${hotBarSlot}`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1366,7 +1366,7 @@ function playerUseItem(client, hotBarSlot) {
|
|||||||
let itemTypeData = getItemTypeData(itemData.itemTypeIndex);
|
let itemTypeData = getItemTypeData(itemData.itemTypeIndex);
|
||||||
let hotBarItems = getPlayerData(client).hotBarItems;
|
let hotBarItems = getPlayerData(client).hotBarItems;
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Item] ${getPlayerDisplayForConsole(client)} used a ${itemTypeData.name} (use type ${itemTypeData.useType} - ${typeof itemTypeData.useType}) item (ID: ${itemData.index}/${itemData.databaseId}, TypeID: ${itemTypeData.index}/${itemTypeData.databaseId})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Item] ${getPlayerDisplayForConsole(client)} used a ${itemTypeData.name} (use type ${itemTypeData.useType} - ${typeof itemTypeData.useType}) item (ID: ${itemData.index}/${itemData.databaseId}, TypeID: ${itemTypeData.index}/${itemTypeData.databaseId})`);
|
||||||
|
|
||||||
markPlayerActionTipSeen(client, "UseItemKeyAfterEquipping");
|
markPlayerActionTipSeen(client, "UseItemKeyAfterEquipping");
|
||||||
|
|
||||||
@@ -1909,7 +1909,7 @@ function playerSwitchItem(client, newHotBarSlot) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let currentHotBarSlot = getPlayerData(client).activeHotBarSlot;
|
let currentHotBarSlot = getPlayerData(client).activeHotBarSlot;
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Item] ${getPlayerDisplayForConsole(client)} switched from hotbar slot ${currentHotBarSlot} to ${newHotBarSlot}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Item] ${getPlayerDisplayForConsole(client)} switched from hotbar slot ${currentHotBarSlot} to ${newHotBarSlot}`);
|
||||||
|
|
||||||
let currentHotBarItem = -1;
|
let currentHotBarItem = -1;
|
||||||
let newHotBarItem = -1;
|
let newHotBarItem = -1;
|
||||||
@@ -2564,7 +2564,7 @@ function saveItemToDatabase(itemId) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Item]: Saving item '${itemData.index}' to database ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Item]: Saving item '${itemData.index}' to database ...`);
|
||||||
|
|
||||||
let position = getItemPosition(itemId);
|
let position = getItemPosition(itemId);
|
||||||
|
|
||||||
@@ -2621,7 +2621,7 @@ function saveItemTypeToDatabase(itemTypeId) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Item]: Saving item type '${itemTypeData.name}' to database ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Item]: Saving item type '${itemTypeData.name}' to database ...`);
|
||||||
|
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
@@ -2753,7 +2753,7 @@ function getItemTypeIndexFromDatabaseId(databaseId) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function playerItemActionDelayComplete(client) {
|
function playerItemActionDelayComplete(client) {
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Item]: Player ${getPlayerDisplayForConsole(client)} item action delay complete (State: ${getPlayerData(client).itemActionState})`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Item]: Player ${getPlayerDisplayForConsole(client)} item action delay complete (State: ${getPlayerData(client).itemActionState})`);
|
||||||
switch (getPlayerData(client).itemActionState) {
|
switch (getPlayerData(client).itemActionState) {
|
||||||
case V_ITEM_ACTION_USE:
|
case V_ITEM_ACTION_USE:
|
||||||
playerUseItem(client, getPlayerData(client).itemActionItem);
|
playerUseItem(client, getPlayerData(client).itemActionItem);
|
||||||
|
|||||||
@@ -554,13 +554,13 @@ function loadJobsFromDatabase() {
|
|||||||
tempJobData.routes = loadJobRoutesFromDatabase(tempJobData.databaseId);
|
tempJobData.routes = loadJobRoutesFromDatabase(tempJobData.databaseId);
|
||||||
tempJobData.ranks = loadJobRanksFromDatabase(tempJobData.databaseId);
|
tempJobData.ranks = loadJobRanksFromDatabase(tempJobData.databaseId);
|
||||||
tempJobs.push(tempJobData);
|
tempJobs.push(tempJobData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Job '${tempJobData.name}' loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Job '${tempJobData.name}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: ${tempJobs.length} jobs loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: ${tempJobs.length} jobs loaded from database successfully!`);
|
||||||
return tempJobs;
|
return tempJobs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -599,7 +599,7 @@ function loadAllJobLocationsFromDatabase() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadJobRanksFromDatabase(jobDatabaseId) {
|
function loadJobRanksFromDatabase(jobDatabaseId) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Loading ranks for job ${jobDatabaseId} from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Loading ranks for job ${jobDatabaseId} from database ...`);
|
||||||
|
|
||||||
let tempJobRanks = [];
|
let tempJobRanks = [];
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
@@ -612,20 +612,20 @@ function loadJobRanksFromDatabase(jobDatabaseId) {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempJobRankData = new JobRankData(dbAssoc[i]);
|
let tempJobRankData = new JobRankData(dbAssoc[i]);
|
||||||
tempJobRanks.push(tempJobRankData);
|
tempJobRanks.push(tempJobRankData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Job rank '${tempJobRankData.name}' loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Job rank '${tempJobRankData.name}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: ${tempJobRanks.length} ranks for job ${jobDatabaseId} loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: ${tempJobRanks.length} ranks for job ${jobDatabaseId} loaded from database successfully!`);
|
||||||
return tempJobRanks;
|
return tempJobRanks;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadJobRoutesFromDatabase(jobDatabaseId) {
|
function loadJobRoutesFromDatabase(jobDatabaseId) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Loading job routes for job ${jobDatabaseId} from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Loading job routes for job ${jobDatabaseId} from database ...`);
|
||||||
|
|
||||||
let tempJobRoutes = [];
|
let tempJobRoutes = [];
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
@@ -639,20 +639,20 @@ function loadJobRoutesFromDatabase(jobDatabaseId) {
|
|||||||
let tempJobRouteData = new JobRouteData(dbAssoc[i]);
|
let tempJobRouteData = new JobRouteData(dbAssoc[i]);
|
||||||
tempJobRouteData.locations = loadJobRouteLocationsFromDatabase(tempJobRouteData.databaseId);
|
tempJobRouteData.locations = loadJobRouteLocationsFromDatabase(tempJobRouteData.databaseId);
|
||||||
tempJobRoutes.push(tempJobRouteData);
|
tempJobRoutes.push(tempJobRouteData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Job route '${tempJobRouteData.name}' loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Job route '${tempJobRouteData.name}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: ${tempJobRoutes.length} job routes for job ${jobDatabaseId} loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: ${tempJobRoutes.length} job routes for job ${jobDatabaseId} loaded from database successfully!`);
|
||||||
return tempJobRoutes;
|
return tempJobRoutes;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadJobRouteLocationsFromDatabase(jobRouteId) {
|
function loadJobRouteLocationsFromDatabase(jobRouteId) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Loading locations for job route ${jobRouteId} from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Loading locations for job route ${jobRouteId} from database ...`);
|
||||||
|
|
||||||
let tempJobRouteLocations = [];
|
let tempJobRouteLocations = [];
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
@@ -665,20 +665,20 @@ function loadJobRouteLocationsFromDatabase(jobRouteId) {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempJobRouteLocationData = new JobRouteLocationData(dbAssoc[i]);
|
let tempJobRouteLocationData = new JobRouteLocationData(dbAssoc[i]);
|
||||||
tempJobRouteLocations.push(tempJobRouteLocationData);
|
tempJobRouteLocations.push(tempJobRouteLocationData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Job route location '${tempJobRouteLocationData.databaseId}' loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Job route location '${tempJobRouteLocationData.databaseId}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: ${tempJobRouteLocations.length} locations for job route ${jobRouteId} loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: ${tempJobRouteLocations.length} locations for job route ${jobRouteId} loaded from database successfully!`);
|
||||||
return tempJobRouteLocations;
|
return tempJobRouteLocations;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadJobEquipmentsFromDatabase(jobDatabaseId) {
|
function loadJobEquipmentsFromDatabase(jobDatabaseId) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Loading job equipments for job ${jobDatabaseId} from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Loading job equipments for job ${jobDatabaseId} from database ...`);
|
||||||
|
|
||||||
let tempJobEquipments = [];
|
let tempJobEquipments = [];
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
@@ -692,20 +692,20 @@ function loadJobEquipmentsFromDatabase(jobDatabaseId) {
|
|||||||
let tempJobEquipmentData = new JobEquipmentData(dbAssoc[i]);
|
let tempJobEquipmentData = new JobEquipmentData(dbAssoc[i]);
|
||||||
tempJobEquipmentData.items = loadJobEquipmentItemsFromDatabase(tempJobEquipmentData.databaseId);
|
tempJobEquipmentData.items = loadJobEquipmentItemsFromDatabase(tempJobEquipmentData.databaseId);
|
||||||
tempJobEquipments.push(tempJobEquipmentData);
|
tempJobEquipments.push(tempJobEquipmentData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Job equipment '${tempJobEquipmentData.name}' loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Job equipment '${tempJobEquipmentData.name}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: ${tempJobEquipments.length} job equipments for job ${jobDatabaseId} loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: ${tempJobEquipments.length} job equipments for job ${jobDatabaseId} loaded from database successfully!`);
|
||||||
return tempJobEquipments;
|
return tempJobEquipments;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadJobLocationsFromDatabase(jobDatabaseId) {
|
function loadJobLocationsFromDatabase(jobDatabaseId) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Loading job locations for job ${jobDatabaseId} from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Loading job locations for job ${jobDatabaseId} from database ...`);
|
||||||
|
|
||||||
let tempJobLocations = [];
|
let tempJobLocations = [];
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
@@ -718,20 +718,20 @@ function loadJobLocationsFromDatabase(jobDatabaseId) {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempJobLocationData = new JobLocationData(dbAssoc[i]);
|
let tempJobLocationData = new JobLocationData(dbAssoc[i]);
|
||||||
tempJobLocations.push(tempJobLocationData);
|
tempJobLocations.push(tempJobLocationData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Job location '${tempJobLocationData.databaseId}' loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Job location '${tempJobLocationData.databaseId}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: ${tempJobLocations.length} job locations for job ${jobDatabaseId} loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: ${tempJobLocations.length} job locations for job ${jobDatabaseId} loaded from database successfully!`);
|
||||||
return tempJobLocations;
|
return tempJobLocations;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadJobUniformsFromDatabase(jobDatabaseId) {
|
function loadJobUniformsFromDatabase(jobDatabaseId) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Loading job uniforms for job ${jobDatabaseId} from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Loading job uniforms for job ${jobDatabaseId} from database ...`);
|
||||||
|
|
||||||
let tempJobUniforms = [];
|
let tempJobUniforms = [];
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
@@ -744,20 +744,20 @@ function loadJobUniformsFromDatabase(jobDatabaseId) {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempJobUniformData = new JobUniformData(dbAssoc[i]);
|
let tempJobUniformData = new JobUniformData(dbAssoc[i]);
|
||||||
tempJobUniforms.push(tempJobUniformData);
|
tempJobUniforms.push(tempJobUniformData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Job uniform '${tempJobUniformData.databaseId}' loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Job uniform '${tempJobUniformData.databaseId}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: ${tempJobUniforms.length} job uniforms for job ${jobDatabaseId} loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: ${tempJobUniforms.length} job uniforms for job ${jobDatabaseId} loaded from database successfully!`);
|
||||||
return tempJobUniforms;
|
return tempJobUniforms;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadJobEquipmentItemsFromDatabase(jobEquipmentDatabaseId) {
|
function loadJobEquipmentItemsFromDatabase(jobEquipmentDatabaseId) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Loading job equipment items for job equipment ${jobEquipmentDatabaseId} from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Loading job equipment items for job equipment ${jobEquipmentDatabaseId} from database ...`);
|
||||||
|
|
||||||
let tempJobEquipmentItems = [];
|
let tempJobEquipmentItems = [];
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
@@ -770,13 +770,13 @@ function loadJobEquipmentItemsFromDatabase(jobEquipmentDatabaseId) {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempJobEquipmentItemData = new JobEquipmentItemData(dbAssoc[i]);
|
let tempJobEquipmentItemData = new JobEquipmentItemData(dbAssoc[i]);
|
||||||
tempJobEquipmentItems.push(tempJobEquipmentItemData);
|
tempJobEquipmentItems.push(tempJobEquipmentItemData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Job equipment item '${tempJobEquipmentItemData.databaseId}' loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Job equipment item '${tempJobEquipmentItemData.databaseId}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: ${tempJobEquipmentItems.length} job equipment items for equipment ${jobEquipmentDatabaseId} loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: ${tempJobEquipmentItems.length} job equipment items for equipment ${jobEquipmentDatabaseId} loaded from database successfully!`);
|
||||||
return tempJobEquipmentItems;
|
return tempJobEquipmentItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -787,13 +787,13 @@ function createAllJobBlips() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Spawning all job location blips ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] Spawning all job location blips ...`);
|
||||||
for (let i in getServerData().jobs) {
|
for (let i in getServerData().jobs) {
|
||||||
for (let j in getServerData().jobs[i].locations) {
|
for (let j in getServerData().jobs[i].locations) {
|
||||||
createJobLocationBlip(i, j);
|
createJobLocationBlip(i, j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] All job location blips spawned!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] All job location blips spawned!`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -803,7 +803,7 @@ function createAllJobPickups() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Spawning all job location pickups ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] Spawning all job location pickups ...`);
|
||||||
let pickupCount = 0;
|
let pickupCount = 0;
|
||||||
for (let i in getServerData().jobs) {
|
for (let i in getServerData().jobs) {
|
||||||
if (getServerData().jobs[i].pickupModel != 0) {
|
if (getServerData().jobs[i].pickupModel != 0) {
|
||||||
@@ -819,11 +819,11 @@ function createAllJobPickups() {
|
|||||||
setElementDimension(getServerData().jobs[i].locations[j].pickup, getServerData().jobs[i].locations[j].dimension);
|
setElementDimension(getServerData().jobs[i].locations[j].pickup, getServerData().jobs[i].locations[j].dimension);
|
||||||
addToWorld(getServerData().jobs[i].locations[j].pickup);
|
addToWorld(getServerData().jobs[i].locations[j].pickup);
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job] Job '${getServerData().jobs[i].name}' location pickup ${j} spawned!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job] Job '${getServerData().jobs[i].name}' location pickup ${j} spawned!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] All job location pickups (${pickupCount}) spawned!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] All job location pickups (${pickupCount}) spawned!`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -2720,11 +2720,11 @@ function saveJobToDatabase(jobData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (jobData.needsSaved == false) {
|
if (jobData.needsSaved == false) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Job ${jobData.name} doesn't need saved. Skipping ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Job ${jobData.name} doesn't need saved. Skipping ...`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saving job ${jobData.name} to database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saving job ${jobData.name} to database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
let safeName = escapeDatabaseString(dbConnection, jobData.name);
|
let safeName = escapeDatabaseString(dbConnection, jobData.name);
|
||||||
@@ -2761,7 +2761,7 @@ function saveJobToDatabase(jobData) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saved job ${jobData.name} to database!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saved job ${jobData.name} to database!`);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2775,11 +2775,11 @@ function saveJobRankToDatabase(jobRankData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (jobRankData.needsSaved == false) {
|
if (jobRankData.needsSaved == false) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Job route ${jobRankData.name} (DB ID ${jobRankData.databaseId}) doesn't need saved. Skipping ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Job route ${jobRankData.name} (DB ID ${jobRankData.databaseId}) doesn't need saved. Skipping ...`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saving job route ${jobRankData.name} to database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saving job route ${jobRankData.name} to database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
let safeName = escapeDatabaseString(dbConnection, jobRankData.name);
|
let safeName = escapeDatabaseString(dbConnection, jobRankData.name);
|
||||||
@@ -2810,7 +2810,7 @@ function saveJobRankToDatabase(jobRankData) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saved job rank ${jobRankData.name} to database!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saved job rank ${jobRankData.name} to database!`);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2824,11 +2824,11 @@ function saveJobRouteToDatabase(jobRouteData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (jobRouteData.needsSaved == false) {
|
if (jobRouteData.needsSaved == false) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Job route ${jobRouteData.name} (DB ID ${jobRouteData.databaseId}) doesn't need saved. Skipping ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Job route ${jobRouteData.name} (DB ID ${jobRouteData.databaseId}) doesn't need saved. Skipping ...`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saving job route ${jobRouteData.name} to database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saving job route ${jobRouteData.name} to database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
let safeName = escapeDatabaseString(dbConnection, jobRouteData.name);
|
let safeName = escapeDatabaseString(dbConnection, jobRouteData.name);
|
||||||
@@ -2869,7 +2869,7 @@ function saveJobRouteToDatabase(jobRouteData) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saved job route ${jobRouteData.name} to database!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saved job route ${jobRouteData.name} to database!`);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2883,11 +2883,11 @@ function saveJobRouteLocationToDatabase(jobRouteLocationData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (jobRouteLocationData.needsSaved == false) {
|
if (jobRouteLocationData.needsSaved == false) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Job route location ${jobRouteLocationData.name} (DB ID ${jobRouteLocationData.databaseId}) doesn't need saved. Skipping ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Job route location ${jobRouteLocationData.name} (DB ID ${jobRouteLocationData.databaseId}) doesn't need saved. Skipping ...`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saving job route location ${jobRouteLocationData.name} to database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saving job route location ${jobRouteLocationData.name} to database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
let safeName = escapeDatabaseString(dbConnection, jobRouteLocationData.name);
|
let safeName = escapeDatabaseString(dbConnection, jobRouteLocationData.name);
|
||||||
@@ -2919,7 +2919,7 @@ function saveJobRouteLocationToDatabase(jobRouteLocationData) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saved job route location ${jobRoutePositionData.name} (${jobRouteLocationData.databaseId}) to database!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saved job route location ${jobRoutePositionData.name} (${jobRouteLocationData.databaseId}) to database!`);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2933,11 +2933,11 @@ function saveJobLocationToDatabase(jobLocationData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!jobLocationData.needsSaved) {
|
if (!jobLocationData.needsSaved) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Job location ${jobLocationData.name} (${jobLocationData.databaseId}) doesn't need saved. Skipping ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Job location ${jobLocationData.name} (${jobLocationData.databaseId}) doesn't need saved. Skipping ...`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saving job location ${jobLocationData.databaseId} to database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saving job location ${jobLocationData.databaseId} to database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
let data = [
|
let data = [
|
||||||
@@ -2968,7 +2968,7 @@ function saveJobLocationToDatabase(jobLocationData) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saved job location ${jobLocationData.databaseId} to database`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saved job location ${jobLocationData.databaseId} to database`);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2982,11 +2982,11 @@ function saveJobEquipmentToDatabase(jobEquipmentData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!jobEquipmentData.needsSaved) {
|
if (!jobEquipmentData.needsSaved) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Job equipment ${jobEquipmentData.name} (${jobEquipmentData.databaseId}) doesn't need saved. Skipping ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Job equipment ${jobEquipmentData.name} (${jobEquipmentData.databaseId}) doesn't need saved. Skipping ...`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saving job equipment ${jobEquipmentData.databaseId} to database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saving job equipment ${jobEquipmentData.databaseId} to database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
let safeName = escapeDatabaseString(dbConnection, jobEquipmentData.name);
|
let safeName = escapeDatabaseString(dbConnection, jobEquipmentData.name);
|
||||||
@@ -3014,7 +3014,7 @@ function saveJobEquipmentToDatabase(jobEquipmentData) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saved job equipment ${jobEquipmentData.databaseId} to database`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saved job equipment ${jobEquipmentData.databaseId} to database`);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -3028,11 +3028,11 @@ function saveJobEquipmentItemToDatabase(jobEquipmentItemData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!jobEquipmentItemData.needsSaved) {
|
if (!jobEquipmentItemData.needsSaved) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Job equipment item ${jobEquipmentItemData.databaseId} doesn't need saved. Skipping ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Job equipment item ${jobEquipmentItemData.databaseId} doesn't need saved. Skipping ...`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saving job equipment weapon ${jobEquipmentItemData.databaseId} to database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saving job equipment weapon ${jobEquipmentItemData.databaseId} to database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
let data = [
|
let data = [
|
||||||
@@ -3059,7 +3059,7 @@ function saveJobEquipmentItemToDatabase(jobEquipmentItemData) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saved job equipment weapon ${jobEquipmentItemData.databaseId} to database`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saved job equipment weapon ${jobEquipmentItemData.databaseId} to database`);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -3073,11 +3073,11 @@ function saveJobUniformToDatabase(jobUniformData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!jobUniformData.needSaved) {
|
if (!jobUniformData.needSaved) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Job uniform ${jobUniformData.databaseId} doesn't need saved. Skipping ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Job uniform ${jobUniformData.databaseId} doesn't need saved. Skipping ...`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saving job uniform ${jobUniformData.databaseId} to database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saving job uniform ${jobUniformData.databaseId} to database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
let safeName = escapeDatabaseString(dbConnection, jobUniformData.name);
|
let safeName = escapeDatabaseString(dbConnection, jobUniformData.name);
|
||||||
@@ -3106,7 +3106,7 @@ function saveJobUniformToDatabase(jobUniformData) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saved job uniform ${jobUniformData.databaseId} to database`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saved job uniform ${jobUniformData.databaseId} to database`);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -3174,7 +3174,7 @@ function createJobLocationPickup(jobId, locationId) {
|
|||||||
|
|
||||||
let tempJobData = getJobData(jobId);
|
let tempJobData = getJobData(jobId);
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating pickup for location ${locationId} of the ${tempJobData.name} job`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Creating pickup for location ${locationId} of the ${tempJobData.name} job`);
|
||||||
|
|
||||||
if (tempJobData.pickupModel != -1) {
|
if (tempJobData.pickupModel != -1) {
|
||||||
let pickupModelId = -1;
|
let pickupModelId = -1;
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ function addPlayerKeyBind(client, keyId, command, params, tempKey = false) {
|
|||||||
|
|
||||||
if (!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "enter")) {
|
if (!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "enter")) {
|
||||||
let keyId = getPlayerKeyBindForCommand(client, "enter");
|
let keyId = getPlayerKeyBindForCommand(client, "enter");
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendPlayerEnterPropertyKey(client, keyId.key);
|
sendPlayerEnterPropertyKey(client, keyId.key);
|
||||||
} else {
|
} else {
|
||||||
sendPlayerEnterPropertyKey(client, false);
|
sendPlayerEnterPropertyKey(client, false);
|
||||||
@@ -140,7 +140,7 @@ function removePlayerKeyBind(client, keyId) {
|
|||||||
|
|
||||||
if (!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "enter")) {
|
if (!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "enter")) {
|
||||||
let keyId = getPlayerKeyBindForCommand(client, "enter");
|
let keyId = getPlayerKeyBindForCommand(client, "enter");
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendPlayerEnterPropertyKey(client, keyId.key);
|
sendPlayerEnterPropertyKey(client, keyId.key);
|
||||||
} else {
|
} else {
|
||||||
sendPlayerEnterPropertyKey(client, false);
|
sendPlayerEnterPropertyKey(client, false);
|
||||||
@@ -208,7 +208,7 @@ function playerUsedKeyBind(client, key, duration = 0) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.KeyBind] ${getPlayerDisplayForConsole(client)} used keybind ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
logToConsole(LOG_DEBUG, `[V.RP.KeyBind] ${getPlayerDisplayForConsole(client)} used keybind ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
||||||
if (!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForKey(client, key)) {
|
if (!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForKey(client, key)) {
|
||||||
let keyBindData = getPlayerKeyBindForKey(client, key);
|
let keyBindData = getPlayerKeyBindForKey(client, key);
|
||||||
if (keyBindData.enabled) {
|
if (keyBindData.enabled) {
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ function getLocaleString(client, stringName, ...args) {
|
|||||||
|
|
||||||
let tempString = getRawLocaleString(getPlayerData(client).locale, stringName);
|
let tempString = getRawLocaleString(getPlayerData(client).locale, stringName);
|
||||||
if (tempString == "" || tempString == null || typeof tempString == "undefined") {
|
if (tempString == "" || tempString == null || typeof tempString == "undefined") {
|
||||||
logToConsole(LOG_WARN, `[AGRP.Locale] Locale string missing for ${stringName} on language ${getLocaleData(getPlayerData(client).locale).englishName}`);
|
logToConsole(LOG_WARN, `[V.RP.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)}"`);
|
submitBugReport(client, `(AUTOMATED REPORT) Locale string "${stringName}" is missing for "${getPlayerLocaleName(client)}"`);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@@ -57,7 +57,7 @@ function getLocaleString(client, stringName, ...args) {
|
|||||||
function getLanguageLocaleString(localeId, stringName, ...args) {
|
function getLanguageLocaleString(localeId, stringName, ...args) {
|
||||||
let tempString = getRawLocaleString(localeId, stringName);
|
let tempString = getRawLocaleString(localeId, stringName);
|
||||||
if (tempString == "" || tempString == null || typeof tempString == "undefined") {
|
if (tempString == "" || tempString == null || typeof tempString == "undefined") {
|
||||||
logToConsole(LOG_WARN, `[AGRP.Locale] Locale string missing for ${stringName} on language ${getLocaleData(localeId).englishName}`);
|
logToConsole(LOG_WARN, `[V.RP.Locale] Locale string missing for ${stringName} on language ${getLocaleData(localeId).englishName}`);
|
||||||
submitBugReport(null, `(AUTOMATED REPORT) Locale string "${stringName}" is missing for "${getLocaleData(localeId).englishName}"`);
|
submitBugReport(null, `(AUTOMATED REPORT) Locale string "${stringName}" is missing for "${getLocaleData(localeId).englishName}"`);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@@ -74,7 +74,7 @@ function getLanguageLocaleString(localeId, stringName, ...args) {
|
|||||||
function getLanguageGroupedLocaleString(localeId, stringName, index, ...args) {
|
function getLanguageGroupedLocaleString(localeId, stringName, index, ...args) {
|
||||||
let tempString = getRawGroupedLocaleString(localeId, stringName, index);
|
let tempString = getRawGroupedLocaleString(localeId, stringName, index);
|
||||||
if (tempString == "" || tempString == null || typeof tempString == "undefined") {
|
if (tempString == "" || tempString == null || typeof tempString == "undefined") {
|
||||||
logToConsole(LOG_WARN, `[AGRP.Locale] Locale string missing for index ${index} of "${stringName}" on language ${getLocaleData(localeId).englishName}`);
|
logToConsole(LOG_WARN, `[V.RP.Locale] Locale string missing for index ${index} of "${stringName}" on language ${getLocaleData(localeId).englishName}`);
|
||||||
submitBugReport(null, `(AUTOMATED REPORT) Locale string index ${index} of "${stringName}" is missing for "${getLocaleData(localeId).englishName}"`);
|
submitBugReport(null, `(AUTOMATED REPORT) Locale string index ${index} of "${stringName}" is missing for "${getLocaleData(localeId).englishName}"`);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@@ -106,7 +106,7 @@ function getGroupedLocaleString(client, stringName, index, ...args) {
|
|||||||
|
|
||||||
function getRawLocaleString(localeId, stringName) {
|
function getRawLocaleString(localeId, stringName) {
|
||||||
if (typeof getLocaleStrings()[localeId][stringName] == "undefined") {
|
if (typeof getLocaleStrings()[localeId][stringName] == "undefined") {
|
||||||
logToConsole(LOG_WARN, `[AGRP.Locale] Locale string missing for ${getLocaleStrings()[localeId][stringName]} on language ${getLocaleData(localeId).englishName}[${localeId}]`);
|
logToConsole(LOG_WARN, `[V.RP.Locale] Locale string missing for ${getLocaleStrings()[localeId][stringName]} on language ${getLocaleData(localeId).englishName}[${localeId}]`);
|
||||||
submitBugReport(null, `(AUTOMATED REPORT) Locale string is missing for "${getLocaleStrings()[localeId][stringName]}" on language ${getLocaleData(localeId).englishName}[${localeId}]`);
|
submitBugReport(null, `(AUTOMATED REPORT) Locale string is missing for "${getLocaleStrings()[localeId][stringName]}" on language ${getLocaleData(localeId).englishName}[${localeId}]`);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@@ -127,7 +127,7 @@ function getRawLocaleString(localeId, stringName) {
|
|||||||
|
|
||||||
function getRawGroupedLocaleString(localeId, stringName, index) {
|
function getRawGroupedLocaleString(localeId, stringName, index) {
|
||||||
if (typeof getLocaleStrings()[localeId][stringName][index] == "undefined") {
|
if (typeof getLocaleStrings()[localeId][stringName][index] == "undefined") {
|
||||||
logToConsole(LOG_WARN, `[AGRP.Locale] Grouped locale string missing for index ${index} of string ${getLocaleStrings()[localeId][stringName][index]} on language ${getLocaleData(localeId).englishName}[${localeId}]`);
|
logToConsole(LOG_WARN, `[V.RP.Locale] Grouped locale string missing for index ${index} of string ${getLocaleStrings()[localeId][stringName][index]} on language ${getLocaleData(localeId).englishName}[${localeId}]`);
|
||||||
submitBugReport(null, `(AUTOMATED REPORT) Grouped locale string is missing for index ${index} of string "${getLocaleStrings()[localeId][stringName][index]}" on language ${getLocaleData(localeId).englishName}[${localeId}]`);
|
submitBugReport(null, `(AUTOMATED REPORT) Grouped locale string is missing for index ${index} of string "${getLocaleStrings()[localeId][stringName][index]}" on language ${getLocaleData(localeId).englishName}[${localeId}]`);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -417,7 +417,7 @@ function enterExitPropertyCommand(command, params, client) {
|
|||||||
}, 1100);
|
}, 1100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Misc] ${getPlayerDisplayForConsole(client)} exited business ${inBusiness.name}[${inBusiness.index}/${inBusiness.databaseId}]`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Misc] ${getPlayerDisplayForConsole(client)} exited business ${inBusiness.name}[${inBusiness.index}/${inBusiness.databaseId}]`);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -826,24 +826,24 @@ function getPlayerWeapon(client) {
|
|||||||
function connectToDatabase() {
|
function connectToDatabase() {
|
||||||
if (getDatabaseConfig().usePersistentConnection) {
|
if (getDatabaseConfig().usePersistentConnection) {
|
||||||
if (persistentDatabaseConnection == null) {
|
if (persistentDatabaseConnection == null) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Initializing database connection ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Database] Initializing database connection ...`);
|
||||||
persistentDatabaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port);
|
persistentDatabaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port);
|
||||||
if (persistentDatabaseConnection.error) {
|
if (persistentDatabaseConnection.error) {
|
||||||
logToConsole(LOG_ERROR, `[AGRP.Database] Database connection error: ${persistentDatabaseConnection.error}`);
|
logToConsole(LOG_ERROR, `[V.RP.Database] Database connection error: ${persistentDatabaseConnection.error}`);
|
||||||
persistentDatabaseConnection = null;
|
persistentDatabaseConnection = null;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Database connection successful!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Database] Database connection successful!`);
|
||||||
return persistentDatabaseConnection;
|
return persistentDatabaseConnection;
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Using existing database connection.`);
|
logToConsole(LOG_DEBUG, `[V.RP.Database] Using existing database connection.`);
|
||||||
return persistentDatabaseConnection;
|
return persistentDatabaseConnection;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let databaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port);
|
let databaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port);
|
||||||
if (databaseConnection.error) {
|
if (databaseConnection.error) {
|
||||||
logToConsole(LOG_ERROR, `[AGRP.Database] Database connection error: ${persistentDatabaseConnection.error}`);
|
logToConsole(LOG_ERROR, `[V.RP.Database] Database connection error: ${persistentDatabaseConnection.error}`);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return databaseConnection;
|
return databaseConnection;
|
||||||
@@ -857,9 +857,9 @@ function disconnectFromDatabase(dbConnection, force = false) {
|
|||||||
if (!getDatabaseConfig().usePersistentConnection || force == true) {
|
if (!getDatabaseConfig().usePersistentConnection || force == true) {
|
||||||
try {
|
try {
|
||||||
dbConnection.close();
|
dbConnection.close();
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Database connection closed successfully`);
|
logToConsole(LOG_DEBUG, `[V.RP.Database] Database connection closed successfully`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logToConsole(LOG_ERROR, `[AGRP.Database] Database connection could not be closed! (Error: ${error})`);
|
logToConsole(LOG_ERROR, `[V.RP.Database] Database connection could not be closed! (Error: ${error})`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -868,7 +868,7 @@ function disconnectFromDatabase(dbConnection, force = false) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function queryDatabase(dbConnection, queryString, useThread = false) {
|
function queryDatabase(dbConnection, queryString, useThread = false) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Query string: ${queryString}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Database] Query string: ${queryString}`);
|
||||||
if (useThread == true) {
|
if (useThread == true) {
|
||||||
Promise.resolve().then(() => {
|
Promise.resolve().then(() => {
|
||||||
let queryResult = dbConnection.query(queryString);
|
let queryResult = dbConnection.query(queryString);
|
||||||
@@ -942,19 +942,19 @@ function quickDatabaseQuery(queryString) {
|
|||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
let insertId = 0;
|
let insertId = 0;
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Database] Query string: ${queryString}`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Database] Query string: ${queryString}`);
|
||||||
let dbQuery = queryDatabase(dbConnection, queryString);
|
let dbQuery = queryDatabase(dbConnection, queryString);
|
||||||
if (getDatabaseInsertId(dbConnection)) {
|
if (getDatabaseInsertId(dbConnection)) {
|
||||||
insertId = getDatabaseInsertId(dbConnection);
|
insertId = getDatabaseInsertId(dbConnection);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Query returned insert id ${insertId}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Database] Query returned insert id ${insertId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dbQuery) {
|
if (dbQuery) {
|
||||||
try {
|
try {
|
||||||
freeDatabaseQuery(dbQuery);
|
freeDatabaseQuery(dbQuery);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Query result free'd successfully`);
|
logToConsole(LOG_DEBUG, `[V.RP.Database] Query result free'd successfully`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logToConsole(LOG_ERROR, `[AGRP.Database] Query result could not be free'd! (Error: ${error})`);
|
logToConsole(LOG_ERROR, `[V.RP.Database] Query result could not be free'd! (Error: ${error})`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1006,9 +1006,9 @@ function setConstantsAsGlobalVariablesInDatabase() {
|
|||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
let entries = Object.entries(global);
|
let entries = Object.entries(global);
|
||||||
for (let i in entries) {
|
for (let i in entries) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Checking entry ${i} (${entries[i]})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Database] Checking entry ${i} (${entries[i]})`);
|
||||||
if (toString(i).slice(0, 3).indexOf("V_") != -1) {
|
if (toString(i).slice(0, 3).indexOf("V_") != -1) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Adding ${i} (${entries[i]}) to database global variables`);
|
logToConsole(LOG_DEBUG, `[V.RP.Database] Adding ${i} (${entries[i]}) to database global variables`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1193,7 +1193,7 @@ function setVehicleHealth(vehicle, health) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function givePlayerWeapon(client, weaponId, ammo, active = true) {
|
function givePlayerWeapon(client, weaponId, ammo, active = true) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to give weapon (Weapon: ${weaponId}, Ammo: ${ammo})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to give weapon (Weapon: ${weaponId}, Ammo: ${ammo})`);
|
||||||
sendNetworkEventToPlayer("v.rp.giveWeapon", client, weaponId, ammo, active);
|
sendNetworkEventToPlayer("v.rp.giveWeapon", client, weaponId, ammo, active);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1447,7 +1447,7 @@ function hideElementForPlayer(element, client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Native.Connected] Hiding element ${element.id} for player ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Native.Connected] Hiding element ${element.id} for player ${getPlayerDisplayForConsole(client)}`);
|
||||||
element.setExistsFor(client, false);
|
element.setExistsFor(client, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1462,7 +1462,7 @@ function showElementForPlayer(element, client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Native.Connected] Showing element ${element.id} for player ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Native.Connected] Showing element ${element.id} for player ${getPlayerDisplayForConsole(client)}`);
|
||||||
element.setExistsFor(client, true);
|
element.setExistsFor(client, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -742,24 +742,24 @@ function getPlayerWeapon(client) {
|
|||||||
function connectToDatabase() {
|
function connectToDatabase() {
|
||||||
if (getDatabaseConfig().usePersistentConnection) {
|
if (getDatabaseConfig().usePersistentConnection) {
|
||||||
if (persistentDatabaseConnection == null) {
|
if (persistentDatabaseConnection == null) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Initializing database connection ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Database] Initializing database connection ...`);
|
||||||
persistentDatabaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port);
|
persistentDatabaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port);
|
||||||
if (persistentDatabaseConnection.error) {
|
if (persistentDatabaseConnection.error) {
|
||||||
logToConsole(LOG_ERROR, `[AGRP.Database] Database connection error: ${persistentDatabaseConnection.error}`);
|
logToConsole(LOG_ERROR, `[V.RP.Database] Database connection error: ${persistentDatabaseConnection.error}`);
|
||||||
persistentDatabaseConnection = null;
|
persistentDatabaseConnection = null;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Database connection successful!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Database] Database connection successful!`);
|
||||||
return persistentDatabaseConnection;
|
return persistentDatabaseConnection;
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Using existing database connection.`);
|
logToConsole(LOG_DEBUG, `[V.RP.Database] Using existing database connection.`);
|
||||||
return persistentDatabaseConnection;
|
return persistentDatabaseConnection;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let databaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port);
|
let databaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port);
|
||||||
if (databaseConnection.error) {
|
if (databaseConnection.error) {
|
||||||
logToConsole(LOG_ERROR, `[AGRP.Database] Database connection error: ${persistentDatabaseConnection.error}`);
|
logToConsole(LOG_ERROR, `[V.RP.Database] Database connection error: ${persistentDatabaseConnection.error}`);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return databaseConnection;
|
return databaseConnection;
|
||||||
@@ -773,9 +773,9 @@ function disconnectFromDatabase(dbConnection) {
|
|||||||
if (!getDatabaseConfig().usePersistentConnection) {
|
if (!getDatabaseConfig().usePersistentConnection) {
|
||||||
try {
|
try {
|
||||||
dbConnection.close();
|
dbConnection.close();
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Database connection closed successfully`);
|
logToConsole(LOG_DEBUG, `[V.RP.Database] Database connection closed successfully`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logToConsole(LOG_ERROR, `[AGRP.Database] Database connection could not be closed! (Error: ${error})`);
|
logToConsole(LOG_ERROR, `[V.RP.Database] Database connection could not be closed! (Error: ${error})`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -784,7 +784,7 @@ function disconnectFromDatabase(dbConnection) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function queryDatabase(dbConnection, queryString, useThread = false) {
|
function queryDatabase(dbConnection, queryString, useThread = false) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Query string: ${queryString}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Database] Query string: ${queryString}`);
|
||||||
if (useThread == true) {
|
if (useThread == true) {
|
||||||
Promise.resolve().then(() => {
|
Promise.resolve().then(() => {
|
||||||
let queryResult = dbConnection.query(queryString);
|
let queryResult = dbConnection.query(queryString);
|
||||||
@@ -849,19 +849,19 @@ function quickDatabaseQuery(queryString) {
|
|||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
let insertId = 0;
|
let insertId = 0;
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Database] Query string: ${queryString}`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Database] Query string: ${queryString}`);
|
||||||
let dbQuery = queryDatabase(dbConnection, queryString);
|
let dbQuery = queryDatabase(dbConnection, queryString);
|
||||||
if (getDatabaseInsertId(dbConnection)) {
|
if (getDatabaseInsertId(dbConnection)) {
|
||||||
insertId = getDatabaseInsertId(dbConnection);
|
insertId = getDatabaseInsertId(dbConnection);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Query returned insert id ${insertId}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Database] Query returned insert id ${insertId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dbQuery) {
|
if (dbQuery) {
|
||||||
try {
|
try {
|
||||||
freeDatabaseQuery(dbQuery);
|
freeDatabaseQuery(dbQuery);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Query result free'd successfully`);
|
logToConsole(LOG_DEBUG, `[V.RP.Database] Query result free'd successfully`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logToConsole(LOG_ERROR, `[AGRP.Database] Query result could not be free'd! (Error: ${error})`);
|
logToConsole(LOG_ERROR, `[V.RP.Database] Query result could not be free'd! (Error: ${error})`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -998,7 +998,7 @@ function setVehicleHealth(vehicle, health) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function givePlayerWeapon(client, weaponId, ammo, active = true) {
|
function givePlayerWeapon(client, weaponId, ammo, active = true) {
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to give weapon (Weapon: ${weaponId}, Ammo: ${ammo})`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to give weapon (Weapon: ${weaponId}, Ammo: ${ammo})`);
|
||||||
//sendNetworkEventToPlayer("v.rp.giveWeapon", client, weaponId, ammo, active);
|
//sendNetworkEventToPlayer("v.rp.giveWeapon", client, weaponId, ammo, active);
|
||||||
client.giveWeapon(weaponId, ammo);
|
client.giveWeapon(weaponId, ammo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,14 +87,14 @@ function updatePlayerNameTag(client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending ${getPlayerDisplayForConsole(client)}'s updated nametag to all players`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending ${getPlayerDisplayForConsole(client)}'s updated nametag to all players`);
|
||||||
sendNetworkEventToPlayer("v.rp.nametag", null, getPlayerName(client), getPlayerNameForNameTag(client), getPlayerColour(client), getPlayerData(client).afk, getPlayerPing(client));
|
sendNetworkEventToPlayer("v.rp.nametag", null, getPlayerName(client), getPlayerNameForNameTag(client), getPlayerColour(client), getPlayerData(client).afk, getPlayerPing(client));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function updateAllPlayerNameTags() {
|
function updateAllPlayerNameTags() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending updated nametags to all players`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending updated nametags to all players`);
|
||||||
let clients = getClients();
|
let clients = getClients();
|
||||||
for (let i in clients) {
|
for (let i in clients) {
|
||||||
updatePlayerNameTag(clients[i]);
|
updatePlayerNameTag(clients[i]);
|
||||||
@@ -104,7 +104,7 @@ function updateAllPlayerNameTags() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function updatePlayerPing(client) {
|
function updatePlayerPing(client) {
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Client] Sending ${getPlayerDisplayForConsole(client)}'s ping to all players`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Client] Sending ${getPlayerDisplayForConsole(client)}'s ping to all players`);
|
||||||
sendNetworkEventToPlayer("v.rp.ping", null, getPlayerName(client), getPlayerPing(client));
|
sendNetworkEventToPlayer("v.rp.ping", null, getPlayerName(client), getPlayerPing(client));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ function updatePlayerPing(client) {
|
|||||||
|
|
||||||
function playerClientReady(client) {
|
function playerClientReady(client) {
|
||||||
playerResourceReady[client.index] = true;
|
playerResourceReady[client.index] = true;
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s client resources are downloaded and ready! Started: ${getYesNoFromBool(playerResourceStarted[client.index])}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s client resources are downloaded and ready! Started: ${getYesNoFromBool(playerResourceStarted[client.index])}`);
|
||||||
if (playerResourceStarted[client.index] == true && playerInitialized[client.index] == false) {
|
if (playerResourceStarted[client.index] == true && playerInitialized[client.index] == false) {
|
||||||
initClient(client);
|
initClient(client);
|
||||||
}
|
}
|
||||||
@@ -122,14 +122,14 @@ function playerClientReady(client) {
|
|||||||
|
|
||||||
function playerGUIReady(client) {
|
function playerGUIReady(client) {
|
||||||
playerGUI[client.index] = true;
|
playerGUI[client.index] = true;
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s client GUI is initialized and ready!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s client GUI is initialized and ready!`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function playerClientStarted(client) {
|
function playerClientStarted(client) {
|
||||||
playerResourceStarted[client.index] = true;
|
playerResourceStarted[client.index] = true;
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s client resources are started and running! Ready: ${getYesNoFromBool(playerResourceReady[client.index])}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s client resources are started and running! Ready: ${getYesNoFromBool(playerResourceReady[client.index])}`);
|
||||||
if (playerResourceReady[client.index] == true && playerInitialized[client.index] == false) {
|
if (playerResourceReady[client.index] == true && playerInitialized[client.index] == false) {
|
||||||
initClient(client);
|
initClient(client);
|
||||||
}
|
}
|
||||||
@@ -138,7 +138,7 @@ function playerClientStarted(client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function playerClientStopped(client) {
|
function playerClientStopped(client) {
|
||||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s client resources have stopped (possibly error?)`);
|
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s client resources have stopped (possibly error?)`);
|
||||||
getPlayerData(client).customDisconnectReason = "ClientScriptVerificationFail";
|
getPlayerData(client).customDisconnectReason = "ClientScriptVerificationFail";
|
||||||
//disconnectPlayer(client);
|
//disconnectPlayer(client);
|
||||||
}
|
}
|
||||||
@@ -146,7 +146,7 @@ function playerClientStopped(client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showSmallGameMessage(client, text, colour, duration, fontName = "Roboto") {
|
function showSmallGameMessage(client, text, colour, duration, fontName = "Roboto") {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing game message to ${getPlayerDisplayForConsole(client)} (${text}) for ${duration} milliseconds`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing game message to ${getPlayerDisplayForConsole(client)} (${text}) for ${duration} milliseconds`);
|
||||||
|
|
||||||
if (getGame() <= V_GAME_GTA_IV_EFLC) {
|
if (getGame() <= V_GAME_GTA_IV_EFLC) {
|
||||||
fontName = "Pricedown";
|
fontName = "Pricedown";
|
||||||
@@ -163,7 +163,7 @@ function enableCityAmbienceForPlayer(client, clearElements = false) {
|
|||||||
// return false;
|
// return false;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`);
|
||||||
//sendNetworkEventToPlayer("v.rp.ambience", client, true);
|
//sendNetworkEventToPlayer("v.rp.ambience", client, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,21 +174,21 @@ function disableCityAmbienceForPlayer(client, clearElements = false) {
|
|||||||
// return false;
|
// return false;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`);
|
||||||
//sendNetworkEventToPlayer("v.rp.ambience", client, false, clearElements);
|
//sendNetworkEventToPlayer("v.rp.ambience", client, false, clearElements);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function clearPlayerOwnedPeds(client) {
|
function clearPlayerOwnedPeds(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Clearing peds owned by ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Clearing peds owned by ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.clearPeds", client);
|
sendNetworkEventToPlayer("v.rp.clearPeds", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function updatePlayerSpawnedState(client, state) {
|
function updatePlayerSpawnedState(client, state) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Setting ${getPlayerDisplayForConsole(client)}'s spawned state ${toUpperCase(getOnOffFromBool(state))}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Setting ${getPlayerDisplayForConsole(client)}'s spawned state ${toUpperCase(getOnOffFromBool(state))}`);
|
||||||
getPlayerData(client).spawned = true;
|
getPlayerData(client).spawned = true;
|
||||||
sendNetworkEventToPlayer("v.rp.spawned", client, state);
|
sendNetworkEventToPlayer("v.rp.spawned", client, state);
|
||||||
}
|
}
|
||||||
@@ -196,21 +196,21 @@ function updatePlayerSpawnedState(client, state) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setPlayerControlState(client, state) {
|
function setPlayerControlState(client, state) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Setting ${getPlayerDisplayForConsole(client)}'s control state ${toUpperCase(getOnOffFromBool(state))}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Setting ${getPlayerDisplayForConsole(client)}'s control state ${toUpperCase(getOnOffFromBool(state))}`);
|
||||||
sendNetworkEventToPlayer("v.rp.control", client, state, !state);
|
sendNetworkEventToPlayer("v.rp.control", client, state, !state);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function updatePlayerShowLogoState(client, state) {
|
function updatePlayerShowLogoState(client, state) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Setting ${getPlayerDisplayForConsole(client)}'s logo state ${toUpperCase(getOnOffFromBool(state))}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Setting ${getPlayerDisplayForConsole(client)}'s logo state ${toUpperCase(getOnOffFromBool(state))}`);
|
||||||
sendNetworkEventToPlayer("v.rp.logo", client, state);
|
sendNetworkEventToPlayer("v.rp.logo", client, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function restorePlayerCamera(client) {
|
function restorePlayerCamera(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Restoring ${getPlayerDisplayForConsole(client)}'s camera`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Restoring ${getPlayerDisplayForConsole(client)}'s camera`);
|
||||||
sendNetworkEventToPlayer("v.rp.restoreCamera", client);
|
sendNetworkEventToPlayer("v.rp.restoreCamera", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,7 +223,7 @@ function setPlayer2DRendering(client, hudState = false, labelState = false, smal
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function syncPlayerProperties(client) {
|
function syncPlayerProperties(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to sync ${getPlayerDisplayForConsole(client)}'s player ped properties`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending signal to sync ${getPlayerDisplayForConsole(client)}'s player ped properties`);
|
||||||
sendNetworkEventToPlayer("v.rp.syncElement", null, getPlayerPed(client).id);
|
sendNetworkEventToPlayer("v.rp.syncElement", null, getPlayerPed(client).id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,7 +231,7 @@ function syncPlayerProperties(client) {
|
|||||||
|
|
||||||
function updatePlayerSnowState(client, forceGroundSnow = false) {
|
function updatePlayerSnowState(client, forceGroundSnow = false) {
|
||||||
if (isSnowSupported(getGame())) {
|
if (isSnowSupported(getGame())) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Setting ${getPlayerDisplayForConsole(client)}'s snow state (Falling: ${toUpperCase(getOnOffFromBool(getServerConfig().fallingSnow))}, Ground: ${toUpperCase(getOnOffFromBool(getServerConfig().groundSnow))})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Setting ${getPlayerDisplayForConsole(client)}'s snow state (Falling: ${toUpperCase(getOnOffFromBool(getServerConfig().fallingSnow))}, Ground: ${toUpperCase(getOnOffFromBool(getServerConfig().groundSnow))})`);
|
||||||
sendNetworkEventToPlayer("v.rp.snow", client, getServerConfig().fallingSnow, getServerConfig().groundSnow, forceGroundSnow);
|
sendNetworkEventToPlayer("v.rp.snow", client, getServerConfig().fallingSnow, getServerConfig().groundSnow, forceGroundSnow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -239,7 +239,7 @@ function updatePlayerSnowState(client, forceGroundSnow = false) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function updatePlayerHotBar(client) {
|
function updatePlayerHotBar(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending updated hotbar data to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending updated hotbar data to ${getPlayerDisplayForConsole(client)}`);
|
||||||
let tempHotBarItems = [];
|
let tempHotBarItems = [];
|
||||||
for (let i in getPlayerData(client).hotBarItems) {
|
for (let i in getPlayerData(client).hotBarItems) {
|
||||||
let itemImage = "";
|
let itemImage = "";
|
||||||
@@ -262,14 +262,14 @@ function updatePlayerHotBar(client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setPlayerWeaponDamageEnabled(client, state) {
|
function setPlayerWeaponDamageEnabled(client, state) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending weapon damage state for ${getPlayerDisplayForConsole(client)} to all players`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending weapon damage state for ${getPlayerDisplayForConsole(client)} to all players`);
|
||||||
sendNetworkEventToPlayer("v.rp.weaponDamageEnabled", null, getPlayerName(client), state);
|
sendNetworkEventToPlayer("v.rp.weaponDamageEnabled", null, getPlayerName(client), state);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setPlayerWeaponDamageEvent(client, eventType) {
|
function setPlayerWeaponDamageEvent(client, eventType) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending weapon damage event (${eventType}) for ${getPlayerDisplayForConsole(client)} to all players`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending weapon damage event (${eventType}) for ${getPlayerDisplayForConsole(client)} to all players`);
|
||||||
sendNetworkEventToPlayer("v.rp.weaponDamageEvent", null, getPlayerName(client), eventType);
|
sendNetworkEventToPlayer("v.rp.weaponDamageEvent", null, getPlayerName(client), eventType);
|
||||||
getPlayerData(client).weaponDamageEvent = eventType;
|
getPlayerData(client).weaponDamageEvent = eventType;
|
||||||
}
|
}
|
||||||
@@ -277,259 +277,259 @@ function setPlayerWeaponDamageEvent(client, eventType) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendJobRouteLocationToPlayer(client, position, colour) {
|
function sendJobRouteLocationToPlayer(client, position, colour) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending job route location data to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending job route location data to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.showJobRouteLocation", client, position, colour);
|
sendNetworkEventToPlayer("v.rp.showJobRouteLocation", client, position, colour);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerLoginSuccessGUI(client) {
|
function showPlayerLoginSuccessGUI(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending login success GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending login success GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.loginSuccess", client);
|
sendNetworkEventToPlayer("v.rp.loginSuccess", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerLoginFailedGUI(client, errorMessage) {
|
function showPlayerLoginFailedGUI(client, errorMessage) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending login failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending login failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.loginFailed", client, errorMessage);
|
sendNetworkEventToPlayer("v.rp.loginFailed", client, errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerRegistrationSuccessGUI(client) {
|
function showPlayerRegistrationSuccessGUI(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending registration success GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending registration success GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.registrationSuccess", client);
|
sendNetworkEventToPlayer("v.rp.registrationSuccess", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerRegistrationFailedGUI(client, errorMessage) {
|
function showPlayerRegistrationFailedGUI(client, errorMessage) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending registration failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending registration failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.registrationFailed", client, errorMessage);
|
sendNetworkEventToPlayer("v.rp.registrationFailed", client, errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendPlayerGUIColours(client) {
|
function sendPlayerGUIColours(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending GUI colours to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending GUI colours to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.guiColour", client, getServerConfig().guiColourPrimary[0], getServerConfig().guiColourPrimary[1], getServerConfig().guiColourPrimary[2], getServerConfig().guiColourSecondary[0], getServerConfig().guiColourSecondary[1], getServerConfig().guiColourSecondary[2], getServerConfig().guiTextColourPrimary[0], getServerConfig().guiTextColourPrimary[1], getServerConfig().guiTextColourPrimary[2]);
|
sendNetworkEventToPlayer("v.rp.guiColour", client, getServerConfig().guiColourPrimary[0], getServerConfig().guiColourPrimary[1], getServerConfig().guiColourPrimary[2], getServerConfig().guiColourSecondary[0], getServerConfig().guiColourSecondary[1], getServerConfig().guiColourSecondary[2], getServerConfig().guiTextColourPrimary[0], getServerConfig().guiTextColourPrimary[1], getServerConfig().guiTextColourPrimary[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendPlayerGUIInit(client) {
|
function sendPlayerGUIInit(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending GUI init signal to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending GUI init signal to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.guiInit", client);
|
sendNetworkEventToPlayer("v.rp.guiInit", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerLoginGUI(client, errorMessage = "") {
|
function showPlayerLoginGUI(client, errorMessage = "") {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show login GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending show login GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.showLogin", client);
|
sendNetworkEventToPlayer("v.rp.showLogin", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerRegistrationGUI(client, errorMessage = "") {
|
function showPlayerRegistrationGUI(client, errorMessage = "") {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show registration GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending show registration GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.showRegistration", client);
|
sendNetworkEventToPlayer("v.rp.showRegistration", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerNewCharacterGUI(client) {
|
function showPlayerNewCharacterGUI(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show new character GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending show new character GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.showNewCharacter", client);
|
sendNetworkEventToPlayer("v.rp.showNewCharacter", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerChangePasswordGUI(client, errorMessage = "") {
|
function showPlayerChangePasswordGUI(client, errorMessage = "") {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show change password GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending show change password GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.showChangePassword", client, errorMessage);
|
sendNetworkEventToPlayer("v.rp.showChangePassword", client, errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerResetPasswordCodeInputGUI(client) {
|
function showPlayerResetPasswordCodeInputGUI(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show reset password code input GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending show reset password code input GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.showResetPasswordCodeInput", client);
|
sendNetworkEventToPlayer("v.rp.showResetPasswordCodeInput", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerResetPasswordEmailInputGUI(client) {
|
function showPlayerResetPasswordEmailInputGUI(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show reset password email input GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending show reset password email input GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.showResetPasswordEmailInput", client);
|
sendNetworkEventToPlayer("v.rp.showResetPasswordEmailInput", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerCharacterSelectGUI(client, firstName, lastName, cash, clan, lastPlayed, skin) {
|
function showPlayerCharacterSelectGUI(client, firstName, lastName, cash, clan, lastPlayed, skin) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending character select GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending character select GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.showCharacterSelect", client, firstName, lastName, cash, clan, lastPlayed, skin);
|
sendNetworkEventToPlayer("v.rp.showCharacterSelect", client, firstName, lastName, cash, clan, lastPlayed, skin);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function updatePlayerCharacterSelectGUI(client, firstName, lastName, cash, clan, lastPlayed, skin) {
|
function updatePlayerCharacterSelectGUI(client, firstName, lastName, cash, clan, lastPlayed, skin) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending update character select GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending update character select GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.switchCharacterSelect", client, firstName, lastName, cash, clan, lastPlayed, skin);
|
sendNetworkEventToPlayer("v.rp.switchCharacterSelect", client, firstName, lastName, cash, clan, lastPlayed, skin);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerCharacterSelectSuccessGUI(client) {
|
function showPlayerCharacterSelectSuccessGUI(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending character select success GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending character select success GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.characterSelectSuccess", client);
|
sendNetworkEventToPlayer("v.rp.characterSelectSuccess", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerCharacterSelectFailedGUI(client) {
|
function showPlayerCharacterSelectFailedGUI(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending character select failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending character select failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.characterSelectFailed", client);
|
sendNetworkEventToPlayer("v.rp.characterSelectFailed", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerPromptGUI(client, promptMessage, promptTitle, yesButtonText = "Yes", noButtonText = "No") {
|
function showPlayerPromptGUI(client, promptMessage, promptTitle, yesButtonText = "Yes", noButtonText = "No") {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show prompt GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${promptTitle}, Message: ${promptMessage}, YesButton: ${yesButtonText}, NoButton: ${noButtonText})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending show prompt GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${promptTitle}, Message: ${promptMessage}, YesButton: ${yesButtonText}, NoButton: ${noButtonText})`);
|
||||||
sendNetworkEventToPlayer("v.rp.showPrompt", client, promptMessage, promptTitle, yesButtonText, noButtonText);
|
sendNetworkEventToPlayer("v.rp.showPrompt", client, promptMessage, promptTitle, yesButtonText, noButtonText);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerInfoGUI(client, infoMessage, infoTitle, buttonText = "OK") {
|
function showPlayerInfoGUI(client, infoMessage, infoTitle, buttonText = "OK") {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show info GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${infoTitle}, Message: ${infoMessage})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending show info GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${infoTitle}, Message: ${infoMessage})`);
|
||||||
sendNetworkEventToPlayer("v.rp.showInfo", client, infoMessage, infoTitle, buttonText);
|
sendNetworkEventToPlayer("v.rp.showInfo", client, infoMessage, infoTitle, buttonText);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerErrorGUI(client, errorMessage, errorTitle, buttonText = "OK") {
|
function showPlayerErrorGUI(client, errorMessage, errorTitle, buttonText = "OK") {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show error GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${errorTitle}, Message: ${errorMessage})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending show error GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${errorTitle}, Message: ${errorMessage})`);
|
||||||
sendNetworkEventToPlayer("v.rp.showError", client, errorMessage, errorTitle, buttonText);
|
sendNetworkEventToPlayer("v.rp.showError", client, errorMessage, errorTitle, buttonText);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendRunCodeToClient(client, code, returnTo) {
|
function sendRunCodeToClient(client, code, returnTo) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending runcode to ${getPlayerDisplayForConsole(client)} (returnTo: ${getPlayerDisplayForConsole(getClientFromIndex(returnTo))}, Code: ${code})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending runcode to ${getPlayerDisplayForConsole(client)} (returnTo: ${getPlayerDisplayForConsole(getClientFromIndex(returnTo))}, Code: ${code})`);
|
||||||
sendNetworkEventToPlayer("v.rp.runCode", client, code, getPlayerId(returnTo));
|
sendNetworkEventToPlayer("v.rp.runCode", client, code, getPlayerId(returnTo));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendPlayerWorkingState(client, state) {
|
function sendPlayerWorkingState(client, state) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending working state (${toUpperCase(getYesNoFromBool(state))}) to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending working state (${toUpperCase(getYesNoFromBool(state))}) to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.working", client, state);
|
sendNetworkEventToPlayer("v.rp.working", client, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendPlayerJobType(client, jobType) {
|
function sendPlayerJobType(client, jobType) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending job type (${jobType}) to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending job type (${jobType}) to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.jobType", client, jobType);
|
sendNetworkEventToPlayer("v.rp.jobType", client, jobType);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendPlayerStopJobRoute(client) {
|
function sendPlayerStopJobRoute(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to abort job route to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending signal to abort job route to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.hideJobRouteLocation", client);
|
sendNetworkEventToPlayer("v.rp.hideJobRouteLocation", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendPlayerMouseCameraToggle(client) {
|
function sendPlayerMouseCameraToggle(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.mouseCamera", client);
|
sendNetworkEventToPlayer("v.rp.mouseCamera", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setPlayerMouseCameraState(client, state) {
|
function setPlayerMouseCameraState(client, state) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.mouseCameraForce", client, state);
|
sendNetworkEventToPlayer("v.rp.mouseCameraForce", client, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendPlayerMouseCursorToggle(client) {
|
function sendPlayerMouseCursorToggle(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to toggle mouse cursor ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending signal to toggle mouse cursor ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.mouseCursor", client);
|
sendNetworkEventToPlayer("v.rp.mouseCursor", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendAddAccountKeyBindToClient(client, key, keyState) {
|
function sendAddAccountKeyBindToClient(client, key, keyState) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending added keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))}, State: ${(keyState) ? "down" : "up"})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending added keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))}, State: ${(keyState) ? "down" : "up"})`);
|
||||||
sendNetworkEventToPlayer("v.rp.addKeyBind", client, toInteger(key), (keyState) ? KEYSTATE_DOWN : KEYSTATE_UP);
|
sendNetworkEventToPlayer("v.rp.addKeyBind", client, toInteger(key), (keyState) ? KEYSTATE_DOWN : KEYSTATE_UP);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendClearKeyBindsToClient(client, key, keyState) {
|
function sendClearKeyBindsToClient(client, key, keyState) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending added keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))}, State: ${(keyState) ? "down" : "up"})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending added keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))}, State: ${(keyState) ? "down" : "up"})`);
|
||||||
sendNetworkEventToPlayer("v.rp.clearKeyBinds", client);
|
sendNetworkEventToPlayer("v.rp.clearKeyBinds", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendRemoveAccountKeyBindToClient(client, key) {
|
function sendRemoveAccountKeyBindToClient(client, key) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending deleted keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending deleted keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))})`);
|
||||||
sendNetworkEventToPlayer("v.rp.delKeyBind", client, toInteger(key));
|
sendNetworkEventToPlayer("v.rp.delKeyBind", client, toInteger(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendPlayerSetPosition(client, position) {
|
function sendPlayerSetPosition(client, position) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending set position signal to ${getPlayerDisplayForConsole(client)} (Position: ${position.x}, ${position.y}, ${position.z})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending set position signal to ${getPlayerDisplayForConsole(client)} (Position: ${position.x}, ${position.y}, ${position.z})`);
|
||||||
sendNetworkEventToPlayer("v.rp.position", client, position);
|
sendNetworkEventToPlayer("v.rp.position", client, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendPlayerSetHeading(client, heading) {
|
function sendPlayerSetHeading(client, heading) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending set heading signal to ${getPlayerDisplayForConsole(client)} (Heading: ${heading})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending set heading signal to ${getPlayerDisplayForConsole(client)} (Heading: ${heading})`);
|
||||||
sendNetworkEventToPlayer("v.rp.heading", client, heading);
|
sendNetworkEventToPlayer("v.rp.heading", client, heading);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendPlayerSetInterior(client, interior) {
|
function sendPlayerSetInterior(client, interior) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending set interior signal to ${getPlayerDisplayForConsole(client)} (Interior: ${interior})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending set interior signal to ${getPlayerDisplayForConsole(client)} (Interior: ${interior})`);
|
||||||
sendNetworkEventToPlayer("v.rp.interior", client, interior);
|
sendNetworkEventToPlayer("v.rp.interior", client, interior);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendPlayerFrozenState(client, state) {
|
function sendPlayerFrozenState(client, state) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending set frozen signal to ${getPlayerDisplayForConsole(client)} (State: ${toUpperCase(getYesNoFromBool(state))})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending set frozen signal to ${getPlayerDisplayForConsole(client)} (State: ${toUpperCase(getYesNoFromBool(state))})`);
|
||||||
sendNetworkEventToPlayer("v.rp.frozen", client, state);
|
sendNetworkEventToPlayer("v.rp.frozen", client, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function clearPlayerWeapons(client, clearData = true) {
|
function clearPlayerWeapons(client, clearData = true) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to clear weapons`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to clear weapons`);
|
||||||
sendNetworkEventToPlayer("v.rp.clearWeapons", client, clearData);
|
sendNetworkEventToPlayer("v.rp.clearWeapons", client, clearData);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerNewCharacterFailedGUI(client, errorMessage) {
|
function showPlayerNewCharacterFailedGUI(client, errorMessage) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending new character failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending new character failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.newCharacterFailed", client, errorMessage);
|
sendNetworkEventToPlayer("v.rp.newCharacterFailed", client, errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendPlayerRemoveFromVehicle(client) {
|
function sendPlayerRemoveFromVehicle(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending remove from vehicle signal to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending remove from vehicle signal to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.removeFromVehicle", client);
|
sendNetworkEventToPlayer("v.rp.removeFromVehicle", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -547,10 +547,10 @@ function showPlayerItemTakeDelay(client, itemId) {
|
|||||||
if (getItemData(itemId)) {
|
if (getItemData(itemId)) {
|
||||||
let delay = getItemTypeData(getItemData(itemId).itemTypeIndex).pickupDelay;
|
let delay = getItemTypeData(getItemData(itemId).itemTypeIndex).pickupDelay;
|
||||||
if (delay > 0) {
|
if (delay > 0) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
||||||
sendNetworkEventToPlayer("v.rp.showItemActionDelay", client, delay);
|
sendNetworkEventToPlayer("v.rp.showItemActionDelay", client, delay);
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||||
playerItemActionDelayComplete(client);
|
playerItemActionDelayComplete(client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -562,10 +562,10 @@ function showPlayerItemUseDelay(client, itemSlot) {
|
|||||||
if (getItemData(getPlayerData(client).hotBarItems[itemSlot])) {
|
if (getItemData(getPlayerData(client).hotBarItems[itemSlot])) {
|
||||||
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).useDelay;
|
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).useDelay;
|
||||||
if (delay > 0) {
|
if (delay > 0) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
||||||
sendNetworkEventToPlayer("v.rp.showItemActionDelay", client, delay);
|
sendNetworkEventToPlayer("v.rp.showItemActionDelay", client, delay);
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||||
playerItemActionDelayComplete(client);
|
playerItemActionDelayComplete(client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -577,10 +577,10 @@ function showPlayerItemDropDelay(client, itemSlot) {
|
|||||||
if (getItemData(getPlayerData(client).hotBarItems[itemSlot])) {
|
if (getItemData(getPlayerData(client).hotBarItems[itemSlot])) {
|
||||||
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).dropDelay;
|
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).dropDelay;
|
||||||
if (delay > 0) {
|
if (delay > 0) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
||||||
sendNetworkEventToPlayer("v.rp.showItemActionDelay", client, delay);
|
sendNetworkEventToPlayer("v.rp.showItemActionDelay", client, delay);
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||||
playerItemActionDelayComplete(client);
|
playerItemActionDelayComplete(client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -592,10 +592,10 @@ function showPlayerItemPickupDelay(client, itemId) {
|
|||||||
if (getItemData(itemId)) {
|
if (getItemData(itemId)) {
|
||||||
let delay = getItemTypeData(getItemData(itemId).itemTypeIndex).pickupDelay;
|
let delay = getItemTypeData(getItemData(itemId).itemTypeIndex).pickupDelay;
|
||||||
if (delay > 0) {
|
if (delay > 0) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
||||||
sendNetworkEventToPlayer("v.rp.showItemActionDelay", client, delay);
|
sendNetworkEventToPlayer("v.rp.showItemActionDelay", client, delay);
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||||
playerItemActionDelayComplete(client);
|
playerItemActionDelayComplete(client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -607,10 +607,10 @@ function showPlayerItemPutDelay(client, itemSlot) {
|
|||||||
if (getItemData(getPlayerData(client).hotBarItems[itemSlot])) {
|
if (getItemData(getPlayerData(client).hotBarItems[itemSlot])) {
|
||||||
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).putDelay;
|
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).putDelay;
|
||||||
if (delay > 0) {
|
if (delay > 0) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
||||||
sendNetworkEventToPlayer("v.rp.showItemActionDelay", client, delay);
|
sendNetworkEventToPlayer("v.rp.showItemActionDelay", client, delay);
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||||
playerItemActionDelayComplete(client);
|
playerItemActionDelayComplete(client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -623,18 +623,18 @@ function showPlayerItemSwitchDelay(client, itemSlot) {
|
|||||||
if (getPlayerData(client).hotBarItems[itemSlot] != -1) {
|
if (getPlayerData(client).hotBarItems[itemSlot] != -1) {
|
||||||
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).switchDelay;
|
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).switchDelay;
|
||||||
if (delay > 0) {
|
if (delay > 0) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
||||||
sendNetworkEventToPlayer("v.rp.showItemActionDelay", client, delay);
|
sendNetworkEventToPlayer("v.rp.showItemActionDelay", client, delay);
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||||
playerItemActionDelayComplete(client);
|
playerItemActionDelayComplete(client);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||||
playerItemActionDelayComplete(client);
|
playerItemActionDelayComplete(client);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||||
playerSwitchItem(client, itemSlot);
|
playerSwitchItem(client, itemSlot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -642,14 +642,14 @@ function showPlayerItemSwitchDelay(client, itemSlot) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendPlayerDrunkEffect(client, amount, duration) {
|
function sendPlayerDrunkEffect(client, amount, duration) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Setting drunk effect for ${getPlayerDisplayForConsole(client)} to ${amount} for ${duration} milliseconds`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Setting drunk effect for ${getPlayerDisplayForConsole(client)} to ${amount} for ${duration} milliseconds`);
|
||||||
sendNetworkEventToPlayer("v.rp.drunkEffect", client, amount, duration);
|
sendNetworkEventToPlayer("v.rp.drunkEffect", client, amount, duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendPlayerClearPedState(client) {
|
function sendPlayerClearPedState(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Clearing ped state for ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Clearing ped state for ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.clearPedState", client);
|
sendNetworkEventToPlayer("v.rp.clearPedState", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -659,29 +659,29 @@ function playerDamagedByPlayer(client, damagerEntityName, weaponId, pedPiece, he
|
|||||||
let damagerEntity = getPlayerFromParams(damagerEntityName);
|
let damagerEntity = getPlayerFromParams(damagerEntityName);
|
||||||
|
|
||||||
if (isNull(damagerEntity)) {
|
if (isNull(damagerEntity)) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager entity from ID is null`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s damager entity from ID is null`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)} was damaged by ${damagerEntity}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)} was damaged by ${damagerEntity}`);
|
||||||
|
|
||||||
if (isNull(damagerEntity)) {
|
if (isNull(damagerEntity)) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager client is INVALID`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s damager client is INVALID`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!getPlayerData(damagerEntity) || !getPlayerData(client)) {
|
if (!getPlayerData(damagerEntity) || !getPlayerData(client)) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager's client data is INVALID`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s damager's client data is INVALID`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager is ${getPlayerDisplayForConsole(damagerEntity)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s damager is ${getPlayerDisplayForConsole(damagerEntity)}`);
|
||||||
|
|
||||||
switch (getPlayerData(damagerEntity).weaponDamageEvent) {
|
switch (getPlayerData(damagerEntity).weaponDamageEvent) {
|
||||||
case V_WEAPON_DAMAGE_EVENT_TAZER:
|
case V_WEAPON_DAMAGE_EVENT_TAZER:
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} is using a tazer`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} is using a tazer`);
|
||||||
if (!isPlayerTazed(client) && !isPlayerHandCuffed(client) && !isPlayerInAnyVehicle(client)) {
|
if (!isPlayerTazed(client) && !isPlayerHandCuffed(client) && !isPlayerInAnyVehicle(client)) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)} was not previously tazed, binded, or in a vehicle. Taze successful`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)} was not previously tazed, binded, or in a vehicle. Taze successful`);
|
||||||
meActionToNearbyPlayers(damagerEntity, `electrifies ${getCharacterFullName(client)} with their tazer`);
|
meActionToNearbyPlayers(damagerEntity, `electrifies ${getCharacterFullName(client)} with their tazer`);
|
||||||
tazePlayer(client);
|
tazePlayer(client);
|
||||||
}
|
}
|
||||||
@@ -694,10 +694,10 @@ function playerDamagedByPlayer(client, damagerEntityName, weaponId, pedPiece, he
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case V_WEAPON_DAMAGE_EVENT_NORMAL:
|
case V_WEAPON_DAMAGE_EVENT_NORMAL:
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} caused ${healthLoss} damage (damage reduction makes it ${(healthLoss * getPlayerData(client).incomingDamageMultiplier)})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} caused ${healthLoss} damage (damage reduction makes it ${(healthLoss * getPlayerData(client).incomingDamageMultiplier)})`);
|
||||||
let remainingDamage = healthLoss * getPlayerData(client).incomingDamageMultiplier;
|
let remainingDamage = healthLoss * getPlayerData(client).incomingDamageMultiplier;
|
||||||
if (getPlayerArmour(client) > 0) {
|
if (getPlayerArmour(client) > 0) {
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s armour was ${getPlayerArmour(client)}, so it was reduced by ${healthLoss}`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s armour was ${getPlayerArmour(client)}, so it was reduced by ${healthLoss}`);
|
||||||
if (getPlayerArmour(client) - remainingDamage < 0) {
|
if (getPlayerArmour(client) - remainingDamage < 0) {
|
||||||
setPlayerArmour(client, 0);
|
setPlayerArmour(client, 0);
|
||||||
remainingDamage = remainingDamage - getPlayerArmour(client);
|
remainingDamage = remainingDamage - getPlayerArmour(client);
|
||||||
@@ -709,7 +709,7 @@ function playerDamagedByPlayer(client, damagerEntityName, weaponId, pedPiece, he
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} caused ${healthLoss} damage (damage reduction makes it ${(healthLoss * getPlayerData(client).incomingDamageMultiplier)})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} caused ${healthLoss} damage (damage reduction makes it ${(healthLoss * getPlayerData(client).incomingDamageMultiplier)})`);
|
||||||
setPlayerHealth(client, getPlayerHealth(client) - (healthLoss * getPlayerData(client).incomingDamageMultiplier));
|
setPlayerHealth(client, getPlayerHealth(client) - (healthLoss * getPlayerData(client).incomingDamageMultiplier));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -969,21 +969,21 @@ function sendPlayerChatAutoHideDelay(client, delay) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function playRadioStreamForPlayer(client, streamURL, loop = true, volume = 0, element = false) {
|
function playRadioStreamForPlayer(client, streamURL, loop = true, volume = 0, element = false) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Forcing ${getPlayerDisplayForConsole(client)} to stream ${streamURL}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Forcing ${getPlayerDisplayForConsole(client)} to stream ${streamURL}`);
|
||||||
sendNetworkEventToPlayer("v.rp.radioStream", client, streamURL, loop, volume, element);
|
sendNetworkEventToPlayer("v.rp.radioStream", client, streamURL, loop, volume, element);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function playAudioFileForPlayer(client, audioName, loop = true, volume = 0, element = false) {
|
function playAudioFileForPlayer(client, audioName, loop = true, volume = 0, element = false) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Forcing ${getPlayerDisplayForConsole(client)} to play audio ${audioName}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Forcing ${getPlayerDisplayForConsole(client)} to play audio ${audioName}`);
|
||||||
sendNetworkEventToPlayer("v.rp.audioFileStream", client, audioName, loop, volume);
|
sendNetworkEventToPlayer("v.rp.audioFileStream", client, audioName, loop, volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function stopRadioStreamForPlayer(client) {
|
function stopRadioStreamForPlayer(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Forcing ${getPlayerDisplayForConsole(client)} to stop their radio stream`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Forcing ${getPlayerDisplayForConsole(client)} to stop their radio stream`);
|
||||||
sendNetworkEventToPlayer("v.rp.stopRadioStream", client);
|
sendNetworkEventToPlayer("v.rp.stopRadioStream", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ function createNPCCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadNPCsFromDatabase() {
|
function loadNPCsFromDatabase() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.NPC]: Loading NPCs from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.NPC]: Loading NPCs from database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
let tempNPCs = [];
|
let tempNPCs = [];
|
||||||
let dbAssoc = [];
|
let dbAssoc = [];
|
||||||
@@ -263,14 +263,14 @@ function loadNPCsFromDatabase() {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.NPC]: ${tempNPCs.length} NPCs loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.NPC]: ${tempNPCs.length} NPCs loaded from database successfully!`);
|
||||||
return tempNPCs;
|
return tempNPCs;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadNPCTriggersFromDatabase(npcDatabaseId) {
|
function loadNPCTriggersFromDatabase(npcDatabaseId) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.NPC]: Loading NPC triggers for NPC ${npcDatabaseId} from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.NPC]: Loading NPC triggers for NPC ${npcDatabaseId} from database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
let tempNPCTriggers = [];
|
let tempNPCTriggers = [];
|
||||||
let dbAssoc = [];
|
let dbAssoc = [];
|
||||||
@@ -288,14 +288,14 @@ function loadNPCTriggersFromDatabase(npcDatabaseId) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.NPC]: ${tempNPCTriggers.length} NPC triggers loaded for NPC ${npcDatabaseId} from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.NPC]: ${tempNPCTriggers.length} NPC triggers loaded for NPC ${npcDatabaseId} from database successfully!`);
|
||||||
return tempNPCTriggers;
|
return tempNPCTriggers;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadNPCTriggerConditionsFromDatabase(npcTriggerDatabaseId) {
|
function loadNPCTriggerConditionsFromDatabase(npcTriggerDatabaseId) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.NPC]: Loading NPC trigger conditions for trigger ${npcTriggerDatabaseId} from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.NPC]: Loading NPC trigger conditions for trigger ${npcTriggerDatabaseId} from database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
let tempNPCTriggerConditions = [];
|
let tempNPCTriggerConditions = [];
|
||||||
let dbAssoc;
|
let dbAssoc;
|
||||||
@@ -311,14 +311,14 @@ function loadNPCTriggerConditionsFromDatabase(npcTriggerDatabaseId) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.NPC]: ${tempNPCTriggerConditions.length} conditions loaded for trigger ${npcTriggerDatabaseId} from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.NPC]: ${tempNPCTriggerConditions.length} conditions loaded for trigger ${npcTriggerDatabaseId} from database successfully!`);
|
||||||
return tempNPCTriggerConditions;
|
return tempNPCTriggerConditions;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadNPCTriggerResponsesFromDatabase(npcTriggerDatabaseId) {
|
function loadNPCTriggerResponsesFromDatabase(npcTriggerDatabaseId) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.NPC]: Loading NPC trigger responses for trigger ${npcTriggerDatabaseId} from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.NPC]: Loading NPC trigger responses for trigger ${npcTriggerDatabaseId} from database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
let tempNPCTriggerResponses = [];
|
let tempNPCTriggerResponses = [];
|
||||||
let dbAssoc;
|
let dbAssoc;
|
||||||
@@ -337,7 +337,7 @@ function loadNPCTriggerResponsesFromDatabase(npcTriggerDatabaseId) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.NPC]: ${tempNPCTriggerResponses.length} responses loaded for trigger ${npcTriggerDatabaseId} from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.NPC]: ${tempNPCTriggerResponses.length} responses loaded for trigger ${npcTriggerDatabaseId} from database successfully!`);
|
||||||
return tempNPCTriggerResponses;
|
return tempNPCTriggerResponses;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -357,28 +357,28 @@ function saveAllNPCsToDatabase() {
|
|||||||
|
|
||||||
function saveNPCToDatabase(npcDataId) {
|
function saveNPCToDatabase(npcDataId) {
|
||||||
if (getServerConfig().devServer) {
|
if (getServerConfig().devServer) {
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.NPC]: NPC ${npcDataId} can't be saved because server is running as developer only. Aborting save ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.NPC]: NPC ${npcDataId} can't be saved because server is running as developer only. Aborting save ...`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getNPCData(npcDataId) == false) {
|
if (getNPCData(npcDataId) == false) {
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.NPC]: NPC ${npcDataId} data is invalid. Aborting save ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.NPC]: NPC ${npcDataId} data is invalid. Aborting save ...`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let tempNPCData = getNPCData(npcDataId);
|
let tempNPCData = getNPCData(npcDataId);
|
||||||
|
|
||||||
if (tempNPCData.databaseId == -1) {
|
if (tempNPCData.databaseId == -1) {
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.NPC]: NPC ${npcDataId} is a temp NPC. Aborting save ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.NPC]: NPC ${npcDataId} is a temp NPC. Aborting save ...`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tempNPCData.needsSaved) {
|
if (!tempNPCData.needsSaved) {
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.NPC]: NPC ${npcDataId} hasn't changed data. Aborting save ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.NPC]: NPC ${npcDataId} hasn't changed data. Aborting save ...`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.NPC]: Saving NPC ${tempNPCData.databaseId} to database ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.NPC]: Saving NPC ${tempNPCData.databaseId} to database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
if (tempNPCData.ped != false) {
|
if (tempNPCData.ped != false) {
|
||||||
@@ -445,7 +445,7 @@ function saveNPCToDatabase(npcDataId) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.NPC]: Saved NPC ${npcDataId} to database!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.NPC]: Saved NPC ${npcDataId} to database!`);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ function startPaintBall(client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Starting paintball for ${getPlayerDisplayForConsole(client)} ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Starting paintball for ${getPlayerDisplayForConsole(client)} ...`);
|
||||||
if (isPlayerWorking(client)) {
|
if (isPlayerWorking(client)) {
|
||||||
stopWorking(client);
|
stopWorking(client);
|
||||||
}
|
}
|
||||||
@@ -79,7 +79,7 @@ function startPaintBall(client) {
|
|||||||
|
|
||||||
messagePlayerAlert(client, getLocaleString(client, "JoinedPaintBall"));
|
messagePlayerAlert(client, getLocaleString(client, "JoinedPaintBall"));
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Started paintball for ${getPlayerDisplayForConsole(client)} successfully`);
|
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Started paintball for ${getPlayerDisplayForConsole(client)} successfully`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -89,7 +89,7 @@ function stopPaintBall(client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Stopping paintball for ${getPlayerDisplayForConsole(client)} ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Stopping paintball for ${getPlayerDisplayForConsole(client)} ...`);
|
||||||
clearPlayerWeapons(client);
|
clearPlayerWeapons(client);
|
||||||
deletePaintBallItems(client);
|
deletePaintBallItems(client);
|
||||||
restorePlayerTempLockerItems(client);
|
restorePlayerTempLockerItems(client);
|
||||||
@@ -119,13 +119,13 @@ function stopPaintBall(client) {
|
|||||||
|
|
||||||
//checkRemainingPaintBallPlayers(tempBusiness);
|
//checkRemainingPaintBallPlayers(tempBusiness);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Stopped paintball for ${getPlayerDisplayForConsole(client)} successfully`);
|
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Stopped paintball for ${getPlayerDisplayForConsole(client)} successfully`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function givePlayerPaintBallItems(client) {
|
function givePlayerPaintBallItems(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Giving ${getPlayerDisplayForConsole(client)} paintball items ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Giving ${getPlayerDisplayForConsole(client)} paintball items ...`);
|
||||||
for (let i in paintBallItems) {
|
for (let i in paintBallItems) {
|
||||||
let itemId = createItem(paintBallItems[i], 999999, V_ITEM_OWNER_PLAYER, getPlayerCurrentSubAccount(client).databaseId);
|
let itemId = createItem(paintBallItems[i], 999999, V_ITEM_OWNER_PLAYER, getPlayerCurrentSubAccount(client).databaseId);
|
||||||
getItemData(itemId).needsSaved = false;
|
getItemData(itemId).needsSaved = false;
|
||||||
@@ -135,26 +135,26 @@ function givePlayerPaintBallItems(client) {
|
|||||||
getPlayerData(client).paintBallItemCache.push(itemId);
|
getPlayerData(client).paintBallItemCache.push(itemId);
|
||||||
updatePlayerHotBar(client);
|
updatePlayerHotBar(client);
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Gave ${getPlayerDisplayForConsole(client)} paintball items successfully`);
|
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Gave ${getPlayerDisplayForConsole(client)} paintball items successfully`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function deletePaintBallItems(client) {
|
function deletePaintBallItems(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Deleting paintball items for ${getPlayerDisplayForConsole(client)} ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Deleting paintball items for ${getPlayerDisplayForConsole(client)} ...`);
|
||||||
for (let i in getPlayerData(client).paintBallItemCache) {
|
for (let i in getPlayerData(client).paintBallItemCache) {
|
||||||
deleteItem(getPlayerData(client).paintBallItemCache[i]);
|
deleteItem(getPlayerData(client).paintBallItemCache[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
cachePlayerHotBarItems(client);
|
cachePlayerHotBarItems(client);
|
||||||
updatePlayerHotBar(client);
|
updatePlayerHotBar(client);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Deleting paintball items for ${getPlayerDisplayForConsole(client)} successfully`);
|
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Deleting paintball items for ${getPlayerDisplayForConsole(client)} successfully`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function cacheAllPaintBallItemTypes() {
|
function cacheAllPaintBallItemTypes() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Cacheing all paintball item types ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Cacheing all paintball item types ...`);
|
||||||
for (let i in paintBallItemNames[getGame()]) {
|
for (let i in paintBallItemNames[getGame()]) {
|
||||||
let itemTypeId = getItemTypeFromParams(paintBallItemNames[getGame()][i]);
|
let itemTypeId = getItemTypeFromParams(paintBallItemNames[getGame()][i]);
|
||||||
if (itemTypeId != -1 && getItemTypeData(itemTypeId) != false) {
|
if (itemTypeId != -1 && getItemTypeData(itemTypeId) != false) {
|
||||||
@@ -162,13 +162,13 @@ function cacheAllPaintBallItemTypes() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Cached all paintball item types`);
|
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Cached all paintball item types`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function respawnPlayerForPaintBall(client) {
|
function respawnPlayerForPaintBall(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Respawning ${getPlayerDisplayForConsole(client)} for paintball ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Respawning ${getPlayerDisplayForConsole(client)} for paintball ...`);
|
||||||
despawnPlayer(client);
|
despawnPlayer(client);
|
||||||
|
|
||||||
let businessId = getPlayerData(client).paintBallBusiness;
|
let businessId = getPlayerData(client).paintBallBusiness;
|
||||||
@@ -183,7 +183,7 @@ function respawnPlayerForPaintBall(client) {
|
|||||||
makePlayerStopAnimation(client);
|
makePlayerStopAnimation(client);
|
||||||
setPlayerControlState(client, true);
|
setPlayerControlState(client, true);
|
||||||
resetPlayerBlip(client);
|
resetPlayerBlip(client);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Respawned ${getPlayerDisplayForConsole(client)} for paintball successfully`);
|
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Respawned ${getPlayerDisplayForConsole(client)} for paintball successfully`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ function playerPromptAnswerNo(client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Prompt] ${getPlayerDisplayForConsole(client)} answered NO to their prompt (${getPlayerData(client).promptType})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Prompt] ${getPlayerDisplayForConsole(client)} answered NO to their prompt (${getPlayerData(client).promptType})`);
|
||||||
|
|
||||||
switch (getPlayerData(client).promptType) {
|
switch (getPlayerData(client).promptType) {
|
||||||
case V_PROMPT_CREATEFIRSTCHAR:
|
case V_PROMPT_CREATEFIRSTCHAR:
|
||||||
@@ -71,7 +71,7 @@ function playerPromptAnswerYes(client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Prompt] ${getPlayerDisplayForConsole(client)} answered YES to their prompt (${getPlayerData(client).promptType})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Prompt] ${getPlayerDisplayForConsole(client)} answered YES to their prompt (${getPlayerData(client).promptType})`);
|
||||||
|
|
||||||
switch (getPlayerData(client).promptType) {
|
switch (getPlayerData(client).promptType) {
|
||||||
case V_PROMPT_CREATEFIRSTCHAR: {
|
case V_PROMPT_CREATEFIRSTCHAR: {
|
||||||
@@ -82,7 +82,7 @@ function playerPromptAnswerYes(client) {
|
|||||||
case V_PROMPT_BIZORDER: {
|
case V_PROMPT_BIZORDER: {
|
||||||
if (getPlayerData(client).businessOrderAmount > 0) {
|
if (getPlayerData(client).businessOrderAmount > 0) {
|
||||||
if (getBusinessData(getPlayerData(client).businessOrderBusiness).till < getPlayerData(client).businessOrderCost) {
|
if (getBusinessData(getPlayerData(client).businessOrderBusiness).till < getPlayerData(client).businessOrderCost) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Prompt] ${getPlayerDisplayForConsole(client)} failed to order ${getPlayerData(client).businessOrderAmount} ${getItemTypeData(getPlayerData(client).businessOrderItem).name} at ${getPlayerData(client).businessOrderCost / getPlayerData(client).businessOrderAmount} each for business ${getBusinessData(getPlayerData(client).businessOrderBusiness).name} (Reason: Not enough money in business till)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Prompt] ${getPlayerDisplayForConsole(client)} failed to order ${getPlayerData(client).businessOrderAmount} ${getItemTypeData(getPlayerData(client).businessOrderItem).name} at ${getPlayerData(client).businessOrderCost / getPlayerData(client).businessOrderAmount} each for business ${getBusinessData(getPlayerData(client).businessOrderBusiness).name} (Reason: Not enough money in business till)`);
|
||||||
if (doesPlayerHaveGUIEnabled(client)) {
|
if (doesPlayerHaveGUIEnabled(client)) {
|
||||||
showPlayerErrorGUI(client, getLocaleString(client, "BusinessOrderNotEnoughMoney", `{ALTCOLOUR}/bizdeposit{MAINCOLOUR}`), getLocaleString(client, "BusinessOrderCanceled"));
|
showPlayerErrorGUI(client, getLocaleString(client, "BusinessOrderNotEnoughMoney", `{ALTCOLOUR}/bizdeposit{MAINCOLOUR}`), getLocaleString(client, "BusinessOrderCanceled"));
|
||||||
} else {
|
} else {
|
||||||
@@ -93,7 +93,7 @@ function playerPromptAnswerYes(client) {
|
|||||||
getPlayerData(client).businessOrderItem = -1;
|
getPlayerData(client).businessOrderItem = -1;
|
||||||
getPlayerData(client).businessOrderValue = -1;
|
getPlayerData(client).businessOrderValue = -1;
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Prompt] ${getPlayerDisplayForConsole(client)} successfully ordered ${getPlayerData(client).businessOrderAmount} ${getItemTypeData(getPlayerData(client).businessOrderItem).name} at ${getPlayerData(client).businessOrderCost / getPlayerData(client).businessOrderAmount} each for business ${getBusinessData(getPlayerData(client).businessOrderBusiness).name}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Prompt] ${getPlayerDisplayForConsole(client)} successfully ordered ${getPlayerData(client).businessOrderAmount} ${getItemTypeData(getPlayerData(client).businessOrderItem).name} at ${getPlayerData(client).businessOrderCost / getPlayerData(client).businessOrderAmount} each for business ${getBusinessData(getPlayerData(client).businessOrderBusiness).name}`);
|
||||||
|
|
||||||
showPlayerInfoGUI(client, getLocaleString(client, "BusinessOrderSuccessInfo", getPlayerData(client).businessOrderAmount, getItemTypeData(getPlayerData(client).businessOrderItem).name, getItemValueDisplay(getPlayerData(client).businessOrderItem, getPlayerData(client).businessOrderValue), getPlayerData(client).businessOrderCost), getLocaleString(client, "GUIInfoTitle"));
|
showPlayerInfoGUI(client, getLocaleString(client, "BusinessOrderSuccessInfo", getPlayerData(client).businessOrderAmount, getItemTypeData(getPlayerData(client).businessOrderItem).name, getItemValueDisplay(getPlayerData(client).businessOrderItem, getPlayerData(client).businessOrderValue), getPlayerData(client).businessOrderCost), getLocaleString(client, "GUIInfoTitle"));
|
||||||
createItem(getPlayerData(client).businessOrderItem, getPlayerData(client).businessOrderValue, V_ITEM_OWNER_BIZFLOOR, getBusinessData(getPlayerData(client).businessOrderBusiness).databaseId, getPlayerData(client).businessOrderAmount);
|
createItem(getPlayerData(client).businessOrderItem, getPlayerData(client).businessOrderValue, V_ITEM_OWNER_BIZFLOOR, getBusinessData(getPlayerData(client).businessOrderBusiness).databaseId, getPlayerData(client).businessOrderAmount);
|
||||||
|
|||||||
@@ -190,20 +190,20 @@ function loadPropertiesFromDatabase() {
|
|||||||
let tempPropertyData = new PropertyData(dbAssoc[i]);
|
let tempPropertyData = new PropertyData(dbAssoc[i]);
|
||||||
tempPropertyData.locations = loadPropertyLocationsFromDatabase(tempPropertyData.databaseId);
|
tempPropertyData.locations = loadPropertyLocationsFromDatabase(tempPropertyData.databaseId);
|
||||||
tempProperties.push(tempPropertyData);
|
tempProperties.push(tempPropertyData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Property]: Property '${tempPropertyData.name}' (ID ${tempPropertyData.databaseId}) loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Property]: Property '${tempPropertyData.name}' (ID ${tempPropertyData.databaseId}) loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_INFO, `[AGRP.Property]: ${tempProperties.length} properties loaded from database successfully!`);
|
logToConsole(LOG_INFO, `[V.RP.Property]: ${tempProperties.length} properties loaded from database successfully!`);
|
||||||
return tempProperties;
|
return tempProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadPropertyLocationsFromDatabase(propertyIndex) {
|
function loadPropertyLocationsFromDatabase(propertyIndex) {
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Property]: Loading property locations for property ${propertyIndex} from database ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Property]: Loading property locations for property ${propertyIndex} from database ...`);
|
||||||
|
|
||||||
let tempPropertyLocations = [];
|
let tempPropertyLocations = [];
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
@@ -219,7 +219,7 @@ function loadPropertyLocationsFromDatabase(propertyIndex) {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempPropertyLocationData = new PropertyLocationData(dbAssoc[i]);
|
let tempPropertyLocationData = new PropertyLocationData(dbAssoc[i]);
|
||||||
tempPropertyLocations.push(tempPropertyLocationData);
|
tempPropertyLocations.push(tempPropertyLocationData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Property]: Location '${tempPropertyLocationData.name}' loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Property]: Location '${tempPropertyLocationData.name}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
freeDatabaseQuery(dbQuery);
|
freeDatabaseQuery(dbQuery);
|
||||||
@@ -227,7 +227,7 @@ function loadPropertyLocationsFromDatabase(propertyIndex) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Property]: ${tempPropertyLocations.length} location for property ${propertyIndex} loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Property]: ${tempPropertyLocations.length} location for property ${propertyIndex} loaded from database successfully!`);
|
||||||
return tempPropertyLocations;
|
return tempPropertyLocations;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1208,7 +1208,7 @@ function orderItemForPropertyCommand(command, params, client) {
|
|||||||
let value = toInteger(splitParams.slice(-1)) || getItemTypeData(itemType).capacity;
|
let value = toInteger(splitParams.slice(-1)) || getItemTypeData(itemType).capacity;
|
||||||
let propertyIndex = getPlayerProperty(client);
|
let propertyIndex = getPlayerProperty(client);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Property] ${getPlayerDisplayForConsole(client)} is ordering ${amount} ${splitParams.slice(0, -2).join(" ")} (${value})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Property] ${getPlayerDisplayForConsole(client)} is ordering ${amount} ${splitParams.slice(0, -2).join(" ")} (${value})`);
|
||||||
|
|
||||||
if (!getPropertyData(propertyIndex)) {
|
if (!getPropertyData(propertyIndex)) {
|
||||||
messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
|
messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
|
||||||
@@ -1460,7 +1460,7 @@ function savePropertyToDatabase(propertyIndex) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Property]: Saving business '${tempPropertyData.name}' to database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Property]: Saving business '${tempPropertyData.name}' to database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
let safePropertyName = escapeDatabaseString(dbConnection, tempPropertyData.name);
|
let safePropertyName = escapeDatabaseString(dbConnection, tempPropertyData.name);
|
||||||
@@ -1516,7 +1516,7 @@ function savePropertyToDatabase(propertyIndex) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Property]: Saved property '${tempPropertyData.name}' to database!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Property]: Saved property '${tempPropertyData.name}' to database!`);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1575,7 +1575,7 @@ function createPropertyEntrancePickup(propertyIndex) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating entrance pickup for property ${propertyData.name}`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Creating entrance pickup for property ${propertyData.name}`);
|
||||||
|
|
||||||
if (areServerElementsSupported() && getGame() != V_GAME_MAFIA_ONE) {
|
if (areServerElementsSupported() && getGame() != V_GAME_MAFIA_ONE) {
|
||||||
let entrancePickup = null;
|
let entrancePickup = null;
|
||||||
@@ -1652,7 +1652,7 @@ function createPropertyEntranceBlip(propertyIndex) {
|
|||||||
blipModelId = propertyData.entranceBlipModel;
|
blipModelId = propertyData.entranceBlipModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating entrance blip for business ${propertyData.name} (model ${blipModelId})`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Creating entrance blip for business ${propertyData.name} (model ${blipModelId})`);
|
||||||
|
|
||||||
if (areServerElementsSupported()) {
|
if (areServerElementsSupported()) {
|
||||||
let entranceBlip = createGameBlip(propertyData.entrancePosition, blipModelId, 1, getColourByType("propertyColour"));
|
let entranceBlip = createGameBlip(propertyData.entrancePosition, blipModelId, 1, getColourByType("propertyColour"));
|
||||||
@@ -1697,7 +1697,7 @@ function createPropertyExitPickup(propertyIndex) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating exit pickup for business ${propertyData.name}`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Creating exit pickup for business ${propertyData.name}`);
|
||||||
|
|
||||||
let exitPickup = null;
|
let exitPickup = null;
|
||||||
if (isGameFeatureSupported("pickup")) {
|
if (isGameFeatureSupported("pickup")) {
|
||||||
@@ -1764,7 +1764,7 @@ function createPropertyExitBlip(propertyIndex) {
|
|||||||
blipModelId = propertyData.exitBlipModel;
|
blipModelId = propertyData.exitBlipModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating exit blip for property ${propertyData.name} (model ${blipModelId})`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Creating exit blip for property ${propertyData.name} (model ${blipModelId})`);
|
||||||
|
|
||||||
let exitBlip = createGameBlip(propertyData.exitPosition, blipModelId, 1, getColourByName("propertyColour"));
|
let exitBlip = createGameBlip(propertyData.exitPosition, blipModelId, 1, getColourByName("propertyColour"));
|
||||||
if (exitBlip != null) {
|
if (exitBlip != null) {
|
||||||
@@ -2270,11 +2270,11 @@ function cachePropertyItems(propertyIndex) {
|
|||||||
clearArray(getPropertyData(propertyIndex).storageItemCache);
|
clearArray(getPropertyData(propertyIndex).storageItemCache);
|
||||||
|
|
||||||
//let propertyData = getPropertyData(propertyIndex);
|
//let propertyData = getPropertyData(propertyIndex);
|
||||||
//logToConsole(LOG_VERBOSE, `[AGRP.Property] Caching business items for business ${propertyIndex} (${propertyData.name}) ...`);
|
//logToConsole(LOG_VERBOSE, `[V.RP.Property] Caching business items for business ${propertyIndex} (${propertyData.name}) ...`);
|
||||||
//getPropertyData(propertyIndex).floorItemCache = getServerData().items.filter(item => item.ownerType == V_ITEM_OWNER_BIZFLOOR && item.ownerId == propertyData.databaseId).map(i => i.index);
|
//getPropertyData(propertyIndex).floorItemCache = getServerData().items.filter(item => item.ownerType == V_ITEM_OWNER_BIZFLOOR && item.ownerId == propertyData.databaseId).map(i => i.index);
|
||||||
//getPropertyData(propertyIndex).storageItemCache = getServerData().items.filter(item => item.ownerType == V_ITEM_OWNER_BIZSTORAGE && item.ownerId == propertyData.databaseId);
|
//getPropertyData(propertyIndex).storageItemCache = getServerData().items.filter(item => item.ownerType == V_ITEM_OWNER_BIZSTORAGE && item.ownerId == propertyData.databaseId);
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Property] Caching business items for business ${propertyIndex} (${getPropertyData(propertyIndex).name}) ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Property] Caching business items for business ${propertyIndex} (${getPropertyData(propertyIndex).name}) ...`);
|
||||||
for (let i in getServerData().items) {
|
for (let i in getServerData().items) {
|
||||||
if (getItemData(i).ownerType == V_ITEM_OWNER_BIZFLOOR && getItemData(i).ownerId == getPropertyData(propertyIndex).databaseId) {
|
if (getItemData(i).ownerType == V_ITEM_OWNER_BIZFLOOR && getItemData(i).ownerId == getPropertyData(propertyIndex).databaseId) {
|
||||||
getPropertyData(propertyIndex).floorItemCache.push(i);
|
getPropertyData(propertyIndex).floorItemCache.push(i);
|
||||||
@@ -2283,7 +2283,7 @@ function cachePropertyItems(propertyIndex) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Property] Successfully cached ${getPropertyData(propertyIndex).floorItemCache.length} floor items and ${getPropertyData(propertyIndex).storageItemCache} storage items for business ${propertyIndex} (${getPropertyData(propertyIndex).name})!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Property] Successfully cached ${getPropertyData(propertyIndex).floorItemCache.length} floor items and ${getPropertyData(propertyIndex).storageItemCache} storage items for business ${propertyIndex} (${getPropertyData(propertyIndex).name})!`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ function loadRadioStationsFromDatabase() {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_INFO, `[AGRP.Radio]: ${tempRadioStations.length} radio stations loaded from database successfully!`);
|
logToConsole(LOG_INFO, `[V.RP.Radio]: ${tempRadioStations.length} radio stations loaded from database successfully!`);
|
||||||
return tempRadioStations;
|
return tempRadioStations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ function loadSubAccountsFromAccount(accountId) {
|
|||||||
let jobRankIndex = getJobRankIndexFromDatabaseId(jobIndex, tempSubAccount.jobRank);
|
let jobRankIndex = getJobRankIndexFromDatabaseId(jobIndex, tempSubAccount.jobRank);
|
||||||
if (!getJobRankData(jobIndex, jobRankIndex)) {
|
if (!getJobRankData(jobIndex, jobRankIndex)) {
|
||||||
let newJobRankIndex = getLowestJobRank(jobIndex);
|
let newJobRankIndex = getLowestJobRank(jobIndex);
|
||||||
console.log(`[AGRP.SubAccount]: Job ${jobIndex} has no rank ${tempSubAccount.jobRank}! Using lowest rank ${newJobRankIndex} instead.`);
|
console.log(`[V.RP.SubAccount]: Job ${jobIndex} has no rank ${tempSubAccount.jobRank}! Using lowest rank ${newJobRankIndex} instead.`);
|
||||||
tempSubAccount.jobRank = getJobRankData(jobIndex, newJobRankIndex).databaseId;
|
tempSubAccount.jobRank = getJobRankData(jobIndex, newJobRankIndex).databaseId;
|
||||||
tempSubAccount.jobRankIndex = newJobRankIndex;
|
tempSubAccount.jobRankIndex = newJobRankIndex;
|
||||||
} else {
|
} else {
|
||||||
@@ -339,7 +339,7 @@ function saveSubAccountToDatabase(subAccountData) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function createSubAccount(accountId, firstName, lastName) {
|
function createSubAccount(accountId, firstName, lastName) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] Attempting to create subaccount ${firstName} ${lastName} in database`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] Attempting to create subaccount ${firstName} ${lastName} in database`);
|
||||||
|
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
let dbQuery = false;
|
let dbQuery = false;
|
||||||
@@ -373,7 +373,7 @@ function showCharacterSelectToClient(client) {
|
|||||||
|
|
||||||
if (doesPlayerHaveAutoSelectLastCharacterEnabled(client)) {
|
if (doesPlayerHaveAutoSelectLastCharacterEnabled(client)) {
|
||||||
if (getPlayerData(client).subAccounts.length > 0) {
|
if (getPlayerData(client).subAccounts.length > 0) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.SubAccount] ${getPlayerDisplayForConsole(client)} is being auto-spawned as character ID ${getPlayerLastUsedSubAccount(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.SubAccount] ${getPlayerDisplayForConsole(client)} is being auto-spawned as character ID ${getPlayerLastUsedSubAccount(client)}`);
|
||||||
selectCharacter(client, getPlayerLastUsedSubAccount(client));
|
selectCharacter(client, getPlayerLastUsedSubAccount(client));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -381,7 +381,7 @@ function showCharacterSelectToClient(client) {
|
|||||||
|
|
||||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
getPlayerData(client).currentSubAccount = 0;
|
getPlayerData(client).currentSubAccount = 0;
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.SubAccount] Setting ${getPlayerDisplayForConsole(client)}'s character to ID ${getPlayerData(client).currentSubAccount}`);
|
logToConsole(LOG_DEBUG, `[V.RP.SubAccount] Setting ${getPlayerDisplayForConsole(client)}'s character to ID ${getPlayerData(client).currentSubAccount}`);
|
||||||
let tempSubAccount = getPlayerData(client).subAccounts[0];
|
let tempSubAccount = getPlayerData(client).subAccounts[0];
|
||||||
let clanName = (tempSubAccount.clan != 0) ? getClanData(getClanIndexFromDatabaseId(tempSubAccount.clan)).name : "None";
|
let clanName = (tempSubAccount.clan != 0) ? getClanData(getClanIndexFromDatabaseId(tempSubAccount.clan)).name : "None";
|
||||||
let lastPlayedText = (tempSubAccount.lastLogin != 0) ? `${msToTime(getCurrentUnixTimestamp() - tempSubAccount.lastLogin)} ago` : "Never";
|
let lastPlayedText = (tempSubAccount.lastLogin != 0) ? `${msToTime(getCurrentUnixTimestamp() - tempSubAccount.lastLogin)} ago` : "Never";
|
||||||
@@ -391,7 +391,7 @@ function showCharacterSelectToClient(client) {
|
|||||||
//setTimeout(function() {
|
//setTimeout(function() {
|
||||||
// showCharacterSelectCameraToPlayer(client);
|
// showCharacterSelectCameraToPlayer(client);
|
||||||
//}, 500);
|
//}, 500);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.SubAccount] ${getPlayerDisplayForConsole(client)} is being shown the character select GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.SubAccount] ${getPlayerDisplayForConsole(client)} is being shown the character select GUI`);
|
||||||
} else {
|
} else {
|
||||||
let charactersList = getPlayerData(client).subAccounts.map((sacct, index) => `{teal}${index + 1}: {ALTCOLOUR}${sacct.firstName} ${sacct.lastName}`);
|
let charactersList = getPlayerData(client).subAccounts.map((sacct, index) => `{teal}${index + 1}: {ALTCOLOUR}${sacct.firstName} ${sacct.lastName}`);
|
||||||
let chunkedList = splitArrayIntoChunks(charactersList, 5);
|
let chunkedList = splitArrayIntoChunks(charactersList, 5);
|
||||||
@@ -400,7 +400,7 @@ function showCharacterSelectToClient(client) {
|
|||||||
messagePlayerNormal(client, chunkedList[i].join("{MAINCOLOUR} • "));
|
messagePlayerNormal(client, chunkedList[i].join("{MAINCOLOUR} • "));
|
||||||
}
|
}
|
||||||
messagePlayerInfo(client, getLocaleString(client, "CharacterSelectHelpText", `{ALTCOLOUR}/usechar{MAINCOLOUR}`, `{ALTCOLOUR}/newchar{MAINCOLOUR}`));
|
messagePlayerInfo(client, getLocaleString(client, "CharacterSelectHelpText", `{ALTCOLOUR}/usechar{MAINCOLOUR}`, `{ALTCOLOUR}/newchar{MAINCOLOUR}`));
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.SubAccount] ${getPlayerDisplayForConsole(client)} is being shown the character select/list message (GUI disabled)`);
|
logToConsole(LOG_DEBUG, `[V.RP.SubAccount] ${getPlayerDisplayForConsole(client)} is being shown the character select/list message (GUI disabled)`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -420,7 +420,7 @@ function checkNewCharacter(client, firstName, lastName) {
|
|||||||
lastName = lastName.trim();
|
lastName = lastName.trim();
|
||||||
|
|
||||||
if (doesNameContainInvalidCharacters(firstName) || doesNameContainInvalidCharacters(lastName)) {
|
if (doesNameContainInvalidCharacters(firstName) || doesNameContainInvalidCharacters(lastName)) {
|
||||||
logToConsole(LOG_INFO | LOG_WARN, `[AGRP.Account] Subaccount ${firstName} ${lastName} could not be created (invalid characters in name)`);
|
logToConsole(LOG_INFO | LOG_WARN, `[V.RP.Account] Subaccount ${firstName} ${lastName} could not be created (invalid characters in name)`);
|
||||||
showPlayerNewCharacterFailedGUI(client, "Invalid characters in name!");
|
showPlayerNewCharacterFailedGUI(client, "Invalid characters in name!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -467,7 +467,7 @@ function checkPreviousCharacter(client) {
|
|||||||
let lastPlayedText = (tempSubAccount.lastLogin != 0) ? `${msToTime(getCurrentUnixTimestamp() - tempSubAccount.lastLogin)} ago` : "Never";
|
let lastPlayedText = (tempSubAccount.lastLogin != 0) ? `${msToTime(getCurrentUnixTimestamp() - tempSubAccount.lastLogin)} ago` : "Never";
|
||||||
showPlayerCharacterSelectGUI(client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.cash, clanName, lastPlayedText, getGameConfig().skins[getGame()][tempSubAccount.skin][0]);
|
showPlayerCharacterSelectGUI(client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.cash, clanName, lastPlayedText, getGameConfig().skins[getGame()][tempSubAccount.skin][0]);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.SubAccount] Setting ${getPlayerDisplayForConsole(client)}'s character to ID ${getPlayerData(client).currentSubAccount}`);
|
logToConsole(LOG_DEBUG, `[V.RP.SubAccount] Setting ${getPlayerDisplayForConsole(client)}'s character to ID ${getPlayerData(client).currentSubAccount}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -488,16 +488,16 @@ function checkNextCharacter(client) {
|
|||||||
let lastPlayedText = (tempSubAccount.lastLogin != 0) ? `${msToTime(getCurrentUnixTimestamp() - tempSubAccount.lastLogin)} ago` : "Never";
|
let lastPlayedText = (tempSubAccount.lastLogin != 0) ? `${msToTime(getCurrentUnixTimestamp() - tempSubAccount.lastLogin)} ago` : "Never";
|
||||||
showPlayerCharacterSelectGUI(client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.cash, clanName, lastPlayedText, getGameConfig().skins[getGame()][tempSubAccount.skin][0]);
|
showPlayerCharacterSelectGUI(client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.cash, clanName, lastPlayedText, getGameConfig().skins[getGame()][tempSubAccount.skin][0]);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.SubAccount] Setting ${getPlayerDisplayForConsole(client)}'s character to ID ${getPlayerData(client).currentSubAccount}`);
|
logToConsole(LOG_DEBUG, `[V.RP.SubAccount] Setting ${getPlayerDisplayForConsole(client)}'s character to ID ${getPlayerData(client).currentSubAccount}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function selectCharacter(client, characterId = -1) {
|
function selectCharacter(client, characterId = -1) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.SubAccount] ${getPlayerDisplayForConsole(client)} character select called (Character ID ${characterId})`);
|
logToConsole(LOG_DEBUG, `[V.RP.SubAccount] ${getPlayerDisplayForConsole(client)} character select called (Character ID ${characterId})`);
|
||||||
if (characterId != -1) {
|
if (characterId != -1) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.SubAccount] ${getPlayerDisplayForConsole(client)} provided character ID (${characterId}) to spawn with`);
|
logToConsole(LOG_DEBUG, `[V.RP.SubAccount] ${getPlayerDisplayForConsole(client)} provided character ID (${characterId}) to spawn with`);
|
||||||
getPlayerData(client).currentSubAccount = characterId;
|
getPlayerData(client).currentSubAccount = characterId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -511,7 +511,7 @@ function selectCharacter(client, characterId = -1) {
|
|||||||
|
|
||||||
getPlayerData(client).switchingCharacter = false;
|
getPlayerData(client).switchingCharacter = false;
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.SubAccount] Spawning ${getPlayerDisplayForConsole(client)} as character ID ${getPlayerData(client).currentSubAccount} with skin ${skin} (${spawnPosition.x}, ${spawnPosition.y}, ${spawnPosition.z})`);
|
logToConsole(LOG_DEBUG, `[V.RP.SubAccount] Spawning ${getPlayerDisplayForConsole(client)} as character ID ${getPlayerData(client).currentSubAccount} with skin ${skin} (${spawnPosition.x}, ${spawnPosition.y}, ${spawnPosition.z})`);
|
||||||
//setPlayerCameraLookAt(client, getPosBehindPos(spawnPosition, spawnHeading, 5), spawnPosition);
|
//setPlayerCameraLookAt(client, getPosBehindPos(spawnPosition, spawnHeading, 5), spawnPosition);
|
||||||
getPlayerData(client).pedState = V_PEDSTATE_SPAWNING;
|
getPlayerData(client).pedState = V_PEDSTATE_SPAWNING;
|
||||||
|
|
||||||
@@ -520,14 +520,14 @@ function selectCharacter(client, characterId = -1) {
|
|||||||
onPlayerSpawn(client);
|
onPlayerSpawn(client);
|
||||||
} else if (getGame() == V_GAME_MAFIA_ONE) {
|
} else if (getGame() == V_GAME_MAFIA_ONE) {
|
||||||
//spawnPlayer(client, spawnPosition, spawnHeading, getGameConfig().skins[getGame()][skin][0]);
|
//spawnPlayer(client, spawnPosition, spawnHeading, getGameConfig().skins[getGame()][skin][0]);
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.SubAccount] Spawning ${getPlayerDisplayForConsole(client)} as ${getGameConfig().skins[getGame()][skin][1]} (${getGameConfig().skins[getGame()][skin][0]})`);
|
//logToConsole(LOG_DEBUG, `[V.RP.SubAccount] Spawning ${getPlayerDisplayForConsole(client)} as ${getGameConfig().skins[getGame()][skin][1]} (${getGameConfig().skins[getGame()][skin][0]})`);
|
||||||
spawnPlayer(client, spawnPosition, spawnHeading, getGameConfig().skins[getGame()][skin][0]);
|
spawnPlayer(client, spawnPosition, spawnHeading, getGameConfig().skins[getGame()][skin][0]);
|
||||||
onPlayerSpawn(client);
|
onPlayerSpawn(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
//removePlayerKeyBind(client, getKeyIdFromParams("insert"));
|
//removePlayerKeyBind(client, getKeyIdFromParams("insert"));
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.SubAccount] Spawned ${getPlayerDisplayForConsole(client)} as character ID ${getPlayerData(client).currentSubAccount} with skin ${skin} (${spawnPosition.x}, ${spawnPosition.y}, ${spawnPosition.z})`);
|
logToConsole(LOG_DEBUG, `[V.RP.SubAccount] Spawned ${getPlayerDisplayForConsole(client)} as character ID ${getPlayerData(client).currentSubAccount} with skin ${skin} (${spawnPosition.x}, ${spawnPosition.y}, ${spawnPosition.z})`);
|
||||||
|
|
||||||
getPlayerCurrentSubAccount(client).lastLogin = getCurrentUnixTimestamp();
|
getPlayerCurrentSubAccount(client).lastLogin = getCurrentUnixTimestamp();
|
||||||
}
|
}
|
||||||
@@ -535,14 +535,14 @@ function selectCharacter(client, characterId = -1) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function switchCharacterCommand(command, params, client) {
|
function switchCharacterCommand(command, params, client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.SubAccount] ${getPlayerDisplayForConsole(client)} is requesting to switch characters (current character: ${getCharacterFullName(client)} [${getPlayerData(client).currentSubAccount}/${getPlayerCurrentSubAccount(client).databaseId}])`);
|
logToConsole(LOG_DEBUG, `[V.RP.SubAccount] ${getPlayerDisplayForConsole(client)} is requesting to switch characters (current character: ${getCharacterFullName(client)} [${getPlayerData(client).currentSubAccount}/${getPlayerCurrentSubAccount(client).databaseId}])`);
|
||||||
if (!isPlayerSpawned(client)) {
|
if (!isPlayerSpawned(client)) {
|
||||||
logToConsole(LOG_WARN, `[AGRP.SubAccount] ${getPlayerDisplayForConsole(client)} is not allowed to switch characters (not spawned)`);
|
logToConsole(LOG_WARN, `[V.RP.SubAccount] ${getPlayerDisplayForConsole(client)} is not allowed to switch characters (not spawned)`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isPlayerSwitchingCharacter(client)) {
|
if (isPlayerSwitchingCharacter(client)) {
|
||||||
logToConsole(LOG_WARN, `[AGRP.SubAccount] ${getPlayerDisplayForConsole(client)} is not allowed to switch characters (already in switch char mode)`);
|
logToConsole(LOG_WARN, `[V.RP.SubAccount] ${getPlayerDisplayForConsole(client)} is not allowed to switch characters (already in switch char mode)`);
|
||||||
messagePlayerError(client, "You are already selecting/switching characters!");
|
messagePlayerError(client, "You are already selecting/switching characters!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,14 +103,14 @@ function initTimers() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function oneMinuteTimerFunction() {
|
function oneMinuteTimerFunction() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Checking server game time`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Checking server game time`);
|
||||||
checkServerGameTime();
|
checkServerGameTime();
|
||||||
|
|
||||||
if (getClients().length > 0) {
|
if (getClients().length > 0) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Checking rentable vehicles`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Checking rentable vehicles`);
|
||||||
checkVehicleRenting();
|
checkVehicleRenting();
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Updating all player name tags`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Updating all player name tags`);
|
||||||
updateAllPlayerNameTags();
|
updateAllPlayerNameTags();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -244,7 +244,7 @@ function checkServerGameTime() {
|
|||||||
removeAllPlayersFromProperties();
|
removeAllPlayersFromProperties();
|
||||||
removeAllPlayersFromVehicles();
|
removeAllPlayersFromVehicles();
|
||||||
saveServerDataToDatabase();
|
saveServerDataToDatabase();
|
||||||
logToConsole(LOG_INFO | LOG_WARN, `[AGRP.Timers] Changing server map to night`);
|
logToConsole(LOG_INFO | LOG_WARN, `[V.RP.Timers] Changing server map to night`);
|
||||||
messageDiscordEventChannel("🌙 Changing server map to night");
|
messageDiscordEventChannel("🌙 Changing server map to night");
|
||||||
game.changeMap(getGameConfig().mainWorldScene[getGame()]);
|
game.changeMap(getGameConfig().mainWorldScene[getGame()]);
|
||||||
}
|
}
|
||||||
@@ -258,7 +258,7 @@ function checkServerGameTime() {
|
|||||||
removeAllPlayersFromProperties();
|
removeAllPlayersFromProperties();
|
||||||
removeAllPlayersFromVehicles();
|
removeAllPlayersFromVehicles();
|
||||||
saveServerDataToDatabase();
|
saveServerDataToDatabase();
|
||||||
logToConsole(LOG_INFO | LOG_WARN, `[AGRP.Timers] Changing server map to day`);
|
logToConsole(LOG_INFO | LOG_WARN, `[V.RP.Timers] Changing server map to day`);
|
||||||
messageDiscordEventChannel("🌞 Changing server map to day");
|
messageDiscordEventChannel("🌞 Changing server map to day");
|
||||||
game.changeMap(getGameConfig().mainWorldScene[getGame()]);
|
game.changeMap(getGameConfig().mainWorldScene[getGame()]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ function initAllClients() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function updateServerRules() {
|
function updateServerRules() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities]: Updating all server rules ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities]: Updating all server rules ...`);
|
||||||
|
|
||||||
let timeWeatherRule = [];
|
let timeWeatherRule = [];
|
||||||
let tempText = "";
|
let tempText = "";
|
||||||
@@ -116,7 +116,7 @@ function updateServerRules() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setServerRule("Time & Weather", timeWeatherRule.join(", "));
|
setServerRule("Time & Weather", timeWeatherRule.join(", "));
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities]: All server rules updated successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities]: All server rules updated successfully!`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -517,15 +517,15 @@ function removeAllPlayersFromVehicles() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function processPlayerEnteringExitingProperty(client) {
|
function processPlayerEnteringExitingProperty(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities]: Processing property enter/exit for player ${getPlayerDisplayForConsole(client)} ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities]: Processing property enter/exit for player ${getPlayerDisplayForConsole(client)} ...`);
|
||||||
if (getPlayerData(client).enteringExitingProperty == null) {
|
if (getPlayerData(client).enteringExitingProperty == null) {
|
||||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.Utilities]: Aborting property enter/exit for player ${getPlayerDisplayForConsole(client)}. Assigned property data is null.`);
|
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.Utilities]: Aborting property enter/exit for player ${getPlayerDisplayForConsole(client)}. Assigned property data is null.`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let pedState = getPlayerData(client).pedState;
|
let pedState = getPlayerData(client).pedState;
|
||||||
if (pedState != V_PEDSTATE_ENTERINGPROPERTY && pedState != V_PEDSTATE_EXITINGPROPERTY) {
|
if (pedState != V_PEDSTATE_ENTERINGPROPERTY && pedState != V_PEDSTATE_EXITINGPROPERTY) {
|
||||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.Utilities]: Aborting property enter/exit for player ${getPlayerDisplayForConsole(client)}. Ped state is not entering or exiting property.`);
|
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.Utilities]: Aborting property enter/exit for player ${getPlayerDisplayForConsole(client)}. Ped state is not entering or exiting property.`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -537,14 +537,14 @@ function processPlayerEnteringExitingProperty(client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (propertyData == null || propertyData == false) {
|
if (propertyData == null || propertyData == false) {
|
||||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.Utilities]: Aborting property enter/exit for player ${getPlayerDisplayForConsole(client)}. Property is invalid.`);
|
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.Utilities]: Aborting property enter/exit for player ${getPlayerDisplayForConsole(client)}. Property is invalid.`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pedState == V_PEDSTATE_ENTERINGPROPERTY) {
|
if (pedState == V_PEDSTATE_ENTERINGPROPERTY) {
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Utilities]: Processing property ENTER for player ${getPlayerDisplayForConsole(client)} ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Utilities]: Processing property ENTER for player ${getPlayerDisplayForConsole(client)} ...`);
|
||||||
if (isGameFeatureSupported("interiorScene") && propertyData.exitScene != "") {
|
if (isGameFeatureSupported("interiorScene") && propertyData.exitScene != "") {
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Utilities]: Player ${getPlayerDisplayForConsole(client)} is entering a property with interior scene (${propertyData.exitScene})`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Utilities]: Player ${getPlayerDisplayForConsole(client)} is entering a property with interior scene (${propertyData.exitScene})`);
|
||||||
spawnPlayer(client, propertyData.exitPosition, propertyData.exitRotation, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
spawnPlayer(client, propertyData.exitPosition, propertyData.exitRotation, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
||||||
onPlayerSpawn(client);
|
onPlayerSpawn(client);
|
||||||
} else {
|
} else {
|
||||||
@@ -580,9 +580,9 @@ function processPlayerEnteringExitingProperty(client) {
|
|||||||
getPlayerData(client).enteringExitingProperty = null;
|
getPlayerData(client).enteringExitingProperty = null;
|
||||||
getPlayerData(client).pedState = V_PEDSTATE_READY;
|
getPlayerData(client).pedState = V_PEDSTATE_READY;
|
||||||
} else if (pedState == V_PEDSTATE_EXITINGPROPERTY) {
|
} else if (pedState == V_PEDSTATE_EXITINGPROPERTY) {
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Utilities]: Processing property EXIT for player ${getPlayerDisplayForConsole(client)} from property ID ${propertyData.index}/${propertyData.databaseId} ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Utilities]: Processing property EXIT for player ${getPlayerDisplayForConsole(client)} from property ID ${propertyData.index}/${propertyData.databaseId} ...`);
|
||||||
if (isGameFeatureSupported("interiorScene") && propertyData.entranceScene != "") {
|
if (isGameFeatureSupported("interiorScene") && propertyData.entranceScene != "") {
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Utilities]: Player ${getPlayerDisplayForConsole(client)} is exiting a property with external interior scene (${propertyData.entranceScene})`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Utilities]: Player ${getPlayerDisplayForConsole(client)} is exiting a property with external interior scene (${propertyData.entranceScene})`);
|
||||||
spawnPlayer(client, propertyData.entrancePosition, propertyData.entranceRotation, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
spawnPlayer(client, propertyData.entrancePosition, propertyData.entranceRotation, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
||||||
onPlayerSpawn(client);
|
onPlayerSpawn(client);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ function loadVehiclesFromDatabase() {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_INFO, `[AGRP.Vehicle]: ${tempVehicles.length} vehicles loaded from database successfully!`);
|
logToConsole(LOG_INFO, `[V.RP.Vehicle]: ${tempVehicles.length} vehicles loaded from database successfully!`);
|
||||||
return tempVehicles;
|
return tempVehicles;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,7 +236,7 @@ function saveVehicleToDatabase(vehicleDataId) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Vehicle]: Saving vehicle ${tempVehicleData.databaseId} to database ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Vehicle]: Saving vehicle ${tempVehicleData.databaseId} to database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
if (tempVehicleData.vehicle != false) {
|
if (tempVehicleData.vehicle != false) {
|
||||||
@@ -313,7 +313,7 @@ function saveVehicleToDatabase(vehicleDataId) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Vehicle]: Saved vehicle ${vehicleDataId} to database!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Vehicle]: Saved vehicle ${vehicleDataId} to database!`);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1488,7 +1488,7 @@ function respawnVehicle(vehicle) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function spawnVehicle(vehicleData) {
|
function spawnVehicle(vehicleData) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Vehicle]: Spawning ${getVehicleNameFromModel(vehicleData.model)} at ${vehicleData.spawnPosition.x}, ${vehicleData.spawnPosition.y}, ${vehicleData.spawnPosition.z} with heading ${vehicleData.spawnRotation}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Vehicle]: Spawning ${getVehicleNameFromModel(vehicleData.model)} at ${vehicleData.spawnPosition.x}, ${vehicleData.spawnPosition.y}, ${vehicleData.spawnPosition.z} with heading ${vehicleData.spawnRotation}`);
|
||||||
let vehicle = createGameVehicle(vehicleData.model, vehicleData.spawnPosition, vehicleData.spawnRotation);
|
let vehicle = createGameVehicle(vehicleData.model, vehicleData.spawnPosition, vehicleData.spawnRotation);
|
||||||
|
|
||||||
if (!vehicle) {
|
if (!vehicle) {
|
||||||
@@ -1505,25 +1505,25 @@ function spawnVehicle(vehicleData) {
|
|||||||
vehicle.setRGBColours(vehicleData.colour1RGBA, vehicleData.colour2RGBA);
|
vehicle.setRGBColours(vehicleData.colour1RGBA, vehicleData.colour2RGBA);
|
||||||
let colour1 = rgbaArrayFromToColour(vehicleData.colour1RGBA);
|
let colour1 = rgbaArrayFromToColour(vehicleData.colour1RGBA);
|
||||||
let colour2 = rgbaArrayFromToColour(vehicleData.colour2RGBA);
|
let colour2 = rgbaArrayFromToColour(vehicleData.colour2RGBA);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Vehicle]: Setting vehicle ${vehicle.id}'s colours to RGBA [${colour1[0]}, ${colour1[1]}, ${colour1[2]}, ${colour1[3]}], [(]${colour2[0]}, ${colour2[1]}, ${colour2[2]}, ${colour2[3]}]`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Vehicle]: Setting vehicle ${vehicle.id}'s colours to RGBA [${colour1[0]}, ${colour1[1]}, ${colour1[2]}, ${colour1[3]}], [(]${colour2[0]}, ${colour2[1]}, ${colour2[2]}, ${colour2[3]}]`);
|
||||||
vehicle.setRGBColours(vehicleData.colour1RGBA, vehicleData.colour2RGBA);
|
vehicle.setRGBColours(vehicleData.colour1RGBA, vehicleData.colour2RGBA);
|
||||||
} else {
|
} else {
|
||||||
setVehicleColours(vehicle, vehicleData.colour1, vehicleData.colour2, vehicleData.colour3, vehicleData.colour4);
|
setVehicleColours(vehicle, vehicleData.colour1, vehicleData.colour2, vehicleData.colour3, vehicleData.colour4);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Vehicle]: Setting vehicle ${vehicle.id}'s colours to ${vehicleData.colour1}, ${vehicleData.colour2}, ${vehicleData.colour3}, ${vehicleData.colour4}`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Vehicle]: Setting vehicle ${vehicle.id}'s colours to ${vehicleData.colour1}, ${vehicleData.colour2}, ${vehicleData.colour3}, ${vehicleData.colour4}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vehicleData.spawnLocked == true) {
|
if (vehicleData.spawnLocked == true) {
|
||||||
setVehicleEngine(vehicle, false);
|
setVehicleEngine(vehicle, false);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Vehicle]: Setting vehicle ${vehicle.id}'s engine to OFF`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Vehicle]: Setting vehicle ${vehicle.id}'s engine to OFF`);
|
||||||
} else {
|
} else {
|
||||||
setVehicleEngine(vehicle, intToBool(vehicleData.engine));
|
setVehicleEngine(vehicle, intToBool(vehicleData.engine));
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Vehicle]: Setting vehicle ${vehicle.id}'s engine to ${toUpperCase(getOnOffFromBool(getVehicleEngine(vehicle)))}`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Vehicle]: Setting vehicle ${vehicle.id}'s engine to ${toUpperCase(getOnOffFromBool(getVehicleEngine(vehicle)))}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof vehicle.locked != "undefined") {
|
if (typeof vehicle.locked != "undefined") {
|
||||||
setVehicleLocked(vehicle, intToBool(vehicleData.locked));
|
setVehicleLocked(vehicle, intToBool(vehicleData.locked));
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Vehicle]: Setting vehicle ${vehicle.id}'s lock state to ${toUpperCase(getOnOffFromBool(getVehicleLocked(vehicle)))}`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Vehicle]: Setting vehicle ${vehicle.id}'s lock state to ${toUpperCase(getOnOffFromBool(getVehicleLocked(vehicle)))}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
//setVehicleHealth(vehicle, 1000);
|
//setVehicleHealth(vehicle, 1000);
|
||||||
|
|||||||
@@ -1748,7 +1748,7 @@ function areWorldLabelsSupported() {
|
|||||||
|
|
||||||
function isGameFeatureSupported(featureName) {
|
function isGameFeatureSupported(featureName) {
|
||||||
if (typeof supportedFeatures[featureName] === "undefined") {
|
if (typeof supportedFeatures[featureName] === "undefined") {
|
||||||
logToConsole(LOG_WARN, `[AGRP.Utilities] Game feature support error. Unknown feature name: ${featureName}`);
|
logToConsole(LOG_WARN, `[V.RP.Utilities] Game feature support error. Unknown feature name: ${featureName}`);
|
||||||
if (isServerScript()) {
|
if (isServerScript()) {
|
||||||
submitBugReport(null, `[AUTOMATED REPORT] Game feature support error. Unknown feature name: ${featureName}`);
|
submitBugReport(null, `[AUTOMATED REPORT] Game feature support error. Unknown feature name: ${featureName}`);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user