Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
588359ef27 | ||
|
|
62a4581c55 | ||
|
|
0607057f3f | ||
|
|
ab4cd7a212 |
41
ECONOMY.md
Normal file
41
ECONOMY.md
Normal file
@@ -0,0 +1,41 @@
|
||||
# Economy Information
|
||||
|
||||
### Basic Information
|
||||
Each server has it's own independent economy with simulated inflation and is designed to slowly self-repair over time, assuming nothing is affecting it too heavily.
|
||||
|
||||
---
|
||||
|
||||
### Asset Ownership
|
||||
Any player or clan is allowed to own as many businesses, vehicles, and houses as they want. However, it should be noted that the more you own, the more upkeep (via taxes, insurance, etc) is required. Failure to maintain this upkeep for too long will automatically force you to lose the unmaintained assets. Vehicle owners can park their car anywhere (subject to IC parking laws), store items in the trunk or dash compartment, give anybody access, and set the price if they want to make it available to buy, and more. Business owners can stock their store with any item they want, set what prices they want for any item for sale, close/open the business, keep a stock of items in the business's storage, force people to pay a fee to enter, and more. House owners can store items in their house, purchase a safe, decorate with furniture, give anybody access, and more.
|
||||
|
||||
---
|
||||
|
||||
### Ordering Items for a Business
|
||||
Ordering items is simple: just use the /bizorder command.
|
||||
You'll need to specify which item you want to order and how many.
|
||||
Remember, the prices will vary depending on certain circumstances.
|
||||
|
||||
The formula is as follows:
|
||||
> Base price * server inflation * demand * risk * amount
|
||||
|
||||
**Here's a breakdown on how the above formula works:**
|
||||
* First, each item has a base price. This value will never change.
|
||||
|
||||
* Next, the base price is multiplied by the server's current inflation value. When the servers were first opened, the inflation value is 100%, which means no inflation. Everything cost 100% of it's calculated price. However, the inflation will slowly increase over time, simulating realistic economy inflation.
|
||||
|
||||
* Next, the inflated price is then multiplied by the demand factor, which is determined by how much demand there is for the item you want. Every 10 of the item ordered increases the demand value by 10%, and this will slowly go back down over time. If another business just ordered 100 of the item you want, the demand has forced the item's order price to increase by 100%, which means it's now double the original price. This simulates the things involved with increased demand, such as the extra manufacturing and shipping needed to get this item imported to your business.
|
||||
|
||||
* Next, the cost is multiplied by a risk value. This value never changes, and varies depending on the item. For illegal items, the risk value will be lower for less-risky items and higher as they get worse. For example, a shotgun versus an AK-47 have different risk levels, as an AK-47 is a far deadlier and a harder to get weapon, and is more difficult to conceal through customs. This simulates the "risk" of ordering items like these. For legal items, there is no risk so the risk price won't increase for those.
|
||||
|
||||
* Finally, the order cost is multiplied by the amount you want to order.
|
||||
|
||||
|
||||
**An example of this formula in action is below ... shown for an order for 10 AK-47's with no inflation**
|
||||
*The demand is increased by 10% since you're ordering 10 of them. 1 = 100% of the normal cost, 1.1 = 110%, and so on.*
|
||||
> Base price $1000
|
||||
> x inflation 1 = $1000
|
||||
> x demand 1.1 = $1100
|
||||
> x risk 5 = $5500
|
||||
> x amount 10 = $55000
|
||||
|
||||
So as you can see, the total cost to order 10 AK-47's in this scenario is $55,000. Remember, an AK-47 is a deadly and uncommon weapon (and highly illegal!) so it's a very risky and costly thing to do business with.
|
||||
25
README.md
25
README.md
@@ -1,7 +1,7 @@
|
||||
# Vortrex's Roleplay Resource
|
||||
|
||||
### Description
|
||||
This is Vortrex's Roleplay Resource
|
||||
This is Vortrex's Roleplay Resource. Originally created for [GTA Connected](https://gtaconnected.com/) but support for other multiplayer mods coming soon!
|
||||
|
||||
### Supported Games and Multiplayer Mods
|
||||
* GTA III (on [GTA Connected](https://gtaconnected.com/))
|
||||
@@ -9,6 +9,29 @@ This is Vortrex's Roleplay Resource
|
||||
* GTA SA (on [GTA Connected](https://gtaconnected.com/))
|
||||
* GTA IV (on [GTA Connected](https://gtaconnected.com/))
|
||||
* Mafia: The City of Lost Heaven (on [Mafia Connected](https://mafiaconnected.com/))
|
||||
* **(Coming Soon!)** GTA V (on [RAGEMP](https://rage.mp/))
|
||||
* **(Coming Soon!)** Mafia Definitive Edition (on MafiaMP)
|
||||
|
||||
### Features
|
||||
*Some features may be disabled on specific multiplayer mods depending on functionality*
|
||||
* Works on multiple server instances sharing the same database
|
||||
* Jobs operate as factions but leader can make ranks "public" so anybody can use those if enabled.
|
||||
* Clans with custom ranks, permissions, pay, titles, and more
|
||||
* Custom inventory system where everything is an item: food, weapons, devices, etc
|
||||
* All items can be dropped, given, used, picked up, or stored in certain places (other items, vehicles, etc)
|
||||
* Ownable vehicles, houses, businesses, and more
|
||||
* No "hard cap" to how many things you can own, but the more you own the more you pay in tax
|
||||
* Stock your business with any items you want, and set custom prices
|
||||
* Extra storage for businesses (floor items for sale, stockroom in back for hidden stuff)
|
||||
* Security features like two-factor login, email alerts for login attempts, and more
|
||||
* Animations and ped speech for extra RP goodness
|
||||
* Players can make aliases for commands
|
||||
* Choosable levels of GUI: Simple (input, list, message like SA-MP), Full (whole app layouts), or None (commands only)
|
||||
* Custom keybinds. Server can set defaults, but players can bind/unbind keys for personalization
|
||||
* *Everything* is dynamically changable in the server using commands and/or GUI
|
||||
* Community-provided translations for GUI and server messages
|
||||
* Automatic translator for chat (players can turn it on/off for themselves)
|
||||
* Way too many other things to list here
|
||||
|
||||
## Setup
|
||||
* Download the server from the [downloads page](https://gtaconnected.com/downloads) of the GTA Connected website.
|
||||
|
||||
4
meta.xml
4
meta.xml
@@ -119,16 +119,14 @@
|
||||
<script src="scripts/client/afk.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/animation.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/business.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/camera.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/chat.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/core.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/chat.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/cursor.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/economy.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/event.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/gui.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/gps.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/house.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/hud.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/item.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/job.js" type="client" language="javascript" />
|
||||
<script src="scripts/client/keybind.js" type="client" language="javascript" />
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"name": "v-roleplay",
|
||||
"main": "index.js",
|
||||
"version": "1.3",
|
||||
"mod": "MafiaMP"
|
||||
}
|
||||
@@ -22,7 +22,7 @@ function makePedPlayAnimation(pedId, animationSlot, positionOffset) {
|
||||
}
|
||||
|
||||
let animationData = getAnimationData(animationSlot);
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Animation] Playing animation ${animationData[0]} for ped ${pedId}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Animation] Playing animation ${animationData[0]} for ped ${pedId}`);
|
||||
|
||||
let freezePlayer = false;
|
||||
switch (animationData.moveType) {
|
||||
|
||||
@@ -35,19 +35,10 @@ function initBusinessScript() {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function receiveBusinessFromServer(businessId, isDeleted, name, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked, hasItems, entranceFee) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Business] Received business ${businessId} (${name}) from server`);
|
||||
function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked, hasItems, entranceFee) {
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Business] Received business ${businessId} (${name}) from server`);
|
||||
|
||||
if (!areServerElementsSupported() || getGame() == V_GAME_MAFIA_ONE || getGame() == V_GAME_GTA_IV) {
|
||||
if (isDeleted == true) {
|
||||
if (getGame() == V_GAME_GTA_IV) {
|
||||
natives.removeBlipAndClearIndex(getBusinessData(businessId).blipId);
|
||||
}
|
||||
|
||||
getServerData().businesses.splice(businessId, 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (getBusinessData(businessId) != false) {
|
||||
let businessData = getBusinessData(businessId);
|
||||
businessData.name = name;
|
||||
@@ -61,22 +52,20 @@ function receiveBusinessFromServer(businessId, isDeleted, name, entrancePosition
|
||||
businessData.locked = locked;
|
||||
businessData.entranceFee = entranceFee;
|
||||
|
||||
if (businessData.buyPrice > 0) {
|
||||
businessData.labelInfoType = V_PROPLABEL_INFO_BUYBIZ;
|
||||
if (hasInterior && !hasItems) {
|
||||
businessData.labelInfoType = V_PROPLABEL_INFO_ENTER;
|
||||
} else if (!hasInterior && hasItems) {
|
||||
businessData.labelInfoType = V_PROPLABEL_INFO_BUY;
|
||||
} else {
|
||||
if (hasInterior && !hasItems) {
|
||||
businessData.labelInfoType = V_PROPLABEL_INFO_ENTER;
|
||||
} else if (!hasInterior && hasItems) {
|
||||
businessData.labelInfoType = V_PROPLABEL_INFO_BUY;
|
||||
} else {
|
||||
businessData.labelInfoType = V_PROPLABEL_INFO_NONE;
|
||||
if (businessData.buyPrice > 0) {
|
||||
businessData.labelInfoType = V_PROPLABEL_INFO_BUYBIZ;
|
||||
}
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Business] Business ${businessId} already exists. Checking blip ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Business] Business ${businessId} already exists. Checking blip ...`);
|
||||
if (blipModel == -1) {
|
||||
if (businessData.blipId != -1) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Business] Business ${businessId}'s blip has been removed by the server`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Business] Business ${businessId}'s blip has been removed by the server`);
|
||||
if (getGame() == V_GAME_GTA_IV) {
|
||||
natives.removeBlipAndClearIndex(getBusinessData(businessId).blipId);
|
||||
} else {
|
||||
@@ -86,11 +75,11 @@ function receiveBusinessFromServer(businessId, isDeleted, name, entrancePosition
|
||||
//businesses.splice(businessData.index, 1);
|
||||
//setAllBusinessDataIndexes();
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Business] Business ${businessId}'s blip is unchanged`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Business] Business ${businessId}'s blip is unchanged`);
|
||||
}
|
||||
} else {
|
||||
if (businessData.blipId != -1) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Business] Business ${businessId}'s blip has been changed by the server`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Business] Business ${businessId}'s blip has been changed by the server`);
|
||||
if (getGame() == V_GAME_GTA_IV) {
|
||||
natives.setBlipCoordinates(businessData.blipId, businessData.entrancePosition);
|
||||
natives.changeBlipSprite(businessData.blipId, businessData.blipModel);
|
||||
@@ -103,20 +92,20 @@ function receiveBusinessFromServer(businessId, isDeleted, name, entrancePosition
|
||||
if (blipId != -1) {
|
||||
tempBusinessData.blipId = blipId;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Business] Business ${businessId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Business] Business ${businessId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Business] Business ${businessId} doesn't exist. Adding ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Business] Business ${businessId} doesn't exist. Adding ...`);
|
||||
let tempBusinessData = new BusinessData(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems);
|
||||
if (blipModel != -1) {
|
||||
let blipId = createGameBlip(tempBusinessData.blipModel, tempBusinessData.entrancePosition, tempBusinessData.name);
|
||||
if (blipId != -1) {
|
||||
tempBusinessData.blipId = blipId;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Business] Business ${businessId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Business] Business ${businessId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Business] Business ${businessId} has no blip.`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Business] Business ${businessId} has no blip.`);
|
||||
}
|
||||
getServerData().businesses.push(tempBusinessData);
|
||||
setAllBusinessDataIndexes();
|
||||
@@ -153,10 +142,4 @@ function setAllBusinessDataIndexes() {
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function removeBusinessesFromClient() {
|
||||
getServerData().businesses.splice(0);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -12,29 +12,24 @@ let cameraFadeIn = false;
|
||||
let cameraFadeStart = 0;
|
||||
let cameraFadeDuration = 0;
|
||||
let cameraFadeColour = 0;
|
||||
let cameraFadeAlpha = 0;
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function processCameraFadeRendering() {
|
||||
if (cameraFadeEnabled) {
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Camera] Camera fade enabled`);
|
||||
let finishTime = cameraFadeStart + cameraFadeDuration;
|
||||
if (sdl.ticks >= finishTime) {
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Camera] Camera fade finished`);
|
||||
cameraFadeEnabled = false;
|
||||
cameraFadeDuration = 0;
|
||||
cameraFadeStart = 0;
|
||||
} else {
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Camera] Camera fade processing`);
|
||||
let currentTick = sdl.ticks - cameraFadeStart;
|
||||
let progressPercent = Math.ceil(currentTick * 100 / cameraFadeDuration);
|
||||
let rgbaArray = rgbaArrayFromToColour(cameraFadeColour);
|
||||
|
||||
cameraFadeAlpha = (cameraFadeIn) ? Math.ceil(((100 - progressPercent) / 100) * 255) : Math.ceil(255 * (progressPercent / 100));
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Camera] Camera fade progress: ${progressPercent}% (Alpha: ${cameraFadeAlpha})`);
|
||||
let alpha = (cameraFadeIn) ? Math.ceil(255 / progressPercent) : Math.ceil(progressPercent / 255);
|
||||
|
||||
cameraFadeColour = toColour(rgbaArray[0], rgbaArray[1], rgbaArray[2], cameraFadeAlpha);
|
||||
cameraFadeColour = toColour(rgbaArray[0], rgbaArray[1], rgbaArray[2], alpha);
|
||||
graphics.drawRectangle(null, toVector2(0, 0), toVector2(game.width, game.height), cameraFadeColour, cameraFadeColour, cameraFadeColour, cameraFadeColour);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ function unBindChatBoxKeys() {
|
||||
// ===========================================================================
|
||||
|
||||
function receiveChatBoxMessageFromServer(messageString, colour, hour, minute, second) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Chat]: Received chatbox message from server: ${messageString}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Chat]: Received chatbox message from server: ${messageString}`);
|
||||
|
||||
// Just in case it's hidden by auto hide
|
||||
//setChatWindowEnabled(true);
|
||||
@@ -77,16 +77,16 @@ function receiveChatBoxMessageFromServer(messageString, colour, hour, minute, se
|
||||
outputString = `${timeStampString}${messageString}`;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Chat]: Changed colours in string: ${outputString}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Chat]: Changed colours in string: ${outputString}`);
|
||||
outputString = replaceColoursInMessage(`${outputString}`);
|
||||
|
||||
if (chatEmojiEnabled == true) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Chat]: Enabled emoji in string: ${outputString}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Chat]: Enabled emoji in string: ${outputString}`);
|
||||
outputString = replaceEmojiInMessage(outputString);
|
||||
}
|
||||
|
||||
if (profanityFilterEnabled == true) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Chat]: Removed profanity in string: ${outputString}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Chat]: Removed profanity in string: ${outputString}`);
|
||||
outputString = replaceProfanityInMessage(outputString);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,21 +32,17 @@ function addAllEventHandlers() {
|
||||
addEventHandler("OnMouseWheel", onMouseWheel);
|
||||
addEventHandler("OnEntityProcess", onEntityProcess);
|
||||
|
||||
if (getGame() <= V_GAME_GTA_SA) {
|
||||
if (findResourceByName("v-events") != null) {
|
||||
if (findResourceByName("v-events").isStarted) {
|
||||
addEventHandler("OnPedEnteredVehicleEx", onPedEnteredVehicle);
|
||||
addEventHandler("OnPedExitedVehicleEx", onPedExitedVehicle);
|
||||
addEventHandler("OnPedEnteredSphereEx", onPedEnteredSphere);
|
||||
addEventHandler("OnPedExitedSphereEx", onPedExitedSphere);
|
||||
}
|
||||
if (findResourceByName("v-events") != null) {
|
||||
if (findResourceByName("v-events").isStarted) {
|
||||
addEventHandler("OnPedEnteredVehicleEx", onPedEnteredVehicle);
|
||||
addEventHandler("OnPedExitedVehicleEx", onPedExitedVehicle);
|
||||
addEventHandler("OnPedEnteredSphereEx", onPedEnteredSphere);
|
||||
addEventHandler("OnPedExitedSphereEx", onPedExitedSphere);
|
||||
}
|
||||
}
|
||||
|
||||
if (getGame() == V_GAME_MAFIA_ONE) {
|
||||
addEventHandler("OnMapLoaded", onMapLoaded);
|
||||
addEventHandler("OnPedEnteringVehicle", onPedEnteredVehicle);
|
||||
addEventHandler("OnPedExitingVehicle", onPedExitedVehicle);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,20 +56,14 @@ function onResourceStart(event, resource) {
|
||||
removeEventHandler("OnPedEnteredSphereEx");
|
||||
removeEventHandler("OnPedExitedSphereEx");
|
||||
|
||||
if (getGame() <= V_GAME_GTA_SA) {
|
||||
if (findResourceByName("v-events") != null) {
|
||||
if (findResourceByName("v-events").isStarted) {
|
||||
addEventHandler("OnPedEnteredVehicleEx", onPedEnteredVehicle);
|
||||
addEventHandler("OnPedExitedVehicleEx", onPedExitedVehicle);
|
||||
addEventHandler("OnPedEnteredSphereEx", onPedEnteredSphere);
|
||||
addEventHandler("OnPedExitedSphereEx", onPedExitedSphere);
|
||||
}
|
||||
}
|
||||
}
|
||||
addEventHandler("OnPedEnteredVehicleEx", onPedEnteredVehicle);
|
||||
addEventHandler("OnPedExitedVehicleEx", onPedExitedVehicle);
|
||||
addEventHandler("OnPedEnteredSphereEx", onPedEnteredSphere);
|
||||
addEventHandler("OnPedExitedSphereEx", onPedExitedSphere);
|
||||
}
|
||||
|
||||
if (resource == thisResource) {
|
||||
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.Event] onResourceStart called - Sending signal to server`);
|
||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.Event] onResourceStart called - Sending signal to server`);
|
||||
localPlayerMoneyInterval = setInterval(updateLocalPlayerMoney, 1000 * 5);
|
||||
sendResourceStartedSignalToServer();
|
||||
}
|
||||
@@ -83,7 +73,7 @@ function onResourceStart(event, resource) {
|
||||
|
||||
function onResourceStop(event, resource) {
|
||||
if (resource == thisResource) {
|
||||
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.Event] onResourceStop called - Sending signal to server`);
|
||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.Event] onResourceStop called - Sending signal to server`);
|
||||
sendResourceStoppedSignalToServer();
|
||||
}
|
||||
}
|
||||
@@ -92,7 +82,7 @@ function onResourceStop(event, resource) {
|
||||
|
||||
function onResourceReady(event, resource) {
|
||||
if (resource == thisResource) {
|
||||
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.Event] onResourceReady called - Sending signal to server`);
|
||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.Event] onResourceReady called - Sending signal to server`);
|
||||
loadLocaleConfig();
|
||||
sendResourceReadySignalToServer();
|
||||
}
|
||||
@@ -101,8 +91,7 @@ function onResourceReady(event, resource) {
|
||||
// ===========================================================================
|
||||
|
||||
function onProcess(event, deltaTime) {
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Event] onProcess`);
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Event] onProcess`);
|
||||
if (localPlayer == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -137,7 +126,7 @@ function onKeyUp(event, keyCode, scanCode, keyModifiers) {
|
||||
// ===========================================================================
|
||||
|
||||
function onDrawnHUD(event) {
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Event] HUD drawn`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Event] HUD drawn`);
|
||||
processMouseCursorRendering();
|
||||
|
||||
if (!renderHUD) {
|
||||
@@ -156,14 +145,12 @@ function onDrawnHUD(event) {
|
||||
processSkinSelectRendering();
|
||||
processNameTagRendering();
|
||||
processInteriorLightsRendering();
|
||||
processCustomHUDRendering();
|
||||
processCameraFadeRendering();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onPedWasted(event, wastedPed, killerPed, weapon, pedPiece) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] Ped ${wastedPed.name} died`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Ped ${wastedPed.name} died`);
|
||||
wastedPed.clearWeapons();
|
||||
}
|
||||
|
||||
@@ -176,7 +163,7 @@ function onElementStreamIn(event, element) {
|
||||
// ===========================================================================
|
||||
|
||||
function onPedExitedVehicle(event, ped, vehicle, seat) {
|
||||
//logToConsole(LOG_DEBUG, `[V.RP.Event] Local player exited vehicle`);
|
||||
//logToConsole(LOG_DEBUG, `[AGRP.Event] Local player exited vehicle`);
|
||||
//sendNetworkEventToServer("v.rp.onPlayerExitVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
||||
|
||||
cruiseControlEnabled = false;
|
||||
@@ -200,7 +187,7 @@ function onPedExitedVehicle(event, ped, vehicle, seat) {
|
||||
// ===========================================================================
|
||||
|
||||
function onPedExitingVehicle(event, ped, vehicle, seat) {
|
||||
//logToConsole(LOG_DEBUG, `[V.RP.Event] Local player exited vehicle`);
|
||||
//logToConsole(LOG_DEBUG, `[AGRP.Event] Local player exited vehicle`);
|
||||
//sendNetworkEventToServer("v.rp.onPlayerExitVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
||||
|
||||
if (localPlayer != null) {
|
||||
@@ -214,7 +201,7 @@ function onPedExitingVehicle(event, ped, vehicle, seat) {
|
||||
// ===========================================================================
|
||||
|
||||
function onPedEnteredVehicle(event, ped, vehicle, seat) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] Ped entered vehicle`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Ped entered vehicle`);
|
||||
//sendNetworkEventToServer("v.rp.onPlayerEnterVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
||||
|
||||
cruiseControlEnabled = false;
|
||||
@@ -242,7 +229,7 @@ function onPedEnteredVehicle(event, ped, vehicle, seat) {
|
||||
function onPedInflictDamage(event, damagedEntity, damagerEntity, weaponId, healthLoss, pedPiece) {
|
||||
//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`;
|
||||
//logToConsole(LOG_DEBUG, `[V.RP.Event] ${damagerEntityString} damaged ${damagedEntityString}'s '${pedPiece} with weapon ${weaponId}`);
|
||||
//logToConsole(LOG_DEBUG, `[AGRP.Event] ${damagerEntityString} damaged ${damagedEntityString}'s '${pedPiece} with weapon ${weaponId}`);
|
||||
if (!isNull(damagedEntity) && !isNull(damagerEntity)) {
|
||||
if (damagedEntity.isType(ELEMENT_PLAYER)) {
|
||||
if (damagedEntity == localPlayer) {
|
||||
@@ -307,7 +294,7 @@ function onEntityProcess(event, entity) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onMapLoaded(event, mapName) {
|
||||
function onMapLoaded(mapName) {
|
||||
sendNetworkEventToServer("v.rp.mapLoaded", mapName);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ let gpsBlipBlinkTimer = null;
|
||||
// ===========================================================================
|
||||
|
||||
function showGPSLocation(position, colour) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GPS] Showing gps location`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GPS] Showing gps location`);
|
||||
if (getMultiplayerMod() == V_MPMOD_GTAC) {
|
||||
if (getGame() == V_GAME_GTA_SA) {
|
||||
// Server-side spheres don't show in GTA SA for some reason.
|
||||
|
||||
@@ -47,7 +47,7 @@ function initGUIScript() {
|
||||
// ===========================================================================
|
||||
|
||||
function initGUI() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Initializing GUI ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Initializing GUI ...`);
|
||||
|
||||
initLoginGUI();
|
||||
initRegisterGUI();
|
||||
@@ -73,7 +73,7 @@ function initGUI() {
|
||||
closeAllWindows();
|
||||
guiReady = true;
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] All GUI created successfully!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] All GUI created successfully!`);
|
||||
|
||||
sendNetworkEventToServer("v.rp.guiReady", true);
|
||||
};
|
||||
@@ -81,7 +81,7 @@ function initGUI() {
|
||||
// ===========================================================================
|
||||
|
||||
function closeAllWindows() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Closing all GUI windows`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Closing all GUI windows`);
|
||||
infoDialog.window.shown = false;
|
||||
yesNoDialog.window.shown = false;
|
||||
errorDialog.window.shown = false;
|
||||
@@ -208,7 +208,7 @@ function isAnyGUIActive() {
|
||||
// ===========================================================================
|
||||
|
||||
function setGUIColours(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}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Received new GUI colours from server: ${red1}, ${green1}, ${blue1} / ${red2}, ${green2}, ${blue2} / ${red3}, ${green3}, ${blue3}`);
|
||||
primaryColour = [red1, green1, blue1];
|
||||
secondaryColour = [red2, green2, blue2];
|
||||
primaryTextColour = [red3, green3, blue3];
|
||||
@@ -228,45 +228,45 @@ function hideAllGUI() {
|
||||
// ===========================================================================
|
||||
|
||||
function processGUIKeyPress(keyCode) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Processing key press: ${keyCode}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Processing key press: ${keyCode}`);
|
||||
|
||||
if (!guiReady) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isAnyGUIActive()) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] GUI is not active. Cancelling keypress processing.`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] GUI is not active. Cancelling keypress processing.`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (keyCode == SDLK_RETURN || keyCode == SDLK_RETURN2) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Key press is submit (${guiSubmitKey})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Key press is submit (${guiSubmitKey})`);
|
||||
if (guiSubmitKey != false) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Calling submit key function`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Calling submit key function`);
|
||||
guiSubmitKey.call();
|
||||
}
|
||||
} else if (keyCode == getKeyIdFromParams("left") || keyCode == getKeyIdFromParams("a")) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Key press is left (${guiLeftKey})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Key press is left (${guiLeftKey})`);
|
||||
if (guiLeftKey != false) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Calling left key function`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Calling left key function`);
|
||||
guiLeftKey.call();
|
||||
}
|
||||
} else if (keyCode == getKeyIdFromParams("right") || keyCode == getKeyIdFromParams("d")) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Key press is right (${guiRightKey})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Key press is right (${guiRightKey})`);
|
||||
if (guiRightKey != false) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Calling right key function`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Calling right key function`);
|
||||
guiRightKey.call();
|
||||
}
|
||||
} else if (keyCode == getKeyIdFromParams("down") || keyCode == getKeyIdFromParams("s")) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Key press is down (${guiDownKey})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Key press is down (${guiDownKey})`);
|
||||
if (guiDownKey != false) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Calling down key function`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Calling down key function`);
|
||||
guiDownKey.call();
|
||||
}
|
||||
} else if (keyCode == getKeyIdFromParams("up") || keyCode == getKeyIdFromParams("w")) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Key press is up (${guiUpKey})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Key press is up (${guiUpKey})`);
|
||||
if (guiUpKey != false) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Calling up key function`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Calling up key function`);
|
||||
guiUpKey.call();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ let twoFactorAuth = {
|
||||
// ===========================================================================
|
||||
|
||||
function initTwoFactorAuthenticationGUI() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating two factor auth GUI ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating two factor auth GUI ...`);
|
||||
twoFactorAuth.window = mexui.window(game.width / 2 - 150, game.height / 2 - 129, 300, 258, 'LOGIN', {
|
||||
main: {
|
||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||
@@ -94,14 +94,14 @@ function initTwoFactorAuthenticationGUI() {
|
||||
},
|
||||
}, checkTwoFactorAuth);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created two factor auth GUI`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created two factor auth GUI`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showTwoFactorAuthGUI() {
|
||||
closeAllWindows();
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing two-factor authentication window`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing two-factor authentication window`);
|
||||
setChatWindowEnabled(false);
|
||||
mexui.setInput(true);
|
||||
twoFactorAuth.window.shown = true;
|
||||
@@ -112,7 +112,7 @@ function showTwoFactorAuthGUI() {
|
||||
// ===========================================================================
|
||||
|
||||
function twoFactorAuthFailed(errorMessage) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Server reports two-factor authentication failed. Reason: ${errorMessage}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports two-factor authentication failed. Reason: ${errorMessage}`);
|
||||
twoFactorAuth.messageLabel.text = errorMessage;
|
||||
twoFactorAuth.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
||||
twoFactorAuth.codeInput.text = "";
|
||||
@@ -121,14 +121,14 @@ function twoFactorAuthFailed(errorMessage) {
|
||||
// ===========================================================================
|
||||
|
||||
function twoFactorAuthSuccess() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Server reports two-factor authentication was successful`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports two-factor authentication was successful`);
|
||||
closeAllWindows();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function checkTwoFactorAuth() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Checking two-factor authentication with server ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Checking two-factor authentication with server ...`);
|
||||
sendNetworkEventToServer("v.rp.2fa", twoFactorAuth.codeInput.lines[0]);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ let passwordChange = {
|
||||
// ===========================================================================
|
||||
|
||||
function initChangePasswordGUI() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating password change GUI ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating password change GUI ...`);
|
||||
passwordChange.window = mexui.window(game.width / 2 - 130, game.height / 2 - 125, 300, 250, 'Change Password', {
|
||||
main: {
|
||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||
@@ -110,13 +110,13 @@ function initChangePasswordGUI() {
|
||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||
},
|
||||
}, checkChangePassword);
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created change password GUI`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created change password GUI`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function passwordChangeFailed(errorMessage) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Server reports change password failed. Reason: ${errorMessage}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports change password failed. Reason: ${errorMessage}`);
|
||||
passwordChange.messageLabel.text = errorMessage;
|
||||
passwordChange.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
||||
passwordChange.passwordInput.text = "";
|
||||
@@ -127,14 +127,14 @@ function passwordChangeFailed(errorMessage) {
|
||||
// ===========================================================================
|
||||
|
||||
function checkChangePassword() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Checking password change with server ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Checking password change with server ...`);
|
||||
sendNetworkEventToServer("v.rp.checkChangePassword", passwordChange.passwordInput.lines[0], passwordChange.confirmPasswordInput.lines[0]);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showChangePasswordGUI(errorMessage) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing change password window`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing change password window`);
|
||||
closeAllWindows();
|
||||
setChatWindowEnabled(false);
|
||||
mexui.setInput(true);
|
||||
@@ -149,7 +149,7 @@ function showChangePasswordGUI(errorMessage) {
|
||||
// ===========================================================================
|
||||
|
||||
function passwordChangeSuccess() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Server reports password change was successful`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports password change was successful`);
|
||||
guiSubmitKey = false;
|
||||
closeAllWindows();
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ let characterSelect = {
|
||||
// ===========================================================================
|
||||
|
||||
function initCharacterSelectGUI() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating character select GUI ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating character select GUI ...`);
|
||||
characterSelect.window = mexui.window(game.width / 2 - 215, game.height / 2 - 83, 430, 190, 'SELECT CHARACTER', {
|
||||
main: {
|
||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||
@@ -31,13 +31,13 @@ function initCharacterSelectGUI() {
|
||||
title: {
|
||||
textSize: 12.0,
|
||||
textFont: mainFont,
|
||||
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
|
||||
textColour: toColour(0, 0, 0, 255),
|
||||
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
|
||||
},
|
||||
icon: {
|
||||
textSize: 10.0,
|
||||
textFont: mainFont,
|
||||
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
|
||||
textColour: toColour(0, 0, 0, 255),
|
||||
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
|
||||
}
|
||||
});
|
||||
@@ -150,14 +150,14 @@ function initCharacterSelectGUI() {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
}
|
||||
});
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created character select GUI`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created character select GUI`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showCharacterSelectGUI(firstName, lastName, cash, clan, lastPlayed, skinId) {
|
||||
closeAllWindows();
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing character selection window`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing character selection window`);
|
||||
setChatWindowEnabled(false);
|
||||
mexui.setInput(true);
|
||||
characterSelect.nameText.text = `${firstName} ${lastName}`;
|
||||
@@ -178,35 +178,35 @@ function showCharacterSelectGUI(firstName, lastName, cash, clan, lastPlayed, ski
|
||||
|
||||
function showNewCharacter() {
|
||||
closeAllWindows();
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing new character dialog window`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing new character dialog window`);
|
||||
showNewCharacterGUI();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function selectNextCharacter() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Requesting next character info from server for character select window`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Requesting next character info from server for character select window`);
|
||||
sendNetworkEventToServer("v.rp.nextCharacter");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function selectPreviousCharacter() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Requesting previous character info from server for character select window`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Requesting previous character info from server for character select window`);
|
||||
sendNetworkEventToServer("v.rp.previousCharacter");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function selectThisCharacter() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Tell server the current shown character was selected in character select window`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Tell server the current shown character was selected in character select window`);
|
||||
sendNetworkEventToServer("v.rp.selectCharacter");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function switchCharacterSelectGUI(firstName, lastName, cash, clan, lastPlayed, skinId) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Updating character info with data from server`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Updating character info with data from server`);
|
||||
setChatWindowEnabled(false);
|
||||
characterSelect.window.shown = false;
|
||||
characterSelect.nameText.text = `${firstName} ${lastName}`;
|
||||
@@ -229,7 +229,7 @@ function switchCharacterSelectGUI(firstName, lastName, cash, clan, lastPlayed, s
|
||||
// ===========================================================================
|
||||
|
||||
function characterSelectSuccess() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Server reports character selection was successful`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports character selection was successful`);
|
||||
closeAllWindows();
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ let errorDialog = {
|
||||
// ===========================================================================
|
||||
|
||||
function initErrorDialogGUI() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating error GUI ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating error GUI ...`);
|
||||
errorDialog.window = mexui.window(getScreenWidth() / 2 - 200, getScreenHeight() / 2 - 70, 400, 140, 'ERROR', {
|
||||
main: {
|
||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||
@@ -58,14 +58,14 @@ function initErrorDialogGUI() {
|
||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
|
||||
},
|
||||
}, closeErrorDialog);
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created error GUI ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created error GUI ...`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showErrorGUI(errorMessage, errorTitle, buttonText) {
|
||||
closeAllWindows();
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing error window. Error: ${errorTitle} - ${errorMessage}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing error window. Error: ${errorTitle} - ${errorMessage}`);
|
||||
setChatWindowEnabled(false);
|
||||
mexui.setInput(true);
|
||||
errorDialog.messageLabel.text = errorMessage;
|
||||
@@ -77,7 +77,7 @@ function showErrorGUI(errorMessage, errorTitle, buttonText) {
|
||||
// ===========================================================================
|
||||
|
||||
function closeErrorDialog() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Closing error dialog`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Closing error dialog`);
|
||||
errorDialog.window.shown = false;
|
||||
mexui.setInput(false);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ let fiveCardPokerGUI = {
|
||||
|
||||
function initFiveCardPokerGUI() {
|
||||
// Render a five card poker game in MexUI
|
||||
//logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating five-card poker GUI ...`);
|
||||
//logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating five-card poker GUI ...`);
|
||||
fiveCardPokerGUI.window = mexui.window(game.width / 2 - 200, game.height - 150, 400, 400, 'Five Card Poker', {
|
||||
main: {
|
||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], 0),
|
||||
@@ -33,7 +33,7 @@ function initFiveCardPokerGUI() {
|
||||
|
||||
fiveCardPokerGUI.window.shown = false;
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created five card poker GUI`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created five card poker GUI`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -22,7 +22,7 @@ let dealerCards = [];
|
||||
|
||||
function initBlackJackGUI() {
|
||||
// Render a blackjack game in MexUI
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating blackjack GUI ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating blackjack GUI ...`);
|
||||
blackJackGUI.window = mexui.window(game.width / 2 - 200, game.height - 150, 400, 400, 'Blackjack', {
|
||||
main: {
|
||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], 0),
|
||||
@@ -42,7 +42,7 @@ function initBlackJackGUI() {
|
||||
|
||||
blackJackGUI.window.shown = false;
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created blackjack GUI`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created blackjack GUI`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -16,7 +16,7 @@ let infoDialog = {
|
||||
// ===========================================================================
|
||||
|
||||
function initInfoDialogGUI() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating info dialog GUI ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating info dialog GUI ...`);
|
||||
infoDialog.window = mexui.window(getScreenWidth() / 2 - 200, getScreenHeight() / 2 - 70, 400, 140, 'Information', {
|
||||
main: {
|
||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||
@@ -57,13 +57,13 @@ function initInfoDialogGUI() {
|
||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
|
||||
},
|
||||
}, closeInfoDialog);
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created info dialog GUI`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created info dialog GUI`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function closeInfoDialog() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Closing info dialog`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Closing info dialog`);
|
||||
infoDialog.window.shown = false;
|
||||
mexui.setInput(false);
|
||||
}
|
||||
@@ -72,7 +72,7 @@ function closeInfoDialog() {
|
||||
|
||||
function showInfoGUI(infoMessage, infoTitle, buttonText) {
|
||||
closeAllWindows();
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing info dialog window. Info: ${infoTitle} - ${infoMessage}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing info dialog window. Info: ${infoTitle} - ${infoMessage}`);
|
||||
mexui.setInput(true);
|
||||
infoDialog.messageLabel.text = infoMessage;
|
||||
infoDialog.okayButton.text = buttonText;
|
||||
|
||||
@@ -25,7 +25,7 @@ function initInventoryGUI() {
|
||||
// ===========================================================================
|
||||
|
||||
function closeAllInventoryGUI() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Closing all inventory GUI`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Closing all inventory GUI`);
|
||||
for (let i in inventoryGUI) {
|
||||
inventoryGUI[i].window.shown = false;
|
||||
}
|
||||
@@ -36,7 +36,7 @@ function closeAllInventoryGUI() {
|
||||
|
||||
function showInventoryGUI(inventoryIndex, items) {
|
||||
closeAllWindows();
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing inventory window. Index: ${inventoryIndex}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing inventory window. Index: ${inventoryIndex}`);
|
||||
inventoryGUI[inventoryIndex].window.shown = true;
|
||||
mexui.setInput(true);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ function initInventoryBulkGUI() {
|
||||
// ===========================================================================
|
||||
|
||||
function closeAllInventoryBulkGUI() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Closing all bulk inventory GUI`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Closing all bulk inventory GUI`);
|
||||
for (let i in inventoryBulkGUI) {
|
||||
inventoryBulkGUI[i].window.shown = false;
|
||||
}
|
||||
@@ -36,7 +36,7 @@ function closeAllInventoryBulkGUI() {
|
||||
|
||||
function showInventoryBulkGUI(inventoryIndex, items) {
|
||||
closeAllWindows();
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing bulk inventory window. Index: ${inventoryIndex}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing bulk inventory window. Index: ${inventoryIndex}`);
|
||||
inventoryBulkGUI[inventoryIndex].window.shown = true;
|
||||
mexui.setInput(true);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ let listDialog = {
|
||||
// ===========================================================================
|
||||
|
||||
function initListGUI() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating list dialog GUI ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating list dialog GUI ...`);
|
||||
listDialog.window = mexui.window(game.width / 2 - 200, game.height / 2 - 70, 400, 500, 'List', {
|
||||
main: {
|
||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||
@@ -72,14 +72,14 @@ function initListGUI() {
|
||||
}
|
||||
}
|
||||
});
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created list dialog GUI`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created list dialog GUI`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showListGUI() {
|
||||
closeAllWindows();
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing list window`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing list window`);
|
||||
setChatWindowEnabled(false);
|
||||
mexui.setInput(true);
|
||||
listDialog.window.shown = true;
|
||||
|
||||
@@ -19,7 +19,7 @@ let flagImageGap = toVector2(5, 5);
|
||||
// ===========================================================================
|
||||
|
||||
function initLocaleChooserGUI() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating locale chooser GUI ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating locale chooser GUI ...`);
|
||||
localeChooser.window = mexui.window(game.width / 2 - 200, game.height - 150, 60, 60, 'Choose a language', {
|
||||
main: {
|
||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], 0),
|
||||
@@ -39,13 +39,13 @@ function initLocaleChooserGUI() {
|
||||
|
||||
localeChooser.window.shown = false;
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created locale chooser GUI`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created locale chooser GUI`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function closeLocaleChooserGUI() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Closing locale chooser window`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Closing locale chooser window`);
|
||||
localeChooser.window.shown = false;
|
||||
for (let i in localeChooser.flagImages) {
|
||||
localeChooser.flagImages[i].shown = false;
|
||||
@@ -63,7 +63,7 @@ function showLocaleChooserGUI(position = toVector2(0.0, 0.0)) {
|
||||
}
|
||||
|
||||
//closeAllWindows();
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing locale chooser window`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing locale chooser window`);
|
||||
mexui.setInput(true);
|
||||
localeChooser.window.shown = true;
|
||||
|
||||
@@ -85,14 +85,14 @@ function toggleLocaleChooserGUI() {
|
||||
// ===========================================================================
|
||||
|
||||
function localeChooserSetLocale(localeId) {
|
||||
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.GUI] Asking server to change locale to ${localeId}`);
|
||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.GUI] Asking server to change locale to ${localeId}`);
|
||||
sendLocaleSelectToServer(localeId);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function resetLocaleChooserOptions() {
|
||||
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.GUI] Resetting locale chooser options`);
|
||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.GUI] Resetting locale chooser options`);
|
||||
|
||||
// let tempLocaleOptions = getServerData().localeOptions; // getAvailableLocaleOptions();
|
||||
let tempLocaleOptions = getAvailableLocaleOptions();
|
||||
@@ -116,7 +116,7 @@ function resetLocaleChooserOptions() {
|
||||
|
||||
localeChooser.flagImages[i].shown = false;
|
||||
|
||||
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.GUI] Created locale chooser option ${tempLocaleOptions[i].englishName} with image ${imagePath}`);
|
||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.GUI] Created locale chooser option ${tempLocaleOptions[i].englishName} with image ${imagePath}`);
|
||||
|
||||
//localeChooser.activeRingImages.push(activeRingImage);
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ let loginHTML =
|
||||
// ===========================================================================
|
||||
|
||||
function initLoginGUI() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating login GUI ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating login GUI ...`);
|
||||
login.window = mexui.window(getScreenWidth() / 2 - 150, getScreenHeight() / 2 - 135, 300, 275, 'LOGIN', {
|
||||
main: {
|
||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||
@@ -143,14 +143,14 @@ function initLoginGUI() {
|
||||
},
|
||||
});
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created login GUI`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created login GUI`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showLoginGUI() {
|
||||
closeAllWindows();
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing login window`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing login window`);
|
||||
setChatWindowEnabled(false);
|
||||
mexui.setInput(true);
|
||||
login.window.shown = true;
|
||||
@@ -164,14 +164,14 @@ function showLoginGUI() {
|
||||
// ===========================================================================
|
||||
|
||||
function checkLogin() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Checking login with server ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Checking login with server ...`);
|
||||
sendNetworkEventToServer("v.rp.checkLogin", login.passwordInput.lines[0]);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loginFailed(errorMessage) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Server reports login failed`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports login failed`);
|
||||
login.messageLabel.text = errorMessage;
|
||||
login.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
||||
login.passwordInput.text = "";
|
||||
@@ -180,7 +180,7 @@ function loginFailed(errorMessage) {
|
||||
// ===========================================================================
|
||||
|
||||
function loginSuccess() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Server reports login was successful`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports login was successful`);
|
||||
guiSubmitKey = false;
|
||||
closeAllWindows();
|
||||
}
|
||||
@@ -189,7 +189,7 @@ function loginSuccess() {
|
||||
|
||||
function switchToPasswordResetGUI() {
|
||||
//closeAllWindows();
|
||||
//logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing password reset dialog window`);
|
||||
//logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing password reset dialog window`);
|
||||
//showResetPasswordGUI();
|
||||
sendNetworkEventToServer("v.rp.checkResetPassword", "");
|
||||
return false;
|
||||
|
||||
@@ -19,7 +19,7 @@ let newCharacter = {
|
||||
// ===========================================================================
|
||||
|
||||
function initNewCharacterGUI() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating new character GUI ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating new character GUI ...`);
|
||||
newCharacter.window = mexui.window(getScreenWidth() / 2 - 150, getScreenHeight() / 2 - 115, 300, 230, 'NEW CHARACTER', {
|
||||
main: {
|
||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||
@@ -110,13 +110,13 @@ function initNewCharacterGUI() {
|
||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||
},
|
||||
}, checkNewCharacter);
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created new character GUI`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created new character GUI`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function newCharacterFailed(errorMessage) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Server reports new character creation failed. Reason: ${errorMessage}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports new character creation failed. Reason: ${errorMessage}`);
|
||||
newCharacter.messageLabel.text = errorMessage;
|
||||
newCharacter.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
||||
newCharacter.firstNameInput.text = "";
|
||||
@@ -134,7 +134,7 @@ function newCharacterFailed(errorMessage) {
|
||||
// ===========================================================================
|
||||
|
||||
function checkNewCharacter() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Checking new character with server ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Checking new character with server ...`);
|
||||
if (newCharacter.firstNameInput.lines[0].length < 2) {
|
||||
return false;
|
||||
}
|
||||
@@ -152,7 +152,7 @@ function checkNewCharacter() {
|
||||
// ===========================================================================
|
||||
|
||||
function showNewCharacterGUI() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing new character window`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing new character window`);
|
||||
closeAllWindows();
|
||||
setChatWindowEnabled(false);
|
||||
mexui.setInput(true);
|
||||
|
||||
@@ -20,7 +20,7 @@ let register = {
|
||||
// ===========================================================================
|
||||
|
||||
function initRegisterGUI() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating register GUI ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating register GUI ...`);
|
||||
register.window = mexui.window(getScreenWidth() / 2 - 150, getScreenHeight() / 2 - 150, 300, 300, 'Register', {
|
||||
main: {
|
||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||
@@ -130,13 +130,13 @@ function initRegisterGUI() {
|
||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||
},
|
||||
}, checkRegistration);
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created register GUI`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created register GUI`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function registrationFailed(errorMessage) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Server reports registration failed. Reason: ${errorMessage}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports registration failed. Reason: ${errorMessage}`);
|
||||
register.messageLabel.text = errorMessage;
|
||||
register.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
||||
register.passwordInput.text = "";
|
||||
@@ -147,14 +147,14 @@ function registrationFailed(errorMessage) {
|
||||
// ===========================================================================
|
||||
|
||||
function checkRegistration() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Checking registration with server ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Checking registration with server ...`);
|
||||
sendNetworkEventToServer("v.rp.checkRegistration", register.passwordInput.lines[0], register.confirmPasswordInput.lines[0], register.emailInput.lines[0]);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showRegistrationGUI() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing registration window`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing registration window`);
|
||||
closeAllWindows();
|
||||
setChatWindowEnabled(false);
|
||||
mexui.setInput(true);
|
||||
@@ -170,7 +170,7 @@ function showRegistrationGUI() {
|
||||
// ===========================================================================
|
||||
|
||||
function registrationSuccess() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Server reports registration was successful`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports registration was successful`);
|
||||
guiSubmitKey = false;
|
||||
closeAllWindows();
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ let passwordReset = {
|
||||
// ===========================================================================
|
||||
|
||||
function initResetPasswordGUI() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating password reset GUI ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating password reset GUI ...`);
|
||||
passwordReset.window = mexui.window(getScreenWidth() / 2 - 150, getScreenHeight() / 2 - 135, 300, 275, 'RESET PASSWORD', {
|
||||
main: {
|
||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||
@@ -120,14 +120,14 @@ function initResetPasswordGUI() {
|
||||
},
|
||||
});
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created password reset GUI`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created password reset GUI`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showResetPasswordGUI() {
|
||||
closeAllWindows();
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing password reset window`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing password reset window`);
|
||||
setChatWindowEnabled(false);
|
||||
mexui.setInput(true);
|
||||
passwordReset.window.shown = true;
|
||||
@@ -141,14 +141,14 @@ function showResetPasswordGUI() {
|
||||
// ===========================================================================
|
||||
|
||||
function checkResetPassword() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Checking password reset with server (${passwordReset.emailInput.lines[0]}) ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Checking password reset with server (${passwordReset.emailInput.lines[0]}) ...`);
|
||||
sendNetworkEventToServer("v.rp.checkResetPassword", passwordReset.emailInput.lines[0]);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function resetPasswordFailed(errorMessage) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Server reports password reset failed`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports password reset failed`);
|
||||
passwordReset.messageLabel.text = errorMessage;
|
||||
passwordReset.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
||||
passwordReset.emailInput.text = "";
|
||||
@@ -157,7 +157,7 @@ function resetPasswordFailed(errorMessage) {
|
||||
// ===========================================================================
|
||||
|
||||
function resetPasswordCodeInputGUI() {
|
||||
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.GUI] Server reports password reset email confirmation was successful. Asking for code ...`);
|
||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.GUI] Server reports password reset email confirmation was successful. Asking for code ...`);
|
||||
closeAllWindows();
|
||||
|
||||
passwordReset.messageLabel.text = getLocaleString("GUIResetPasswordCodeInputLabel");
|
||||
@@ -172,7 +172,7 @@ function resetPasswordCodeInputGUI() {
|
||||
// ===========================================================================
|
||||
|
||||
function resetPasswordEmailInputGUI() {
|
||||
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.GUI] Server reports password reset request was approved. Asking for email ...`);
|
||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.GUI] Server reports password reset request was approved. Asking for email ...`);
|
||||
closeAllWindows();
|
||||
|
||||
passwordReset.messageLabel.text = getLocaleString("GUIResetPasswordConfirmEmailLabel");
|
||||
|
||||
@@ -18,7 +18,7 @@ let yesNoDialog = {
|
||||
// ===========================================================================
|
||||
|
||||
function initYesNoDialogGUI() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created prompt GUI ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created prompt GUI ...`);
|
||||
yesNoDialog.window = mexui.window(game.width / 2 - 200, game.height / 2 - 70, 400, 140, 'Question', {
|
||||
main: {
|
||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||
@@ -73,14 +73,14 @@ function initYesNoDialogGUI() {
|
||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
|
||||
},
|
||||
}, yesNoDialogAnswerNo);
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created prompt GUI`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created prompt GUI`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showYesNoPromptGUI(promptMessage, promptTitle, yesButtonText, noButtonText) {
|
||||
closeAllWindows();
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing prompt window. Prompt: ${promptTitle} - ${promptMessage}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing prompt window. Prompt: ${promptTitle} - ${promptMessage}`);
|
||||
mexui.setInput(true);
|
||||
|
||||
yesNoDialog.messageLabel.text = "";
|
||||
@@ -99,7 +99,7 @@ function showYesNoPromptGUI(promptMessage, promptTitle, yesButtonText, noButtonT
|
||||
// ===========================================================================
|
||||
|
||||
function yesNoDialogAnswerNo() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Responding with answer NO to server prompt`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Responding with answer NO to server prompt`);
|
||||
sendNetworkEventToServer("v.rp.promptAnswerNo");
|
||||
closeAllWindows();
|
||||
}
|
||||
@@ -107,7 +107,7 @@ function yesNoDialogAnswerNo() {
|
||||
// ===========================================================================
|
||||
|
||||
function yesNoDialogAnswerYes() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.GUI] Responding with answer YES to server prompt`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Responding with answer YES to server prompt`);
|
||||
sendNetworkEventToServer("v.rp.promptAnswerYes");
|
||||
closeAllWindows();
|
||||
}
|
||||
|
||||
@@ -25,19 +25,10 @@ class HouseData {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function receiveHouseFromServer(houseId, isDeleted, description, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.House] Received house ${houseId} (${name}) from server`);
|
||||
function receiveHouseFromServer(houseId, description, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked) {
|
||||
logToConsole(LOG_DEBUG, `[AGRP.House] Received house ${houseId} (${name}) from server`);
|
||||
|
||||
if (!areServerElementsSupported() || getGame() == V_GAME_MAFIA_ONE || getGame() == V_GAME_GTA_IV) {
|
||||
if (isDeleted == true) {
|
||||
if (getGame() == V_GAME_GTA_IV) {
|
||||
natives.removeBlipAndClearIndex(getHouseData(houseId).blipId);
|
||||
}
|
||||
|
||||
getServerData().houses.splice(houseId, 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (getHouseData(houseId) != false) {
|
||||
let houseData = getHouseData(houseId);
|
||||
houseData.description = description;
|
||||
@@ -55,18 +46,14 @@ function receiveHouseFromServer(houseId, isDeleted, description, entrancePositio
|
||||
if (houseData.rentPrice > 0) {
|
||||
houseData.labelInfoType = V_PROPLABEL_INFO_RENTHOUSE;
|
||||
} else {
|
||||
if (houseData.hasInterior) {
|
||||
houseData.labelInfoType = V_PROPLABEL_INFO_ENTER;
|
||||
} else {
|
||||
houseData.labelInfoType = V_PROPLABEL_INFO_NONE;
|
||||
}
|
||||
houseData.labelInfoType = V_PROPLABEL_INFO_ENTER;
|
||||
}
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.House] House ${houseId} already exists. Checking blip ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.House] House ${houseId} already exists. Checking blip ...`);
|
||||
if (blipModel == -1) {
|
||||
if (houseData.blipId != -1) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.House] House ${houseId}'s blip has been removed by the server`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.House] House ${houseId}'s blip has been removed by the server`);
|
||||
if (getGame() == V_GAME_GTA_IV) {
|
||||
natives.removeBlipAndClearIndex(getHouseData(houseId).blipId);
|
||||
} else {
|
||||
@@ -74,11 +61,11 @@ function receiveHouseFromServer(houseId, isDeleted, description, entrancePositio
|
||||
}
|
||||
houseData.blipId = -1;
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.House] House ${houseId}'s blip is unchanged`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.House] House ${houseId}'s blip is unchanged`);
|
||||
}
|
||||
} else {
|
||||
if (houseData.blipId != -1) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.House] House ${houseId}'s blip has been changed by the server`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.House] House ${houseId}'s blip has been changed by the server`);
|
||||
if (getGame() == V_GAME_GTA_IV) {
|
||||
natives.setBlipCoordinates(houseData.blipId, houseData.entrancePosition);
|
||||
natives.changeBlipSprite(houseData.blipId, houseData.blipModel);
|
||||
@@ -91,20 +78,20 @@ function receiveHouseFromServer(houseId, isDeleted, description, entrancePositio
|
||||
if (blipId != -1) {
|
||||
houseData.blipId = blipId;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[V.RP.House] House ${houseId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.House] House ${houseId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.House] House ${houseId} doesn't exist. Adding ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.House] House ${houseId} doesn't exist. Adding ...`);
|
||||
let tempHouseData = new HouseData(houseId, description, entrancePosition, blipModel, pickupModel, hasInterior);
|
||||
if (blipModel != -1) {
|
||||
let blipId = createGameBlip(tempHouseData.blipModel, tempHouseData.entrancePosition, "House");
|
||||
if (blipId != -1) {
|
||||
tempHouseData.blipId = blipId;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[V.RP.House] House ${houseId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.House] House ${houseId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.House] House ${houseId} has no blip.`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.House] House ${houseId} has no blip.`);
|
||||
}
|
||||
getServerData().houses.push(tempHouseData);
|
||||
setAllHouseDataIndexes();
|
||||
@@ -137,10 +124,4 @@ function setAllHouseDataIndexes() {
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function removeHousesFromClient() {
|
||||
getServerData().houses.splice(0);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1,58 +0,0 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/v-roleplay
|
||||
// ===========================================================================
|
||||
// FILE: hud.js
|
||||
// DESC: Provides custom HUD functions and usage
|
||||
// TYPE: Client (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
let customHUDMoneyFont = null;
|
||||
let customHUDMoneyColour = toColour(200, 200, 200, 200);
|
||||
let customHUDMoneySize = 22.0;
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initCustomHUDScript() {
|
||||
logToConsole(LOG_DEBUG, "[V.RP.HUD]: Initializing HUD script ...");
|
||||
customHUDMoneyFont = initCustomHUDMoneyFont();
|
||||
logToConsole(LOG_DEBUG, "[V.RP.HUD]: HUD script initialized!");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function processCustomHUDRendering() {
|
||||
logToConsole(LOG_VERBOSE, "[V.RP.HUD]: Processing custom HUD rendering ...");
|
||||
|
||||
if (renderHUD == false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (getGame() == V_GAME_MAFIA_ONE) {
|
||||
if (customHUDMoneyFont != null) {
|
||||
let text = getCurrencyString(localPlayerMoney);
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.HUD]: Rendering custom HUD money (${text})...`);
|
||||
customHUDMoneyFont.render(text, [game.width - 150, 20], 130, 1.0, 0.0, customHUDMoneyFont.size, customHUDMoneyColour, true, true, false, true);
|
||||
} else {
|
||||
logToConsole(LOG_VERBOSE | LOG_ERROR, `[V.RP.HUD]: Rendering custom HUD money FAILED. Font object is null!`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initCustomHUDMoneyFont() {
|
||||
logToConsole(LOG_DEBUG, "[V.RP.HUD]: Loading custom HUD money font ...");
|
||||
let tempFont = null;
|
||||
let fontStream = openFile("files/fonts/aurora-bold-condensed.ttf");
|
||||
if (fontStream != null) {
|
||||
tempFont = lucasFont.createFont(fontStream, customHUDMoneySize);
|
||||
logToConsole(LOG_DEBUG, "[V.RP.HUD]: Custom HUD money font loaded successfully!");
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG | LOG_ERROR, "[V.RP.HUD]: Loading custom HUD money font FAILED. Font file stream is null!");
|
||||
}
|
||||
|
||||
return tempFont;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -47,7 +47,7 @@ function processItemActionRendering() {
|
||||
// ===========================================================================
|
||||
|
||||
function updatePlayerHotBar(activeSlot, itemsArray) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Main] Updating hotbar`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Main] Updating hotbar`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -42,21 +42,21 @@ function initJobScript() {
|
||||
// ===========================================================================
|
||||
|
||||
function setLocalPlayerJobType(tempJobType) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job] Set local player job type to ${tempJobType}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Set local player job type to ${tempJobType}`);
|
||||
localPlayerJobType = tempJobType;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setLocalPlayerWorkingState(tempWorking) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job] Setting working state to ${tempWorking}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Setting working state to ${tempWorking}`);
|
||||
localPlayerWorking = tempWorking;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showJobRouteLocation(position, colour) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job] Showing job route location at ${position.x}, ${position.y}, ${position.z}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Showing job route location at ${position.x}, ${position.y}, ${position.z}`);
|
||||
hideJobRouteLocation();
|
||||
if (getMultiplayerMod() == V_MPMOD_GTAC) {
|
||||
if (getGame() == V_GAME_GTA_SA) {
|
||||
@@ -80,7 +80,7 @@ function showJobRouteLocation(position, colour) {
|
||||
// ===========================================================================
|
||||
|
||||
function enteredJobRouteSphere() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job] Entered job route sphere`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Entered job route sphere`);
|
||||
hideJobRouteLocation();
|
||||
tellServerPlayerArrivedAtJobRouteLocation();
|
||||
}
|
||||
@@ -114,7 +114,7 @@ function blinkJobRouteLocationBlip(times, position, colour) {
|
||||
// ===========================================================================
|
||||
|
||||
function hideJobRouteLocation() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job] Hiding job route location`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Hiding job route location`);
|
||||
|
||||
if (jobRouteLocationBlip != null) {
|
||||
destroyElement(jobRouteLocationBlip);
|
||||
@@ -136,19 +136,10 @@ function hideJobRouteLocation() {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function receiveJobFromServer(jobId, isDeleted, jobLocationId, name, position, blipModel, pickupModel) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job] Received job ${jobId} (${name}) from server`);
|
||||
function receiveJobFromServer(jobId, jobLocationId, name, position, blipModel, pickupModel) {
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Received job ${jobId} (${name}) from server`);
|
||||
|
||||
if (!areServerElementsSupported() || getGame() == V_GAME_MAFIA_ONE || getGame() == V_GAME_GTA_IV) {
|
||||
if (isDeleted == true) {
|
||||
if (getGame() == V_GAME_GTA_IV) {
|
||||
natives.removeBlipAndClearIndex(getJobData(jobId).blipId);
|
||||
}
|
||||
|
||||
getServerData().jobs.splice(jobs, 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (getJobData(jobId) != false) {
|
||||
let jobData = getJobData(jobId);
|
||||
jobData.jobLocationId = jobLocationId;
|
||||
@@ -157,10 +148,10 @@ function receiveJobFromServer(jobId, isDeleted, jobLocationId, name, position, b
|
||||
jobData.blipModel = blipModel;
|
||||
jobData.pickupModel = pickupModel;
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job] Job ${jobId} already exists. Checking blip ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Job ${jobId} already exists. Checking blip ...`);
|
||||
if (blipModel == -1) {
|
||||
if (jobData.blipId != -1) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job] Job ${jobId}'s blip has been removed by the server`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Job ${jobId}'s blip has been removed by the server`);
|
||||
if (getGame() == V_GAME_GTA_IV) {
|
||||
natives.removeBlipAndClearIndex(getJobData(jobId).blipId);
|
||||
} else {
|
||||
@@ -168,11 +159,11 @@ function receiveJobFromServer(jobId, isDeleted, jobLocationId, name, position, b
|
||||
}
|
||||
jobData.blipId = -1;
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job] Job ${jobId}'s blip is unchanged`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Job ${jobId}'s blip is unchanged`);
|
||||
}
|
||||
} else {
|
||||
if (jobData.blipId != -1) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job] Job ${jobId}'s blip has been changed by the server`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Job ${jobId}'s blip has been changed by the server`);
|
||||
if (getGame() == V_GAME_GTA_IV) {
|
||||
natives.setBlipCoordinates(jobData.blipId, jobData.position);
|
||||
natives.changeBlipSprite(jobData.blipId, jobData.blipModel);
|
||||
@@ -185,20 +176,20 @@ function receiveJobFromServer(jobId, isDeleted, jobLocationId, name, position, b
|
||||
if (blipId != -1) {
|
||||
jobData.blipId = blipId;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job] Job ${jobId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Job ${jobId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job] Job ${jobId} doesn't exist. Adding ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Job ${jobId} doesn't exist. Adding ...`);
|
||||
let tempJobData = new JobData(jobId, jobLocationId, name, position, blipModel, pickupModel);
|
||||
if (blipModel != -1) {
|
||||
let blipId = createGameBlip(blipModel, tempJobData.position, tempJobData.name);
|
||||
if (blipId != -1) {
|
||||
tempJobData.blipId = blipId;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job] Job ${jobId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Job ${jobId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job] Job ${jobId} has no blip.`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Job ${jobId} has no blip.`);
|
||||
}
|
||||
getServerData().jobs.push(tempJobData);
|
||||
setAllJobDataIndexes();
|
||||
@@ -226,14 +217,8 @@ function getJobData(jobId) {
|
||||
|
||||
function setAllJobDataIndexes() {
|
||||
for (let i in getServerData().jobs) {
|
||||
getServerData().jobs[i].index = i;
|
||||
jobs[i].index = i;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function removeJobsFromClient() {
|
||||
getServerData().jobs.splice(0);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -23,7 +23,7 @@ function initKeyBindScript() {
|
||||
// ===========================================================================
|
||||
|
||||
function bindAccountKey(key, keyState) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.KeyBind]: Binded key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.KeyBind]: Binded key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
||||
keyBinds.push(toInteger(key));
|
||||
bindKey(toInteger(key), keyState, function (event) {
|
||||
if (isAnyGUIActive()) {
|
||||
@@ -32,14 +32,14 @@ function bindAccountKey(key, keyState) {
|
||||
|
||||
if (hasKeyBindDelayElapsed()) {
|
||||
if (canLocalPlayerUseKeyBinds()) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.KeyBind]: Using keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.KeyBind]: Using keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
||||
lastKeyBindUse = sdl.ticks;
|
||||
tellServerPlayerUsedKeyBind(key);
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.KeyBind]: Failed to use keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key}) - Not allowed to use keybinds!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.KeyBind]: Failed to use keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key}) - Not allowed to use keybinds!`);
|
||||
}
|
||||
} else {
|
||||
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!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.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) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.KeyBind]: Unbinded key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.KeyBind]: Unbinded key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
||||
unbindKey(key);
|
||||
keyBinds.splice(keyBinds.indexOf(key), 1);
|
||||
return true;
|
||||
|
||||
@@ -97,7 +97,7 @@ function renderPropertyEntranceLabel(name, position, locked, isBusiness, price,
|
||||
screenPosition = getScreenFromWorldPosition(position);
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Label] World [${position.x}, ${position.y}, ${position.z}] to screen [${screenPosition.x}, ${screenPosition.y}, ${screenPosition.z}]`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Label] World [${position.x}, ${position.y}, ${position.z}] to screen [${screenPosition.x}, ${screenPosition.y}, ${screenPosition.z}]`);
|
||||
|
||||
if (screenPosition.x < 0 || screenPosition.x > game.width) {
|
||||
return false;
|
||||
@@ -140,7 +140,7 @@ function renderPropertyEntranceLabel(name, position, locked, isBusiness, price,
|
||||
let infoText = "";
|
||||
switch (labelInfoType) {
|
||||
case V_PROPLABEL_INFO_ENTER: {
|
||||
if (enterPropertyKey != null) {
|
||||
if (enterPropertyKey) {
|
||||
infoText = getLocaleString("PropertyEnterKeyPressLabel", toUpperCase(getKeyNameFromId(enterPropertyKey)));
|
||||
} else {
|
||||
infoText = getLocaleString("PropertyEnterCommandLabel", "/enter");
|
||||
@@ -174,7 +174,7 @@ function renderPropertyEntranceLabel(name, position, locked, isBusiness, price,
|
||||
}
|
||||
|
||||
default: {
|
||||
if (enterPropertyKey != null) {
|
||||
if (enterPropertyKey) {
|
||||
infoText = getLocaleString("PropertyEnterKeyPressLabel", toUpperCase(getKeyNameFromId(enterPropertyKey)));
|
||||
} else {
|
||||
infoText = getLocaleString("PropertyEnterCommandLabel", "/enter");
|
||||
@@ -348,10 +348,10 @@ function processLabelRendering() {
|
||||
if (getGame() == V_GAME_GTA_IV || getGame() == V_GAME_GTA_IV_EFLC) {
|
||||
natives.drawColouredCylinder(getPosBelowPos(job.position, 1.0), 0.0, 0.0, 255, 255, 0, 255);
|
||||
}
|
||||
}
|
||||
|
||||
if (getDistance(localPlayer.position, job.position) <= propertyPickupRenderDistance) {
|
||||
renderJobLabel(job.name, job.position, job.jobType);
|
||||
}
|
||||
if (getDistance(localPlayer.position, job.position) <= 5.0) {
|
||||
renderJobLabel(job.name, job.position, job.jobType);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ function loadLocaleConfig() {
|
||||
function loadAllLocaleStrings() {
|
||||
let localeOptions = getServerData().localeOptions;
|
||||
for (let i in localeOptions) {
|
||||
logToConsole(LOG_INFO, `[V.RP.Locale] Loading locale strings for ${localeOptions[i].englishName} (${i})`);
|
||||
logToConsole(LOG_INFO, `[AGRP.Locale] Loading locale strings for ${localeOptions[i].englishName} (${i})`);
|
||||
let localeStringFile = loadTextFile(`locale/${localeOptions[i].stringsFile}`);
|
||||
let localeStringData = JSON.parse(localeStringFile);
|
||||
|
||||
@@ -60,7 +60,7 @@ function loadAllLocaleStrings() {
|
||||
// ===========================================================================
|
||||
|
||||
function setLocale(tempLocaleId) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Locale] Setting locale to ${tempLocaleId} (${getServerData().localeOptions[tempLocaleId].englishName})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Locale] Setting locale to ${tempLocaleId} (${getServerData().localeOptions[tempLocaleId].englishName})`);
|
||||
localLocaleId = tempLocaleId;
|
||||
resetGUIStrings();
|
||||
}
|
||||
@@ -53,7 +53,7 @@ function processLogoRendering() {
|
||||
// ===========================================================================
|
||||
|
||||
function setServerLogoRenderState(state) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Main] Server logo ${(state) ? "enabled" : "disabled"}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Main] Server logo ${(state) ? "enabled" : "disabled"}`);
|
||||
renderLogo = state;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ function loadBigGameMessageFont() {
|
||||
|
||||
fontStream = openFile("files/fonts/aurora-bold-condensed.ttf");
|
||||
if (fontStream != null) {
|
||||
tempBigGameMessageFonts["AuroraBdCnBT"] = lucasFont.createFont(fontStream, 28.0);
|
||||
tempBigGameMessageFonts["AuroraBdCnBT"] = lucasFont.createFont(fontStream, 20.0);
|
||||
fontStream.close();
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ function processSmallGameMessageRendering() {
|
||||
logToConsole(LOG_VERBOSE, "[V.RP.Messaging]: Processing small game message rendering ...");
|
||||
if (renderSmallGameMessage) {
|
||||
if (smallGameMessageText != "") {
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Messaging]: Rendering small game message: ${smallGameMessageText}`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Messaging]: Rendering small game message: ${smallGameMessageText}`);
|
||||
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);
|
||||
}
|
||||
@@ -89,7 +89,7 @@ function processSmallGameMessageRendering() {
|
||||
// ===========================================================================
|
||||
|
||||
function showSmallGameMessage(text, colour, duration, fontName) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Messaging] Showing small game message '${text}' using font ${fontName} for ${duration}ms`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Messaging] Showing small game message '${text}' using font ${fontName} for ${duration}ms`);
|
||||
if (smallGameMessageText != "") {
|
||||
clearTimeout(smallGameMessageTimer);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ function addAllNetworkHandlers() {
|
||||
|
||||
// Job
|
||||
addNetworkEventHandler("v.rp.job", receiveJobFromServer);
|
||||
addNetworkEventHandler("v.rp.removeJobs", removeJobsFromClient);
|
||||
addNetworkEventHandler("v.rp.working", setLocalPlayerWorkingState);
|
||||
addNetworkEventHandler("v.rp.jobType", setLocalPlayerJobType);
|
||||
addNetworkEventHandler("v.rp.showJobRouteLocation", showJobRouteLocation);
|
||||
@@ -65,7 +64,6 @@ function addAllNetworkHandlers() {
|
||||
|
||||
// Vehicle
|
||||
addNetworkEventHandler("v.rp.vehicle", receiveVehicleFromServer);
|
||||
addNetworkEventHandler("v.rp.removeVehicles", removeVehiclesFromClient);
|
||||
addNetworkEventHandler("v.rp.veh.lights", setVehicleLights);
|
||||
addNetworkEventHandler("v.rp.veh.engine", setVehicleEngine);
|
||||
addNetworkEventHandler("v.rp.veh.repair", repairVehicle);
|
||||
@@ -119,11 +117,9 @@ function addAllNetworkHandlers() {
|
||||
|
||||
// Business
|
||||
addNetworkEventHandler("v.rp.business", receiveBusinessFromServer);
|
||||
addNetworkEventHandler("v.rp.removeBusinesses", removeBusinessesFromClient);
|
||||
|
||||
// House
|
||||
addNetworkEventHandler("v.rp.house", receiveHouseFromServer);
|
||||
addNetworkEventHandler("v.rp.removeHouses", removeHousesFromClient);
|
||||
|
||||
// GPS
|
||||
addNetworkEventHandler("v.rp.showGPSBlip", showGPSLocation);
|
||||
@@ -192,7 +188,7 @@ function sendResourceStoppedSignalToServer() {
|
||||
// ===========================================================================
|
||||
|
||||
function set2DRendering(hudState, labelState, smallGameMessageState, scoreboardState, hotBarState, 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})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Main] Updating render states (HUD: ${hudState}, Labels: ${labelState}, Bottom Text: ${smallGameMessageState}, Scoreboard: ${scoreboardState}, HotBar: ${hotBarState}, Item Action Delay: ${itemActionDelayState})`);
|
||||
renderHUD = hudState;
|
||||
|
||||
if (getGame() == V_GAME_GTA_IV) {
|
||||
@@ -217,10 +213,9 @@ function set2DRendering(hudState, labelState, smallGameMessageState, scoreboardS
|
||||
// ===========================================================================
|
||||
|
||||
function onServerSpawnedLocalPlayer(state) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Main] Setting spawned state to ${state}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Main] Setting spawned state to ${state}`);
|
||||
isSpawned = state;
|
||||
setUpInitialGame();
|
||||
calledDeathEvent = false;
|
||||
if (state) {
|
||||
setTimeout(function () {
|
||||
calledDeathEvent = false;
|
||||
@@ -283,12 +278,7 @@ function anchorBoat(vehicleId) {
|
||||
// ===========================================================================
|
||||
|
||||
function setEnterPropertyKey(key) {
|
||||
if (key == -1) {
|
||||
enterPropertyKey = null;
|
||||
} else {
|
||||
enterPropertyKey = key;
|
||||
}
|
||||
|
||||
enterPropertyKey = key;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -346,7 +336,7 @@ function setLocalPlayerInfiniteRun(state) {
|
||||
// ===========================================================================
|
||||
|
||||
function setLocalPlayerSkin(skinId) {
|
||||
logToConsole(LOG_INFO, `[V.RP.Server] Setting locale player skin to ${skinId}`);
|
||||
logToConsole(LOG_INFO, `[AGRP.Server] Setting locale player skin to ${skinId}`);
|
||||
if (getGame() == V_GAME_GTA_IV) {
|
||||
if (natives.isModelInCdimage(skinId)) {
|
||||
natives.requestModel(skinId);
|
||||
@@ -389,17 +379,7 @@ function changeScene(sceneName) {
|
||||
natives.initCutscene(cutsceneName);
|
||||
}
|
||||
} else if (getGame() == V_GAME_MAFIA_ONE) {
|
||||
renderHUD = false;
|
||||
renderHotBar = false;
|
||||
renderInteriorLights = false;
|
||||
renderItemActionDelay = false;
|
||||
renderLabels = false;
|
||||
renderLogo = false;
|
||||
renderScoreBoard = false;
|
||||
renderSmallGameMessage = false;
|
||||
setTimeout(function () {
|
||||
game.changeMap(sceneName, false);
|
||||
}, 250);
|
||||
game.changeMap(sceneName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ function initClientScripts() {
|
||||
initEventScript();
|
||||
initSkinSelectScript();
|
||||
initCursorScript();
|
||||
initCustomHUDScript();
|
||||
|
||||
addAllNetworkHandlers();
|
||||
}
|
||||
@@ -191,8 +190,8 @@ function setUpInitialGame() {
|
||||
// Some last steps
|
||||
//natives.loadAllObjectsNow();
|
||||
} else if (getGame() == V_GAME_MAFIA_ONE) {
|
||||
game.mapEnabled = true;
|
||||
//game.setTrafficEnabled(false);
|
||||
game.mapEnabled = false;
|
||||
game.setTrafficEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,27 +19,24 @@ function processSync(event, deltaTime) {
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
if (calledDeathEvent == false) {
|
||||
if (localPlayer.health <= 0) {
|
||||
if (!calledDeathEvent) {
|
||||
logToConsole(LOG_DEBUG, `Local player died`);
|
||||
localPlayer.clearWeapons();
|
||||
calledDeathEvent = true;
|
||||
sendNetworkEventToServer("v.rp.playerDeath");
|
||||
}
|
||||
if (localPlayer.health <= 0) {
|
||||
if (!calledDeathEvent) {
|
||||
logToConsole(LOG_DEBUG, `Local player died`);
|
||||
localPlayer.clearWeapons();
|
||||
calledDeathEvent = true;
|
||||
sendNetworkEventToServer("v.rp.playerDeath");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if (localPlayer.health <= 0) {
|
||||
// if (!calledDeathEvent) {
|
||||
// logToConsole(LOG_DEBUG, `Local player died`);
|
||||
// localPlayer.clearWeapons();
|
||||
// calledDeathEvent = true;
|
||||
// sendNetworkEventToServer("v.rp.playerDeath");
|
||||
// }
|
||||
//}
|
||||
if (localPlayer.health <= 0) {
|
||||
if (!calledDeathEvent) {
|
||||
logToConsole(LOG_DEBUG, `Local player died`);
|
||||
localPlayer.clearWeapons();
|
||||
calledDeathEvent = true;
|
||||
sendNetworkEventToServer("v.rp.playerDeath");
|
||||
}
|
||||
}
|
||||
|
||||
if (streamingRadioElement) {
|
||||
//streamingRadio.volume = getStreamingRadioVolumeForPosition(streamingRadio.position);
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
// ===========================================================================
|
||||
|
||||
function setLocalPlayerFrozenState(state) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Setting frozen state to ${state}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Setting frozen state to ${state}`);
|
||||
gui.showCursor(state, !state);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setLocalPlayerControlState(controlState, cursorState = false) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Setting control state to ${controlState} (Cursor: ${cursorState})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Setting control state to ${controlState} (Cursor: ${cursorState})`);
|
||||
controlsEnabled = controlState;
|
||||
game.setPlayerControl(controlState);
|
||||
if (getGame() == V_GAME_GTA_III || getGame() == V_GAME_GTA_VC) {
|
||||
@@ -29,14 +29,14 @@ function setLocalPlayerControlState(controlState, cursorState = false) {
|
||||
// ===========================================================================
|
||||
|
||||
function fadeLocalCamera(state, duration, colour) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Fading camera ${(state) ? "in" : "out"} for ${duration}ms`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Fading camera ${(state) ? "in" : "out"} for ${time}ms`);
|
||||
|
||||
cameraFadeDuration = duration;
|
||||
cameraFadeStart = sdl.ticks;
|
||||
cameraFadeEnabled = true;
|
||||
cameraFadeIn = state;
|
||||
cameraFadeColour = colour;
|
||||
cameraFadeAlpha = (state) ? 255 : 0;
|
||||
cameraFadeEnabled = true;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -48,7 +48,7 @@ function removeLocalPlayerFromVehicle() {
|
||||
// ===========================================================================
|
||||
|
||||
function restoreLocalCamera() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Camera restored`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Camera restored`);
|
||||
if (isGameFeatureSupported("customCamera")) {
|
||||
game.restoreCamera(true);
|
||||
}
|
||||
@@ -57,7 +57,7 @@ function restoreLocalCamera() {
|
||||
// ===========================================================================
|
||||
|
||||
function setLocalCameraLookAt(cameraPosition, cameraLookAt) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Set camera to look at [${cameraLookAt.x}, ${cameraLookAt.y}, ${cameraLookAt.z}] from [${cameraPosition.x}, ${cameraPosition.y}, ${cameraPosition.z}]`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Set camera to look at [${cameraLookAt.x}, ${cameraLookAt.y}, ${cameraLookAt.z}] from [${cameraPosition.x}, ${cameraPosition.y}, ${cameraPosition.z}]`);
|
||||
if (isCustomCameraSupported()) {
|
||||
game.setCameraLookAt(cameraPosition, cameraLookAt, true);
|
||||
}
|
||||
@@ -66,15 +66,15 @@ function setLocalCameraLookAt(cameraPosition, cameraLookAt) {
|
||||
// ===========================================================================
|
||||
|
||||
function clearLocalPlayerOwnedPeds() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Clearing all self-owned peds ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Clearing all self-owned peds ...`);
|
||||
clearSelfOwnedPeds();
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Utilities] All self-owned peds cleared`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] All self-owned peds cleared`);
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setCityAmbienceState(state, clearElements = false) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Ambient civilians and traffic ${(state) ? "enabled" : "disabled"}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Ambient civilians and traffic ${(state) ? "enabled" : "disabled"}`);
|
||||
game.setTrafficEnabled(state);
|
||||
|
||||
if (getMultiplayerMod() == V_MPMOD_GTAC) {
|
||||
@@ -134,7 +134,7 @@ function enterVehicleAsPassenger() {
|
||||
// ===========================================================================
|
||||
|
||||
function giveLocalPlayerWeapon(weaponId, ammo, active) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Giving weapon ${weaponId} with ${ammo} ammo`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Giving weapon ${weaponId} with ${ammo} ammo`);
|
||||
forceWeapon = weaponId;
|
||||
if (getGame() == V_GAME_MAFIA_ONE) {
|
||||
localPlayer.giveWeapon(weaponId, 0, ammo);
|
||||
@@ -155,7 +155,7 @@ function giveLocalPlayerWeapon(weaponId, ammo, active) {
|
||||
// ===========================================================================
|
||||
|
||||
function clearLocalPlayerWeapons(clearData) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Clearing weapons`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Clearing weapons`);
|
||||
localPlayer.clearWeapons();
|
||||
if (clearData == true) {
|
||||
forceWeapon = 0;
|
||||
@@ -173,7 +173,7 @@ function getClosestVehicle(pos) {
|
||||
// ===========================================================================
|
||||
|
||||
function setLocalPlayerPosition(position) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Setting position to ${position.x}, ${position.y}, ${position.z}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Setting position to ${position.x}, ${position.y}, ${position.z}`);
|
||||
if (typeof localPlayer.velocity != "undefined") {
|
||||
localPlayer.velocity = toVector3(0.0, 0.0, 0.0);
|
||||
}
|
||||
@@ -186,7 +186,7 @@ function setLocalPlayerPosition(position) {
|
||||
// ===========================================================================
|
||||
|
||||
function setLocalPlayerHeading(heading) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Setting heading to ${heading}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Setting heading to ${heading}`);
|
||||
if (typeof localPlayer.heading != "undefined") {
|
||||
localPlayer.heading = heading;
|
||||
}
|
||||
@@ -195,7 +195,7 @@ function setLocalPlayerHeading(heading) {
|
||||
// ===========================================================================
|
||||
|
||||
function setLocalPlayerInterior(interior) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Setting interior to ${interior}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Setting interior to ${interior}`);
|
||||
if (getMultiplayerMod() == V_MPMOD_GTAC) {
|
||||
if (!isGTAIV()) {
|
||||
localPlayer.interior = interior;
|
||||
@@ -224,11 +224,7 @@ function setLocalPlayerInterior(interior) {
|
||||
// ===========================================================================
|
||||
|
||||
function setSnowState(falling, ground, forceGround) {
|
||||
if (!isGameFeatureSupported("snow")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Setting falling snow to ${falling} and ground snow to ${ground}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Setting falling snow to ${falling} and ground snow to ${ground}`);
|
||||
snowing = falling;
|
||||
//snow.force = ground;
|
||||
//if (forceGround == true) {
|
||||
@@ -242,16 +238,13 @@ function setSnowState(falling, ground, forceGround) {
|
||||
// ===========================================================================
|
||||
|
||||
function setLocalPlayerHealth(health) {
|
||||
if (localPlayer == null) {
|
||||
return false;
|
||||
}
|
||||
localPlayer.health = health;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function playPedSpeech(pedName, speechId) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Making ${pedName}'s ped talk (${speechId})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Making ${pedName}'s ped talk (${speechId})`);
|
||||
if (getMultiplayerMod() == V_MPMOD_GTAC) {
|
||||
game.SET_CHAR_SAY(int, int);
|
||||
}
|
||||
@@ -260,7 +253,7 @@ function playPedSpeech(pedName, speechId) {
|
||||
// ===========================================================================
|
||||
|
||||
function clearLocalPedState() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Clearing local ped state`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Clearing local ped state`);
|
||||
localPlayer.clearObjective();
|
||||
}
|
||||
|
||||
@@ -274,7 +267,7 @@ function getWeaponSlot(weaponId) {
|
||||
|
||||
function setLocalPlayerDrunkEffect(amount, duration) {
|
||||
if (getMultiplayerMod() == V_MPMOD_GTAC) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Drunk effect set to ${amount} for ${duration} ms`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Drunk effect set to ${amount} for ${duration} ms`);
|
||||
drunkEffectAmount = 0;
|
||||
drunkEffectDurationTimer = setInterval(function () {
|
||||
drunkEffectAmount = drunkEffectAmount;
|
||||
@@ -292,13 +285,11 @@ function setLocalPlayerDrunkEffect(amount, duration) {
|
||||
// ===========================================================================
|
||||
|
||||
function getLocalPlayerVehicleSeat() {
|
||||
return inVehicleSeat;
|
||||
|
||||
//for (let i = 0; i <= 4; i++) {
|
||||
// if (localPlayer.vehicle.getOccupant(i) == localPlayer) {
|
||||
// return i;
|
||||
// }
|
||||
//}
|
||||
for (let i = 0; i <= 4; i++) {
|
||||
if (localPlayer.vehicle.getOccupant(i) == localPlayer) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -326,7 +317,7 @@ function clearSelfOwnedVehicles() {
|
||||
// ===========================================================================
|
||||
|
||||
function setMouseCameraState(state) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Utilities] ${(state) ? "Enabled" : "Disabled"} mouse camera`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] ${(state) ? "Enabled" : "Disabled"} mouse camera`);
|
||||
mouseCameraEnabled = state;
|
||||
SetStandardControlsEnabled(!mouseCameraEnabled);
|
||||
}
|
||||
@@ -334,28 +325,28 @@ function setMouseCameraState(state) {
|
||||
// ===========================================================================
|
||||
|
||||
function toggleMouseCursor() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Utilities] ${(!gui.cursorEnabled) ? "Enabled" : "Disabled"} mouse cursor`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] ${(!gui.cursorEnabled) ? "Enabled" : "Disabled"} mouse cursor`);
|
||||
gui.showCursor(!gui.cursorEnabled, gui.cursorEnabled);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function toggleMouseCursor() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Utilities] ${(!gui.cursorEnabled) ? "Enabled" : "Disabled"} mouse cursor`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] ${(!gui.cursorEnabled) ? "Enabled" : "Disabled"} mouse cursor`);
|
||||
setMouseCameraState(!mouseCameraEnabled);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerWeaponDamageEvent(clientName, eventType) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Set ${clientName} damage event type to ${eventType}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Set ${clientName} damage event type to ${eventType}`);
|
||||
weaponDamageEvent[clientName] = eventType;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerWeaponDamageEnabled(clientName, state) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Utilities] ${(state) ? "Enabled" : "Disabled"} damage from ${clientName}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] ${(state) ? "Enabled" : "Disabled"} damage from ${clientName}`);
|
||||
weaponDamageEnabled[clientName] = state;
|
||||
}
|
||||
|
||||
@@ -410,9 +401,7 @@ function processLocalPlayerVehicleControlState() {
|
||||
if (localPlayer.vehicle != null) {
|
||||
if (doesEntityDataExist(localPlayer.vehicle, "v.rp.engine")) {
|
||||
if (getEntityData(localPlayer.vehicle, "v.rp.engine") == false) {
|
||||
if (localPlayer.vehicle.engine == true) {
|
||||
localPlayer.vehicle.engine = false;
|
||||
}
|
||||
localPlayer.vehicle.engine = false;
|
||||
//localPlayer.vehicle.netFlags.sendSync = false;
|
||||
if (!localPlayer.vehicle.engine) {
|
||||
if (typeof localPlayer.vehicle.velocity != "undefined") {
|
||||
@@ -481,7 +470,7 @@ function getVehicleForNetworkEvent(vehicle) {
|
||||
// ===========================================================================
|
||||
|
||||
function setMinuteDuration(minuteDuration) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Setting minute duration to ${minuteDuration}ms`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Setting minute duration to ${minuteDuration}ms`);
|
||||
|
||||
if (isTimeSupported()) {
|
||||
game.time.minuteDuration = minuteDuration;
|
||||
@@ -626,7 +615,7 @@ function updateLocalPlayerMoney() {
|
||||
// ===========================================================================
|
||||
|
||||
function setLocalPlayerMoney(amount) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Setting local player money`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Setting local player money`);
|
||||
localPlayerMoney = amount;
|
||||
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 = "") {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Vehicle] Received vehicle ${vehicleId} (${getVehicleNameFromModel(model, getGame())}) from server`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Vehicle] Received vehicle ${vehicleId} (${getVehicleNameFromModel(model, getGame())}) from server`);
|
||||
|
||||
if (getGame() != V_GAME_GTA_IV) {
|
||||
return false;
|
||||
@@ -52,7 +52,7 @@ function receiveVehicleFromServer(vehicleId, position, model, colour1, colour2,
|
||||
|
||||
let vehicle = natives.getVehicleFromNetworkId(vehicleId.ivNetworkId);
|
||||
} else {
|
||||
//logToConsole(LOG_DEBUG, `[V.RP.Vehicle] Vehicle ${vehicleId} doesn't exist. Adding ...`);
|
||||
//logToConsole(LOG_DEBUG, `[AGRP.Vehicle] Vehicle ${vehicleId} doesn't exist. Adding ...`);
|
||||
//let tempVehicleData = new VehicleData(vehicleId, name, position, blipModel, pickupModel);
|
||||
|
||||
//vehicles.push(tempVehicleData);
|
||||
@@ -163,12 +163,4 @@ function getVehicleSpeed(vehicle) {
|
||||
return speed;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function removeVehiclesFromClient() {
|
||||
// Need to destroy elements before clearing array
|
||||
|
||||
getServerData().vehicles.splice(0);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -284,31 +284,31 @@ function toggleAccountGUICommand(command, params, client) {
|
||||
if (doesPlayerHaveGUIEnabled(client)) {
|
||||
getPlayerData(client).accountData.settings = addBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
||||
messagePlayerNormal(client, getLocaleString(client, "GUIAccountSettingToggle", `{softRed}${toUpperCase(getLocaleString(client, "Off"))}{MAINCOLOUR}`));
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} has toggled GUI for their account OFF.`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has toggled GUI for their account OFF.`);
|
||||
} else {
|
||||
getPlayerData(client).accountData.settings = removeBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
||||
messagePlayerNormal(client, getLocaleString(client, "GUIAccountSettingToggle", `{softGreen}${toUpperCase(getLocaleString(client, "On"))}{MAINCOLOUR}`));
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} has toggled GUI for their account ON.`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has toggled GUI for their account ON.`);
|
||||
}
|
||||
|
||||
if (!isPlayerLoggedIn(client)) {
|
||||
if (getPlayerData().accountData.databaseId != 0) {
|
||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
showPlayerLoginGUI(client);
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI`);
|
||||
} else {
|
||||
hideAllPlayerGUI(client);
|
||||
messagePlayerNormal(client, getLocaleString(client, "WelcomeBack", getServerName(), getPlayerName(client), "{ALTCOLOUR}/login{MAINCOLOUR}"));
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled)`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled)`);
|
||||
}
|
||||
} else {
|
||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
showPlayerRegistrationGUI(client);
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI`);
|
||||
} else {
|
||||
hideAllPlayerGUI(client);
|
||||
messagePlayerNormal(client, getLocaleString(client, "WelcomeNewPlayer", getServerName(), getPlayerName(client), "{ALTCOLOUR}/register{MAINCOLOUR}"));
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register message (GUI disabled)`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register message (GUI disabled)`);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -323,11 +323,11 @@ function toggleAccountLoginAttemptNotificationsCommand(command, params, client)
|
||||
if (doesPlayerHaveLoginAlertsEnabled(client)) {
|
||||
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`);
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} has toggled the login attempt email notifications OFF for their account`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has toggled the login attempt email notifications OFF for their account`);
|
||||
} else {
|
||||
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`);
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} has toggled the login attempt email notifications OFF for their account`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has toggled the login attempt email notifications OFF for their account`);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -341,14 +341,14 @@ function toggleAccountServerLogoCommand(command, params, client) {
|
||||
if (!doesPlayerHaveLogoEnabled(client)) {
|
||||
getPlayerData(client).accountData.settings = removeBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
||||
messagePlayerSuccess(client, getLocaleString(client, "AccountServerLogoSet", `${getBoolRedGreenInlineColour(true)}${getLocaleString(client, "On")}{MAINCOLOUR}`));
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} has toggled the server logo ON for their account`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has toggled the server logo ON for their account`);
|
||||
if (getServerConfig().showLogo) {
|
||||
updatePlayerShowLogoState(client, true);
|
||||
}
|
||||
} else {
|
||||
getPlayerData(client).accountData.settings = addBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
||||
messagePlayerSuccess(client, getLocaleString(client, "AccountServerLogoSet", `${getBoolRedGreenInlineColour(false)}${getLocaleString(client, "Off")}{MAINCOLOUR}`));
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} has toggled the server logo OFF for their account`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has toggled the server logo OFF for their account`);
|
||||
updatePlayerShowLogoState(client, false);
|
||||
}
|
||||
|
||||
@@ -377,11 +377,11 @@ function toggleAccountTwoFactorAuthCommand(command, params, client) {
|
||||
if (!doesPlayerHaveTwoFactorAuthEnabled(client)) {
|
||||
getPlayerData(client).accountData.settings = addBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
||||
messagePlayerSuccess(client, getLocaleString(client, "TwoFactorAuthSet", `${getBoolRedGreenInlineColour(true)}${getLocaleString(client, "On")}{MAINCOLOUR}`));
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} has toggled two-factor authentication ON for their account`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has toggled two-factor authentication ON for their account`);
|
||||
} else {
|
||||
getPlayerData(client).accountData.settings = removeBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
||||
messagePlayerSuccess(client, getLocaleString(client, "TwoFactorAuthSet", `${getBoolRedGreenInlineColour(false)}${toUpperCase(getLocaleString(client, "Off"))}{MAINCOLOUR}`));
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} has toggled two-factor authentication OFF for their account`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has toggled two-factor authentication OFF for their account`);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -828,7 +828,7 @@ function saltAccountInfo(name, password) {
|
||||
// ===========================================================================
|
||||
|
||||
function loginSuccess(client) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} successfully logged in.`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} successfully logged in.`);
|
||||
getPlayerData(client).loggedIn = true;
|
||||
|
||||
if (getPlayerData(client).loginTimeout != null) {
|
||||
@@ -839,7 +839,7 @@ function loginSuccess(client) {
|
||||
updateConnectionLogOnAuth(client, getPlayerData(client).accountData.databaseId);
|
||||
|
||||
if (doesPlayerHaveStaffPermission(client, "Developer") || doesPlayerHaveStaffPermission(client, "ManageServer")) {
|
||||
logToConsole(LOG_WARN, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} has needed permissions and is being given administrator access`);
|
||||
logToConsole(LOG_WARN, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has needed permissions and is being given administrator access`);
|
||||
setPlayerNativeAdminState(client, true);
|
||||
}
|
||||
|
||||
@@ -851,11 +851,11 @@ function loginSuccess(client) {
|
||||
}, 3500);
|
||||
|
||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the error GUI (not a tester).`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the error GUI (not a tester).`);
|
||||
showPlayerErrorGUI(client, getLocaleString(client, "NotATester"), getLocaleString(client, "AccessDenied"));
|
||||
return false;
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the "not a tester" error message (GUI disabled).`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the "not a tester" error message (GUI disabled).`);
|
||||
messagePlayerError(client, getLocaleString(client, "NotATester"));
|
||||
return false;
|
||||
}
|
||||
@@ -866,10 +866,10 @@ function loginSuccess(client) {
|
||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
showPlayerPrompt(client, getLocaleString(client, "NoCharactersGUIMessage"), getLocaleString(client, "NoCharactersGUIWindowTitle"), getLocaleString(client, "Yes"), getLocaleString(client, "No"));
|
||||
getPlayerData(client).promptType = V_PROMPT_CREATEFIRSTCHAR;
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the no characters prompt GUI`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the no characters prompt GUI`);
|
||||
} else {
|
||||
messagePlayerAlert(client, getLocaleString(client, "NoCharactersChatMessage", `{ALTCOLOUR}/newchar{MAINCOLOUR}`));
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the no characters message (GUI disabled)`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the no characters message (GUI disabled)`);
|
||||
}
|
||||
} else {
|
||||
showCharacterSelectToClient(client);
|
||||
@@ -935,10 +935,6 @@ function saveAccountToDatabase(accountData) {
|
||||
let dbQuery2 = queryDatabase(dbConnection, queryString2);
|
||||
freeDatabaseQuery(dbQuery2);
|
||||
|
||||
//saveAllAccountCommandAliasesToDatabase(accountData);
|
||||
//saveAllAccountStaffNotesToDatabase(accountData);
|
||||
//saveAllAccountKeyBindsToDatabase(accountData);
|
||||
|
||||
disconnectFromDatabase(dbConnection);
|
||||
return true;
|
||||
}
|
||||
@@ -1014,39 +1010,6 @@ function saveAccountStaffNotesDatabase(staffNoteData) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function saveAccountCommandAliasesToDatabase(commandAliasData) {
|
||||
let dbConnection = connectToDatabase();
|
||||
if (dbConnection) {
|
||||
let safeOriginalCommandName = escapeDatabaseString(dbConnection, commandAliasData.forCommand);
|
||||
let safeAliasCommandName = escapeDatabaseString(dbConnection, commandAliasData.aliasCommand);
|
||||
|
||||
let data = [
|
||||
["acct_cmd_for_cmd", safeOriginalCommandName],
|
||||
["acct_cmd_alias_cmd", safeAliasCommandName],
|
||||
["acct_cmd_deleted", boolToInt(commandAliasData.whoAdded)],
|
||||
["acct_cmd_when_added", commandAliasData.whenAdded],
|
||||
["acct_cmd_server", commandAliasData.server],
|
||||
["acct_cmd_acct", commandAliasData.account],
|
||||
];
|
||||
|
||||
let dbQuery = null;
|
||||
if (commandAliasData.databaseId == 0) {
|
||||
let queryString = createDatabaseInsertQuery("acct_cmd", data);
|
||||
dbQuery = queryDatabase(dbConnection, queryString);
|
||||
commandAliasData.databaseId = getDatabaseInsertId(dbConnection);
|
||||
} else {
|
||||
let queryString = createDatabaseUpdateQuery("acct_cmd", data, `acct_cmd_id=${commandAliasData.databaseId}`);
|
||||
dbQuery = queryDatabase(dbConnection, queryString);
|
||||
}
|
||||
|
||||
commandAliasData.needsSaved = false;
|
||||
freeDatabaseQuery(dbQuery);
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/*
|
||||
function saveAccountContactsToDatabase(accountContactData) {
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -1070,7 +1033,7 @@ function saveAccountContactsToDatabase(accountContactData) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function createAccount(name, password, email = "") {
|
||||
async function createAccount(name, password, email = "") {
|
||||
let dbConnection = connectToDatabase();
|
||||
|
||||
if (dbConnection) {
|
||||
@@ -1105,7 +1068,7 @@ function checkLogin(client, password) {
|
||||
}
|
||||
|
||||
if (isPlayerLoggedIn(client)) {
|
||||
logToConsole(LOG_WARN, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} attempted to login but is already logged in`);
|
||||
logToConsole(LOG_WARN, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} attempted to login but is already logged in`);
|
||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
showPlayerLoginSuccessGUI(client);
|
||||
} else {
|
||||
@@ -1116,25 +1079,25 @@ function checkLogin(client, password) {
|
||||
}
|
||||
|
||||
if (!isPlayerRegistered(client)) {
|
||||
logToConsole(LOG_WARN, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} attempted to login but is not registered`);
|
||||
logToConsole(LOG_WARN, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} attempted to login but is not registered`);
|
||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
showPlayerRegistrationGUI(client);
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI`);
|
||||
} else {
|
||||
messagePlayerError(client, "Your name is not registered! Use /register to make an account.");
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register message (GUI disabled)`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register message (GUI disabled)`);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (areParamsEmpty(password)) {
|
||||
logToConsole(LOG_WARN, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} attempted to login but failed (empty password). ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining`);
|
||||
logToConsole(LOG_WARN, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} attempted to login but failed (empty password). ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining`);
|
||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
showPlayerLoginFailedGUI(client, getLocaleString(client, "LoginFailedInvalidPassword", getPlayerData(client).loginAttemptsRemaining));
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
|
||||
} else {
|
||||
messagePlayerError(client, getLocaleString(client, "LoginFailedNoPassword", getPlayerData(client).loginAttemptsRemaining));
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled) with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.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.
|
||||
@@ -1145,13 +1108,13 @@ function checkLogin(client, password) {
|
||||
}
|
||||
|
||||
if (!isAccountPasswordCorrect(getPlayerData(client).accountData, hashAccountPassword(getPlayerName(client), password))) {
|
||||
logToConsole(LOG_WARN, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} attempted to login but failed (wrong password). ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining`);
|
||||
logToConsole(LOG_WARN, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} attempted to login but failed (wrong password). ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining`);
|
||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
showPlayerLoginFailedGUI(client, getLocaleString(client, "LoginFailedInvalidPassword", getPlayerData(client).loginAttemptsRemaining));
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
|
||||
} else {
|
||||
messagePlayerError(client, getLocaleString(client, "LoginFailedInvalidPassword", getPlayerData(client).loginAttemptsRemaining));
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled) with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.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.
|
||||
@@ -1184,7 +1147,7 @@ function checkLogin(client, password) {
|
||||
// ===========================================================================
|
||||
|
||||
function checkRegistration(client, password, confirmPassword = "", emailAddress = "") {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account]: Checking registration for ${getPlayerName(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: Checking registration for ${getPlayerName(client)}`);
|
||||
|
||||
if (isPlayerRegistered(client)) {
|
||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
@@ -1305,11 +1268,11 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
|
||||
}, 5000);
|
||||
|
||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the error GUI (not a tester).`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the error GUI (not a tester).`);
|
||||
showPlayerErrorGUI(client, getLocaleString(client, "NotATester"), getLocaleString(client, "AccessDenied"));
|
||||
return false;
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the "not a tester" error message (GUI disabled).`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the "not a tester" error message (GUI disabled).`);
|
||||
messagePlayerError(client, getLocaleString(client, "NotATester"));
|
||||
return false;
|
||||
}
|
||||
@@ -1458,7 +1421,7 @@ function savePlayerToDatabase(client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account]: Saving client ${getPlayerName(client)} to database ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: Saving client ${getPlayerName(client)} to database ...`);
|
||||
saveAccountToDatabase(getPlayerData(client).accountData);
|
||||
|
||||
if (getPlayerData(client).currentSubAccount != -1) {
|
||||
@@ -1480,7 +1443,7 @@ function savePlayerToDatabase(client) {
|
||||
|
||||
saveSubAccountToDatabase(getPlayerCurrentSubAccount(client));
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account]: Saved client ${getPlayerDisplayForConsole(client)} to database successfully!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: Saved client ${getPlayerDisplayForConsole(client)} to database successfully!`);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1503,13 +1466,8 @@ function createDefaultAccountServerData(accountDatabaseId) {
|
||||
let dbConnection = connectToDatabase();
|
||||
let serversAssoc = fetchQueryAssoc(dbConnection, "SELECT * FROM svr_main");
|
||||
|
||||
let defaultSettings = 0;
|
||||
for (let i in getGlobalConfig().defaultEnabledAccountSettings) {
|
||||
defaultSettings = addBitFlag(defaultSettings, getAccountSettingsFlagValue(getGlobalConfig().defaultEnabledAccountSettings[i]));
|
||||
}
|
||||
|
||||
for (let i in serversAssoc) {
|
||||
let dbQueryString = `INSERT INTO acct_svr (acct_svr_acct, acct_svr_svr, acct_svr_settings) VALUES (${accountDatabaseId}, ${serversAssoc[i]["svr_id"]}, ${defaultSettings})`;
|
||||
let dbQueryString = `INSERT INTO acct_svr (acct_svr_acct, acct_svr_svr) VALUES (${accountDatabaseId}, ${serversAssoc[i]["svr_id"]})`;
|
||||
quickDatabaseQuery(dbQueryString);
|
||||
}
|
||||
|
||||
@@ -1519,7 +1477,7 @@ function createDefaultAccountServerData(accountDatabaseId) {
|
||||
// ===========================================================================
|
||||
|
||||
function loadAccountKeybindsFromDatabase(accountDatabaseID) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account]: Loading account keybinds for account ${accountDatabaseID} from database ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: Loading account keybinds for account ${accountDatabaseID} from database ...`);
|
||||
|
||||
let tempAccountKeybinds = [];
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -1542,21 +1500,21 @@ function loadAccountKeybindsFromDatabase(accountDatabaseID) {
|
||||
for (let i in dbAssoc) {
|
||||
let tempAccountKeyBindData = new KeyBindData(dbAssoc[i]);
|
||||
tempAccountKeybinds.push(tempAccountKeyBindData);
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account]: Account keybind '${tempAccountKeyBindData.databaseId}' (Key ${tempAccountKeyBindData.key} '${toUpperCase(getKeyNameFromId(tempAccountKeyBindData.key))}') loaded from database successfully!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: Account keybind '${tempAccountKeyBindData.databaseId}' (Key ${tempAccountKeyBindData.key} '${toUpperCase(getKeyNameFromId(tempAccountKeyBindData.key))}') loaded from database successfully!`);
|
||||
}
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account]: ${tempAccountKeybinds.length} account keybinds for account ${accountDatabaseID} loaded from database successfully!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: ${tempAccountKeybinds.length} account keybinds for account ${accountDatabaseID} loaded from database successfully!`);
|
||||
return tempAccountKeybinds;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadAccountStaffNotesFromDatabase(accountDatabaseID) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account]: Loading account staff notes for account ${accountDatabaseID} from database ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: Loading account staff notes for account ${accountDatabaseID} from database ...`);
|
||||
|
||||
let tempAccountStaffNotes = [];
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -1569,46 +1527,20 @@ function loadAccountStaffNotesFromDatabase(accountDatabaseID) {
|
||||
for (let i in dbAssoc) {
|
||||
let tempAccountStaffNoteData = new AccountStaffNoteData(dbAssoc[i]);
|
||||
tempAccountStaffNotes.push(tempAccountStaffNoteData);
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account]: Account staff note '${tempAccountStaffNoteData.databaseId}' loaded from database successfully!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: Account staff note '${tempAccountStaffNoteData.databaseId}' loaded from database successfully!`);
|
||||
}
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account]: ${tempAccountStaffNotes.length} account staff notes for account ${accountDatabaseID} loaded from database successfully!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: ${tempAccountStaffNotes.length} account staff notes for account ${accountDatabaseID} loaded from database successfully!`);
|
||||
return tempAccountStaffNotes;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadAccountCommandAliasesFromDatabase(accountDatabaseID) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account]: Loading account command aliases for account ${accountDatabaseID} from database ...`);
|
||||
|
||||
let tempAccountCommandAliases = [];
|
||||
let dbConnection = connectToDatabase();
|
||||
let dbAssoc = [];
|
||||
|
||||
if (dbConnection) {
|
||||
let dbQueryString = `SELECT * FROM acct_cmd WHERE acct_cmd_deleted = 0 AND acct_cmd_acct = ${accountDatabaseID}`;
|
||||
dbAssoc = fetchQueryAssoc(dbConnection, dbQueryString);
|
||||
if (dbAssoc.length > 0) {
|
||||
for (let i in dbAssoc) {
|
||||
let tempAccountCommandAliasData = new AccountCommandAliasData(dbAssoc[i]);
|
||||
tempAccountCommandAliases.push(tempAccountCommandAliasData);
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account]: Account command alias '${tempAccountCommandAliasData.databaseId}' loaded from database successfully!`);
|
||||
}
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account]: ${tempAccountCommandAliases.length} account command aliases for account ${accountDatabaseID} loaded from database successfully!`);
|
||||
return tempAccountCommandAliases;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadAccountContactsFromDatabase(accountDatabaseID) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account]: Loading account contacts for account ${accountDatabaseID} from database ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: Loading account contacts for account ${accountDatabaseID} from database ...`);
|
||||
|
||||
let tempAccountContacts = [];
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -1621,20 +1553,20 @@ function loadAccountContactsFromDatabase(accountDatabaseID) {
|
||||
for (let i in dbAssoc) {
|
||||
let tempAccountContactData = new AccountContactData(dbAssoc[i]);
|
||||
tempAccountContacts.push(tempAccountContactData);
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account]: Account contact '${tempAccountContactData.databaseId}' loaded from database successfully!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: Account contact '${tempAccountContactData.databaseId}' loaded from database successfully!`);
|
||||
}
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account]: ${tempAccountContacts.length} account contacts for account ${accountDatabaseID} loaded from database successfully!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: ${tempAccountContacts.length} account contacts for account ${accountDatabaseID} loaded from database successfully!`);
|
||||
return tempAccountContacts;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadAccountMessagesFromDatabase(accountDatabaseID) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account]: Loading account messages for account ${accountDatabaseID} from database ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: Loading account messages for account ${accountDatabaseID} from database ...`);
|
||||
|
||||
let tempAccountMessages = [];
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -1647,13 +1579,13 @@ function loadAccountMessagesFromDatabase(accountDatabaseID) {
|
||||
for (let i in dbAssoc) {
|
||||
let tempAccountMessageData = new AccountContactData(dbAssoc[i]);
|
||||
tempAccountMessages.push(tempAccountMessageData);
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account]: Account contact '${tempAccountMessageData.databaseId}' loaded from database successfully!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: Account contact '${tempAccountMessageData.databaseId}' loaded from database successfully!`);
|
||||
}
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account]: ${tempAccountMessages.length} account messages for account ${accountDatabaseID} loaded from database successfully!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: ${tempAccountMessages.length} account messages for account ${accountDatabaseID} loaded from database successfully!`);
|
||||
return tempAccountMessages;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,12 +29,6 @@ function playPlayerAnimationCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!getAnimationData(animationSlot)) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidAnimation"));
|
||||
messagePlayerInfo(client, getLocaleString(client, "AnimationCommandTip", `{ALTCOLOUR}/animlist{MAINCOLOUR}`));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (toInteger(animationPositionOffset) < 0 || toInteger(animationPositionOffset) > 3) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidAnimationDistance"));
|
||||
return false;
|
||||
|
||||
@@ -65,7 +65,7 @@ function accountBanCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_WARN, `[V.RP.Ban]: ${getPlayerDisplayForConsole(targetClient)} (${getPlayerData(targetClient).accountData.name}) account was banned by ${getPlayerDisplayForConsole(client)}. Reason: ${reason}`);
|
||||
logToConsole(LOG_WARN, `[AGRP.Ban]: ${getPlayerDisplayForConsole(targetClient)} (${getPlayerData(targetClient).accountData.name}) account was banned by ${getPlayerDisplayForConsole(client)}. Reason: ${reason}`);
|
||||
|
||||
announceAdminAction(`PlayerAccountBanned`, `{ALTCOLOUR}${getPlayerName(targetClient)}{MAINCOLOUR}`);
|
||||
banAccount(getPlayerData(targetClient).accountData.databaseId, getPlayerData(client).accountData.databaseId, reason);
|
||||
@@ -97,7 +97,7 @@ function subAccountBanCommand(command, params, client, fromDiscord) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_WARN, `[V.RP.Ban]: ${getPlayerDisplayForConsole(targetClient)} (${getPlayerData(targetClient).accountData.name})'s subaccount was banned by ${getPlayerDisplayForConsole(client)}. Reason: ${reason}`);
|
||||
logToConsole(LOG_WARN, `[AGRP.Ban]: ${getPlayerDisplayForConsole(targetClient)} (${getPlayerData(targetClient).accountData.name})'s subaccount was banned by ${getPlayerDisplayForConsole(client)}. Reason: ${reason}`);
|
||||
|
||||
announceAdminAction(`PlayerCharacterBanned`, `{ALTCOLOUR}${getPlayerName(targetClient)}{MAINCOLOUR}`);
|
||||
banSubAccount(getPlayerData(targetClient).currentSubAccountData.databaseId, getPlayerData(client).accountData.databaseId, reason);
|
||||
|
||||
@@ -227,21 +227,21 @@ function loadBusinessesFromDatabase() {
|
||||
tempBusinessData.locations = loadBusinessLocationsFromDatabase(tempBusinessData.databaseId);
|
||||
//tempBusinessData.gameScripts = loadBusinessGameScriptsFromDatabase(tempBusinessData.databaseId);
|
||||
tempBusinesses.push(tempBusinessData);
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Business]: Business '${tempBusinessData.name}' (ID ${tempBusinessData.databaseId}) loaded from database successfully!`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Business]: Business '${tempBusinessData.name}' (ID ${tempBusinessData.databaseId}) loaded from database successfully!`);
|
||||
}
|
||||
}
|
||||
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
|
||||
logToConsole(LOG_INFO, `[V.RP.Business]: ${tempBusinesses.length} businesses loaded from database successfully!`);
|
||||
logToConsole(LOG_INFO, `[AGRP.Business]: ${tempBusinesses.length} businesses loaded from database successfully!`);
|
||||
return tempBusinesses;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadBusinessLocationsFromDatabase(businessId) {
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Business]: Loading business locations for business ${businessId} from database ...`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Business]: Loading business locations for business ${businessId} from database ...`);
|
||||
|
||||
let tempBusinessLocations = [];
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -255,13 +255,13 @@ function loadBusinessLocationsFromDatabase(businessId) {
|
||||
for (let i in dbAssoc) {
|
||||
let tempBusinessLocationData = new BusinessLocationData(dbAssoc[i]);
|
||||
tempBusinessLocations.push(tempBusinessLocationData);
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Business]: Location '${tempBusinessLocationData.name}' loaded from database successfully!`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Business]: Location '${tempBusinessLocationData.name}' loaded from database successfully!`);
|
||||
}
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Business]: ${tempBusinessLocations.length} location for business ${businessId} loaded from database successfully!`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Business]: ${tempBusinessLocations.length} location for business ${businessId} loaded from database successfully!`);
|
||||
return tempBusinessLocations;
|
||||
}
|
||||
|
||||
@@ -269,7 +269,7 @@ function loadBusinessLocationsFromDatabase(businessId) {
|
||||
|
||||
/*
|
||||
function loadBusinessGameScriptsFromDatabase(businessId) {
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Business]: Loading business game scripts for business ${businessId} from database ...`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Business]: Loading business game scripts for business ${businessId} from database ...`);
|
||||
|
||||
let tempBusinessGameScripts = [];
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -284,13 +284,13 @@ function loadBusinessGameScriptsFromDatabase(businessId) {
|
||||
for (let i in dbAssoc) {
|
||||
let tempBusinessGameScriptData = new BusinessGameScriptData(dbAssoc[i]);
|
||||
tempBusinessGameScripts.push(tempBusinessGameScriptData);
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Business]: Game script '${tempBusinessGameScriptData.name}' loaded from database successfully!`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Business]: Game script '${tempBusinessGameScriptData.name}' loaded from database successfully!`);
|
||||
}
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Business]: ${tempBusinessGameScripts.length} game scripts for business ${businessId} loaded from database successfully!`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Business]: ${tempBusinessGameScripts.length} game scripts for business ${businessId} loaded from database successfully!`);
|
||||
return tempBusinessGameScripts;
|
||||
}
|
||||
*/
|
||||
@@ -382,8 +382,8 @@ function createBusiness(name, entrancePosition, exitPosition, entrancePickupMode
|
||||
setBusinessDataIndexes();
|
||||
saveAllBusinessesToDatabase();
|
||||
|
||||
spawnBusinessPickups(businessId - 1);
|
||||
spawnBusinessBlips(businessId - 1);
|
||||
createBusinessPickups(businessId - 1);
|
||||
createBusinessBlips(businessId - 1);
|
||||
|
||||
return tempBusinessData;
|
||||
}
|
||||
@@ -460,9 +460,8 @@ function setBusinessNameCommand(command, params, client) {
|
||||
|
||||
let oldBusinessName = getBusinessData(businessId).name;
|
||||
getBusinessData(businessId).name = newBusinessName;
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "v.rp.label.name", getBusinessData(businessId).name, true);
|
||||
getBusinessData(businessId).needsSaved = true;
|
||||
updateBusinessPickupLabelData(businessId);
|
||||
|
||||
messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} renamed business {businessBlue}${oldBusinessName}{MAINCOLOUR} to {businessBlue}${newBusinessName}`, true);
|
||||
}
|
||||
|
||||
@@ -504,7 +503,6 @@ function setBusinessOwnerCommand(command, params, client) {
|
||||
getBusinessData(businessId).ownerType = V_BIZ_OWNER_PLAYER;
|
||||
getBusinessData(businessId).ownerId = getPlayerCurrentSubAccount(newBusinessOwner).databaseId;
|
||||
getBusinessData(businessId).needsSaved = true;
|
||||
updateBusinessPickupLabelData(businessId);
|
||||
|
||||
messagePlayerSuccess(client, `{MAINCOLOUR}You gave business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} to {ALTCOLOUR}${getCharacterFullName(newBusinessOwner)}`);
|
||||
}
|
||||
@@ -547,7 +545,6 @@ function setBusinessJobCommand(command, params, client) {
|
||||
getBusinessData(businessId).ownerType = V_BIZ_OWNER_JOB;
|
||||
getBusinessData(businessId).ownerId = getJobData(jobId).databaseId;
|
||||
getBusinessData(businessId).needsSaved = true;
|
||||
updateBusinessPickupLabelData(businessId);
|
||||
|
||||
messagePlayerSuccess(client, `{MAINCOLOUR}You set the owner of business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} to the {jobYellow}${getJobData(jobId).name}`);
|
||||
}
|
||||
@@ -731,9 +728,8 @@ function setBusinessJobCommand(command, params, client) {
|
||||
|
||||
getBusinessData(businessId).ownerType = V_BIZ_OWNER_JOB;
|
||||
getBusinessData(businessId).ownerId = getJobData(jobId).databaseId;
|
||||
getBusinessData(businessId).needsSaved = true;
|
||||
updateBusinessPickupLabelData(businessId);
|
||||
|
||||
getBusinessData(businessId).needsSaved = true;
|
||||
messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}owner to the {jobYellow}${getJobData(jobId).name} {MAINCOLOUR}job`);
|
||||
}
|
||||
|
||||
@@ -762,9 +758,8 @@ function setBusinessPublicCommand(command, params, client) {
|
||||
|
||||
getBusinessData(businessId).ownerType = V_BIZ_OWNER_PUBLIC;
|
||||
getBusinessData(businessId).ownerId = 0;
|
||||
getBusinessData(businessId).needsSaved = true;
|
||||
updateBusinessPickupLabelData(businessId);
|
||||
|
||||
getBusinessData(businessId).needsSaved = true;
|
||||
messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}owner set to {ALTCOLOUR}public`);
|
||||
}
|
||||
|
||||
@@ -794,7 +789,6 @@ function removeBusinessOwnerCommand(command, params, client) {
|
||||
getBusinessData(businessId).ownerType = V_BIZ_OWNER_NONE;
|
||||
getBusinessData(businessId).ownerId = -1;
|
||||
getBusinessData(businessId).needsSaved = true;
|
||||
updateBusinessPickupLabelData(businessId);
|
||||
|
||||
messagePlayerSuccess(client, `{MAINCOLOUR}You removed business {businessBlue}${getBusinessData(businessId).name}'s{MAINCOLOUR} owner`);
|
||||
}
|
||||
@@ -825,8 +819,8 @@ function toggleBusinessInteriorLightsCommand(command, params, client) {
|
||||
|
||||
getBusinessData(businessId).interiorLights = !getBusinessData(businessId).interiorLights;
|
||||
updateBusinessInteriorLightsForOccupants(businessId);
|
||||
getBusinessData(businessId).needsSaved = true;
|
||||
|
||||
getBusinessData(businessId).needsSaved = true;
|
||||
meActionToNearbyPlayers(client, `turns ${toLowerCase(getOnOffFromBool(getBusinessData(businessId).interiorLights))} the business lights`);
|
||||
}
|
||||
|
||||
@@ -858,7 +852,6 @@ function setBusinessEntranceFeeCommand(command, params, client) {
|
||||
getBusinessData(businessId).entranceFee = entranceFee;
|
||||
getBusinessData(businessId).needsSaved = true;
|
||||
updateBusinessPickupLabelData(businessId);
|
||||
|
||||
messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} entrance fee to {ALTCOLOUR}${getCurrencyString(entranceFee)}`);
|
||||
}
|
||||
|
||||
@@ -888,8 +881,6 @@ function setBusinessPaintBallCommand(command, params, client) {
|
||||
|
||||
getBusinessData(businessId).type = V_BIZ_TYPE_PAINTBALL;
|
||||
getBusinessData(businessId).needsSaved = true;
|
||||
updateBusinessPickupLabelData(businessId);
|
||||
|
||||
messagePlayerSuccess(client, getLocaleString(client, "BusinessIsNowPaintBall"));
|
||||
}
|
||||
|
||||
@@ -1148,8 +1139,8 @@ function setBusinessInteriorTypeCommand(command, params, client) {
|
||||
|
||||
//deleteBusinessExitPickup(businessId);
|
||||
//deleteBusinessExitBlip(businessId);
|
||||
//spawnBusinessExitBlip(businessId);
|
||||
//spawnBusinessExitPickup(businessId);
|
||||
//createBusinessExitBlip(businessId);
|
||||
//createBusinessExitPickup(businessId);
|
||||
|
||||
resetBusinessPickups(businessId);
|
||||
|
||||
@@ -1207,8 +1198,8 @@ function addBusinessPropertyTemplateEntities(command, params, client) {
|
||||
|
||||
//deleteBusinessExitPickup(businessId);
|
||||
//deleteBusinessExitBlip(businessId);
|
||||
//spawnBusinessExitBlip(businessId);
|
||||
//spawnBusinessExitPickup(businessId);
|
||||
//createBusinessExitBlip(businessId);
|
||||
//createBusinessExitPickup(businessId);
|
||||
|
||||
resetBusinessPickups(businessId);
|
||||
|
||||
@@ -1310,7 +1301,6 @@ function giveDefaultItemsToBusinessCommand(command, params, client) {
|
||||
|
||||
cacheBusinessItems(businessId);
|
||||
updateBusinessPickupLabelData(businessId);
|
||||
|
||||
messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} gave business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} the default items for ${typeParam}`, true);
|
||||
}
|
||||
|
||||
@@ -1336,7 +1326,6 @@ function setBusinessDealershipCommand(command, params, client) {
|
||||
getBusinessData(businessId).labelHelpType == V_PROPLABEL_INFO_ENTERVEHICLE;
|
||||
getBusinessData(businessId).type = V_BIZ_TYPE_DEALERSHIP;
|
||||
updateBusinessPickupLabelData(businessId);
|
||||
|
||||
messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set the type of business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} to dealership`, true);
|
||||
}
|
||||
|
||||
@@ -1479,9 +1468,9 @@ function setBusinessBuyPriceCommand(command, params, client) {
|
||||
}
|
||||
|
||||
getBusinessData(businessId).buyPrice = amount;
|
||||
getBusinessData(businessId).needsSaved = true;
|
||||
updateBusinessPickupLabelData(businessId);
|
||||
setEntityData(getBusinessData(businessId).entrancePickup, "v.rp.label.price", getBusinessData(businessId).buyPrice, true);
|
||||
|
||||
getBusinessData(businessId).needsSaved = true;
|
||||
messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name}'s{MAINCOLOUR} for-sale price to {ALTCOLOUR}${getCurrencyString(amount)}`);
|
||||
}
|
||||
|
||||
@@ -1565,7 +1554,7 @@ function orderItemForBusinessCommand(command, params, client) {
|
||||
let value = getItemTypeData(itemType).orderValue;
|
||||
let businessId = getPlayerBusiness(client);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Business] ${getPlayerDisplayForConsole(client)} is ordering ${amount} ${splitParams.slice(0, -2).join(" ")}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Business] ${getPlayerDisplayForConsole(client)} is ordering ${amount} ${splitParams.slice(0, -2).join(" ")}`);
|
||||
|
||||
if (!getBusinessData(businessId)) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
|
||||
@@ -1584,14 +1573,23 @@ function orderItemForBusinessCommand(command, params, client) {
|
||||
getPlayerData(client).businessOrderBusiness = businessId;
|
||||
getPlayerData(client).businessOrderItem = itemType;
|
||||
getPlayerData(client).businessOrderCost = orderTotalCost;
|
||||
getBusinessData(businessId).needsSaved = true;
|
||||
|
||||
getBusinessData(businessId).needsSaved = true;
|
||||
showPlayerPrompt(client, `Ordering ${amount} ${getPluralForm(getItemTypeData(itemType).name)} will cost a total of ${getCurrencyString(orderTotalCost)}`, "Business Order Cost");
|
||||
getPlayerData(client).promptType = V_PROMPT_BIZORDER;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* This is a command handler function.
|
||||
*
|
||||
* @param {string} command - The command name used by the player
|
||||
* @param {string} params - The parameters/args string used with the command by the player
|
||||
* @param {Client} client - The client/player that used the command
|
||||
* @return {bool} Whether or not the command was successful
|
||||
*
|
||||
*/
|
||||
function orderItemForBusiness(businessId, itemType, amount) {
|
||||
if (getBusinessData(businessId).till < orderTotalCost) {
|
||||
let neededAmount = orderTotalCost - getBusinessData(businessId).till;
|
||||
@@ -1697,8 +1695,8 @@ function moveBusinessEntranceCommand(command, params, client) {
|
||||
|
||||
//deleteBusinessEntranceBlip(businessId);
|
||||
//deleteBusinessEntrancePickup(businessId);
|
||||
//spawnBusinessEntranceBlip(businessId);
|
||||
//spawnBusinessEntrancePickup(businessId);
|
||||
//createBusinessEntranceBlip(businessId);
|
||||
//createBusinessEntrancePickup(businessId);
|
||||
|
||||
resetBusinessPickups(businessId);
|
||||
resetBusinessBlips(businessId);
|
||||
@@ -1738,8 +1736,8 @@ function moveBusinessExitCommand(command, params, client) {
|
||||
deleteBusinessExitBlip(businessId);
|
||||
deleteBusinessExitPickup(businessId);
|
||||
|
||||
spawnBusinessExitBlip(businessId);
|
||||
spawnBusinessExitPickup(businessId);
|
||||
createBusinessExitBlip(businessId);
|
||||
createBusinessExitPickup(businessId);
|
||||
|
||||
getBusinessData(businessId).needsSaved = true;
|
||||
|
||||
@@ -1895,7 +1893,7 @@ function saveBusinessToDatabase(businessId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Business]: Saving business '${tempBusinessData.name}' to database ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Business]: Saving business '${tempBusinessData.name}' to database ...`);
|
||||
let dbConnection = connectToDatabase();
|
||||
if (dbConnection) {
|
||||
let safeBusinessName = escapeDatabaseString(dbConnection, tempBusinessData.name);
|
||||
@@ -1951,7 +1949,7 @@ function saveBusinessToDatabase(businessId) {
|
||||
disconnectFromDatabase(dbConnection);
|
||||
return true;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Business]: Saved business '${tempBusinessData.name}' to database!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Business]: Saved business '${tempBusinessData.name}' to database!`);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1964,14 +1962,14 @@ function saveBusinessToDatabase(businessId) {
|
||||
* @return {Boolean} Whether or not the server pickups were created
|
||||
*
|
||||
*/
|
||||
function spawnAllBusinessPickups() {
|
||||
function createAllBusinessPickups() {
|
||||
if (!getServerConfig().createBusinessPickups) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (let i in getServerData().businesses) {
|
||||
spawnBusinessEntrancePickup(i);
|
||||
spawnBusinessExitPickup(i);
|
||||
createBusinessEntrancePickup(i);
|
||||
createBusinessExitPickup(i);
|
||||
updateBusinessPickupLabelData(i);
|
||||
}
|
||||
|
||||
@@ -1986,7 +1984,7 @@ function spawnAllBusinessPickups() {
|
||||
* @return {Boolean} Whether or not the server blips were created
|
||||
*
|
||||
*/
|
||||
function spawnAllBusinessBlips() {
|
||||
function createAllBusinessBlips() {
|
||||
if (!getServerConfig().createBusinessBlips) {
|
||||
return false;
|
||||
}
|
||||
@@ -1996,8 +1994,8 @@ function spawnAllBusinessBlips() {
|
||||
}
|
||||
|
||||
for (let i in getServerData().businesses) {
|
||||
spawnBusinessEntranceBlip(i);
|
||||
spawnBusinessExitBlip(i);
|
||||
createBusinessEntranceBlip(i);
|
||||
createBusinessExitBlip(i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2010,7 +2008,7 @@ function spawnAllBusinessBlips() {
|
||||
* @return {Boolean} Whether or not the blip was created
|
||||
*
|
||||
*/
|
||||
function spawnBusinessEntrancePickup(businessId) {
|
||||
function createBusinessEntrancePickup(businessId) {
|
||||
if (!getServerConfig().createBusinessPickups) {
|
||||
return false;
|
||||
}
|
||||
@@ -2021,7 +2019,7 @@ function spawnBusinessEntrancePickup(businessId) {
|
||||
// return false;
|
||||
//}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Creating entrance pickup for business ${businessData.name}`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating entrance pickup for business ${businessData.name}`);
|
||||
|
||||
if (areServerElementsSupported() && getGame() != V_GAME_MAFIA_ONE && getGame() != V_GAME_GTA_IV) {
|
||||
let entrancePickup = null;
|
||||
@@ -2073,7 +2071,7 @@ function spawnBusinessEntrancePickup(businessId) {
|
||||
* @return {Boolean} Whether or not the blip was created
|
||||
*
|
||||
*/
|
||||
function spawnBusinessEntranceBlip(businessId) {
|
||||
function createBusinessEntranceBlip(businessId) {
|
||||
if (!getServerConfig().createBusinessBlips) {
|
||||
return false;
|
||||
}
|
||||
@@ -2098,7 +2096,7 @@ function spawnBusinessEntranceBlip(businessId) {
|
||||
blipModelId = businessData.entranceBlipModel;
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Creating entrance blip for business ${businessData.name} (model ${blipModelId})`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating entrance blip for business ${businessData.name} (model ${blipModelId})`);
|
||||
|
||||
if (areServerElementsSupported() && getGame() != V_GAME_MAFIA_ONE && getGame() != V_GAME_GTA_IV) {
|
||||
let entranceBlip = createGameBlip(businessData.entrancePosition, blipModelId, 1, getColourByType("businessBlue"));
|
||||
@@ -2131,7 +2129,7 @@ function spawnBusinessEntranceBlip(businessId) {
|
||||
* @return {Boolean} Whether or not the pickup was created
|
||||
*
|
||||
*/
|
||||
function spawnBusinessExitPickup(businessId) {
|
||||
function createBusinessExitPickup(businessId) {
|
||||
if (!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
@@ -2150,7 +2148,7 @@ function spawnBusinessExitPickup(businessId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Creating exit pickup for business ${businessData.name}`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating exit pickup for business ${businessData.name}`);
|
||||
|
||||
let exitPickup = null;
|
||||
if (isGameFeatureSupported("pickup")) {
|
||||
@@ -2193,7 +2191,7 @@ function spawnBusinessExitPickup(businessId) {
|
||||
* @return {Boolean} Whether or not the blip was created
|
||||
*
|
||||
*/
|
||||
function spawnBusinessExitBlip(businessId) {
|
||||
function createBusinessExitBlip(businessId) {
|
||||
if (!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
@@ -2222,7 +2220,7 @@ function spawnBusinessExitBlip(businessId) {
|
||||
blipModelId = businessData.exitBlipModel;
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Creating exit blip for business ${businessData.name} (model ${blipModelId})`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating exit blip for business ${businessData.name} (model ${blipModelId})`);
|
||||
|
||||
let exitBlip = createGameBlip(businessData.exitPosition, blipModelId, 1, getColourByName("businessBlue"));
|
||||
if (exitBlip != null) {
|
||||
@@ -2273,7 +2271,6 @@ function deleteBusiness(businessId, whoDeleted = 0) {
|
||||
removePlayersFromBusiness(businessId);
|
||||
|
||||
getServerData().businesses.splice(businessId, 1);
|
||||
updateBusinessPickupLabelData(businessId);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -2414,7 +2411,7 @@ function deleteBusinessEntrancePickup(businessId) {
|
||||
//removeFromWorld(getBusinessData(businessId).entrancePickup);
|
||||
deleteGameElement(getBusinessData(businessId).entrancePickup);
|
||||
getBusinessData(businessId).entrancePickup = null;
|
||||
updateBusinessPickupLabelData(businessId);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2513,8 +2510,8 @@ function reloadAllBusinessesCommand(command, params, client) {
|
||||
//forceAllPlayersToStopWorking();
|
||||
clearArray(getServerData().businesses);
|
||||
getServerData().businesses = loadBusinessesFromDatabase();
|
||||
spawnAllBusinessPickups();
|
||||
spawnAllBusinessBlips();
|
||||
createAllBusinessPickups();
|
||||
createAllBusinessBlips();
|
||||
setBusinessDataIndexes();
|
||||
cacheAllBusinessItems();
|
||||
|
||||
@@ -2844,11 +2841,11 @@ function cacheBusinessItems(businessId) {
|
||||
clearArray(getBusinessData(businessId).storageItemCache);
|
||||
|
||||
//let businessData = getBusinessData(businessId);
|
||||
//logToConsole(LOG_VERBOSE, `[V.RP.Business] Caching business items for business ${businessId} (${businessData.name}) ...`);
|
||||
//logToConsole(LOG_VERBOSE, `[AGRP.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).storageItemCache = getServerData().items.filter(item => item.ownerType == V_ITEM_OWNER_BIZSTORAGE && item.ownerId == businessData.databaseId);
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Business] Caching business items for business ${businessId} (${getBusinessData(businessId).name}) ...`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Business] Caching business items for business ${businessId} (${getBusinessData(businessId).name}) ...`);
|
||||
for (let i in getServerData().items) {
|
||||
if (getItemData(i).ownerType == V_ITEM_OWNER_BIZFLOOR && getItemData(i).ownerId == getBusinessData(businessId).databaseId) {
|
||||
getBusinessData(businessId).floorItemCache.push(i);
|
||||
@@ -2857,7 +2854,7 @@ function cacheBusinessItems(businessId) {
|
||||
}
|
||||
}
|
||||
|
||||
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})!`);
|
||||
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})!`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -2872,11 +2869,7 @@ function getBusinessIdFromDatabaseId(databaseId) {
|
||||
// Updates all pickup data for a business by businessId
|
||||
function updateBusinessPickupLabelData(businessId) {
|
||||
if (!areServerElementsSupported() || getGame() == V_GAME_MAFIA_ONE || getGame() == V_GAME_GTA_IV) {
|
||||
if (getBusinessData(businessId) == false) {
|
||||
sendBusinessToPlayer(null, businessId, true, "", false, -1, -1, 0, 0, false, false, false);
|
||||
} else {
|
||||
sendBusinessToPlayer(null, businessId, false, getBusinessData(businessId).name, getBusinessData(businessId).entrancePosition, getBusinessEntranceBlipModelForNetworkEvent(businessId), getBusinessEntrancePickupModelForNetworkEvent(businessId), getBusinessData(businessId).buyPrice, getBusinessData(businessId).rentPrice, getBusinessData(businessId).hasInterior, getBusinessData(businessId).locked, doesBusinessHaveAnyItemsToBuy(businessId));
|
||||
}
|
||||
sendBusinessToPlayer(null, businessId, getBusinessData(businessId).name, getBusinessData(businessId).entrancePosition, getBusinessEntranceBlipModelForNetworkEvent(businessId), getBusinessEntrancePickupModelForNetworkEvent(businessId), getBusinessData(businessId).buyPrice, getBusinessData(businessId).rentPrice, getBusinessData(businessId).hasInterior, getBusinessData(businessId).locked, doesBusinessHaveAnyItemsToBuy(businessId));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2933,24 +2926,24 @@ function updateBusinessPickupLabelData(businessId) {
|
||||
|
||||
function resetBusinessPickups(businessId) {
|
||||
deleteBusinessPickups(businessId);
|
||||
spawnBusinessEntrancePickup(businessId);
|
||||
spawnBusinessExitPickup(businessId);
|
||||
createBusinessEntrancePickup(businessId);
|
||||
createBusinessExitPickup(businessId);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function resetBusinessBlips(businessId) {
|
||||
deleteBusinessBlips(businessId);
|
||||
spawnBusinessEntranceBlip(businessId);
|
||||
spawnBusinessExitBlip(businessId);
|
||||
createBusinessEntranceBlip(businessId);
|
||||
createBusinessExitBlip(businessId);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function resetAllBusinessPickups(businessId) {
|
||||
deleteBusinessPickups(businessId);
|
||||
spawnBusinessEntrancePickup(businessId);
|
||||
spawnBusinessExitPickup(businessId);
|
||||
createBusinessEntrancePickup(businessId);
|
||||
createBusinessExitPickup(businessId);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -2958,15 +2951,15 @@ function resetAllBusinessPickups(businessId) {
|
||||
function resetAllBusinessBlips() {
|
||||
for (let i in getServerData().businesses) {
|
||||
deleteBusinessBlips(i);
|
||||
spawnBusinessBlips(i);
|
||||
createBusinessBlips(i);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function spawnBusinessBlips(businessId) {
|
||||
spawnBusinessEntranceBlip(businessId);
|
||||
spawnBusinessExitBlip(businessId);
|
||||
function createBusinessBlips(businessId) {
|
||||
createBusinessEntranceBlip(businessId);
|
||||
createBusinessExitBlip(businessId);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -2974,15 +2967,15 @@ function spawnBusinessBlips(businessId) {
|
||||
function resetAllBusinessPickups() {
|
||||
for (let i in getServerData().businesses) {
|
||||
deleteBusinessPickups(i);
|
||||
spawnBusinessPickups(i);
|
||||
createBusinessPickups(i);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function spawnBusinessPickups(businessId) {
|
||||
spawnBusinessEntrancePickup(businessId);
|
||||
spawnBusinessExitPickup(businessId);
|
||||
function createBusinessPickups(businessId) {
|
||||
createBusinessEntrancePickup(businessId);
|
||||
createBusinessExitPickup(businessId);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -7,17 +7,6 @@
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
const V_CHAT_TYPE_NONE = 0; // None (invalid)
|
||||
const V_CHAT_TYPE_GLOBAL = 1; // Global OOC
|
||||
const V_CHAT_TYPE_LOCAL = 2; // Local OOC
|
||||
const V_CHAT_TYPE_TALK = 3; // Local IC (normal talking)
|
||||
const V_CHAT_TYPE_SHOUT = 4; // Local IC (shouting)
|
||||
const V_CHAT_TYPE_WHISPER = 5; // Local IC (whispering)
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initChatScript() {
|
||||
logToConsole(LOG_INFO, "[V.RP.Chat]: Initializing chat script ...");
|
||||
logToConsole(LOG_INFO, "[V.RP.Chat]: Chat script initialized successfully!");
|
||||
@@ -49,17 +38,8 @@ function processPlayerChat(client, messageText) {
|
||||
}
|
||||
|
||||
messageText = messageText.substring(0, 128);
|
||||
|
||||
switch (getGlobalConfig().mainChatType) {
|
||||
case V_CHAT_TYPE_TALK:
|
||||
talkToNearbyPlayers(client, messageText);
|
||||
break;
|
||||
|
||||
case V_CHAT_TYPE_GLOBAL:
|
||||
default:
|
||||
chatToAllPlayers(client, messageTest);
|
||||
break;
|
||||
}
|
||||
messagePlayerNormal(null, `💬 ${getCharacterFullName(client)}: {MAINCOLOUR}${messageText}`, getPlayerColour(client));
|
||||
messageDiscordChatChannel(`💬 ${getCharacterFullName(client)}: ${messageText}`);
|
||||
} else {
|
||||
messagePlayerNormal(null, `🛡️ (ADMIN) - ${messageText}`);
|
||||
}
|
||||
@@ -267,7 +247,8 @@ function replyToLastPrivateMessageCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
messagePlayerPrivateMessage(getPlayerData(client).privateMessageReplyTo, client, params);
|
||||
getPlayerData(targetClient).privateMessageReplyTo = client;
|
||||
messagePlayerPrivateMessage(targetClient, client, messageText);
|
||||
|
||||
markPlayerActionTipSeen(client, "ReplyToDirectMessage");
|
||||
}
|
||||
@@ -435,11 +416,4 @@ function canPlayerUseMegaphone(client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function chatToAllPlayers(client, messageText) {
|
||||
messagePlayerNormal(null, `💬 ${getCharacterFullName(client)}: {MAINCOLOUR}${messageText}`, getPlayerColour(client));
|
||||
messageDiscordChatChannel(`💬 ${getCharacterFullName(client)}: ${messageText}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -132,13 +132,13 @@ function loadClansFromDatabase() {
|
||||
//tempClanData.members = loadClanMembersFromDatabase(tempClanData.databaseId);
|
||||
tempClanData.ranks = loadClanRanksFromDatabase(tempClanData.databaseId);
|
||||
tempClans.push(tempClanData);
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Clan]: Clan '${tempClanData.name}' loaded from database successfully!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Clan]: Clan '${tempClanData.name}' loaded from database successfully!`);
|
||||
}
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
|
||||
logToConsole(LOG_INFO, `[V.RP.Clan]: ${tempClans.length} clans loaded from database successfully!`);
|
||||
logToConsole(LOG_INFO, `[AGRP.Clan]: ${tempClans.length} clans loaded from database successfully!`);
|
||||
return tempClans;
|
||||
}
|
||||
|
||||
@@ -158,20 +158,20 @@ function loadClanMembersFromDatabase() {
|
||||
for (let i in dbAssoc) {
|
||||
let tempClanData = new ClanData(dbAssoc[i]);
|
||||
tempClans.push(tempClanData);
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Clan]: Clan '${tempClanData.name}' loaded from database successfully!`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Clan]: Clan '${tempClanData.name}' loaded from database successfully!`);
|
||||
}
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
|
||||
logToConsole(LOG_INFO, `[V.RP.Clan]: ${tempClans.length} clans loaded from database successfully!`);
|
||||
logToConsole(LOG_INFO, `[AGRP.Clan]: ${tempClans.length} clans loaded from database successfully!`);
|
||||
return tempClans;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadClanRanksFromDatabase(clanDatabaseId) {
|
||||
logToConsole(LOG_INFO, `[V.RP.Clan]: Loading ranks for clan ${clanDatabaseId} from database ...`);
|
||||
logToConsole(LOG_INFO, `[AGRP.Clan]: Loading ranks for clan ${clanDatabaseId} from database ...`);
|
||||
|
||||
let dbConnection = connectToDatabase();
|
||||
let dbAssoc = [];
|
||||
@@ -184,13 +184,13 @@ function loadClanRanksFromDatabase(clanDatabaseId) {
|
||||
for (let i in dbAssoc) {
|
||||
let tempClanRankData = new ClanRankData(dbAssoc[i]);
|
||||
tempClanRanks.push(tempClanRankData);
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Clan]: Clan rank '${tempClanRankData.name}' loaded from database successfully!`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Clan]: Clan rank '${tempClanRankData.name}' loaded from database successfully!`);
|
||||
}
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
|
||||
logToConsole(LOG_INFO, `[V.RP.Clan]: Loaded ranks for clan ${clanDatabaseId} from database successfully!`);
|
||||
logToConsole(LOG_INFO, `[AGRP.Clan]: Loaded ranks for clan ${clanDatabaseId} from database successfully!`);
|
||||
return tempClanRanks;
|
||||
}
|
||||
|
||||
@@ -1285,10 +1285,10 @@ function setClanRankTitle(clanId, rankId, title) {
|
||||
// ===========================================================================
|
||||
|
||||
function saveAllClansToDatabase() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Clan]: Saving all server clans to database ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Clan]: Saving all server clans to database ...`);
|
||||
|
||||
if (getServerConfig().devServer) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Clan]: Aborting save all clans to database, dev server is enabled.`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Clan]: Aborting save all clans to database, dev server is enabled.`);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1296,7 +1296,7 @@ function saveAllClansToDatabase() {
|
||||
saveClanToDatabase(i);
|
||||
}
|
||||
|
||||
logToConsole(LOG_INFO, `[V.RP.Clan]: Saved all server clans to database`);
|
||||
logToConsole(LOG_INFO, `[AGRP.Clan]: Saved all server clans to database`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -162,7 +162,7 @@ function initClientScript() {
|
||||
// ===========================================================================
|
||||
|
||||
function resetClientStuff(client) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Resetting client data for ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Resetting client data for ${getPlayerDisplayForConsole(client)}`);
|
||||
|
||||
if (!getPlayerData(client)) {
|
||||
return false;
|
||||
@@ -207,15 +207,15 @@ function kickAllClients() {
|
||||
// ===========================================================================
|
||||
|
||||
function initClient(client) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account] Initializing client ${getPlayerDisplayForConsole(client)} ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account] Initializing client ${getPlayerDisplayForConsole(client)} ...`);
|
||||
|
||||
if (isConsole(client)) {
|
||||
logToConsole(LOG_DEBUG | LOG_ERROR, `[V.RP.Account] Client initialization failed for ${getPlayerDisplayForConsole(client)}! (is console client)`);
|
||||
logToConsole(LOG_DEBUG | LOG_ERROR, `[AGRP.Account] Client initialization failed for ${getPlayerDisplayForConsole(client)}! (is console client)`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (playerInitialized[client.index] == true) {
|
||||
logToConsole(LOG_DEBUG | LOG_ERROR, `[V.RP.Account] Client initialization failed for ${getPlayerDisplayForConsole(client)}! (already initialized)`);
|
||||
logToConsole(LOG_DEBUG | LOG_ERROR, `[AGRP.Account] Client initialization failed for ${getPlayerDisplayForConsole(client)}! (already initialized)`);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -223,25 +223,25 @@ function initClient(client) {
|
||||
|
||||
//setEntityData(client, "v.rp.isInitialized", true, false);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account] Initializing GUI for ${getPlayerDisplayForConsole(client)} ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account] Initializing GUI for ${getPlayerDisplayForConsole(client)} ...`);
|
||||
sendPlayerCurrencyString(client);
|
||||
sendPlayerGUIColours(client);
|
||||
sendPlayerGUIInit(client);
|
||||
updatePlayerSnowState(client, getServerConfig().groundSnow);
|
||||
|
||||
//logToConsole(LOG_DEBUG, `[V.RP.Account] Showing connect camera to ${getPlayerDisplayForConsole(client)} ...`);
|
||||
//logToConsole(LOG_DEBUG, `[AGRP.Account] Showing connect camera to ${getPlayerDisplayForConsole(client)} ...`);
|
||||
//showConnectCameraToPlayer(client);
|
||||
|
||||
messageClient(`Please wait ...`, client, getColourByName("softGreen"));
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account] Waiting for 2.5 seconds to prevent race attack ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account] Waiting for 2.5 seconds to prevent race attack ...`);
|
||||
setTimeout(function () {
|
||||
if (client != null) {
|
||||
clearChatBox(client);
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account] Loading account for ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account] Loading account for ${getPlayerDisplayForConsole(client)}`);
|
||||
let tempAccountData = loadAccountFromName(getPlayerName(client), true);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account] Loading subaccounts for ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account] Loading subaccounts for ${getPlayerDisplayForConsole(client)}`);
|
||||
let tempSubAccounts = loadSubAccountsFromAccount(tempAccountData.databaseId);
|
||||
|
||||
getServerData().clients[getPlayerId(client)] = new ClientData(client, tempAccountData, tempSubAccounts);
|
||||
@@ -258,10 +258,10 @@ function initClient(client) {
|
||||
playRadioStreamForPlayer(client, getServerIntroMusicURL(), true, getPlayerStreamingRadioVolume(client));
|
||||
} else {
|
||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI.`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI.`);
|
||||
showPlayerLoginGUI(client);
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled).`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled).`);
|
||||
messagePlayerNormal(client, getLocaleString(client, "WelcomeBack", getServerName(), getPlayerName(client), "/login"), getColourByName("softGreen"));
|
||||
|
||||
if (checkForGeoIPModule()) {
|
||||
@@ -281,10 +281,10 @@ function initClient(client) {
|
||||
} else {
|
||||
sendPlayerLocaleId(client, 0);
|
||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI.`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI.`);
|
||||
showPlayerRegistrationGUI(client);
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register message (GUI disabled).`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register message (GUI disabled).`);
|
||||
messagePlayerNormal(client, getLocaleString(client, "WelcomeNewPlayer", getServerName(), getPlayerName(client), "/register"), getColourByName("softGreen"));
|
||||
}
|
||||
playRadioStreamForPlayer(client, getServerIntroMusicURL(), true, getPlayerStreamingRadioVolume(client));
|
||||
|
||||
@@ -454,8 +454,6 @@ function loadCommands() {
|
||||
new CommandData("language", setLocaleCommand, "<language name>", getStaffFlagValue("None"), true, false, "Sets your language"),
|
||||
new CommandData("locale", setLocaleCommand, "<language name>", getStaffFlagValue("None"), true, false, "Sets your language"),
|
||||
new CommandData("setlang", setLocaleCommand, "<language name>", getStaffFlagValue("None"), true, false, "Sets your language"),
|
||||
new CommandData("locales", showLocaleListCommand, "", getStaffFlagValue("None"), true, false, "Shows a list of available languages"),
|
||||
new CommandData("languages", showLocaleListCommand, "", getStaffFlagValue("None"), true, false, "Shows a list of available languages"),
|
||||
],
|
||||
messaging: [],
|
||||
misc: [
|
||||
@@ -705,24 +703,20 @@ function loadCommands() {
|
||||
// ===========================================================================
|
||||
|
||||
function addAllCommandHandlers() {
|
||||
if (!isGameFeatureSupported("commandHandler")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let commandCount = 0;
|
||||
let commands = getCommands();
|
||||
for (let i in commands) {
|
||||
for (let j in commands[i]) {
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Command] Adding command handler for ${i} - ${commands[i][j].command}`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Command] Adding command handler for ${i} - ${commands[i][j].command}`);
|
||||
addCommandHandler(commands[i][j].command, processPlayerCommand);
|
||||
commandCount++;
|
||||
}
|
||||
}
|
||||
|
||||
//removeCommandHandler("help");
|
||||
//addCommandHandler("help", helpCommand);
|
||||
removeCommandHandler("help");
|
||||
addCommandHandler("help", helpCommand);
|
||||
|
||||
logToConsole(LOG_INFO, `[V.RP.Command] ${commandCount} command handlers added!`);
|
||||
logToConsole(LOG_INFO, `[AGRP.Command] ${commandCount} command handlers added!`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -888,12 +882,6 @@ function processPlayerCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
let possibleAlias = getPlayerAliasForCommand(command);
|
||||
if (possibleAlias) {
|
||||
// Just change to the command the alias is for, then continue as normal
|
||||
command = possibleAlias.forCommand;
|
||||
}
|
||||
|
||||
let commandData = getCommand(toLowerCase(command));
|
||||
|
||||
let paramsDisplay = params;
|
||||
@@ -902,7 +890,7 @@ function processPlayerCommand(command, params, client) {
|
||||
}
|
||||
|
||||
if (!doesCommandExist(toLowerCase(command))) {
|
||||
logToConsole(LOG_WARN, `[V.RP.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (invalid command): /${command} ${paramsDisplay}`);
|
||||
logToConsole(LOG_WARN, `[AGRP.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (invalid command): /${command} ${paramsDisplay}`);
|
||||
|
||||
let possibleCommand = getCommandFromParams(command);
|
||||
if (possibleCommand != false && doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(toLowerCase(possibleCommand.command)))) {
|
||||
@@ -914,7 +902,7 @@ function processPlayerCommand(command, params, client) {
|
||||
}
|
||||
|
||||
if (!commandData.enabled) {
|
||||
logToConsole(LOG_WARN, `[V.RP.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (command is disabled): /${command} ${paramsDisplay}`);
|
||||
logToConsole(LOG_WARN, `[AGRP.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, getLocaleString(client, "CommandDisabled", `{ALTCOLOUR}/${command}{MAINCOLOUR}`));
|
||||
return false;
|
||||
@@ -922,7 +910,7 @@ function processPlayerCommand(command, params, client) {
|
||||
|
||||
if (doesCommandRequireLogin(toLowerCase(command))) {
|
||||
if (!isPlayerLoggedIn(client)) {
|
||||
logToConsole(LOG_WARN, `[V.RP.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (requires login first): /${command} ${paramsDisplay}`);
|
||||
logToConsole(LOG_WARN, `[AGRP.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (requires login first): /${command} ${paramsDisplay}`);
|
||||
messagePlayerError(client, getLocaleString(client, "CommandRequiresLogin", `{ALTCOLOUR}/${command}{MAINCOLOUR}`));
|
||||
return false;
|
||||
}
|
||||
@@ -930,7 +918,7 @@ function processPlayerCommand(command, params, client) {
|
||||
|
||||
if (isClientFromDiscord(client)) {
|
||||
if (!isCommandAllowedOnDiscord(command)) {
|
||||
logToConsole(LOG_WARN, `[V.RP.Command] ${getPlayerDisplayForConsole(client)} attempted to use command from discord, but failed (not available on discord): /${command} ${paramsDisplay}`);
|
||||
logToConsole(LOG_WARN, `[AGRP.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!`);
|
||||
return false;
|
||||
}
|
||||
@@ -938,13 +926,13 @@ function processPlayerCommand(command, params, client) {
|
||||
|
||||
if (!isConsole(client)) {
|
||||
if (!doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(toLowerCase(command)))) {
|
||||
logToConsole(LOG_WARN, `[V.RP.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (no permission): /${command} ${paramsDisplay}`);
|
||||
logToConsole(LOG_WARN, `[AGRP.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (no permission): /${command} ${paramsDisplay}`);
|
||||
messagePlayerError(client, getLocaleString(client, "CommandNoPermissions", `{ALTCOLOUR}/${toLowerCase(command)}{MAINCOLOUR}`));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Command] ${getPlayerDisplayForConsole(client)} used command: /${command} ${paramsDisplay}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Command] ${getPlayerDisplayForConsole(client)} used command: /${command} ${paramsDisplay}`);
|
||||
commandData.handlerFunction(toLowerCase(command), params, client);
|
||||
}
|
||||
|
||||
|
||||
@@ -125,8 +125,8 @@ class ServerConfigData {
|
||||
this.discordBotToken = intToBool(dbAssoc["svr_discord_bot_token"]);
|
||||
this.introMusicURL = dbAssoc["svr_intro_music"];
|
||||
|
||||
this.useRealTime = intToBool(toInteger(dbAssoc["svr_real_time"]));
|
||||
this.realTimeZone = toInteger(dbAssoc["svr_real_time_timezone"]);
|
||||
this.useRealTime = intToBool(toInteger(dbAssoc["svr_real_time_enabled"]));
|
||||
this.realTimeZone = dbAssoc["svr_real_time_timezone"];
|
||||
|
||||
this.discord = {
|
||||
sendEvents: intToBool(dbAssoc["svr_discord_send_events"]),
|
||||
@@ -140,8 +140,8 @@ class ServerConfigData {
|
||||
passiveIncome: toFloat(dbAssoc["svr_passive_income"]),
|
||||
}
|
||||
|
||||
this.devServer = intToBool(toInteger(server.getCVar("v_devserver")));
|
||||
this.testerOnly = intToBool(toInteger(server.getCVar("v_testeronly")));
|
||||
this.devServer = intToBool(toInteger(server.getCVar("agrp_devserver")));
|
||||
this.testerOnly = intToBool(toInteger(server.getCVar("agrp_testeronly")));
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -250,9 +250,6 @@ let globalConfig = {
|
||||
"ChatBoxTimestamps",
|
||||
"ChatEmoji",
|
||||
],
|
||||
mainChatType: V_CHAT_TYPE_TALK,
|
||||
nightMapStartHour: 19,
|
||||
nightMapEndHour: 7,
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
@@ -269,49 +266,49 @@ function loadGlobalConfig() {
|
||||
try {
|
||||
getGlobalConfig().database = loadDatabaseConfig();
|
||||
} catch (error) {
|
||||
logToConsole(LOG_ERROR, `[V.RP.Config] Failed to load global configuration. Error: ${error}`);
|
||||
logToConsole(LOG_ERROR, `[AGRP.Config] Failed to load global configuration. Error: ${error}`);
|
||||
thisResource.stop();
|
||||
}
|
||||
|
||||
try {
|
||||
getGlobalConfig().economy = loadEconomyConfig();
|
||||
} catch (error) {
|
||||
logToConsole(LOG_ERROR, `[V.RP.Config] Failed to load economy configuration. Error: ${error}`);
|
||||
logToConsole(LOG_ERROR, `[AGRP.Config] Failed to load economy configuration. Error: ${error}`);
|
||||
thisResource.stop();
|
||||
}
|
||||
|
||||
try {
|
||||
getGlobalConfig().locale = loadLocaleConfig();
|
||||
} catch (error) {
|
||||
logToConsole(LOG_ERROR, `[V.RP.Config] Failed to load locale configuration. Error: ${error}`);
|
||||
logToConsole(LOG_ERROR, `[AGRP.Config] Failed to load locale configuration. Error: ${error}`);
|
||||
thisResource.stop();
|
||||
}
|
||||
|
||||
try {
|
||||
getGlobalConfig().accents = loadAccentConfig();
|
||||
} catch (error) {
|
||||
logToConsole(LOG_ERROR, `[V.RP.Config] Failed to load accent configuration. Error: ${error}`);
|
||||
logToConsole(LOG_ERROR, `[AGRP.Config] Failed to load accent configuration. Error: ${error}`);
|
||||
thisResource.stop();
|
||||
}
|
||||
|
||||
try {
|
||||
getGlobalConfig().discord = loadDiscordConfig();
|
||||
} catch (error) {
|
||||
logToConsole(LOG_ERROR, `[V.RP.Config] Failed to load discord configuration. Error: ${error}`);
|
||||
logToConsole(LOG_ERROR, `[AGRP.Config] Failed to load discord configuration. Error: ${error}`);
|
||||
thisResource.stop();
|
||||
}
|
||||
|
||||
try {
|
||||
getGlobalConfig().keyBind = loadKeyBindConfig();
|
||||
} catch (error) {
|
||||
logToConsole(LOG_ERROR, `[V.RP.Config] Failed to load keybind configuration. Error: ${error}`);
|
||||
logToConsole(LOG_ERROR, `[AGRP.Config] Failed to load keybind configuration. Error: ${error}`);
|
||||
thisResource.stop();
|
||||
}
|
||||
|
||||
try {
|
||||
getGlobalConfig().email = loadEmailConfig();
|
||||
} catch (error) {
|
||||
logToConsole(LOG_ERROR, `[V.RP.Config] Failed to load email configuration. Error: ${error}`);
|
||||
logToConsole(LOG_ERROR, `[AGRP.Config] Failed to load email configuration. Error: ${error}`);
|
||||
thisResource.stop();
|
||||
}
|
||||
|
||||
@@ -382,12 +379,12 @@ function applyConfigToServer(tempServerConfig) {
|
||||
updateServerGameTime();
|
||||
|
||||
//if (isTimeSupported()) {
|
||||
// logToConsole(LOG_DEBUG, `[V.RP.Config]: Setting time to to ${tempServerConfig.hour}:${tempServerConfig.minute} with minute duration of ${tempServerConfig.minuteDuration}`);
|
||||
// logToConsole(LOG_DEBUG, `[AGRP.Config]: Setting time to to ${tempServerConfig.hour}:${tempServerConfig.minute} with minute duration of ${tempServerConfig.minuteDuration}`);
|
||||
// setGameTime(tempServerConfig.hour, tempServerConfig.minute, tempServerConfig.minuteDuration);
|
||||
//}
|
||||
|
||||
if (isWeatherSupported()) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Config]: Setting weather to ${tempServerConfig.weather}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Config]: Setting weather to ${tempServerConfig.weather}`);
|
||||
game.forceWeather(getWeatherData(tempServerConfig.weather).weatherId);
|
||||
}
|
||||
|
||||
@@ -397,7 +394,7 @@ function applyConfigToServer(tempServerConfig) {
|
||||
// ===========================================================================
|
||||
|
||||
function saveServerConfigToDatabase() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Config]: Saving server ${getServerConfig().databaseId} configuration to database ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Config]: Saving server ${getServerConfig().databaseId} configuration to database ...`);
|
||||
if (getServerConfig().needsSaved) {
|
||||
let dbConnection = connectToDatabase();
|
||||
if (dbConnection) {
|
||||
@@ -449,8 +446,6 @@ function saveServerConfigToDatabase() {
|
||||
["svr_job_blips", getServerConfig().createJobBlips],
|
||||
["svr_job_pickups", getServerConfig().createJobPickups],
|
||||
["svr_nametag_distance", getServerConfig().nameTagDistance],
|
||||
["svr_real_time", boolToInt(getServerConfig().useRealTime)],
|
||||
["svr_real_time_timezone", getServerConfig().realTimeZone],
|
||||
];
|
||||
|
||||
let dbQuery = null;
|
||||
@@ -463,7 +458,7 @@ function saveServerConfigToDatabase() {
|
||||
|
||||
}
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Config]: Server ${getServerConfig().databaseId} configuration saved to database!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Config]: Server ${getServerConfig().databaseId} configuration saved to database!`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -937,7 +932,7 @@ function reloadEmailConfigurationCommand(command, params, client) {
|
||||
*/
|
||||
function reloadDatabaseConfigurationCommand(command, params, client) {
|
||||
if (getDatabaseConfig().usePersistentConnection && isDatabaseConnected(persistentDatabaseConnection)) {
|
||||
logToConsole(LOG_WARN, `[V.RP.Database] Closing persistent database connection`);
|
||||
logToConsole(LOG_WARN, `[AGRP.Database] Closing persistent database connection`);
|
||||
persistentDatabaseConnection.close();
|
||||
persistentDatabaseConnection = null;
|
||||
}
|
||||
@@ -985,7 +980,7 @@ function getServerIntroMusicURL() {
|
||||
// ===========================================================================
|
||||
|
||||
function loadLocaleConfig() {
|
||||
logToConsole(LOG_DEBUG, "[V.RP.Config] Loading locale configuration ...");
|
||||
logToConsole(LOG_DEBUG, "[V.RP.Config] Loading locale configuration");
|
||||
let localeConfig = JSON.parse(loadTextFile(`config/locale.json`));
|
||||
if (localeConfig != null) {
|
||||
return localeConfig;
|
||||
@@ -995,7 +990,7 @@ function loadLocaleConfig() {
|
||||
// ===========================================================================
|
||||
|
||||
function loadEconomyConfig() {
|
||||
logToConsole(LOG_DEBUG, "[V.RP.Config] Loading economy configuration ...");
|
||||
logToConsole(LOG_DEBUG, "[V.RP.Config] Loading economy configuration");
|
||||
let economyConfig = JSON.parse(loadTextFile(`config/economy.json`));
|
||||
if (economyConfig != null) {
|
||||
return economyConfig;
|
||||
@@ -1005,7 +1000,7 @@ function loadEconomyConfig() {
|
||||
// ===========================================================================
|
||||
|
||||
function loadAccentConfig() {
|
||||
logToConsole(LOG_DEBUG, "[V.RP.Config] Loading accents configuration ...");
|
||||
logToConsole(LOG_DEBUG, "[V.RP.Config] Loading accents configuration");
|
||||
let accentConfig = JSON.parse(loadTextFile(`config/accents.json`));
|
||||
if (accentConfig != null) {
|
||||
return accentConfig;
|
||||
@@ -1015,7 +1010,7 @@ function loadAccentConfig() {
|
||||
// ===========================================================================
|
||||
|
||||
function loadDiscordConfig() {
|
||||
logToConsole(LOG_DEBUG, "[V.RP.Config] Loading discord configuration ...");
|
||||
logToConsole(LOG_DEBUG, "[V.RP.Config] Loading discord configuration");
|
||||
let discordConfig = JSON.parse(loadTextFile(`config/discord.json`));
|
||||
if (discordConfig != null) {
|
||||
return discordConfig;
|
||||
@@ -1026,7 +1021,7 @@ function loadDiscordConfig() {
|
||||
// ===========================================================================
|
||||
|
||||
function loadDatabaseConfig() {
|
||||
logToConsole(LOG_DEBUG, "[V.RP.Config] Loading database configuration ...");
|
||||
logToConsole(LOG_DEBUG, "[V.RP.Config] Loading database configuration");
|
||||
let databaseConfig = JSON.parse(loadTextFile("config/database.json"));
|
||||
if (databaseConfig != null) {
|
||||
return databaseConfig;
|
||||
@@ -1037,7 +1032,7 @@ function loadDatabaseConfig() {
|
||||
// ===========================================================================
|
||||
|
||||
function loadKeyBindConfig() {
|
||||
logToConsole(LOG_DEBUG, "[V.RP.Config] Loading keybind configuration ...");
|
||||
logToConsole(LOG_DEBUG, "[V.RP.Config] Loading keybind configuration");
|
||||
let keyBindConfig = JSON.parse(loadTextFile("config/keybind.json"));
|
||||
if (keyBindConfig != null) {
|
||||
return keyBindConfig;
|
||||
@@ -1048,7 +1043,7 @@ function loadKeyBindConfig() {
|
||||
// ===========================================================================
|
||||
|
||||
function loadEmailConfig() {
|
||||
logToConsole(LOG_DEBUG, "[V.RP.Config] Loading email configuration ...");
|
||||
logToConsole(LOG_DEBUG, "[V.RP.Config] Loading email configuration");
|
||||
let emailConfig = JSON.parse(loadTextFile("config/email.json"));
|
||||
if (emailConfig != null) {
|
||||
return emailConfig;
|
||||
@@ -1131,30 +1126,20 @@ function getDatabaseConfig() {
|
||||
// ===========================================================================
|
||||
|
||||
function loadServerConfig() {
|
||||
logToConsole(LOG_DEBUG, "[V.RP.Config] Loading server configuration ...");
|
||||
logToConsole(LOG_DEBUG, "[V.RP.Config] Loading server configuration");
|
||||
|
||||
if (toInteger(server.getCVar("v_devserver")) == 1) {
|
||||
try {
|
||||
serverConfig = loadServerConfigFromGame(getGame());
|
||||
if (toInteger(server.getCVar("agrp_devserver")) == 1) {
|
||||
serverConfig = loadServerConfigFromGame(getGame());
|
||||
|
||||
if (serverConfig == false) {
|
||||
logToConsole(LOG_ERROR, `[V.RP.Config] Could not load server configuration for game ${getGame()}`);
|
||||
server.shutdown();
|
||||
}
|
||||
} catch (error) {
|
||||
logToConsole(LOG_ERROR, `[V.RP.Config] Could not load server configuration for game ${getGame()} (${error})`);
|
||||
if (serverConfig == false) {
|
||||
logToConsole(LOG_ERROR, `[AGRP.Config] Could not load server configuration for game ${getGame()}`);
|
||||
server.shutdown();
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
serverConfig = loadServerConfigFromGameAndPort(getGame(), getServerPort());
|
||||
serverConfig = loadServerConfigFromGameAndPort(getGame(), getServerPort());
|
||||
|
||||
if (serverConfig == false) {
|
||||
logToConsole(LOG_ERROR, `[V.RP.Config] Could not load server configuration for game ${getGame()} and port ${getServerPort()}`);
|
||||
server.shutdown();
|
||||
}
|
||||
} catch (error) {
|
||||
logToConsole(LOG_ERROR, `[V.RP.Config] Could not load server configuration for game ${getGame()} (${error})`);
|
||||
if (serverConfig == false) {
|
||||
logToConsole(LOG_ERROR, `[AGRP.Config] Could not load server configuration for game ${getGame()} and port ${getServerPort()}`);
|
||||
server.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -643,9 +643,9 @@ function fixAllServerBlipsCommand(command, params, client) {
|
||||
deleteGameElement(blip);
|
||||
});
|
||||
|
||||
spawnAllJobBlips();
|
||||
spawnAllBusinessBlips();
|
||||
spawnAllHouseBlips();
|
||||
createAllJobBlips();
|
||||
createAllBusinessBlips();
|
||||
createAllHouseBlips();
|
||||
|
||||
messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} reset all server blips`);
|
||||
}
|
||||
@@ -658,9 +658,9 @@ function fixAllServerPickupsCommand(command, params, client) {
|
||||
deleteGameElement(pickup);
|
||||
});
|
||||
|
||||
spawnAllJobPickups();
|
||||
spawnAllBusinessPickups();
|
||||
spawnAllHousePickups();
|
||||
createAllJobPickups();
|
||||
createAllBusinessPickups();
|
||||
createAllHousePickups();
|
||||
|
||||
messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} reset all server pickups`);
|
||||
}
|
||||
|
||||
@@ -15,8 +15,33 @@ function initEventScript() {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function addAllEventHandlers() {
|
||||
addEventHandler("onResourceStart", onResourceStart);
|
||||
addEventHandler("onResourceStop", onResourceStop);
|
||||
addEventHandler("onProcess", onProcess);
|
||||
addEventHandler("onPlayerConnect", onPlayerConnect);
|
||||
addEventHandler("onPlayerJoin", onPlayerJoin);
|
||||
addEventHandler("onPlayerJoined", onPlayerJoined);
|
||||
addEventHandler("onPlayerChat", onPlayerChat);
|
||||
addEventHandler("onPlayerQuit", onPlayerQuit);
|
||||
addEventHandler("onElementStreamIn", onElementStreamIn);
|
||||
addEventHandler("onElementStreamOut", onElementStreamOut);
|
||||
addEventHandler("onPedSpawn", onPedSpawn);
|
||||
addEventHandler("OnPickupPickedUp", onPedPickupPickedUp);
|
||||
addEventHandler("onPedEnteredVehicleEx", onPedEnteredVehicle);
|
||||
addEventHandler("onPedExitedVehicleEx", onPedExitedVehicle);
|
||||
addEventHandler("onPedEnteredSphereEx", onPedEnteredSphere);
|
||||
addEventHandler("onPedExitedSphereEx", onPedExitedSphere);
|
||||
|
||||
if (getGame() == V_GAME_MAFIA_ONE) {
|
||||
addEventHandler("onPedFall", onPedFall);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onPlayerConnect(event, ipAddress, port) {
|
||||
logToConsole(LOG_INFO, `[V.RP.Event] onPlayerConnect - Client connecting (IP: ${ipAddress})`);
|
||||
logToConsole(LOG_INFO, `[AGRP.Event] onPlayerConnect - Client connecting (IP: ${ipAddress})`);
|
||||
//if(isIpAddressBanned(ipAddress)) {
|
||||
// messagePlayerError(client, "You are banned from this server!");
|
||||
// return false;
|
||||
@@ -26,7 +51,7 @@ function onPlayerConnect(event, ipAddress, port) {
|
||||
// ===========================================================================
|
||||
|
||||
function onPlayerJoin(event, client) {
|
||||
logToConsole(LOG_INFO, `[V.RP.Event] onPlayerJoin - Client ${getPlayerDisplayForConsole(client)} joining from ${getPlayerIP(client)}`);
|
||||
logToConsole(LOG_INFO, `[AGRP.Event] onPlayerJoin - Client ${getPlayerDisplayForConsole(client)} joining from ${getPlayerIP(client)}`);
|
||||
|
||||
playerResourceReady[getPlayerId(client)] = false;
|
||||
playerResourceStarted[getPlayerId(client)] = false;
|
||||
@@ -47,7 +72,7 @@ function onPlayerJoin(event, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function onPlayerJoined(event, client) {
|
||||
logToConsole(LOG_INFO, `[V.RP.Event] onPlayerJoined - Client ${getPlayerDisplayForConsole(client)} joined from ${getPlayerIP(client)}`);
|
||||
logToConsole(LOG_INFO, `[AGRP.Event] onPlayerJoined - Client ${getPlayerDisplayForConsole(client)} joined from ${getPlayerIP(client)}`);
|
||||
//initClient(client);
|
||||
}
|
||||
|
||||
@@ -184,7 +209,7 @@ function onPedExitingVehicle(event, ped, vehicle) {
|
||||
// ===========================================================================
|
||||
|
||||
function onResourceStart(event, resource) {
|
||||
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Resource ${resource.name} started!`);
|
||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Resource ${resource.name} started!`);
|
||||
|
||||
if (resource == thisResource) {
|
||||
//messageAdmins(`{MAINCOLOUR}Resource {ALTCOLOUR}${resource.name}{MAINCOLOUR} started!`);
|
||||
@@ -195,7 +220,7 @@ function onResourceStart(event, resource) {
|
||||
// ===========================================================================
|
||||
|
||||
function onResourceStop(event, resource) {
|
||||
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Resource ${resource.name} stopped!`);
|
||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Resource ${resource.name} stopped!`);
|
||||
|
||||
//if(resource != thisResource) {
|
||||
// messageAdmins(`{MAINCOLOUR}Resource {ALTCOLOUR}${resource.name}{MAINCOLOUR} stopped!`);
|
||||
@@ -214,8 +239,6 @@ function onResourceStop(event, resource) {
|
||||
// ===========================================================================
|
||||
|
||||
function onPedEnteredSphere(event, ped, sphere) {
|
||||
logToConsole(LOG_WARN | LOG_VERBOSE, `[V.RP.Event] OnPedEnteredSphere event called`);
|
||||
|
||||
if (ped == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -224,7 +247,7 @@ function onPedEnteredSphere(event, ped, sphere) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Ped ${ped.id} entered sphere ${sphere.id}!`);
|
||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} entered sphere ${sphere.id}!`);
|
||||
//if (ped.isType(ELEMENT_PLAYER)) {
|
||||
// let client = getClientFromPlayerElement(ped);
|
||||
|
||||
@@ -240,8 +263,6 @@ function onPedEnteredSphere(event, ped, sphere) {
|
||||
// ===========================================================================
|
||||
|
||||
function onPedExitedSphere(event, ped, sphere) {
|
||||
logToConsole(LOG_WARN | LOG_VERBOSE, `[V.RP.Event] OnPedExitedSphere event called`);
|
||||
|
||||
if (ped == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -250,7 +271,7 @@ function onPedExitedSphere(event, ped, sphere) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Ped ${ped.id} exited sphere ${sphere.id}!`);
|
||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} exited sphere ${sphere.id}!`);
|
||||
//if (ped.isType(ELEMENT_PLAYER)) {
|
||||
// let client = getClientFromPlayerElement(ped);
|
||||
//}
|
||||
@@ -259,8 +280,6 @@ function onPedExitedSphere(event, ped, sphere) {
|
||||
// ===========================================================================
|
||||
|
||||
function onPedPickupPickedUp(event, ped, pickup) {
|
||||
logToConsole(LOG_WARN | LOG_VERBOSE, `[V.RP.Event] OnPedPickupPickedUp event called`);
|
||||
|
||||
if (ped == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -269,7 +288,7 @@ function onPedPickupPickedUp(event, ped, pickup) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Ped ${ped.id} picked up pickup ${pickup.id}!`);
|
||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} picked up pickup ${pickup.id}!`);
|
||||
|
||||
if (ped.isType(ELEMENT_PLAYER)) {
|
||||
let client = getClientFromPlayerElement(ped);
|
||||
@@ -286,7 +305,7 @@ function onPedPickupPickedUp(event, ped, pickup) {
|
||||
|
||||
/*
|
||||
function onPedWasted(event, ped, killerPed, weapon, pedPiece) {
|
||||
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Ped ${ped.id} wasted by ped ${killerPed.id}!`);
|
||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} wasted by ped ${killerPed.id}!`);
|
||||
|
||||
if (ped.isType(ELEMENT_PLAYER)) {
|
||||
let killerClient = null;
|
||||
@@ -300,13 +319,8 @@ function onPedWasted(event, ped, killerPed, weapon, pedPiece) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onPlayerDeath(client, killer, weapon = 0, pedPiece = 0) {
|
||||
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Player ${getPlayerDisplayForConsole(client)} died!`);
|
||||
|
||||
// Death is already being processed
|
||||
if (getPlayerData(client).pedState == V_PEDSTATE_DEAD) {
|
||||
return false;
|
||||
}
|
||||
function onPlayerDeath(client, killer, weapon, pedPiece) {
|
||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Player ${getPlayerDisplayForConsole(client)} died!`);
|
||||
|
||||
logToConsole(LOG_INFO, `${getPlayerDisplayForConsole(client)} died.`);
|
||||
getPlayerData(client).pedState = V_PEDSTATE_DEAD;
|
||||
@@ -314,7 +328,7 @@ function onPlayerDeath(client, killer, weapon = 0, pedPiece = 0) {
|
||||
setPlayerControlState(client, false);
|
||||
setTimeout(function () {
|
||||
if (isFadeCameraSupported()) {
|
||||
fadePlayerCamera(client, false, 1000);
|
||||
fadeCamera(client, false, 1.0);
|
||||
}
|
||||
setTimeout(function () {
|
||||
if (isPlayerInPaintBall(client)) {
|
||||
@@ -336,7 +350,6 @@ function onPlayerDeath(client, killer, weapon = 0, pedPiece = 0) {
|
||||
}
|
||||
} else {
|
||||
respawnPlayerForPaintBall(client);
|
||||
getPlayerData(client).pedState = V_PEDSTATE_READY;
|
||||
}
|
||||
} else {
|
||||
if (getPlayerCurrentSubAccount(client).inJail) {
|
||||
@@ -350,14 +363,14 @@ function onPlayerDeath(client, killer, weapon = 0, pedPiece = 0) {
|
||||
}
|
||||
|
||||
spawnPlayer(client, closestJail.position, closestJail.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
||||
|
||||
if (isFadeCameraSupported()) {
|
||||
fadePlayerCamera(client, true, 1000);
|
||||
fadeCamera(client, true, 1.0);
|
||||
}
|
||||
updatePlayerSpawnedState(client, true);
|
||||
makePlayerStopAnimation(client);
|
||||
setPlayerControlState(client, true);
|
||||
resetPlayerBlip(client);
|
||||
getPlayerData(client).pedState = V_PEDSTATE_READY;
|
||||
} else {
|
||||
let closestHospital = getClosestHospital(getPlayerPosition(client));
|
||||
despawnPlayer(client);
|
||||
@@ -371,14 +384,13 @@ function onPlayerDeath(client, killer, weapon = 0, pedPiece = 0) {
|
||||
spawnPlayer(client, closestHospital.position, closestHospital.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
||||
|
||||
if (isFadeCameraSupported()) {
|
||||
fadePlayerCamera(client, true, 1000);
|
||||
fadeCamera(client, true, 1.0);
|
||||
}
|
||||
|
||||
updatePlayerSpawnedState(client, true);
|
||||
makePlayerStopAnimation(client);
|
||||
setPlayerControlState(client, true);
|
||||
resetPlayerBlip(client);
|
||||
getPlayerData(client).pedState = V_PEDSTATE_READY;
|
||||
}
|
||||
}
|
||||
}, 2000);
|
||||
@@ -401,13 +413,7 @@ function onPlayerDeath(client, killer, weapon = 0, pedPiece = 0) {
|
||||
// ===========================================================================
|
||||
|
||||
function onPedSpawn(ped) {
|
||||
logToConsole(LOG_WARN | LOG_VERBOSE, `[V.RP.Event] OnPedSpawn event called`);
|
||||
|
||||
if (ped != null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Ped ${ped.id} spawned!`);
|
||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} spawned!`);
|
||||
|
||||
//if (ped.type == ELEMENT_PLAYER) {
|
||||
// if (getGame() != V_GAME_MAFIA_ONE) {
|
||||
@@ -420,14 +426,14 @@ function onPedSpawn(ped) {
|
||||
// ===========================================================================
|
||||
|
||||
async function onPlayerSpawn(client) {
|
||||
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Player ${getPlayerDisplayForConsole(client)} spawned!`);
|
||||
//logToConsole(LOG_DEBUG, `[V.RP.Event] Checking for ${getPlayerDisplayForConsole(client)}'s player ped`);
|
||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Player ${getPlayerDisplayForConsole(client)} spawned!`);
|
||||
//logToConsole(LOG_DEBUG, `[AGRP.Event] Checking for ${getPlayerDisplayForConsole(client)}'s player ped`);
|
||||
//if(getPlayerPed(client) == null) {
|
||||
// logToConsole(LOG_DEBUG, `[V.RP.Event] ${getPlayerDisplayForConsole(client)}'s player element not set yet. Rechecking ...`);
|
||||
// logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)}'s player element not set yet. Rechecking ...`);
|
||||
// setTimeout(onPlayerSpawn, 500, client);
|
||||
// return false;
|
||||
//}
|
||||
//logToConsole(LOG_DEBUG, `[V.RP.Event] ${getPlayerDisplayForConsole(client)}'s player ped is valid. Continuing spawn processing ...`);
|
||||
//logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)}'s player ped is valid. Continuing spawn processing ...`);
|
||||
|
||||
if (areServerElementsSupported()) {
|
||||
await waitUntil(() => client != null && getPlayerPed(client) != null);
|
||||
@@ -435,53 +441,53 @@ async function onPlayerSpawn(client) {
|
||||
|
||||
stopRadioStreamForPlayer(client);
|
||||
|
||||
//logToConsole(LOG_DEBUG, `[V.RP.Event] Checking ${getPlayerDisplayForConsole(client)}'s player data`);
|
||||
//logToConsole(LOG_DEBUG, `[AGRP.Event] Checking ${getPlayerDisplayForConsole(client)}'s player data`);
|
||||
if (!getPlayerData(client)) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] ${getPlayerDisplayForConsole(client)}'s player data is invalid. Kicking them from server.`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)}'s player data is invalid. Kicking them from server.`);
|
||||
getPlayerData(targetClient).customDisconnectReason = "Desync";
|
||||
disconnectPlayer(client);
|
||||
return false;
|
||||
}
|
||||
|
||||
//logToConsole(LOG_DEBUG, `[V.RP.Event] Checking ${getPlayerDisplayForConsole(client)}'s login status`);
|
||||
//logToConsole(LOG_DEBUG, `[AGRP.Event] Checking ${getPlayerDisplayForConsole(client)}'s login status`);
|
||||
if (!isPlayerLoggedIn(client)) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] ${getPlayerDisplayForConsole(client)} is NOT logged in. Despawning their player.`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)} is NOT logged in. Despawning their player.`);
|
||||
getPlayerData(targetClient).customDisconnectReason = "Desync";
|
||||
disconnectPlayer(client);
|
||||
return false;
|
||||
}
|
||||
|
||||
//logToConsole(LOG_DEBUG, `[V.RP.Event] Checking ${getPlayerDisplayForConsole(client)}'s selected character status`);
|
||||
//logToConsole(LOG_DEBUG, `[AGRP.Event] Checking ${getPlayerDisplayForConsole(client)}'s selected character status`);
|
||||
if (getPlayerData(client).currentSubAccount == -1) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] ${getPlayerDisplayForConsole(client)} has NOT selected a character. Despawning their player.`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)} has NOT selected a character. Despawning their player.`);
|
||||
getPlayerData(targetClient).customDisconnectReason = "Desync";
|
||||
disconnectPlayer(client);
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] ${getPlayerDisplayForConsole(client)}'s player data is valid. Continuing spawn processing ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)}'s player data is valid. Continuing spawn processing ...`);
|
||||
|
||||
if (isGameFeatureSupported("pedScale")) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped scale (${getPlayerCurrentSubAccount(client).pedScale})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped scale (${getPlayerCurrentSubAccount(client).pedScale})`);
|
||||
setEntityData(getPlayerPed(client), "v.rp.scale", getPlayerCurrentSubAccount(client).pedScale, true);
|
||||
}
|
||||
|
||||
//if (isPlayerSwitchingCharacter(client) || isPlayerCreatingCharacter(client)) {
|
||||
// logToConsole(LOG_DEBUG, `[V.RP.Event] ${getPlayerDisplayForConsole(client)}'s ped is being used for character selection/creation. No further spawn processing needed'`);
|
||||
// logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)}'s ped is being used for character selection/creation. No further spawn processing needed'`);
|
||||
// return false;
|
||||
//}
|
||||
|
||||
if (isCustomCameraSupported()) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] Restoring ${getPlayerDisplayForConsole(client)}'s camera`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Restoring ${getPlayerDisplayForConsole(client)}'s camera`);
|
||||
restorePlayerCamera(client);
|
||||
}
|
||||
|
||||
if (areServerElementsSupported()) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] Storing ${getPlayerDisplayForConsole(client)} ped in client data `);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Storing ${getPlayerDisplayForConsole(client)} ped in client data `);
|
||||
getPlayerData(client).ped = getPlayerPed(client);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] Sending ${getPlayerDisplayForConsole(client)} the 'now playing as' message`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Sending ${getPlayerDisplayForConsole(client)} the 'now playing as' message`);
|
||||
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, "Please report any bugs using /bug and suggestions using /idea", getColourByName("yellow"));
|
||||
@@ -495,65 +501,65 @@ async function onPlayerSpawn(client) {
|
||||
//}
|
||||
|
||||
if (isGameFeatureSupported("interior")) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] Setting player interior for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).interior}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Setting player interior for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).interior}`);
|
||||
setPlayerInterior(client, getPlayerCurrentSubAccount(client).interior);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] Setting player dimension for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).dimension}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Setting player dimension for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).dimension}`);
|
||||
setPlayerDimension(client, getPlayerCurrentSubAccount(client).dimension);
|
||||
|
||||
//if(getPlayerCurrentSubAccount(client).interior != 0 || getPlayerCurrentSubAccount(client).dimension != 0) {
|
||||
// updateAllInteriorVehiclesForPlayer(client, getPlayerCurrentSubAccount(client).interior, getPlayerCurrentSubAccount(client).dimension);
|
||||
//}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] Setting player health for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).health}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Setting player health for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).health}`);
|
||||
setPlayerHealth(client, getPlayerCurrentSubAccount(client).health);
|
||||
|
||||
if (isGameFeatureSupported("pedArmour")) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] Setting player armour for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).armour}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Setting player armour for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).armour}`);
|
||||
setPlayerArmour(client, getPlayerCurrentSubAccount(client).armour);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] Sending ${getPlayerDisplayForConsole(client)}'s job type to their client (${getJobIndexFromDatabaseId(getPlayerCurrentSubAccount(client))})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Sending ${getPlayerDisplayForConsole(client)}'s job type to their client (${getJobIndexFromDatabaseId(getPlayerCurrentSubAccount(client))})`);
|
||||
sendPlayerJobType(client, getPlayerCurrentSubAccount(client).job);
|
||||
|
||||
if (isGameFeatureSupported("rendering2D")) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] Enabling all rendering states for ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Enabling all rendering states for ${getPlayerDisplayForConsole(client)}`);
|
||||
setPlayer2DRendering(client, true, true, true, true, true, true);
|
||||
}
|
||||
|
||||
//if (isGameFeatureSupported("snow")) {
|
||||
// logToConsole(LOG_DEBUG, `[V.RP.Event] Sending snow states to ${getPlayerDisplayForConsole(client)}`);
|
||||
// logToConsole(LOG_DEBUG, `[AGRP.Event] Sending snow states to ${getPlayerDisplayForConsole(client)}`);
|
||||
// updatePlayerSnowState(client, true);
|
||||
//}
|
||||
|
||||
if (areServerElementsSupported() && isGameFeatureSupported("walkStyle")) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] Setting player walking style for ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Setting player walking style for ${getPlayerDisplayForConsole(client)}`);
|
||||
setEntityData(getPlayerPed(client), "v.rp.walkStyle", getPlayerCurrentSubAccount(client).walkStyle, true);
|
||||
}
|
||||
|
||||
if (isGameFeatureSupported("fightStyle")) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] Setting player fighting style for ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Setting player fighting style for ${getPlayerDisplayForConsole(client)}`);
|
||||
setPlayerFightStyle(client, getPlayerCurrentSubAccount(client).fightStyle);
|
||||
}
|
||||
|
||||
if (isGameFeatureSupported("rendering2D")) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] Updating logo state for ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Updating logo state for ${getPlayerDisplayForConsole(client)}`);
|
||||
updatePlayerShowLogoState(client, (getServerConfig().showLogo && doesPlayerHaveLogoEnabled(client)));
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] Caching ${getPlayerDisplayForConsole(client)}'s hotbar items`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Caching ${getPlayerDisplayForConsole(client)}'s hotbar items`);
|
||||
cachePlayerHotBarItems(client);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] Syncing ${getPlayerDisplayForConsole(client)}'s hotbar`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Syncing ${getPlayerDisplayForConsole(client)}'s hotbar`);
|
||||
updatePlayerHotBar(client);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] Setting ${getPlayerDisplayForConsole(client)}'s switchchar state to false`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Setting ${getPlayerDisplayForConsole(client)}'s switchchar state to false`);
|
||||
getPlayerData(client).switchingCharacter = false;
|
||||
|
||||
if (!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "enter")) {
|
||||
let keyId = getPlayerKeyBindForCommand(client, "enter");
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
|
||||
sendPlayerEnterPropertyKey(client, keyId.key);
|
||||
}
|
||||
|
||||
@@ -584,7 +590,7 @@ async function onPlayerSpawn(client) {
|
||||
//sendPlayerPedPartsAndProps(client);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped state to ready`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped state to ready`);
|
||||
getPlayerData(client).pedState = V_PEDSTATE_READY;
|
||||
|
||||
if (areServerElementsSupported()) {
|
||||
@@ -594,16 +600,16 @@ async function onPlayerSpawn(client) {
|
||||
//}, 1000);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] Syncing ${getPlayerDisplayForConsole(client)}'s cash ${getPlayerCurrentSubAccount(client).cash}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Syncing ${getPlayerDisplayForConsole(client)}'s cash ${getPlayerCurrentSubAccount(client).cash}`);
|
||||
updatePlayerCash(client);
|
||||
|
||||
if (isGameFeatureSupported("customNametag")) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] Sending player nametag distance to ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Sending player nametag distance to ${getPlayerDisplayForConsole(client)}`);
|
||||
sendNameTagDistanceToClient(client, getServerConfig().nameTagDistance);
|
||||
}
|
||||
|
||||
if (!areServerElementsSupported() || getGame() == V_GAME_MAFIA_ONE || getGame() == V_GAME_GTA_IV) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] Sending properties, jobs, and vehicles to ${getPlayerDisplayForConsole(client)} (no server elements)`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Sending properties, jobs, and vehicles to ${getPlayerDisplayForConsole(client)} (no server elements)`);
|
||||
sendAllBusinessesToPlayer(client);
|
||||
sendAllHousesToPlayer(client);
|
||||
if (getGame() != V_GAME_GTA_IV) {
|
||||
@@ -616,7 +622,7 @@ async function onPlayerSpawn(client) {
|
||||
sendAllVehiclesToPlayer(client);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] Updating spawned state for ${getPlayerDisplayForConsole(client)} to true`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Updating spawned state for ${getPlayerDisplayForConsole(client)} to true`);
|
||||
updatePlayerSpawnedState(client, true);
|
||||
|
||||
getPlayerData(client).payDayTickStart = sdl.ticks;
|
||||
@@ -624,7 +630,7 @@ async function onPlayerSpawn(client) {
|
||||
// Locales are handled via resource files now. No need to send anymore, but kept in case revert is needed.
|
||||
//sendPlayerLocaleStrings(client);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] Updating all player name tags`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Updating all player name tags`);
|
||||
updateAllPlayerNameTags();
|
||||
|
||||
setPlayerWeaponDamageEvent(client, V_WEAPON_DAMAGE_EVENT_NORMAL);
|
||||
@@ -681,9 +687,7 @@ async function onPlayerSpawn(client) {
|
||||
// ===========================================================================
|
||||
|
||||
function onPlayerCommand(event, client, command, params) {
|
||||
logToConsole(LOG_WARN | LOG_VERBOSE, `[V.RP.Event] OnPlayerCommand event called`);
|
||||
|
||||
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Player used command ${command}!`);
|
||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Player used command ${command}!`);
|
||||
|
||||
if (!doesCommandExist(command)) {
|
||||
processPlayerCommand(command, params, client);
|
||||
@@ -693,8 +697,6 @@ function onPlayerCommand(event, client, command, params) {
|
||||
// ===========================================================================
|
||||
|
||||
function onPedExitedVehicle(event, ped, vehicle, seat) {
|
||||
logToConsole(LOG_WARN | LOG_VERBOSE, `[V.RP.Event] OnPedExitedVehicle event called`);
|
||||
|
||||
if (ped == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -703,7 +705,7 @@ function onPedExitedVehicle(event, ped, vehicle, seat) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Ped ${ped.id} exited vehicle ${vehicle.id} from seat ${seat}!`);
|
||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} exited vehicle ${vehicle.id} from seat ${seat}!`);
|
||||
|
||||
if (getVehicleData(vehicle) == false) {
|
||||
return false;
|
||||
@@ -736,7 +738,7 @@ function onPedExitedVehicle(event, ped, vehicle, seat) {
|
||||
|
||||
getVehicleData(vehicle).lastActiveTime = getCurrentUnixTimestamp();
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] ${getPlayerDisplayForConsole(client)} exited a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("v.rp.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)} exited a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("v.rp.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -744,34 +746,28 @@ function onPedExitedVehicle(event, ped, vehicle, seat) {
|
||||
// ===========================================================================
|
||||
|
||||
function onPedEnteredVehicle(event, ped, vehicle, seat) {
|
||||
logToConsole(LOG_WARN | LOG_VERBOSE, `[V.RP.Event] OnPedEnteredVehicle event called`);
|
||||
|
||||
if (ped == 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;
|
||||
}
|
||||
|
||||
if (vehicle == 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;
|
||||
}
|
||||
|
||||
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Ped ${ped.id} entered vehicle ${vehicle.id} in seat ${seat}!`);
|
||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} entered vehicle ${vehicle.id} in seat ${seat}!`);
|
||||
|
||||
if (ped.isType(ELEMENT_PLAYER)) {
|
||||
let client = getClientFromPlayerElement(ped);
|
||||
if (client != null) {
|
||||
if (getPlayerData(client) == 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;
|
||||
}
|
||||
|
||||
if (!getVehicleData(vehicle)) {
|
||||
logToConsole(LOG_ERROR | LOG_DEBUG, `[V.RP.Event] ${getPlayerDisplayForConsole(client)} entered vehicle ${vehicle.id} in seat ${seat}, but vehicle data is false`);
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] ${getPlayerDisplayForConsole(client)} entered a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("v.rp.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)} entered a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("v.rp.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
|
||||
|
||||
getPlayerData(client).lastVehicle = vehicle;
|
||||
getVehicleData(vehicle).lastActiveTime = getCurrentUnixTimestamp();
|
||||
@@ -874,8 +870,6 @@ function onPedEnteredVehicle(event, ped, vehicle, seat) {
|
||||
// ===========================================================================
|
||||
|
||||
function onPedEnteringVehicle(event, ped, vehicle, seat) {
|
||||
logToConsole(LOG_WARN | LOG_VERBOSE, `[V.RP.Event] OnPedEnteringVehicle event called`);
|
||||
|
||||
if (ped == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -884,7 +878,7 @@ function onPedEnteringVehicle(event, ped, vehicle, seat) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Ped ${ped.id} is entering vehicle ${vehicle.id} in seat ${seat}!`);
|
||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} is entering vehicle ${vehicle.id} in seat ${seat}!`);
|
||||
|
||||
if (ped.isType(ELEMENT_PLAYER)) {
|
||||
let client = getClientFromPlayerElement(ped);
|
||||
@@ -900,8 +894,6 @@ function onPedEnteringVehicle(event, ped, vehicle, seat) {
|
||||
// ===========================================================================
|
||||
|
||||
function onPedExitingVehicle(event, ped, vehicle, seat) {
|
||||
logToConsole(LOG_WARN | LOG_VERBOSE, `[V.RP.Event] OnPedExitingVehicle event called`);
|
||||
|
||||
if (ped == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -910,7 +902,7 @@ function onPedExitingVehicle(event, ped, vehicle, seat) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Ped ${ped.id} is exiting vehicle ${vehicle.id} in seat ${seat}!`);
|
||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} is exiting vehicle ${vehicle.id} in seat ${seat}!`);
|
||||
|
||||
if (ped.isType(ELEMENT_PLAYER)) {
|
||||
let client = getClientFromPlayerElement(ped);
|
||||
@@ -938,12 +930,12 @@ function onPlayerExitingVehicle(client, vehicle, seat) {
|
||||
// ===========================================================================
|
||||
|
||||
function onPedFall(ped) {
|
||||
//if (ped.isType(ELEMENT_PLAYER)) {
|
||||
// let client = getClientFromPlayerElement(ped);
|
||||
// if (client != null) {
|
||||
// processPlayerDeath(client);
|
||||
// }
|
||||
//}
|
||||
if (ped.isType(ELEMENT_PLAYER)) {
|
||||
let client = getClientFromPlayerElement(ped);
|
||||
if (client != null) {
|
||||
processPlayerDeath(client);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -45,8 +45,8 @@ class GateData {
|
||||
// ===========================================================================
|
||||
|
||||
function initGateScript() {
|
||||
logToConsole(LOG_INFO, `[V.RP.Gate]: Initializing gate script ...`);
|
||||
logToConsole(LOG_INFO, `[V.RP.Gate]: Gate script initialized successfully!`);
|
||||
logToConsole(LOG_INFO, `[AGRP.Gate]: Initializing gate script ...`);
|
||||
logToConsole(LOG_INFO, `[AGRP.Gate]: Gate script initialized successfully!`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -193,7 +193,7 @@ function saveGateToDatabase(gateId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Gate]: Saving gate ${tempGateData.databaseId} to database ...`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Gate]: Saving gate ${tempGateData.databaseId} to database ...`);
|
||||
let dbConnection = connectToDatabase();
|
||||
if (dbConnection) {
|
||||
let safeGateName = escapeDatabaseString(tempGateData.name);
|
||||
@@ -227,7 +227,7 @@ function saveGateToDatabase(gateId) {
|
||||
disconnectFromDatabase(dbConnection);
|
||||
return true;
|
||||
}
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Gate]: Saved gate ${gateDataId} to database!`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Gate]: Saved gate ${gateDataId} to database!`);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -248,13 +248,13 @@ function loadGatesFromDatabase() {
|
||||
for (let i in dbAssoc) {
|
||||
let tempGateData = new GateData(dbAssoc[i]);
|
||||
tempGates.push(tempGateData);
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Gate]: Gate '${tempGateData.name}' loaded from database successfully!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Gate]: Gate '${tempGateData.name}' loaded from database successfully!`);
|
||||
}
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
|
||||
logToConsole(LOG_INFO, `[V.RP.Gate]: ${tempGates.length} gates loaded from database successfully!`);
|
||||
logToConsole(LOG_INFO, `[AGRP.Gate]: ${tempGates.length} gates loaded from database successfully!`);
|
||||
return tempGates;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
// ===========================================================================
|
||||
|
||||
function initHelpScript() {
|
||||
logToConsole(LOG_INFO, `[V.RP.Help]: Initializing help script ...`);
|
||||
logToConsole(LOG_INFO, `[V.RP.Help]: Help script initialized successfully!`);
|
||||
logToConsole(LOG_INFO, `[AGRP.Help]: Initializing help script ...`);
|
||||
logToConsole(LOG_INFO, `[AGRP.Help]: Help script initialized successfully!`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -187,12 +187,12 @@ function loadHousesFromDatabase() {
|
||||
for (let i in dbAssoc) {
|
||||
let tempHouseData = new HouseData(dbAssoc[i]);
|
||||
tempHouses.push(tempHouseData);
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.House]: House '${tempHouseData.description}' (ID ${tempHouseData.databaseId}) loaded!`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.House]: House '${tempHouseData.description}' (ID ${tempHouseData.databaseId}) loaded!`);
|
||||
}
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
logToConsole(LOG_INFO, `[V.RP.House]: ${tempHouses.length} houses loaded from database successfully!`);
|
||||
logToConsole(LOG_INFO, `[AGRP.House]: ${tempHouses.length} houses loaded from database successfully!`);
|
||||
return tempHouses;
|
||||
}
|
||||
|
||||
@@ -462,7 +462,7 @@ function setHousePickupCommand(command, params, client) {
|
||||
}
|
||||
|
||||
deleteHouseEntrancePickup(houseId);
|
||||
spawnHouseEntrancePickup(houseId);
|
||||
createHouseEntrancePickup(houseId);
|
||||
|
||||
getHouseData(houseId).needsSaved = true;
|
||||
|
||||
@@ -527,8 +527,8 @@ function setHouseInteriorTypeCommand(command, params, client) {
|
||||
|
||||
deleteHouseEntrancePickup(houseId);
|
||||
deleteHouseExitPickup(houseId);
|
||||
spawnHouseEntrancePickup(houseId);
|
||||
spawnHouseExitPickup(houseId);
|
||||
createHouseEntrancePickup(houseId);
|
||||
createHouseExitPickup(houseId);
|
||||
|
||||
getHouseData(houseId).needsSaved = true;
|
||||
|
||||
@@ -654,8 +654,8 @@ function moveHouseExitCommand(command, params, client) {
|
||||
|
||||
deleteHouseExitPickup(houseId);
|
||||
deleteHouseExitBlip(houseId);
|
||||
spawnHouseExitPickup(houseId);
|
||||
spawnHouseExitBlip(houseId);
|
||||
createHouseExitPickup(houseId);
|
||||
createHouseExitBlip(houseId);
|
||||
|
||||
getHouseData(houseId).needsSaved = true;
|
||||
|
||||
@@ -798,8 +798,8 @@ function createHouse(description, entrancePosition, exitPosition, entrancePickup
|
||||
saveHouseToDatabase(houseId - 1);
|
||||
setHouseDataIndexes();
|
||||
|
||||
spawnHousePickups(houseId - 1);
|
||||
spawnHouseBlips(houseId - 1);
|
||||
createHousePickups(houseId - 1);
|
||||
createHouseBlips(houseId - 1);
|
||||
|
||||
return houseId - 1;
|
||||
}
|
||||
@@ -877,9 +877,9 @@ function getPlayerHouse(client) {
|
||||
// ===========================================================================
|
||||
|
||||
function saveAllHousesToDatabase() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.House]: Saving all server houses to database ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.House]: Saving all server houses to database ...`);
|
||||
if (getServerConfig().devServer) {
|
||||
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.House]: Aborting save all houses to database, dev server is enabled.`);
|
||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.House]: Aborting save all houses to database, dev server is enabled.`);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -888,7 +888,7 @@ function saveAllHousesToDatabase() {
|
||||
saveHouseToDatabase(i);
|
||||
}
|
||||
}
|
||||
logToConsole(LOG_INFO, `[V.RP.House]: Saved all server houses to database`);
|
||||
logToConsole(LOG_INFO, `[AGRP.House]: Saved all server houses to database`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -900,7 +900,7 @@ function saveHouseToDatabase(houseId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.House]: Saving house '${tempHouseData.description}' to database ...`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.House]: Saving house '${tempHouseData.description}' to database ...`);
|
||||
let dbConnection = connectToDatabase();
|
||||
if (dbConnection) {
|
||||
let safeHouseDescription = escapeDatabaseString(dbConnection, tempHouseData.description);
|
||||
@@ -954,7 +954,7 @@ function saveHouseToDatabase(houseId) {
|
||||
disconnectFromDatabase(dbConnection);
|
||||
return true;
|
||||
}
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.House]: Saved house '${tempHouseData.description}' to database!`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.House]: Saved house '${tempHouseData.description}' to database!`);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -968,7 +968,7 @@ function saveHouseLocationToDatabase(houseId, locationId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.House]: Saving house location ${locationId} for house ${houseId} to database ...`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.House]: Saving house location ${locationId} for house ${houseId} to database ...`);
|
||||
let dbConnection = connectToDatabase();
|
||||
if (dbConnection) {
|
||||
let data = [
|
||||
@@ -1009,32 +1009,32 @@ function saveHouseLocationToDatabase(houseId, locationId) {
|
||||
disconnectFromDatabase(dbConnection);
|
||||
return true;
|
||||
}
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.House]: Saved location ${locationId} for house ${houseId} to database`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.House]: Saved location ${locationId} for house ${houseId} to database`);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function spawnAllHousePickups() {
|
||||
function createAllHousePickups() {
|
||||
for (let i in getServerData().houses) {
|
||||
spawnHouseEntrancePickup(i);
|
||||
spawnHouseExitPickup(i);
|
||||
createHouseEntrancePickup(i);
|
||||
createHouseExitPickup(i);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function spawnAllHouseBlips() {
|
||||
function createAllHouseBlips() {
|
||||
for (let i in getServerData().houses) {
|
||||
spawnHouseEntranceBlip(i);
|
||||
spawnHouseExitBlip(i);
|
||||
createHouseEntranceBlip(i);
|
||||
createHouseExitBlip(i);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function spawnHouseEntrancePickup(houseId) {
|
||||
function createHouseEntrancePickup(houseId) {
|
||||
if (!getServerConfig().createHousePickups) {
|
||||
return false;
|
||||
}
|
||||
@@ -1082,7 +1082,7 @@ function spawnHouseEntrancePickup(houseId) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function spawnHouseEntranceBlip(houseId) {
|
||||
function createHouseEntranceBlip(houseId) {
|
||||
if (!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
@@ -1139,7 +1139,7 @@ function spawnHouseEntranceBlip(houseId) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function spawnHouseExitPickup(houseId) {
|
||||
function createHouseExitPickup(houseId) {
|
||||
if (!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
@@ -1189,7 +1189,7 @@ function spawnHouseExitPickup(houseId) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function spawnHouseExitBlip(houseId) {
|
||||
function createHouseExitBlip(houseId) {
|
||||
if (!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
@@ -1702,8 +1702,8 @@ function canPlayerLockUnlockHouse(client, houseId) {
|
||||
function resetHousePickups(houseId) {
|
||||
deleteHouseEntrancePickup(houseId);
|
||||
deleteHouseExitPickup(houseId);
|
||||
spawnHouseEntrancePickup(houseId);
|
||||
spawnHouseExitPickup(houseId);
|
||||
createHouseEntrancePickup(houseId);
|
||||
createHouseExitPickup(houseId);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1711,8 +1711,8 @@ function resetHousePickups(houseId) {
|
||||
function resetHouseBlips(houseId) {
|
||||
deleteHouseEntranceBlip(houseId);
|
||||
deleteHouseExitBlip(houseId);
|
||||
spawnHouseEntranceBlip(houseId);
|
||||
spawnHouseExitBlip(houseId);
|
||||
createHouseEntranceBlip(houseId);
|
||||
createHouseExitBlip(houseId);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1830,15 +1830,15 @@ function deleteAllHousePickups() {
|
||||
// ===========================================================================
|
||||
|
||||
function createHouseBlips(houseId) {
|
||||
spawnHouseEntranceBlip(houseId);
|
||||
spawnHouseExitBlip(houseId);
|
||||
createHouseEntranceBlip(houseId);
|
||||
createHouseExitBlip(houseId);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function createHousePickups(houseId) {
|
||||
spawnHouseEntrancePickup(houseId);
|
||||
spawnHouseExitPickup(houseId);
|
||||
createHouseEntrancePickup(houseId);
|
||||
createHouseExitPickup(houseId);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
// Load script files here
|
||||
require("shared/const.js");
|
||||
require("shared/gamedata.js");
|
||||
require("shared/utilities.js");
|
||||
|
||||
require("native/mafiamp.js");
|
||||
require("accent.js");
|
||||
require("account.js");
|
||||
require("animation.js");
|
||||
require("anticheat.js");
|
||||
require("ban.js");
|
||||
require("bank.js");
|
||||
require("bitflag.js");
|
||||
require("business.js");
|
||||
require("casino.js");
|
||||
require("chat.js");
|
||||
require("clan.js");
|
||||
require("client.js");
|
||||
require("command.js");
|
||||
require("config.js");
|
||||
require("core.js");
|
||||
require("crime.js");
|
||||
require("database.js");
|
||||
require("developer.js");
|
||||
require("discord.js");
|
||||
require("economy.js");
|
||||
require("email.js");
|
||||
require("event.js");
|
||||
require("fishing.js");
|
||||
require("forensics.js");
|
||||
require("gate.js");
|
||||
require("gps.js");
|
||||
require("gui.js");
|
||||
require("help.js");
|
||||
require("house.js");
|
||||
require("index.js");
|
||||
require("insurance.js");
|
||||
require("item.js");
|
||||
require("job.js");
|
||||
require("keybind.js");
|
||||
require("locale.js");
|
||||
require("messaging.js");
|
||||
require("misc.js");
|
||||
require("netevents.js");
|
||||
require("npc.js");
|
||||
require("paintball.js");
|
||||
require("prompt.js");
|
||||
require("property.js");
|
||||
require("race.js");
|
||||
require("radio.js");
|
||||
require("security.js");
|
||||
require("staff.js");
|
||||
require("subaccount.js");
|
||||
require("theme.js");
|
||||
require("timers.js");
|
||||
require("trigger.js");
|
||||
require("tutorial.js");
|
||||
require("utilities.js");
|
||||
require("vehicle.js");
|
||||
@@ -288,7 +288,7 @@ function initItemScript() {
|
||||
// ===========================================================================
|
||||
|
||||
function loadItemsFromDatabase() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Item]: Loading items from database ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Item]: Loading items from database ...`);
|
||||
let tempItems = [];
|
||||
let dbConnection = connectToDatabase();
|
||||
let dbAssoc = [];
|
||||
@@ -299,19 +299,19 @@ function loadItemsFromDatabase() {
|
||||
for (let i in dbAssoc) {
|
||||
let tempItemData = new ItemData(dbAssoc[i]);
|
||||
tempItems.push(tempItemData);
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Item]: Loaded item ${tempItemData.databaseId} (type ${tempItemData.itemType})} from database`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Item]: Loaded item ${tempItemData.databaseId} (type ${tempItemData.itemType})} from database`);
|
||||
}
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Item]: Loaded ${tempItems.length} items from database ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Item]: Loaded ${tempItems.length} items from database ...`);
|
||||
return tempItems;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadItemTypesFromDatabase() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Item]: Loading item types from database ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Item]: Loading item types from database ...`);
|
||||
let tempItemTypes = [];
|
||||
let dbConnection = connectToDatabase();
|
||||
let dbAssoc = [];
|
||||
@@ -323,13 +323,13 @@ function loadItemTypesFromDatabase() {
|
||||
for (let i in dbAssoc) {
|
||||
let tempItemTypeData = new ItemTypeData(dbAssoc[i]);
|
||||
tempItemTypes.push(tempItemTypeData);
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Item]: Loaded item type ${tempItemTypeData.name} (id ${tempItemTypeData.databaseId}} from database`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Item]: Loaded item type ${tempItemTypeData.name} (id ${tempItemTypeData.databaseId}} from database`);
|
||||
}
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Item]: Loaded ${tempItemTypes.length} item types from database ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Item]: Loaded ${tempItemTypes.length} item types from database ...`);
|
||||
return tempItemTypes;
|
||||
}
|
||||
|
||||
@@ -356,13 +356,13 @@ function createGroundItem(itemTypeId, value, position, dimension = 0) {
|
||||
let itemIndex = createItem(itemTypeId, value, V_ITEM_OWNER_GROUND, 0);
|
||||
getItemData(itemIndex).position = position;
|
||||
getItemData(itemIndex).dimension = dimension;
|
||||
spawnGroundItemObject(itemIndex);
|
||||
createGroundItemObject(itemIndex);
|
||||
return itemIndex;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function spawnGroundItemObject(itemId) {
|
||||
function createGroundItemObject(itemId) {
|
||||
if (!getItemData(itemId)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1352,7 +1352,7 @@ function playerUseItem(client, hotBarSlot) {
|
||||
let itemIndex = getPlayerData(client).hotBarItems[hotBarSlot];
|
||||
|
||||
if (itemIndex == -1) {
|
||||
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.Item] ${getPlayerDisplayForConsole(client)} tried to use an empty hotbar slot ${hotBarSlot}`);
|
||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.Item] ${getPlayerDisplayForConsole(client)} tried to use an empty hotbar slot ${hotBarSlot}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1366,7 +1366,7 @@ function playerUseItem(client, hotBarSlot) {
|
||||
let itemTypeData = getItemTypeData(itemData.itemTypeIndex);
|
||||
let hotBarItems = getPlayerData(client).hotBarItems;
|
||||
|
||||
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})`);
|
||||
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})`);
|
||||
|
||||
markPlayerActionTipSeen(client, "UseItemKeyAfterEquipping");
|
||||
|
||||
@@ -1772,7 +1772,7 @@ function playerDropItem(client, hotBarSlot) {
|
||||
getItemData(itemId).position = getPosInFrontOfPos(getPlayerPosition(client), getPlayerHeading(client), getItemTypeData(getItemData(itemId).itemTypeIndex).dropFrontDistance);
|
||||
getItemData(itemId).dimension = getPlayerDimension(client);
|
||||
//getItemData(itemId).interior = getPlayerInterior(client);
|
||||
spawnGroundItemObject(itemId);
|
||||
createGroundItemObject(itemId);
|
||||
getItemData(itemId).needsSaved = true;
|
||||
getServerData().groundItemCache.push(itemId);
|
||||
}
|
||||
@@ -1909,7 +1909,7 @@ function playerSwitchItem(client, newHotBarSlot) {
|
||||
}
|
||||
|
||||
let currentHotBarSlot = getPlayerData(client).activeHotBarSlot;
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Item] ${getPlayerDisplayForConsole(client)} switched from hotbar slot ${currentHotBarSlot} to ${newHotBarSlot}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Item] ${getPlayerDisplayForConsole(client)} switched from hotbar slot ${currentHotBarSlot} to ${newHotBarSlot}`);
|
||||
|
||||
let currentHotBarItem = -1;
|
||||
let newHotBarItem = -1;
|
||||
@@ -2137,9 +2137,9 @@ function cacheAllGroundItems() {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function spawnAllGroundItemObjects() {
|
||||
function createAllGroundItemObjects() {
|
||||
for (let i in getServerData().groundItemCache) {
|
||||
spawnGroundItemObject(getServerData().groundItemCache[i]);
|
||||
createGroundItemObject(getServerData().groundItemCache[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2564,7 +2564,7 @@ function saveItemToDatabase(itemId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Item]: Saving item '${itemData.index}' to database ...`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Item]: Saving item '${itemData.index}' to database ...`);
|
||||
|
||||
let position = getItemPosition(itemId);
|
||||
|
||||
@@ -2621,7 +2621,7 @@ function saveItemTypeToDatabase(itemTypeId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Item]: Saving item type '${itemTypeData.name}' to database ...`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Item]: Saving item type '${itemTypeData.name}' to database ...`);
|
||||
|
||||
let dbConnection = connectToDatabase();
|
||||
if (dbConnection) {
|
||||
@@ -2753,7 +2753,7 @@ function getItemTypeIndexFromDatabaseId(databaseId) {
|
||||
// ===========================================================================
|
||||
|
||||
function playerItemActionDelayComplete(client) {
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Item]: Player ${getPlayerDisplayForConsole(client)} item action delay complete (State: ${getPlayerData(client).itemActionState})`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Item]: Player ${getPlayerDisplayForConsole(client)} item action delay complete (State: ${getPlayerData(client).itemActionState})`);
|
||||
switch (getPlayerData(client).itemActionState) {
|
||||
case V_ITEM_ACTION_USE:
|
||||
playerUseItem(client, getPlayerData(client).itemActionItem);
|
||||
@@ -3293,15 +3293,4 @@ function cacheItemItems(itemId) {
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function despawnAllGroundItemObjects() {
|
||||
for (let i in getServerData().groundItemCache) {
|
||||
if (getItemData(getServerData().groundItemCache[i]).object != null) {
|
||||
destroyGameElement(getItemData(getServerData().groundItemCache[i]).object);
|
||||
getItemData(getServerData().groundItemCache[i]).object = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -554,13 +554,13 @@ function loadJobsFromDatabase() {
|
||||
tempJobData.routes = loadJobRoutesFromDatabase(tempJobData.databaseId);
|
||||
tempJobData.ranks = loadJobRanksFromDatabase(tempJobData.databaseId);
|
||||
tempJobs.push(tempJobData);
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Job '${tempJobData.name}' loaded from database successfully!`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Job '${tempJobData.name}' loaded from database successfully!`);
|
||||
}
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: ${tempJobs.length} jobs loaded from database successfully!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: ${tempJobs.length} jobs loaded from database successfully!`);
|
||||
return tempJobs;
|
||||
}
|
||||
|
||||
@@ -599,7 +599,7 @@ function loadAllJobLocationsFromDatabase() {
|
||||
// ===========================================================================
|
||||
|
||||
function loadJobRanksFromDatabase(jobDatabaseId) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: Loading ranks for job ${jobDatabaseId} from database ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Loading ranks for job ${jobDatabaseId} from database ...`);
|
||||
|
||||
let tempJobRanks = [];
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -612,20 +612,20 @@ function loadJobRanksFromDatabase(jobDatabaseId) {
|
||||
for (let i in dbAssoc) {
|
||||
let tempJobRankData = new JobRankData(dbAssoc[i]);
|
||||
tempJobRanks.push(tempJobRankData);
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Job rank '${tempJobRankData.name}' loaded from database successfully!`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Job rank '${tempJobRankData.name}' loaded from database successfully!`);
|
||||
}
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: ${tempJobRanks.length} ranks for job ${jobDatabaseId} loaded from database successfully!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: ${tempJobRanks.length} ranks for job ${jobDatabaseId} loaded from database successfully!`);
|
||||
return tempJobRanks;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadJobRoutesFromDatabase(jobDatabaseId) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: Loading job routes for job ${jobDatabaseId} from database ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Loading job routes for job ${jobDatabaseId} from database ...`);
|
||||
|
||||
let tempJobRoutes = [];
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -639,20 +639,20 @@ function loadJobRoutesFromDatabase(jobDatabaseId) {
|
||||
let tempJobRouteData = new JobRouteData(dbAssoc[i]);
|
||||
tempJobRouteData.locations = loadJobRouteLocationsFromDatabase(tempJobRouteData.databaseId);
|
||||
tempJobRoutes.push(tempJobRouteData);
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Job route '${tempJobRouteData.name}' loaded from database successfully!`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Job route '${tempJobRouteData.name}' loaded from database successfully!`);
|
||||
}
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: ${tempJobRoutes.length} job routes for job ${jobDatabaseId} loaded from database successfully!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: ${tempJobRoutes.length} job routes for job ${jobDatabaseId} loaded from database successfully!`);
|
||||
return tempJobRoutes;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadJobRouteLocationsFromDatabase(jobRouteId) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: Loading locations for job route ${jobRouteId} from database ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Loading locations for job route ${jobRouteId} from database ...`);
|
||||
|
||||
let tempJobRouteLocations = [];
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -665,20 +665,20 @@ function loadJobRouteLocationsFromDatabase(jobRouteId) {
|
||||
for (let i in dbAssoc) {
|
||||
let tempJobRouteLocationData = new JobRouteLocationData(dbAssoc[i]);
|
||||
tempJobRouteLocations.push(tempJobRouteLocationData);
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Job route location '${tempJobRouteLocationData.databaseId}' loaded from database successfully!`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Job route location '${tempJobRouteLocationData.databaseId}' loaded from database successfully!`);
|
||||
}
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: ${tempJobRouteLocations.length} locations for job route ${jobRouteId} loaded from database successfully!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: ${tempJobRouteLocations.length} locations for job route ${jobRouteId} loaded from database successfully!`);
|
||||
return tempJobRouteLocations;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadJobEquipmentsFromDatabase(jobDatabaseId) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: Loading job equipments for job ${jobDatabaseId} from database ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Loading job equipments for job ${jobDatabaseId} from database ...`);
|
||||
|
||||
let tempJobEquipments = [];
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -692,20 +692,20 @@ function loadJobEquipmentsFromDatabase(jobDatabaseId) {
|
||||
let tempJobEquipmentData = new JobEquipmentData(dbAssoc[i]);
|
||||
tempJobEquipmentData.items = loadJobEquipmentItemsFromDatabase(tempJobEquipmentData.databaseId);
|
||||
tempJobEquipments.push(tempJobEquipmentData);
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Job equipment '${tempJobEquipmentData.name}' loaded from database successfully!`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Job equipment '${tempJobEquipmentData.name}' loaded from database successfully!`);
|
||||
}
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: ${tempJobEquipments.length} job equipments for job ${jobDatabaseId} loaded from database successfully!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: ${tempJobEquipments.length} job equipments for job ${jobDatabaseId} loaded from database successfully!`);
|
||||
return tempJobEquipments;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadJobLocationsFromDatabase(jobDatabaseId) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: Loading job locations for job ${jobDatabaseId} from database ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Loading job locations for job ${jobDatabaseId} from database ...`);
|
||||
|
||||
let tempJobLocations = [];
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -718,20 +718,20 @@ function loadJobLocationsFromDatabase(jobDatabaseId) {
|
||||
for (let i in dbAssoc) {
|
||||
let tempJobLocationData = new JobLocationData(dbAssoc[i]);
|
||||
tempJobLocations.push(tempJobLocationData);
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Job location '${tempJobLocationData.databaseId}' loaded from database successfully!`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Job location '${tempJobLocationData.databaseId}' loaded from database successfully!`);
|
||||
}
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: ${tempJobLocations.length} job locations for job ${jobDatabaseId} loaded from database successfully!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: ${tempJobLocations.length} job locations for job ${jobDatabaseId} loaded from database successfully!`);
|
||||
return tempJobLocations;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadJobUniformsFromDatabase(jobDatabaseId) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: Loading job uniforms for job ${jobDatabaseId} from database ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Loading job uniforms for job ${jobDatabaseId} from database ...`);
|
||||
|
||||
let tempJobUniforms = [];
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -744,20 +744,20 @@ function loadJobUniformsFromDatabase(jobDatabaseId) {
|
||||
for (let i in dbAssoc) {
|
||||
let tempJobUniformData = new JobUniformData(dbAssoc[i]);
|
||||
tempJobUniforms.push(tempJobUniformData);
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Job uniform '${tempJobUniformData.databaseId}' loaded from database successfully!`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Job uniform '${tempJobUniformData.databaseId}' loaded from database successfully!`);
|
||||
}
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: ${tempJobUniforms.length} job uniforms for job ${jobDatabaseId} loaded from database successfully!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: ${tempJobUniforms.length} job uniforms for job ${jobDatabaseId} loaded from database successfully!`);
|
||||
return tempJobUniforms;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadJobEquipmentItemsFromDatabase(jobEquipmentDatabaseId) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: Loading job equipment items for job equipment ${jobEquipmentDatabaseId} from database ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Loading job equipment items for job equipment ${jobEquipmentDatabaseId} from database ...`);
|
||||
|
||||
let tempJobEquipmentItems = [];
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -770,40 +770,40 @@ function loadJobEquipmentItemsFromDatabase(jobEquipmentDatabaseId) {
|
||||
for (let i in dbAssoc) {
|
||||
let tempJobEquipmentItemData = new JobEquipmentItemData(dbAssoc[i]);
|
||||
tempJobEquipmentItems.push(tempJobEquipmentItemData);
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Job equipment item '${tempJobEquipmentItemData.databaseId}' loaded from database successfully!`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Job equipment item '${tempJobEquipmentItemData.databaseId}' loaded from database successfully!`);
|
||||
}
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: ${tempJobEquipmentItems.length} job equipment items for equipment ${jobEquipmentDatabaseId} loaded from database successfully!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: ${tempJobEquipmentItems.length} job equipment items for equipment ${jobEquipmentDatabaseId} loaded from database successfully!`);
|
||||
return tempJobEquipmentItems;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function spawnAllJobBlips() {
|
||||
function createAllJobBlips() {
|
||||
if (!getServerConfig().createJobBlips) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job] Spawning all job location blips ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Spawning all job location blips ...`);
|
||||
for (let i in getServerData().jobs) {
|
||||
for (let j in getServerData().jobs[i].locations) {
|
||||
spawnJobLocationBlip(i, j);
|
||||
createJobLocationBlip(i, j);
|
||||
}
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job] All job location blips spawned!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job] All job location blips spawned!`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function spawnAllJobPickups() {
|
||||
function createAllJobPickups() {
|
||||
if (!getServerConfig().createJobPickups) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job] Spawning all job location pickups ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Spawning all job location pickups ...`);
|
||||
let pickupCount = 0;
|
||||
for (let i in getServerData().jobs) {
|
||||
if (getServerData().jobs[i].pickupModel != 0) {
|
||||
@@ -819,11 +819,11 @@ function spawnAllJobPickups() {
|
||||
setElementDimension(getServerData().jobs[i].locations[j].pickup, getServerData().jobs[i].locations[j].dimension);
|
||||
addToWorld(getServerData().jobs[i].locations[j].pickup);
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Job] Job '${getServerData().jobs[i].name}' location pickup ${j} spawned!`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Job] Job '${getServerData().jobs[i].name}' location pickup ${j} spawned!`);
|
||||
}
|
||||
}
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job] All job location pickups (${pickupCount}) spawned!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job] All job location pickups (${pickupCount}) spawned!`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -943,11 +943,6 @@ function takeJobCommand(command, params, client) {
|
||||
let closestJobLocation = getClosestJobLocation(getPlayerPosition(client), getPlayerDimension(client));
|
||||
let jobData = getJobData(closestJobLocation.jobIndex);
|
||||
|
||||
if (closestJobLocation == false) {
|
||||
messagePlayerError(client, getLocaleString(client, "NoJobLocationCloseEnough"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (closestJobLocation.position.distance(getPlayerPosition(client)) > getGlobalConfig().takeJobDistance) {
|
||||
messagePlayerError(client, getLocaleString(client, "NoJobLocationCloseEnough"));
|
||||
return false;
|
||||
@@ -1555,8 +1550,8 @@ function reloadAllJobsCommand(command, params, client) {
|
||||
|
||||
Promise.resolve().then(() => {
|
||||
getServerData().jobs = loadJobsFromDatabase();
|
||||
spawnAllJobPickups();
|
||||
spawnAllJobBlips();
|
||||
createAllJobPickups();
|
||||
createAllJobBlips();
|
||||
});
|
||||
|
||||
announceAdminAction("AllJobsReloaded");
|
||||
@@ -1565,11 +1560,6 @@ function reloadAllJobsCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function createJobCommand(command, params, client) {
|
||||
if (areParamsEmpty(params)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
|
||||
createJob(params);
|
||||
|
||||
messagePlayerSuccess(client, `Job {jobYellow}${params} {MAINCOLOUR}created!`);
|
||||
@@ -2730,11 +2720,11 @@ function saveJobToDatabase(jobData) {
|
||||
}
|
||||
|
||||
if (jobData.needsSaved == false) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: Job ${jobData.name} doesn't need saved. Skipping ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Job ${jobData.name} doesn't need saved. Skipping ...`);
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saving job ${jobData.name} to database ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saving job ${jobData.name} to database ...`);
|
||||
let dbConnection = connectToDatabase();
|
||||
if (dbConnection) {
|
||||
let safeName = escapeDatabaseString(dbConnection, jobData.name);
|
||||
@@ -2771,7 +2761,7 @@ function saveJobToDatabase(jobData) {
|
||||
disconnectFromDatabase(dbConnection);
|
||||
return true;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saved job ${jobData.name} to database!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saved job ${jobData.name} to database!`);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -2785,11 +2775,11 @@ function saveJobRankToDatabase(jobRankData) {
|
||||
}
|
||||
|
||||
if (jobRankData.needsSaved == false) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: Job route ${jobRankData.name} (DB ID ${jobRankData.databaseId}) doesn't need saved. Skipping ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Job route ${jobRankData.name} (DB ID ${jobRankData.databaseId}) doesn't need saved. Skipping ...`);
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saving job route ${jobRankData.name} to database ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saving job route ${jobRankData.name} to database ...`);
|
||||
let dbConnection = connectToDatabase();
|
||||
if (dbConnection) {
|
||||
let safeName = escapeDatabaseString(dbConnection, jobRankData.name);
|
||||
@@ -2820,7 +2810,7 @@ function saveJobRankToDatabase(jobRankData) {
|
||||
disconnectFromDatabase(dbConnection);
|
||||
return true;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saved job rank ${jobRankData.name} to database!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saved job rank ${jobRankData.name} to database!`);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -2834,11 +2824,11 @@ function saveJobRouteToDatabase(jobRouteData) {
|
||||
}
|
||||
|
||||
if (jobRouteData.needsSaved == false) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: Job route ${jobRouteData.name} (DB ID ${jobRouteData.databaseId}) doesn't need saved. Skipping ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Job route ${jobRouteData.name} (DB ID ${jobRouteData.databaseId}) doesn't need saved. Skipping ...`);
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saving job route ${jobRouteData.name} to database ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saving job route ${jobRouteData.name} to database ...`);
|
||||
let dbConnection = connectToDatabase();
|
||||
if (dbConnection) {
|
||||
let safeName = escapeDatabaseString(dbConnection, jobRouteData.name);
|
||||
@@ -2879,7 +2869,7 @@ function saveJobRouteToDatabase(jobRouteData) {
|
||||
disconnectFromDatabase(dbConnection);
|
||||
return true;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saved job route ${jobRouteData.name} to database!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saved job route ${jobRouteData.name} to database!`);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -2893,11 +2883,11 @@ function saveJobRouteLocationToDatabase(jobRouteLocationData) {
|
||||
}
|
||||
|
||||
if (jobRouteLocationData.needsSaved == false) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: Job route location ${jobRouteLocationData.name} (DB ID ${jobRouteLocationData.databaseId}) doesn't need saved. Skipping ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Job route location ${jobRouteLocationData.name} (DB ID ${jobRouteLocationData.databaseId}) doesn't need saved. Skipping ...`);
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saving job route location ${jobRouteLocationData.name} to database ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saving job route location ${jobRouteLocationData.name} to database ...`);
|
||||
let dbConnection = connectToDatabase();
|
||||
if (dbConnection) {
|
||||
let safeName = escapeDatabaseString(dbConnection, jobRouteLocationData.name);
|
||||
@@ -2929,7 +2919,7 @@ function saveJobRouteLocationToDatabase(jobRouteLocationData) {
|
||||
disconnectFromDatabase(dbConnection);
|
||||
return true;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saved job route location ${jobRoutePositionData.name} (${jobRouteLocationData.databaseId}) to database!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saved job route location ${jobRoutePositionData.name} (${jobRouteLocationData.databaseId}) to database!`);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -2943,11 +2933,11 @@ function saveJobLocationToDatabase(jobLocationData) {
|
||||
}
|
||||
|
||||
if (!jobLocationData.needsSaved) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: Job location ${jobLocationData.name} (${jobLocationData.databaseId}) doesn't need saved. Skipping ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Job location ${jobLocationData.name} (${jobLocationData.databaseId}) doesn't need saved. Skipping ...`);
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saving job location ${jobLocationData.databaseId} to database ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saving job location ${jobLocationData.databaseId} to database ...`);
|
||||
let dbConnection = connectToDatabase();
|
||||
if (dbConnection) {
|
||||
let data = [
|
||||
@@ -2978,7 +2968,7 @@ function saveJobLocationToDatabase(jobLocationData) {
|
||||
return true;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saved job location ${jobLocationData.databaseId} to database`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saved job location ${jobLocationData.databaseId} to database`);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -2992,11 +2982,11 @@ function saveJobEquipmentToDatabase(jobEquipmentData) {
|
||||
}
|
||||
|
||||
if (!jobEquipmentData.needsSaved) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: Job equipment ${jobEquipmentData.name} (${jobEquipmentData.databaseId}) doesn't need saved. Skipping ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Job equipment ${jobEquipmentData.name} (${jobEquipmentData.databaseId}) doesn't need saved. Skipping ...`);
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saving job equipment ${jobEquipmentData.databaseId} to database ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saving job equipment ${jobEquipmentData.databaseId} to database ...`);
|
||||
let dbConnection = connectToDatabase();
|
||||
if (dbConnection) {
|
||||
let safeName = escapeDatabaseString(dbConnection, jobEquipmentData.name);
|
||||
@@ -3024,7 +3014,7 @@ function saveJobEquipmentToDatabase(jobEquipmentData) {
|
||||
disconnectFromDatabase(dbConnection);
|
||||
return true;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saved job equipment ${jobEquipmentData.databaseId} to database`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saved job equipment ${jobEquipmentData.databaseId} to database`);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -3038,11 +3028,11 @@ function saveJobEquipmentItemToDatabase(jobEquipmentItemData) {
|
||||
}
|
||||
|
||||
if (!jobEquipmentItemData.needsSaved) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: Job equipment item ${jobEquipmentItemData.databaseId} doesn't need saved. Skipping ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Job equipment item ${jobEquipmentItemData.databaseId} doesn't need saved. Skipping ...`);
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saving job equipment weapon ${jobEquipmentItemData.databaseId} to database ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saving job equipment weapon ${jobEquipmentItemData.databaseId} to database ...`);
|
||||
let dbConnection = connectToDatabase();
|
||||
if (dbConnection) {
|
||||
let data = [
|
||||
@@ -3069,7 +3059,7 @@ function saveJobEquipmentItemToDatabase(jobEquipmentItemData) {
|
||||
disconnectFromDatabase(dbConnection);
|
||||
return true;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saved job equipment weapon ${jobEquipmentItemData.databaseId} to database`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saved job equipment weapon ${jobEquipmentItemData.databaseId} to database`);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -3083,11 +3073,11 @@ function saveJobUniformToDatabase(jobUniformData) {
|
||||
}
|
||||
|
||||
if (!jobUniformData.needSaved) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: Job uniform ${jobUniformData.databaseId} doesn't need saved. Skipping ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Job uniform ${jobUniformData.databaseId} doesn't need saved. Skipping ...`);
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saving job uniform ${jobUniformData.databaseId} to database ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saving job uniform ${jobUniformData.databaseId} to database ...`);
|
||||
let dbConnection = connectToDatabase();
|
||||
if (dbConnection) {
|
||||
let safeName = escapeDatabaseString(dbConnection, jobUniformData.name);
|
||||
@@ -3116,7 +3106,7 @@ function saveJobUniformToDatabase(jobUniformData) {
|
||||
disconnectFromDatabase(dbConnection);
|
||||
return true;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saved job uniform ${jobUniformData.databaseId} to database`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saved job uniform ${jobUniformData.databaseId} to database`);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -3184,7 +3174,7 @@ function createJobLocationPickup(jobId, locationId) {
|
||||
|
||||
let tempJobData = getJobData(jobId);
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Creating pickup for location ${locationId} of the ${tempJobData.name} job`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating pickup for location ${locationId} of the ${tempJobData.name} job`);
|
||||
|
||||
if (tempJobData.pickupModel != -1) {
|
||||
let pickupModelId = -1;
|
||||
@@ -3197,19 +3187,17 @@ function createJobLocationPickup(jobId, locationId) {
|
||||
}
|
||||
|
||||
if (areServerElementsSupported()) {
|
||||
if (isGameFeatureSupported("pickup")) {
|
||||
let pickup = createGamePickup(pickupModelId, tempJobData.locations[locationId].position, getGameConfig().pickupTypes[getGame()].job);
|
||||
if (pickup != false) {
|
||||
tempJobData.locations[locationId].pickup = pickup;
|
||||
setElementDimension(pickup, tempJobData.locations[locationId].dimension);
|
||||
setElementOnAllDimensions(pickup, false);
|
||||
setEntityData(pickup, "v.rp.owner.type", V_PICKUP_JOB, false);
|
||||
setEntityData(pickup, "v.rp.owner.id", locationId, false);
|
||||
setEntityData(pickup, "v.rp.label.type", V_LABEL_JOB, true);
|
||||
setEntityData(pickup, "v.rp.label.name", tempJobData.name, true);
|
||||
setEntityData(pickup, "v.rp.label.jobType", tempJobData.databaseId, true);
|
||||
addToWorld(pickup);
|
||||
}
|
||||
let pickup = createGamePickup(pickupModelId, tempJobData.locations[locationId].position, getGameConfig().pickupTypes[getGame()].job);
|
||||
if (pickup != false) {
|
||||
tempJobData.locations[locationId].pickup = pickup;
|
||||
setElementDimension(pickup, tempJobData.locations[locationId].dimension);
|
||||
setElementOnAllDimensions(pickup, false);
|
||||
setEntityData(pickup, "v.rp.owner.type", V_PICKUP_JOB, false);
|
||||
setEntityData(pickup, "v.rp.owner.id", locationId, false);
|
||||
setEntityData(pickup, "v.rp.label.type", V_LABEL_JOB, true);
|
||||
setEntityData(pickup, "v.rp.label.name", tempJobData.name, true);
|
||||
setEntityData(pickup, "v.rp.label.jobType", tempJobData.databaseId, true);
|
||||
addToWorld(pickup);
|
||||
}
|
||||
} else {
|
||||
let blipModelId = -1;
|
||||
@@ -3228,7 +3216,7 @@ function createJobLocationPickup(jobId, locationId) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function spawnJobLocationBlip(jobId, locationId) {
|
||||
function createJobLocationBlip(jobId, locationId) {
|
||||
if (!getServerConfig().createJobBlips) {
|
||||
return false;
|
||||
}
|
||||
@@ -3430,14 +3418,14 @@ function respawnPlayerLastJobVehicle(client) {
|
||||
|
||||
function resetAllJobBlips() {
|
||||
deleteAllJobBlips();
|
||||
spawnAllJobBlips();
|
||||
createAllJobBlips();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function resetAllJobPickups() {
|
||||
deleteAllJobPickups();
|
||||
spawnAllJobPickups();
|
||||
createAllJobPickups();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -3563,11 +3551,7 @@ function createJobUniformCommand(command, params, client) {
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let jobId = getJobFromParams(getParam(params, " ", 1));
|
||||
let skinIndex = getPlayerCurrentSubAccount(client).skin;
|
||||
|
||||
if (areThereEnoughParams(params, 2, " ")) {
|
||||
skinIndex = getSkinModelIndexFromParams(splitParams.slice(1).join(" "), getGame());
|
||||
}
|
||||
let skinIndex = getSkinModelIndexFromParams(splitParams.slice(1).join(" "), getGame());
|
||||
|
||||
if (!getJobData(jobId)) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidJob"));
|
||||
@@ -3580,7 +3564,7 @@ function createJobUniformCommand(command, params, client) {
|
||||
}
|
||||
|
||||
createJobUniform(jobId, skinIndex);
|
||||
messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created uniform with skin {ALTCOLOUR}${getSkinNameFromIndex(skinIndex)} (${getGameConfig().skins[skinIndex][0]}){MAINCOLOUR} for job {jobYellow}${getJobData(jobId).name}`);
|
||||
messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created uniform with skin {ALTCOLOUR}${getGameConfig().skins[skinIndex][1]} (${getGameConfig().skins[skinIndex][0]}){MAINCOLOUR} for job {jobYellow}${getJobData(jobId).name}`);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,8 +53,6 @@ function addKeyBindCommand(command, params, client) {
|
||||
let tempCommand = getParam(params, " ", 2);
|
||||
let tempParams = (splitParams.length > 2) ? splitParams.slice(2).join(" ") : "";
|
||||
|
||||
tempCommand = removeSlashesFromString(tempCommand);
|
||||
|
||||
if (!keyId) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidKeyBindName"));
|
||||
messagePlayerTip(client, getLocaleString(client, "KeyBindNameTip"));
|
||||
@@ -63,7 +61,7 @@ function addKeyBindCommand(command, params, client) {
|
||||
}
|
||||
|
||||
addPlayerKeyBind(client, keyId, tempCommand, tempParams);
|
||||
messagePlayerSuccess(client, getLocaleString(client, "KeyBindAdded", `{ALTCOLOUR}${toUpperCase(getKeyNameFromId(keyId))}{MAINCOLOUR}`, `{ALTCOLOUR}/${tempCommand} ${tempParams}`));
|
||||
messagePlayerSuccess(client, getLocaleString(client, "KeyBindRemoved", `{ALTCOLOUR}${toUpperCase(getKeyNameFromId(keyId))}{MAINCOLOUR}`, `{ALTCOLOUR}/${tempCommand} ${tempParams}`));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -108,7 +106,7 @@ function copyKeyBindsToServerCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function addPlayerKeyBind(client, keyId, command, params, tempKey = false) {
|
||||
let keyBindData = new KeyBindData(false, keyId, `${command} ${params}`);
|
||||
let keyBindData = new KeyBindData(false, keys, `${command} ${params}`);
|
||||
if (tempKey == true) {
|
||||
keyBindData.databaseId = -1;
|
||||
}
|
||||
@@ -118,7 +116,7 @@ function addPlayerKeyBind(client, keyId, command, params, tempKey = false) {
|
||||
|
||||
if (!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "enter")) {
|
||||
let keyId = getPlayerKeyBindForCommand(client, "enter");
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
|
||||
sendPlayerEnterPropertyKey(client, keyId.key);
|
||||
} else {
|
||||
sendPlayerEnterPropertyKey(client, false);
|
||||
@@ -142,8 +140,8 @@ function removePlayerKeyBind(client, keyId) {
|
||||
|
||||
if (!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "enter")) {
|
||||
let keyId = getPlayerKeyBindForCommand(client, "enter");
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
|
||||
sendPlayerEnterPropertyKey(client, -1);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
|
||||
sendPlayerEnterPropertyKey(client, keyId.key);
|
||||
} else {
|
||||
sendPlayerEnterPropertyKey(client, false);
|
||||
}
|
||||
@@ -210,7 +208,7 @@ function playerUsedKeyBind(client, key, duration = 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.KeyBind] ${getPlayerDisplayForConsole(client)} used keybind ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.KeyBind] ${getPlayerDisplayForConsole(client)} used keybind ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
||||
if (!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForKey(client, key)) {
|
||||
let keyBindData = getPlayerKeyBindForKey(client, key);
|
||||
if (keyBindData.enabled) {
|
||||
@@ -240,7 +238,7 @@ function sendAccountKeyBindsToClient(client) {
|
||||
// ===========================================================================
|
||||
|
||||
function showKeyBindListCommand(command, params, client) {
|
||||
let keybindList = getPlayerData(client).keyBinds.map(function (x) { return `{chatBoxListIndex}${toUpperCase(getKeyNameFromId(x.key))}: {MAINCOLOUR}${x.commandString}`; });
|
||||
let keybindList = getPlayerData(client).keyBinds.map(function (x) { return `{ALTCOLOUR}${toUpperCase(getKeyNameFromId(x.key))}: {MAINCOLOUR}${x.commandString}`; });
|
||||
|
||||
let chunkedList = splitArrayIntoChunks(keybindList, 6);
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ function getLocaleString(client, stringName, ...args) {
|
||||
|
||||
let tempString = getRawLocaleString(getPlayerData(client).locale, stringName);
|
||||
if (tempString == "" || tempString == null || typeof tempString == "undefined") {
|
||||
logToConsole(LOG_WARN, `[V.RP.Locale] Locale string missing for ${stringName} on language ${getLocaleData(getPlayerData(client).locale).englishName}`);
|
||||
logToConsole(LOG_WARN, `[AGRP.Locale] Locale string missing for ${stringName} on language ${getLocaleData(getPlayerData(client).locale).englishName}`);
|
||||
submitBugReport(client, `(AUTOMATED REPORT) Locale string "${stringName}" is missing for "${getPlayerLocaleName(client)}"`);
|
||||
return "";
|
||||
}
|
||||
@@ -57,7 +57,7 @@ function getLocaleString(client, stringName, ...args) {
|
||||
function getLanguageLocaleString(localeId, stringName, ...args) {
|
||||
let tempString = getRawLocaleString(localeId, stringName);
|
||||
if (tempString == "" || tempString == null || typeof tempString == "undefined") {
|
||||
logToConsole(LOG_WARN, `[V.RP.Locale] Locale string missing for ${stringName} on language ${getLocaleData(localeId).englishName}`);
|
||||
logToConsole(LOG_WARN, `[AGRP.Locale] Locale string missing for ${stringName} on language ${getLocaleData(localeId).englishName}`);
|
||||
submitBugReport(null, `(AUTOMATED REPORT) Locale string "${stringName}" is missing for "${getLocaleData(localeId).englishName}"`);
|
||||
return "";
|
||||
}
|
||||
@@ -74,7 +74,7 @@ function getLanguageLocaleString(localeId, stringName, ...args) {
|
||||
function getLanguageGroupedLocaleString(localeId, stringName, index, ...args) {
|
||||
let tempString = getRawGroupedLocaleString(localeId, stringName, index);
|
||||
if (tempString == "" || tempString == null || typeof tempString == "undefined") {
|
||||
logToConsole(LOG_WARN, `[V.RP.Locale] Locale string missing for index ${index} of "${stringName}" on language ${getLocaleData(localeId).englishName}`);
|
||||
logToConsole(LOG_WARN, `[AGRP.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}"`);
|
||||
return "";
|
||||
}
|
||||
@@ -106,7 +106,7 @@ function getGroupedLocaleString(client, stringName, index, ...args) {
|
||||
|
||||
function getRawLocaleString(localeId, stringName) {
|
||||
if (typeof getLocaleStrings()[localeId][stringName] == "undefined") {
|
||||
logToConsole(LOG_WARN, `[V.RP.Locale] Locale string missing for ${getLocaleStrings()[localeId][stringName]} on language ${getLocaleData(localeId).englishName}[${localeId}]`);
|
||||
logToConsole(LOG_WARN, `[AGRP.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}]`);
|
||||
return "";
|
||||
}
|
||||
@@ -127,7 +127,7 @@ function getRawLocaleString(localeId, stringName) {
|
||||
|
||||
function getRawGroupedLocaleString(localeId, stringName, index) {
|
||||
if (typeof getLocaleStrings()[localeId][stringName][index] == "undefined") {
|
||||
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}]`);
|
||||
logToConsole(LOG_WARN, `[AGRP.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}]`);
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -367,7 +367,7 @@ function enterExitPropertyCommand(command, params, client) {
|
||||
|
||||
if (closestProperty.exitScene != "" && isGameFeatureSupported("interiorScene")) {
|
||||
getPlayerCurrentSubAccount(client).spawnPosition = closestProperty.exitPosition;
|
||||
if (isMainWorldScene(closestProperty.exitScene) || closestProperty.exitScene == "V.MAINWORLD") {
|
||||
if (isMainWorldScene(closestProperty.exitScene) || closestProperty.exitScene == "AGRP.MAINWORLD") {
|
||||
setPlayerScene(client, getGameConfig().mainWorldScene[getGame()]);
|
||||
} else {
|
||||
setPlayerScene(client, closestProperty.exitScene);
|
||||
@@ -376,7 +376,7 @@ function enterExitPropertyCommand(command, params, client) {
|
||||
}
|
||||
|
||||
if (isFadeCameraSupported()) {
|
||||
fadePlayerCamera(client, false, 1000);
|
||||
fadeCamera(client, false, 1.0);
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
@@ -399,11 +399,9 @@ function enterExitPropertyCommand(command, params, client) {
|
||||
|
||||
if (closestProperty.entranceScene != "" && isGameFeatureSupported("interiorScene")) {
|
||||
getPlayerCurrentSubAccount(client).spawnPosition = closestProperty.entrancePosition;
|
||||
if (isMainWorldScene(closestProperty.entranceScene) || closestProperty.entranceScene == "V.MAINWORLD") {
|
||||
destroyGameElement(client.player);
|
||||
if (isMainWorldScene(closestProperty.entranceScene) || closestProperty.entranceScene == "AGRP.MAINWORLD") {
|
||||
setPlayerScene(client, getGameConfig().mainWorldScene[getGame()]);
|
||||
} else {
|
||||
destroyGameElement(client.player);
|
||||
setPlayerScene(client, closestProperty.entranceScene);
|
||||
}
|
||||
|
||||
@@ -411,7 +409,7 @@ function enterExitPropertyCommand(command, params, client) {
|
||||
}
|
||||
|
||||
if (isFadeCameraSupported()) {
|
||||
fadePlayerCamera(client, false, 1000);
|
||||
fadeCamera(client, false, 1.0);
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
@@ -419,7 +417,7 @@ function enterExitPropertyCommand(command, params, client) {
|
||||
}, 1100);
|
||||
}
|
||||
}
|
||||
//logToConsole(LOG_DEBUG, `[V.RP.Misc] ${getPlayerDisplayForConsole(client)} exited business ${inBusiness.name}[${inBusiness.index}/${inBusiness.databaseId}]`);
|
||||
//logToConsole(LOG_DEBUG, `[AGRP.Misc] ${getPlayerDisplayForConsole(client)} exited business ${inBusiness.name}[${inBusiness.index}/${inBusiness.databaseId}]`);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -927,7 +925,7 @@ function processPlayerDeath(client) {
|
||||
updatePlayerSpawnedState(client, false);
|
||||
setPlayerControlState(client, false);
|
||||
setTimeout(function () {
|
||||
fadePlayerCamera(client, false, 2000);
|
||||
fadePlayerCamera(client, false, 1000);
|
||||
setTimeout(function () {
|
||||
if (isPlayerInPaintBall(client)) {
|
||||
respawnPlayerForPaintBall(client);
|
||||
@@ -944,7 +942,7 @@ function processPlayerDeath(client) {
|
||||
|
||||
spawnPlayer(client, closestJail.position, closestJail.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
||||
|
||||
fadePlayerCamera(client, true, 2000);
|
||||
fadePlayerCamera(client, true, 1000);
|
||||
updatePlayerSpawnedState(client, true);
|
||||
makePlayerStopAnimation(client);
|
||||
setPlayerControlState(client, true);
|
||||
@@ -960,7 +958,7 @@ function processPlayerDeath(client) {
|
||||
}
|
||||
|
||||
spawnPlayer(client, closestHospital.position, closestHospital.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
||||
fadePlayerCamera(client, true, 2000);
|
||||
fadePlayerCamera(client, true, 1000);
|
||||
updatePlayerSpawnedState(client, true);
|
||||
makePlayerStopAnimation(client);
|
||||
setPlayerControlState(client, true);
|
||||
|
||||
@@ -7,25 +7,6 @@
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
class vPlayer {
|
||||
constructor(id, name = "", object = null) {
|
||||
object: null;
|
||||
name: null;
|
||||
id: -1;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
class vVehicle {
|
||||
constructor(id, object = null) {
|
||||
object: null;
|
||||
id: -1;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let builtInCommands = [
|
||||
"refresh",
|
||||
"restart",
|
||||
@@ -845,24 +826,24 @@ function getPlayerWeapon(client) {
|
||||
function connectToDatabase() {
|
||||
if (getDatabaseConfig().usePersistentConnection) {
|
||||
if (persistentDatabaseConnection == null) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Database] Initializing database connection ...`);
|
||||
persistentDatabaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port, getDatabaseConfig().useSSL);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Initializing database connection ...`);
|
||||
persistentDatabaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port);
|
||||
if (persistentDatabaseConnection.error) {
|
||||
logToConsole(LOG_ERROR, `[V.RP.Database] Database connection error: ${persistentDatabaseConnection.error}`);
|
||||
logToConsole(LOG_ERROR, `[AGRP.Database] Database connection error: ${persistentDatabaseConnection.error}`);
|
||||
persistentDatabaseConnection = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Database] Database connection successful!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Database connection successful!`);
|
||||
return persistentDatabaseConnection;
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Database] Using existing database connection.`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Using existing database connection.`);
|
||||
return persistentDatabaseConnection;
|
||||
}
|
||||
} else {
|
||||
let databaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port, getDatabaseConfig().useSSL);
|
||||
let databaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port);
|
||||
if (databaseConnection.error) {
|
||||
logToConsole(LOG_ERROR, `[V.RP.Database] Database connection error: ${persistentDatabaseConnection.error}`);
|
||||
logToConsole(LOG_ERROR, `[AGRP.Database] Database connection error: ${persistentDatabaseConnection.error}`);
|
||||
return false;
|
||||
} else {
|
||||
return databaseConnection;
|
||||
@@ -876,9 +857,9 @@ function disconnectFromDatabase(dbConnection, force = false) {
|
||||
if (!getDatabaseConfig().usePersistentConnection || force == true) {
|
||||
try {
|
||||
dbConnection.close();
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Database] Database connection closed successfully`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Database connection closed successfully`);
|
||||
} catch (error) {
|
||||
logToConsole(LOG_ERROR, `[V.RP.Database] Database connection could not be closed! (Error: ${error})`);
|
||||
logToConsole(LOG_ERROR, `[AGRP.Database] Database connection could not be closed! (Error: ${error})`);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -887,7 +868,7 @@ function disconnectFromDatabase(dbConnection, force = false) {
|
||||
// ===========================================================================
|
||||
|
||||
function queryDatabase(dbConnection, queryString, useThread = false) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Database] Query string: ${queryString}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Query string: ${queryString}`);
|
||||
if (useThread == true) {
|
||||
Promise.resolve().then(() => {
|
||||
let queryResult = dbConnection.query(queryString);
|
||||
@@ -961,19 +942,19 @@ function quickDatabaseQuery(queryString) {
|
||||
let dbConnection = connectToDatabase();
|
||||
let insertId = 0;
|
||||
if (dbConnection) {
|
||||
//logToConsole(LOG_DEBUG, `[V.RP.Database] Query string: ${queryString}`);
|
||||
//logToConsole(LOG_DEBUG, `[AGRP.Database] Query string: ${queryString}`);
|
||||
let dbQuery = queryDatabase(dbConnection, queryString);
|
||||
if (getDatabaseInsertId(dbConnection)) {
|
||||
insertId = getDatabaseInsertId(dbConnection);
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Database] Query returned insert id ${insertId}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Query returned insert id ${insertId}`);
|
||||
}
|
||||
|
||||
if (dbQuery) {
|
||||
try {
|
||||
freeDatabaseQuery(dbQuery);
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Database] Query result free'd successfully`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Query result free'd successfully`);
|
||||
} catch (error) {
|
||||
logToConsole(LOG_ERROR, `[V.RP.Database] Query result could not be free'd! (Error: ${error})`);
|
||||
logToConsole(LOG_ERROR, `[AGRP.Database] Query result could not be free'd! (Error: ${error})`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1025,9 +1006,9 @@ function setConstantsAsGlobalVariablesInDatabase() {
|
||||
let dbConnection = connectToDatabase();
|
||||
let entries = Object.entries(global);
|
||||
for (let i in entries) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Database] Checking entry ${i} (${entries[i]})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Checking entry ${i} (${entries[i]})`);
|
||||
if (toString(i).slice(0, 3).indexOf("V_") != -1) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Database] Adding ${i} (${entries[i]}) to database global variables`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Adding ${i} (${entries[i]}) to database global variables`);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1212,7 +1193,7 @@ function setVehicleHealth(vehicle, health) {
|
||||
// ===========================================================================
|
||||
|
||||
function givePlayerWeapon(client, weaponId, ammo, active = true) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to give weapon (Weapon: ${weaponId}, Ammo: ${ammo})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to give weapon (Weapon: ${weaponId}, Ammo: ${ammo})`);
|
||||
sendNetworkEventToPlayer("v.rp.giveWeapon", client, weaponId, ammo, active);
|
||||
}
|
||||
|
||||
@@ -1466,7 +1447,7 @@ function hideElementForPlayer(element, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Native.Connected] Hiding element ${element.id} for player ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Native.Connected] Hiding element ${element.id} for player ${getPlayerDisplayForConsole(client)}`);
|
||||
element.setExistsFor(client, false);
|
||||
}
|
||||
|
||||
@@ -1481,7 +1462,7 @@ function showElementForPlayer(element, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Native.Connected] Showing element ${element.id} for player ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Native.Connected] Showing element ${element.id} for player ${getPlayerDisplayForConsole(client)}`);
|
||||
element.setExistsFor(client, true);
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -7,26 +7,6 @@
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
class vPlayer {
|
||||
constructor(id, name = "", object = null) {
|
||||
object: null;
|
||||
name: null;
|
||||
id: -1;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
class vVehicle {
|
||||
constructor(id, object = null) {
|
||||
object: null;
|
||||
id: -1;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
// Needs updated for RAGEMP
|
||||
let builtInCommands = [
|
||||
"refresh",
|
||||
"restart",
|
||||
@@ -762,24 +742,24 @@ function getPlayerWeapon(client) {
|
||||
function connectToDatabase() {
|
||||
if (getDatabaseConfig().usePersistentConnection) {
|
||||
if (persistentDatabaseConnection == null) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Database] Initializing database connection ...`);
|
||||
persistentDatabaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port, getDatabaseConfig().useSSL);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Initializing database connection ...`);
|
||||
persistentDatabaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port);
|
||||
if (persistentDatabaseConnection.error) {
|
||||
logToConsole(LOG_ERROR, `[V.RP.Database] Database connection error: ${persistentDatabaseConnection.error}`);
|
||||
logToConsole(LOG_ERROR, `[AGRP.Database] Database connection error: ${persistentDatabaseConnection.error}`);
|
||||
persistentDatabaseConnection = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Database] Database connection successful!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Database connection successful!`);
|
||||
return persistentDatabaseConnection;
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Database] Using existing database connection.`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Using existing database connection.`);
|
||||
return persistentDatabaseConnection;
|
||||
}
|
||||
} else {
|
||||
let databaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port, getDatabaseConfig().useSSL);
|
||||
let databaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port);
|
||||
if (databaseConnection.error) {
|
||||
logToConsole(LOG_ERROR, `[V.RP.Database] Database connection error: ${persistentDatabaseConnection.error}`);
|
||||
logToConsole(LOG_ERROR, `[AGRP.Database] Database connection error: ${persistentDatabaseConnection.error}`);
|
||||
return false;
|
||||
} else {
|
||||
return databaseConnection;
|
||||
@@ -793,9 +773,9 @@ function disconnectFromDatabase(dbConnection) {
|
||||
if (!getDatabaseConfig().usePersistentConnection) {
|
||||
try {
|
||||
dbConnection.close();
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Database] Database connection closed successfully`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Database connection closed successfully`);
|
||||
} catch (error) {
|
||||
logToConsole(LOG_ERROR, `[V.RP.Database] Database connection could not be closed! (Error: ${error})`);
|
||||
logToConsole(LOG_ERROR, `[AGRP.Database] Database connection could not be closed! (Error: ${error})`);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -804,7 +784,7 @@ function disconnectFromDatabase(dbConnection) {
|
||||
// ===========================================================================
|
||||
|
||||
function queryDatabase(dbConnection, queryString, useThread = false) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Database] Query string: ${queryString}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Query string: ${queryString}`);
|
||||
if (useThread == true) {
|
||||
Promise.resolve().then(() => {
|
||||
let queryResult = dbConnection.query(queryString);
|
||||
@@ -869,19 +849,19 @@ function quickDatabaseQuery(queryString) {
|
||||
let dbConnection = connectToDatabase();
|
||||
let insertId = 0;
|
||||
if (dbConnection) {
|
||||
//logToConsole(LOG_DEBUG, `[V.RP.Database] Query string: ${queryString}`);
|
||||
//logToConsole(LOG_DEBUG, `[AGRP.Database] Query string: ${queryString}`);
|
||||
let dbQuery = queryDatabase(dbConnection, queryString);
|
||||
if (getDatabaseInsertId(dbConnection)) {
|
||||
insertId = getDatabaseInsertId(dbConnection);
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Database] Query returned insert id ${insertId}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Query returned insert id ${insertId}`);
|
||||
}
|
||||
|
||||
if (dbQuery) {
|
||||
try {
|
||||
freeDatabaseQuery(dbQuery);
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Database] Query result free'd successfully`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Query result free'd successfully`);
|
||||
} catch (error) {
|
||||
logToConsole(LOG_ERROR, `[V.RP.Database] Query result could not be free'd! (Error: ${error})`);
|
||||
logToConsole(LOG_ERROR, `[AGRP.Database] Query result could not be free'd! (Error: ${error})`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1018,7 +998,7 @@ function setVehicleHealth(vehicle, health) {
|
||||
// ===========================================================================
|
||||
|
||||
function givePlayerWeapon(client, weaponId, ammo, active = true) {
|
||||
//logToConsole(LOG_DEBUG, `[V.RP.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to give weapon (Weapon: ${weaponId}, Ammo: ${ammo})`);
|
||||
//logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to give weapon (Weapon: ${weaponId}, Ammo: ${ammo})`);
|
||||
//sendNetworkEventToPlayer("v.rp.giveWeapon", client, weaponId, ammo, active);
|
||||
client.giveWeapon(weaponId, ammo);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ function addAllNetworkEventHandlers() {
|
||||
|
||||
// Event
|
||||
addNetworkEventHandler("v.rp.pickup", onPlayerNearPickup);
|
||||
addNetworkEventHandler("v.rp.playerDeath", processPlayerDeath);
|
||||
addNetworkEventHandler("v.rp.playerDeath", onPlayerDeath);
|
||||
|
||||
// Job
|
||||
addNetworkEventHandler("v.rp.arrivedAtJobRouteLocation", playerArrivedAtJobRouteLocation);
|
||||
@@ -87,14 +87,14 @@ function updatePlayerNameTag(client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending ${getPlayerDisplayForConsole(client)}'s updated nametag to all players`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.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));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function updateAllPlayerNameTags() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending updated nametags to all players`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending updated nametags to all players`);
|
||||
let clients = getClients();
|
||||
for (let i in clients) {
|
||||
updatePlayerNameTag(clients[i]);
|
||||
@@ -104,7 +104,7 @@ function updateAllPlayerNameTags() {
|
||||
// ===========================================================================
|
||||
|
||||
function updatePlayerPing(client) {
|
||||
//logToConsole(LOG_DEBUG, `[V.RP.Client] Sending ${getPlayerDisplayForConsole(client)}'s ping to all players`);
|
||||
//logToConsole(LOG_DEBUG, `[AGRP.Client] Sending ${getPlayerDisplayForConsole(client)}'s ping to all players`);
|
||||
sendNetworkEventToPlayer("v.rp.ping", null, getPlayerName(client), getPlayerPing(client));
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ function updatePlayerPing(client) {
|
||||
|
||||
function playerClientReady(client) {
|
||||
playerResourceReady[client.index] = true;
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s client resources are downloaded and ready! Started: ${getYesNoFromBool(playerResourceStarted[client.index])}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s client resources are downloaded and ready! Started: ${getYesNoFromBool(playerResourceStarted[client.index])}`);
|
||||
if (playerResourceStarted[client.index] == true && playerInitialized[client.index] == false) {
|
||||
initClient(client);
|
||||
}
|
||||
@@ -122,14 +122,14 @@ function playerClientReady(client) {
|
||||
|
||||
function playerGUIReady(client) {
|
||||
playerGUI[client.index] = true;
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s client GUI is initialized and ready!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s client GUI is initialized and ready!`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function playerClientStarted(client) {
|
||||
playerResourceStarted[client.index] = true;
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s client resources are started and running! Ready: ${getYesNoFromBool(playerResourceReady[client.index])}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s client resources are started and running! Ready: ${getYesNoFromBool(playerResourceReady[client.index])}`);
|
||||
if (playerResourceReady[client.index] == true && playerInitialized[client.index] == false) {
|
||||
initClient(client);
|
||||
}
|
||||
@@ -138,7 +138,7 @@ function playerClientStarted(client) {
|
||||
// ===========================================================================
|
||||
|
||||
function playerClientStopped(client) {
|
||||
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s client resources have stopped (possibly error?)`);
|
||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s client resources have stopped (possibly error?)`);
|
||||
getPlayerData(client).customDisconnectReason = "ClientScriptVerificationFail";
|
||||
//disconnectPlayer(client);
|
||||
}
|
||||
@@ -146,7 +146,7 @@ function playerClientStopped(client) {
|
||||
// ===========================================================================
|
||||
|
||||
function showSmallGameMessage(client, text, colour, duration, fontName = "Roboto") {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing game message to ${getPlayerDisplayForConsole(client)} (${text}) for ${duration} milliseconds`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing game message to ${getPlayerDisplayForConsole(client)} (${text}) for ${duration} milliseconds`);
|
||||
|
||||
if (getGame() <= V_GAME_GTA_IV_EFLC) {
|
||||
fontName = "Pricedown";
|
||||
@@ -163,7 +163,7 @@ function enableCityAmbienceForPlayer(client, clearElements = false) {
|
||||
// return false;
|
||||
//}
|
||||
|
||||
//logToConsole(LOG_DEBUG, `[V.RP.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`);
|
||||
//logToConsole(LOG_DEBUG, `[AGRP.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`);
|
||||
//sendNetworkEventToPlayer("v.rp.ambience", client, true);
|
||||
}
|
||||
|
||||
@@ -174,21 +174,21 @@ function disableCityAmbienceForPlayer(client, clearElements = false) {
|
||||
// return false;
|
||||
//}
|
||||
|
||||
//logToConsole(LOG_DEBUG, `[V.RP.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`);
|
||||
//logToConsole(LOG_DEBUG, `[AGRP.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`);
|
||||
//sendNetworkEventToPlayer("v.rp.ambience", client, false, clearElements);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function clearPlayerOwnedPeds(client) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Clearing peds owned by ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Clearing peds owned by ${getPlayerDisplayForConsole(client)}`);
|
||||
sendNetworkEventToPlayer("v.rp.clearPeds", client);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function updatePlayerSpawnedState(client, state) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Setting ${getPlayerDisplayForConsole(client)}'s spawned state ${toUpperCase(getOnOffFromBool(state))}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Setting ${getPlayerDisplayForConsole(client)}'s spawned state ${toUpperCase(getOnOffFromBool(state))}`);
|
||||
getPlayerData(client).spawned = true;
|
||||
sendNetworkEventToPlayer("v.rp.spawned", client, state);
|
||||
}
|
||||
@@ -196,21 +196,21 @@ function updatePlayerSpawnedState(client, state) {
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerControlState(client, state) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Setting ${getPlayerDisplayForConsole(client)}'s control state ${toUpperCase(getOnOffFromBool(state))}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Setting ${getPlayerDisplayForConsole(client)}'s control state ${toUpperCase(getOnOffFromBool(state))}`);
|
||||
sendNetworkEventToPlayer("v.rp.control", client, state, !state);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function updatePlayerShowLogoState(client, state) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Setting ${getPlayerDisplayForConsole(client)}'s logo state ${toUpperCase(getOnOffFromBool(state))}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Setting ${getPlayerDisplayForConsole(client)}'s logo state ${toUpperCase(getOnOffFromBool(state))}`);
|
||||
sendNetworkEventToPlayer("v.rp.logo", client, state);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function restorePlayerCamera(client) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Restoring ${getPlayerDisplayForConsole(client)}'s camera`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Restoring ${getPlayerDisplayForConsole(client)}'s camera`);
|
||||
sendNetworkEventToPlayer("v.rp.restoreCamera", client);
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ function setPlayer2DRendering(client, hudState = false, labelState = false, smal
|
||||
// ===========================================================================
|
||||
|
||||
function syncPlayerProperties(client) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending signal to sync ${getPlayerDisplayForConsole(client)}'s player ped properties`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to sync ${getPlayerDisplayForConsole(client)}'s player ped properties`);
|
||||
sendNetworkEventToPlayer("v.rp.syncElement", null, getPlayerPed(client).id);
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ function syncPlayerProperties(client) {
|
||||
|
||||
function updatePlayerSnowState(client, forceGroundSnow = false) {
|
||||
if (isSnowSupported(getGame())) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Setting ${getPlayerDisplayForConsole(client)}'s snow state (Falling: ${toUpperCase(getOnOffFromBool(getServerConfig().fallingSnow))}, Ground: ${toUpperCase(getOnOffFromBool(getServerConfig().groundSnow))})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.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);
|
||||
}
|
||||
}
|
||||
@@ -239,7 +239,7 @@ function updatePlayerSnowState(client, forceGroundSnow = false) {
|
||||
// ===========================================================================
|
||||
|
||||
function updatePlayerHotBar(client) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending updated hotbar data to ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending updated hotbar data to ${getPlayerDisplayForConsole(client)}`);
|
||||
let tempHotBarItems = [];
|
||||
for (let i in getPlayerData(client).hotBarItems) {
|
||||
let itemImage = "";
|
||||
@@ -262,14 +262,14 @@ function updatePlayerHotBar(client) {
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerWeaponDamageEnabled(client, state) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending weapon damage state for ${getPlayerDisplayForConsole(client)} to all players`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending weapon damage state for ${getPlayerDisplayForConsole(client)} to all players`);
|
||||
sendNetworkEventToPlayer("v.rp.weaponDamageEnabled", null, getPlayerName(client), state);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerWeaponDamageEvent(client, eventType) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending weapon damage event (${eventType}) for ${getPlayerDisplayForConsole(client)} to all players`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending weapon damage event (${eventType}) for ${getPlayerDisplayForConsole(client)} to all players`);
|
||||
sendNetworkEventToPlayer("v.rp.weaponDamageEvent", null, getPlayerName(client), eventType);
|
||||
getPlayerData(client).weaponDamageEvent = eventType;
|
||||
}
|
||||
@@ -277,259 +277,259 @@ function setPlayerWeaponDamageEvent(client, eventType) {
|
||||
// ===========================================================================
|
||||
|
||||
function sendJobRouteLocationToPlayer(client, position, colour) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending job route location data to ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending job route location data to ${getPlayerDisplayForConsole(client)}`);
|
||||
sendNetworkEventToPlayer("v.rp.showJobRouteLocation", client, position, colour);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerLoginSuccessGUI(client) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending login success GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending login success GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
sendNetworkEventToPlayer("v.rp.loginSuccess", client);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerLoginFailedGUI(client, errorMessage) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending login failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending login failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
sendNetworkEventToPlayer("v.rp.loginFailed", client, errorMessage);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerRegistrationSuccessGUI(client) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending registration success GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending registration success GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
sendNetworkEventToPlayer("v.rp.registrationSuccess", client);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerRegistrationFailedGUI(client, errorMessage) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending registration failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending registration failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
sendNetworkEventToPlayer("v.rp.registrationFailed", client, errorMessage);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendPlayerGUIColours(client) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending GUI colours to ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.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]);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendPlayerGUIInit(client) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending GUI init signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending GUI init signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
sendNetworkEventToPlayer("v.rp.guiInit", client);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerLoginGUI(client, errorMessage = "") {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending show login GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show login GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
sendNetworkEventToPlayer("v.rp.showLogin", client);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerRegistrationGUI(client, errorMessage = "") {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending show registration GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show registration GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
sendNetworkEventToPlayer("v.rp.showRegistration", client);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerNewCharacterGUI(client) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending show new character GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show new character GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
sendNetworkEventToPlayer("v.rp.showNewCharacter", client);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerChangePasswordGUI(client, errorMessage = "") {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending show change password GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show change password GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
sendNetworkEventToPlayer("v.rp.showChangePassword", client, errorMessage);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerResetPasswordCodeInputGUI(client) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending show reset password code input GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show reset password code input GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
sendNetworkEventToPlayer("v.rp.showResetPasswordCodeInput", client);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerResetPasswordEmailInputGUI(client) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending show reset password email input GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show reset password email input GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
sendNetworkEventToPlayer("v.rp.showResetPasswordEmailInput", client);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerCharacterSelectGUI(client, firstName, lastName, cash, clan, lastPlayed, skin) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending character select GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending character select GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
sendNetworkEventToPlayer("v.rp.showCharacterSelect", client, firstName, lastName, cash, clan, lastPlayed, skin);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function updatePlayerCharacterSelectGUI(client, firstName, lastName, cash, clan, lastPlayed, skin) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending update character select GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending update character select GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
sendNetworkEventToPlayer("v.rp.switchCharacterSelect", client, firstName, lastName, cash, clan, lastPlayed, skin);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerCharacterSelectSuccessGUI(client) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending character select success GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending character select success GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
sendNetworkEventToPlayer("v.rp.characterSelectSuccess", client);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerCharacterSelectFailedGUI(client) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending character select failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending character select failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
sendNetworkEventToPlayer("v.rp.characterSelectFailed", client);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerPromptGUI(client, promptMessage, promptTitle, yesButtonText = "Yes", noButtonText = "No") {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending show prompt GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${promptTitle}, Message: ${promptMessage}, YesButton: ${yesButtonText}, NoButton: ${noButtonText})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.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);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerInfoGUI(client, infoMessage, infoTitle, buttonText = "OK") {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending show info GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${infoTitle}, Message: ${infoMessage})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show info GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${infoTitle}, Message: ${infoMessage})`);
|
||||
sendNetworkEventToPlayer("v.rp.showInfo", client, infoMessage, infoTitle, buttonText);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerErrorGUI(client, errorMessage, errorTitle, buttonText = "OK") {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending show error GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${errorTitle}, Message: ${errorMessage})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show error GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${errorTitle}, Message: ${errorMessage})`);
|
||||
sendNetworkEventToPlayer("v.rp.showError", client, errorMessage, errorTitle, buttonText);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendRunCodeToClient(client, code, returnTo) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending runcode to ${getPlayerDisplayForConsole(client)} (returnTo: ${getPlayerDisplayForConsole(getClientFromIndex(returnTo))}, Code: ${code})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending runcode to ${getPlayerDisplayForConsole(client)} (returnTo: ${getPlayerDisplayForConsole(getClientFromIndex(returnTo))}, Code: ${code})`);
|
||||
sendNetworkEventToPlayer("v.rp.runCode", client, code, getPlayerId(returnTo));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendPlayerWorkingState(client, state) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending working state (${toUpperCase(getYesNoFromBool(state))}) to ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending working state (${toUpperCase(getYesNoFromBool(state))}) to ${getPlayerDisplayForConsole(client)}`);
|
||||
sendNetworkEventToPlayer("v.rp.working", client, state);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendPlayerJobType(client, jobType) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending job type (${jobType}) to ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending job type (${jobType}) to ${getPlayerDisplayForConsole(client)}`);
|
||||
sendNetworkEventToPlayer("v.rp.jobType", client, jobType);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendPlayerStopJobRoute(client) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending signal to abort job route to ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to abort job route to ${getPlayerDisplayForConsole(client)}`);
|
||||
sendNetworkEventToPlayer("v.rp.hideJobRouteLocation", client);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendPlayerMouseCameraToggle(client) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`);
|
||||
sendNetworkEventToPlayer("v.rp.mouseCamera", client);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerMouseCameraState(client, state) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`);
|
||||
sendNetworkEventToPlayer("v.rp.mouseCameraForce", client, state);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendPlayerMouseCursorToggle(client) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending signal to toggle mouse cursor ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to toggle mouse cursor ${getPlayerDisplayForConsole(client)}`);
|
||||
sendNetworkEventToPlayer("v.rp.mouseCursor", client);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendAddAccountKeyBindToClient(client, key, keyState) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending added keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))}, State: ${(keyState) ? "down" : "up"})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.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);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendClearKeyBindsToClient(client, key, keyState) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending added keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))}, State: ${(keyState) ? "down" : "up"})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending added keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))}, State: ${(keyState) ? "down" : "up"})`);
|
||||
sendNetworkEventToPlayer("v.rp.clearKeyBinds", client);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendRemoveAccountKeyBindToClient(client, key) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending deleted keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending deleted keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))})`);
|
||||
sendNetworkEventToPlayer("v.rp.delKeyBind", client, toInteger(key));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendPlayerSetPosition(client, position) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending set position signal to ${getPlayerDisplayForConsole(client)} (Position: ${position.x}, ${position.y}, ${position.z})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending set position signal to ${getPlayerDisplayForConsole(client)} (Position: ${position.x}, ${position.y}, ${position.z})`);
|
||||
sendNetworkEventToPlayer("v.rp.position", client, position);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendPlayerSetHeading(client, heading) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending set heading signal to ${getPlayerDisplayForConsole(client)} (Heading: ${heading})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending set heading signal to ${getPlayerDisplayForConsole(client)} (Heading: ${heading})`);
|
||||
sendNetworkEventToPlayer("v.rp.heading", client, heading);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendPlayerSetInterior(client, interior) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending set interior signal to ${getPlayerDisplayForConsole(client)} (Interior: ${interior})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending set interior signal to ${getPlayerDisplayForConsole(client)} (Interior: ${interior})`);
|
||||
sendNetworkEventToPlayer("v.rp.interior", client, interior);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendPlayerFrozenState(client, state) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending set frozen signal to ${getPlayerDisplayForConsole(client)} (State: ${toUpperCase(getYesNoFromBool(state))})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending set frozen signal to ${getPlayerDisplayForConsole(client)} (State: ${toUpperCase(getYesNoFromBool(state))})`);
|
||||
sendNetworkEventToPlayer("v.rp.frozen", client, state);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function clearPlayerWeapons(client, clearData = true) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to clear weapons`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to clear weapons`);
|
||||
sendNetworkEventToPlayer("v.rp.clearWeapons", client, clearData);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerNewCharacterFailedGUI(client, errorMessage) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending new character failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending new character failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
sendNetworkEventToPlayer("v.rp.newCharacterFailed", client, errorMessage);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendPlayerRemoveFromVehicle(client) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending remove from vehicle signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending remove from vehicle signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
sendNetworkEventToPlayer("v.rp.removeFromVehicle", client);
|
||||
}
|
||||
|
||||
@@ -547,10 +547,10 @@ function showPlayerItemTakeDelay(client, itemId) {
|
||||
if (getItemData(itemId)) {
|
||||
let delay = getItemTypeData(getItemData(itemId).itemTypeIndex).pickupDelay;
|
||||
if (delay > 0) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
||||
sendNetworkEventToPlayer("v.rp.showItemActionDelay", client, delay);
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||
playerItemActionDelayComplete(client);
|
||||
}
|
||||
}
|
||||
@@ -562,10 +562,10 @@ function showPlayerItemUseDelay(client, itemSlot) {
|
||||
if (getItemData(getPlayerData(client).hotBarItems[itemSlot])) {
|
||||
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).useDelay;
|
||||
if (delay > 0) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
||||
sendNetworkEventToPlayer("v.rp.showItemActionDelay", client, delay);
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||
playerItemActionDelayComplete(client);
|
||||
}
|
||||
}
|
||||
@@ -577,10 +577,10 @@ function showPlayerItemDropDelay(client, itemSlot) {
|
||||
if (getItemData(getPlayerData(client).hotBarItems[itemSlot])) {
|
||||
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).dropDelay;
|
||||
if (delay > 0) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
||||
sendNetworkEventToPlayer("v.rp.showItemActionDelay", client, delay);
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||
playerItemActionDelayComplete(client);
|
||||
}
|
||||
}
|
||||
@@ -592,10 +592,10 @@ function showPlayerItemPickupDelay(client, itemId) {
|
||||
if (getItemData(itemId)) {
|
||||
let delay = getItemTypeData(getItemData(itemId).itemTypeIndex).pickupDelay;
|
||||
if (delay > 0) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
||||
sendNetworkEventToPlayer("v.rp.showItemActionDelay", client, delay);
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||
playerItemActionDelayComplete(client);
|
||||
}
|
||||
}
|
||||
@@ -607,10 +607,10 @@ function showPlayerItemPutDelay(client, itemSlot) {
|
||||
if (getItemData(getPlayerData(client).hotBarItems[itemSlot])) {
|
||||
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).putDelay;
|
||||
if (delay > 0) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
||||
sendNetworkEventToPlayer("v.rp.showItemActionDelay", client, delay);
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||
playerItemActionDelayComplete(client);
|
||||
}
|
||||
}
|
||||
@@ -623,18 +623,18 @@ function showPlayerItemSwitchDelay(client, itemSlot) {
|
||||
if (getPlayerData(client).hotBarItems[itemSlot] != -1) {
|
||||
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).switchDelay;
|
||||
if (delay > 0) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
||||
sendNetworkEventToPlayer("v.rp.showItemActionDelay", client, delay);
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||
playerItemActionDelayComplete(client);
|
||||
}
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||
playerItemActionDelayComplete(client);
|
||||
}
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||
playerSwitchItem(client, itemSlot);
|
||||
}
|
||||
}
|
||||
@@ -642,14 +642,14 @@ function showPlayerItemSwitchDelay(client, itemSlot) {
|
||||
// ===========================================================================
|
||||
|
||||
function sendPlayerDrunkEffect(client, amount, duration) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Setting drunk effect for ${getPlayerDisplayForConsole(client)} to ${amount} for ${duration} milliseconds`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Setting drunk effect for ${getPlayerDisplayForConsole(client)} to ${amount} for ${duration} milliseconds`);
|
||||
sendNetworkEventToPlayer("v.rp.drunkEffect", client, amount, duration);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendPlayerClearPedState(client) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Clearing ped state for ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Clearing ped state for ${getPlayerDisplayForConsole(client)}`);
|
||||
sendNetworkEventToPlayer("v.rp.clearPedState", client);
|
||||
}
|
||||
|
||||
@@ -659,29 +659,29 @@ function playerDamagedByPlayer(client, damagerEntityName, weaponId, pedPiece, he
|
||||
let damagerEntity = getPlayerFromParams(damagerEntityName);
|
||||
|
||||
if (isNull(damagerEntity)) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s damager entity from ID is null`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager entity from ID is null`);
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)} was damaged by ${damagerEntity}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)} was damaged by ${damagerEntity}`);
|
||||
|
||||
if (isNull(damagerEntity)) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s damager client is INVALID`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager client is INVALID`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!getPlayerData(damagerEntity) || !getPlayerData(client)) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s damager's client data is INVALID`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager's client data is INVALID`);
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s damager is ${getPlayerDisplayForConsole(damagerEntity)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager is ${getPlayerDisplayForConsole(damagerEntity)}`);
|
||||
|
||||
switch (getPlayerData(damagerEntity).weaponDamageEvent) {
|
||||
case V_WEAPON_DAMAGE_EVENT_TAZER:
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} is using a tazer`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} is using a tazer`);
|
||||
if (!isPlayerTazed(client) && !isPlayerHandCuffed(client) && !isPlayerInAnyVehicle(client)) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)} was not previously tazed, binded, or in a vehicle. Taze successful`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)} was not previously tazed, binded, or in a vehicle. Taze successful`);
|
||||
meActionToNearbyPlayers(damagerEntity, `electrifies ${getCharacterFullName(client)} with their tazer`);
|
||||
tazePlayer(client);
|
||||
}
|
||||
@@ -694,10 +694,10 @@ function playerDamagedByPlayer(client, damagerEntityName, weaponId, pedPiece, he
|
||||
break;
|
||||
|
||||
case V_WEAPON_DAMAGE_EVENT_NORMAL:
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} caused ${healthLoss} damage (damage reduction makes it ${(healthLoss * getPlayerData(client).incomingDamageMultiplier)})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} caused ${healthLoss} damage (damage reduction makes it ${(healthLoss * getPlayerData(client).incomingDamageMultiplier)})`);
|
||||
let remainingDamage = healthLoss * getPlayerData(client).incomingDamageMultiplier;
|
||||
if (getPlayerArmour(client) > 0) {
|
||||
//logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s armour was ${getPlayerArmour(client)}, so it was reduced by ${healthLoss}`);
|
||||
//logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s armour was ${getPlayerArmour(client)}, so it was reduced by ${healthLoss}`);
|
||||
if (getPlayerArmour(client) - remainingDamage < 0) {
|
||||
setPlayerArmour(client, 0);
|
||||
remainingDamage = remainingDamage - getPlayerArmour(client);
|
||||
@@ -709,7 +709,7 @@ function playerDamagedByPlayer(client, damagerEntityName, weaponId, pedPiece, he
|
||||
break;
|
||||
|
||||
default:
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} caused ${healthLoss} damage (damage reduction makes it ${(healthLoss * getPlayerData(client).incomingDamageMultiplier)})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.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));
|
||||
break;
|
||||
}
|
||||
@@ -969,21 +969,21 @@ function sendPlayerChatAutoHideDelay(client, delay) {
|
||||
// ===========================================================================
|
||||
|
||||
function playRadioStreamForPlayer(client, streamURL, loop = true, volume = 0, element = false) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Forcing ${getPlayerDisplayForConsole(client)} to stream ${streamURL}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Forcing ${getPlayerDisplayForConsole(client)} to stream ${streamURL}`);
|
||||
sendNetworkEventToPlayer("v.rp.radioStream", client, streamURL, loop, volume, element);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function playAudioFileForPlayer(client, audioName, loop = true, volume = 0, element = false) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Forcing ${getPlayerDisplayForConsole(client)} to play audio ${audioName}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Forcing ${getPlayerDisplayForConsole(client)} to play audio ${audioName}`);
|
||||
sendNetworkEventToPlayer("v.rp.audioFileStream", client, audioName, loop, volume);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function stopRadioStreamForPlayer(client) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Client] Forcing ${getPlayerDisplayForConsole(client)} to stop their radio stream`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Forcing ${getPlayerDisplayForConsole(client)} to stop their radio stream`);
|
||||
sendNetworkEventToPlayer("v.rp.stopRadioStream", client);
|
||||
}
|
||||
|
||||
@@ -1112,59 +1112,53 @@ function setPlayerInfiniteRun(client, state) {
|
||||
|
||||
// ==========================================================================
|
||||
|
||||
function sendBusinessToPlayer(client, businessId, isDeleted, name, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked, hasItems) {
|
||||
sendNetworkEventToPlayer("v.rp.business", client, businessId, isDeleted, name, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked, hasItems);
|
||||
function sendBusinessToPlayer(client, businessId, name, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked, hasItems) {
|
||||
sendNetworkEventToPlayer("v.rp.business", client, businessId, name, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked, hasItems);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
|
||||
function sendHouseToPlayer(client, houseId, isDeleted, description, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked) {
|
||||
sendNetworkEventToPlayer("v.rp.house", client, houseId, isDeleted, description, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked);
|
||||
function sendHouseToPlayer(client, houseId, description, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked) {
|
||||
sendNetworkEventToPlayer("v.rp.house", client, houseId, description, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
|
||||
function sendJobToPlayer(client, jobId, isDeleted, jobLocationId, name, position, blipModel, pickupModel) {
|
||||
sendNetworkEventToPlayer("v.rp.job", client, jobId, isDeleted, jobLocationId, name, position);
|
||||
function sendJobToPlayer(client, jobId, jobLocationId, name, position, blipModel, pickupModel) {
|
||||
sendNetworkEventToPlayer("v.rp.job", client, jobId, jobLocationId, name, position);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
|
||||
function sendVehicleToPlayer(client, vehicleId, isDeleted, model, position, heading, colour1, colour2, colour3, colour4) {
|
||||
sendNetworkEventToPlayer("v.rp.vehicle", client, vehicleId, isDeleted, model, position, heading, colour1, colour2, colour3, colour4);
|
||||
function sendVehicleToPlayer(client, vehicleId, model, position, heading, colour1, colour2, colour3, colour4) {
|
||||
sendNetworkEventToPlayer("v.rp.vehicle", client, vehicleId, model, position, heading, colour1, colour2, colour3, colour4);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
|
||||
function sendAllBusinessesToPlayer(client) {
|
||||
sendNetworkEventToPlayer("v.rp.removeBusinesses", client);
|
||||
|
||||
let businesses = getServerData().businesses;
|
||||
for (let i in businesses) {
|
||||
sendBusinessToPlayer(client, businesses[i].index, false, businesses[i].name, businesses[i].entrancePosition, businesses[i].entranceBlipModel, businesses[i].entrancePickupModel, businesses[i].buyPrice, businesses[i].rentPrice, businesses[i].hasInterior, doesBusinessHaveAnyItemsToBuy(i));
|
||||
sendBusinessToPlayer(client, businesses[i].index, businesses[i].name, businesses[i].entrancePosition, businesses[i].entranceBlipModel, businesses[i].entrancePickupModel, businesses[i].buyPrice, businesses[i].rentPrice, businesses[i].hasInterior, doesBusinessHaveAnyItemsToBuy(i));
|
||||
}
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
|
||||
function sendAllHousesToPlayer(client) {
|
||||
sendNetworkEventToPlayer("v.rp.removeHouses", client);
|
||||
|
||||
let houses = getServerData().houses;
|
||||
for (let i in houses) {
|
||||
sendHouseToPlayer(client, houses[i].index, false, houses[i].entrancePosition, houses[i].entranceBlipModel, houses[i].entrancePickupModel, houses[i].buyPrice, houses[i].rentPrice, houses[i].hasInterior);
|
||||
sendHouseToPlayer(client, houses[i].index, houses[i].entrancePosition, houses[i].entranceBlipModel, houses[i].entrancePickupModel, houses[i].buyPrice, houses[i].rentPrice, houses[i].hasInterior);
|
||||
}
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
|
||||
function sendAllJobsToPlayer(client) {
|
||||
sendNetworkEventToPlayer("v.rp.removeJobs", client);
|
||||
|
||||
let jobs = getServerData().jobs;
|
||||
for (let i in jobs) {
|
||||
for (let j in jobs[i].locations) {
|
||||
sendJobToPlayer(client, jobs[i].index, false, jobs[i].locations[j].index, jobs[i].name, jobs[i].locations[j].position, jobs[i].pickupModel, jobs[i].blipModel);
|
||||
sendJobToPlayer(client, jobs[i].index, jobs[i].locations[j].index, jobs[i].name, jobs[i].locations[j].position, jobs[i].pickupModel, jobs[i].blipModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1172,11 +1166,9 @@ function sendAllJobsToPlayer(client) {
|
||||
// ==========================================================================
|
||||
|
||||
function sendAllVehiclesToPlayer(client) {
|
||||
sendNetworkEventToPlayer("v.rp.removeVehicles", client);
|
||||
|
||||
let vehicles = getServerData().vehicles;
|
||||
for (let i in vehicles) {
|
||||
sendVehicleToPlayer(client, vehicles[i].index, false, vehicles[i].model, vehicles[i].syncPosition, vehicles[i].syncHeading, vehicles[i].colour1, vehicles[i].colour2, vehicles[i].colour3, vehicles[i].colour4);
|
||||
sendVehicleToPlayer(client, vehicles[i].index, vehicles[i].model, vehicles[i].syncPosition, vehicles[i].syncHeading, vehicles[i].colour1, vehicles[i].colour2, vehicles[i].colour3, vehicles[i].colour4);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1319,11 +1311,6 @@ function playerMapLoaded(client, mapName) {
|
||||
|
||||
setTimeout(function () {
|
||||
processPlayerEnteringExitingProperty(client);
|
||||
|
||||
setTimeout(function () {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.NetEvents] Enabling all rendering states for ${getPlayerDisplayForConsole(client)} since map switch finished`);
|
||||
setPlayer2DRendering(client, true, true, true, true, true, true);
|
||||
}, 500);
|
||||
}, 500);
|
||||
}
|
||||
|
||||
|
||||
@@ -246,7 +246,7 @@ function createNPCCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function loadNPCsFromDatabase() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.NPC]: Loading NPCs from database ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.NPC]: Loading NPCs from database ...`);
|
||||
let dbConnection = connectToDatabase();
|
||||
let tempNPCs = [];
|
||||
let dbAssoc = [];
|
||||
@@ -263,14 +263,14 @@ function loadNPCsFromDatabase() {
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.NPC]: ${tempNPCs.length} NPCs loaded from database successfully!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.NPC]: ${tempNPCs.length} NPCs loaded from database successfully!`);
|
||||
return tempNPCs;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadNPCTriggersFromDatabase(npcDatabaseId) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.NPC]: Loading NPC triggers for NPC ${npcDatabaseId} from database ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.NPC]: Loading NPC triggers for NPC ${npcDatabaseId} from database ...`);
|
||||
let dbConnection = connectToDatabase();
|
||||
let tempNPCTriggers = [];
|
||||
let dbAssoc = [];
|
||||
@@ -288,14 +288,14 @@ function loadNPCTriggersFromDatabase(npcDatabaseId) {
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.NPC]: ${tempNPCTriggers.length} NPC triggers loaded for NPC ${npcDatabaseId} from database successfully!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.NPC]: ${tempNPCTriggers.length} NPC triggers loaded for NPC ${npcDatabaseId} from database successfully!`);
|
||||
return tempNPCTriggers;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadNPCTriggerConditionsFromDatabase(npcTriggerDatabaseId) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.NPC]: Loading NPC trigger conditions for trigger ${npcTriggerDatabaseId} from database ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.NPC]: Loading NPC trigger conditions for trigger ${npcTriggerDatabaseId} from database ...`);
|
||||
let dbConnection = connectToDatabase();
|
||||
let tempNPCTriggerConditions = [];
|
||||
let dbAssoc;
|
||||
@@ -311,14 +311,14 @@ function loadNPCTriggerConditionsFromDatabase(npcTriggerDatabaseId) {
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.NPC]: ${tempNPCTriggerConditions.length} conditions loaded for trigger ${npcTriggerDatabaseId} from database successfully!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.NPC]: ${tempNPCTriggerConditions.length} conditions loaded for trigger ${npcTriggerDatabaseId} from database successfully!`);
|
||||
return tempNPCTriggerConditions;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadNPCTriggerResponsesFromDatabase(npcTriggerDatabaseId) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.NPC]: Loading NPC trigger responses for trigger ${npcTriggerDatabaseId} from database ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.NPC]: Loading NPC trigger responses for trigger ${npcTriggerDatabaseId} from database ...`);
|
||||
let dbConnection = connectToDatabase();
|
||||
let tempNPCTriggerResponses = [];
|
||||
let dbAssoc;
|
||||
@@ -337,7 +337,7 @@ function loadNPCTriggerResponsesFromDatabase(npcTriggerDatabaseId) {
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.NPC]: ${tempNPCTriggerResponses.length} responses loaded for trigger ${npcTriggerDatabaseId} from database successfully!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.NPC]: ${tempNPCTriggerResponses.length} responses loaded for trigger ${npcTriggerDatabaseId} from database successfully!`);
|
||||
return tempNPCTriggerResponses;
|
||||
}
|
||||
|
||||
@@ -357,28 +357,28 @@ function saveAllNPCsToDatabase() {
|
||||
|
||||
function saveNPCToDatabase(npcDataId) {
|
||||
if (getServerConfig().devServer) {
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.NPC]: NPC ${npcDataId} can't be saved because server is running as developer only. Aborting save ...`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.NPC]: NPC ${npcDataId} can't be saved because server is running as developer only. Aborting save ...`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (getNPCData(npcDataId) == false) {
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.NPC]: NPC ${npcDataId} data is invalid. Aborting save ...`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.NPC]: NPC ${npcDataId} data is invalid. Aborting save ...`);
|
||||
return false;
|
||||
}
|
||||
|
||||
let tempNPCData = getNPCData(npcDataId);
|
||||
|
||||
if (tempNPCData.databaseId == -1) {
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.NPC]: NPC ${npcDataId} is a temp NPC. Aborting save ...`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.NPC]: NPC ${npcDataId} is a temp NPC. Aborting save ...`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!tempNPCData.needsSaved) {
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.NPC]: NPC ${npcDataId} hasn't changed data. Aborting save ...`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.NPC]: NPC ${npcDataId} hasn't changed data. Aborting save ...`);
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.NPC]: Saving NPC ${tempNPCData.databaseId} to database ...`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.NPC]: Saving NPC ${tempNPCData.databaseId} to database ...`);
|
||||
let dbConnection = connectToDatabase();
|
||||
if (dbConnection) {
|
||||
if (tempNPCData.ped != false) {
|
||||
@@ -445,7 +445,7 @@ function saveNPCToDatabase(npcDataId) {
|
||||
disconnectFromDatabase(dbConnection);
|
||||
return true;
|
||||
}
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.NPC]: Saved NPC ${npcDataId} to database!`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.NPC]: Saved NPC ${npcDataId} to database!`);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -756,21 +756,4 @@ function createNPC(skinIndex, position, heading, interior, dimension) {
|
||||
return npcIndex - 1;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function despawnAllNPCs() {
|
||||
for (let i in getServerData().npcs) {
|
||||
destroyGameElement(getServerData().npc[i].npc);
|
||||
getServerData().npc[i].npc = null;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function spawnAllNPCs() {
|
||||
for (let i in getServerData().npcs) {
|
||||
spawnNPC(i);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -60,7 +60,7 @@ function startPaintBall(client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Starting paintball for ${getPlayerDisplayForConsole(client)} ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Starting paintball for ${getPlayerDisplayForConsole(client)} ...`);
|
||||
if (isPlayerWorking(client)) {
|
||||
stopWorking(client);
|
||||
}
|
||||
@@ -79,7 +79,7 @@ function startPaintBall(client) {
|
||||
|
||||
messagePlayerAlert(client, getLocaleString(client, "JoinedPaintBall"));
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Started paintball for ${getPlayerDisplayForConsole(client)} successfully`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Started paintball for ${getPlayerDisplayForConsole(client)} successfully`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -89,7 +89,7 @@ function stopPaintBall(client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Stopping paintball for ${getPlayerDisplayForConsole(client)} ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Stopping paintball for ${getPlayerDisplayForConsole(client)} ...`);
|
||||
clearPlayerWeapons(client);
|
||||
deletePaintBallItems(client);
|
||||
restorePlayerTempLockerItems(client);
|
||||
@@ -119,13 +119,13 @@ function stopPaintBall(client) {
|
||||
|
||||
//checkRemainingPaintBallPlayers(tempBusiness);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Stopped paintball for ${getPlayerDisplayForConsole(client)} successfully`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Stopped paintball for ${getPlayerDisplayForConsole(client)} successfully`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function givePlayerPaintBallItems(client) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Giving ${getPlayerDisplayForConsole(client)} paintball items ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Giving ${getPlayerDisplayForConsole(client)} paintball items ...`);
|
||||
for (let i in paintBallItems) {
|
||||
let itemId = createItem(paintBallItems[i], 999999, V_ITEM_OWNER_PLAYER, getPlayerCurrentSubAccount(client).databaseId);
|
||||
getItemData(itemId).needsSaved = false;
|
||||
@@ -135,26 +135,26 @@ function givePlayerPaintBallItems(client) {
|
||||
getPlayerData(client).paintBallItemCache.push(itemId);
|
||||
updatePlayerHotBar(client);
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Gave ${getPlayerDisplayForConsole(client)} paintball items successfully`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Gave ${getPlayerDisplayForConsole(client)} paintball items successfully`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function deletePaintBallItems(client) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Deleting paintball items for ${getPlayerDisplayForConsole(client)} ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Deleting paintball items for ${getPlayerDisplayForConsole(client)} ...`);
|
||||
for (let i in getPlayerData(client).paintBallItemCache) {
|
||||
deleteItem(getPlayerData(client).paintBallItemCache[i]);
|
||||
}
|
||||
|
||||
cachePlayerHotBarItems(client);
|
||||
updatePlayerHotBar(client);
|
||||
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Deleting paintball items for ${getPlayerDisplayForConsole(client)} successfully`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Deleting paintball items for ${getPlayerDisplayForConsole(client)} successfully`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function cacheAllPaintBallItemTypes() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Cacheing all paintball item types ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Cacheing all paintball item types ...`);
|
||||
for (let i in paintBallItemNames[getGame()]) {
|
||||
let itemTypeId = getItemTypeFromParams(paintBallItemNames[getGame()][i]);
|
||||
if (itemTypeId != -1 && getItemTypeData(itemTypeId) != false) {
|
||||
@@ -162,13 +162,13 @@ function cacheAllPaintBallItemTypes() {
|
||||
}
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Cached all paintball item types`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Cached all paintball item types`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function respawnPlayerForPaintBall(client) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Respawning ${getPlayerDisplayForConsole(client)} for paintball ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Respawning ${getPlayerDisplayForConsole(client)} for paintball ...`);
|
||||
despawnPlayer(client);
|
||||
|
||||
let businessId = getPlayerData(client).paintBallBusiness;
|
||||
@@ -177,13 +177,13 @@ function respawnPlayerForPaintBall(client) {
|
||||
|
||||
spawnPlayer(client, getBusinessData(businessId).exitPosition, 0.0, getPlayerSkin(client), getBusinessData(businessId).exitInterior, getBusinessData(businessId).exitDimension);
|
||||
if (isFadeCameraSupported()) {
|
||||
fadePlayerCamera(client, true, 500);
|
||||
fadeCamera(client, true, 0.5);
|
||||
}
|
||||
updatePlayerSpawnedState(client, true);
|
||||
makePlayerStopAnimation(client);
|
||||
setPlayerControlState(client, true);
|
||||
resetPlayerBlip(client);
|
||||
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Respawned ${getPlayerDisplayForConsole(client)} for paintball successfully`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Respawned ${getPlayerDisplayForConsole(client)} for paintball successfully`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -32,7 +32,7 @@ function playerPromptAnswerNo(client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Prompt] ${getPlayerDisplayForConsole(client)} answered NO to their prompt (${getPlayerData(client).promptType})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Prompt] ${getPlayerDisplayForConsole(client)} answered NO to their prompt (${getPlayerData(client).promptType})`);
|
||||
|
||||
switch (getPlayerData(client).promptType) {
|
||||
case V_PROMPT_CREATEFIRSTCHAR:
|
||||
@@ -71,7 +71,7 @@ function playerPromptAnswerYes(client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Prompt] ${getPlayerDisplayForConsole(client)} answered YES to their prompt (${getPlayerData(client).promptType})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Prompt] ${getPlayerDisplayForConsole(client)} answered YES to their prompt (${getPlayerData(client).promptType})`);
|
||||
|
||||
switch (getPlayerData(client).promptType) {
|
||||
case V_PROMPT_CREATEFIRSTCHAR: {
|
||||
@@ -82,7 +82,7 @@ function playerPromptAnswerYes(client) {
|
||||
case V_PROMPT_BIZORDER: {
|
||||
if (getPlayerData(client).businessOrderAmount > 0) {
|
||||
if (getBusinessData(getPlayerData(client).businessOrderBusiness).till < getPlayerData(client).businessOrderCost) {
|
||||
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)`);
|
||||
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)`);
|
||||
if (doesPlayerHaveGUIEnabled(client)) {
|
||||
showPlayerErrorGUI(client, getLocaleString(client, "BusinessOrderNotEnoughMoney", `{ALTCOLOUR}/bizdeposit{MAINCOLOUR}`), getLocaleString(client, "BusinessOrderCanceled"));
|
||||
} else {
|
||||
@@ -93,7 +93,7 @@ function playerPromptAnswerYes(client) {
|
||||
getPlayerData(client).businessOrderItem = -1;
|
||||
getPlayerData(client).businessOrderValue = -1;
|
||||
} else {
|
||||
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}`);
|
||||
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}`);
|
||||
|
||||
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);
|
||||
|
||||
@@ -190,20 +190,20 @@ function loadPropertiesFromDatabase() {
|
||||
let tempPropertyData = new PropertyData(dbAssoc[i]);
|
||||
tempPropertyData.locations = loadPropertyLocationsFromDatabase(tempPropertyData.databaseId);
|
||||
tempProperties.push(tempPropertyData);
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Property]: Property '${tempPropertyData.name}' (ID ${tempPropertyData.databaseId}) loaded from database successfully!`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Property]: Property '${tempPropertyData.name}' (ID ${tempPropertyData.databaseId}) loaded from database successfully!`);
|
||||
}
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
|
||||
logToConsole(LOG_INFO, `[V.RP.Property]: ${tempProperties.length} properties loaded from database successfully!`);
|
||||
logToConsole(LOG_INFO, `[AGRP.Property]: ${tempProperties.length} properties loaded from database successfully!`);
|
||||
return tempProperties;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadPropertyLocationsFromDatabase(propertyIndex) {
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Property]: Loading property locations for property ${propertyIndex} from database ...`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Property]: Loading property locations for property ${propertyIndex} from database ...`);
|
||||
|
||||
let tempPropertyLocations = [];
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -219,7 +219,7 @@ function loadPropertyLocationsFromDatabase(propertyIndex) {
|
||||
for (let i in dbAssoc) {
|
||||
let tempPropertyLocationData = new PropertyLocationData(dbAssoc[i]);
|
||||
tempPropertyLocations.push(tempPropertyLocationData);
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Property]: Location '${tempPropertyLocationData.name}' loaded from database successfully!`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Property]: Location '${tempPropertyLocationData.name}' loaded from database successfully!`);
|
||||
}
|
||||
}
|
||||
freeDatabaseQuery(dbQuery);
|
||||
@@ -227,7 +227,7 @@ function loadPropertyLocationsFromDatabase(propertyIndex) {
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Property]: ${tempPropertyLocations.length} location for property ${propertyIndex} loaded from database successfully!`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Property]: ${tempPropertyLocations.length} location for property ${propertyIndex} loaded from database successfully!`);
|
||||
return tempPropertyLocations;
|
||||
}
|
||||
|
||||
@@ -1208,7 +1208,7 @@ function orderItemForPropertyCommand(command, params, client) {
|
||||
let value = toInteger(splitParams.slice(-1)) || getItemTypeData(itemType).capacity;
|
||||
let propertyIndex = getPlayerProperty(client);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Property] ${getPlayerDisplayForConsole(client)} is ordering ${amount} ${splitParams.slice(0, -2).join(" ")} (${value})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Property] ${getPlayerDisplayForConsole(client)} is ordering ${amount} ${splitParams.slice(0, -2).join(" ")} (${value})`);
|
||||
|
||||
if (!getPropertyData(propertyIndex)) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
|
||||
@@ -1460,7 +1460,7 @@ function savePropertyToDatabase(propertyIndex) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Property]: Saving business '${tempPropertyData.name}' to database ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Property]: Saving business '${tempPropertyData.name}' to database ...`);
|
||||
let dbConnection = connectToDatabase();
|
||||
if (dbConnection) {
|
||||
let safePropertyName = escapeDatabaseString(dbConnection, tempPropertyData.name);
|
||||
@@ -1516,7 +1516,7 @@ function savePropertyToDatabase(propertyIndex) {
|
||||
disconnectFromDatabase(dbConnection);
|
||||
return true;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Property]: Saved property '${tempPropertyData.name}' to database!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Property]: Saved property '${tempPropertyData.name}' to database!`);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1575,7 +1575,7 @@ function createPropertyEntrancePickup(propertyIndex) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Creating entrance pickup for property ${propertyData.name}`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating entrance pickup for property ${propertyData.name}`);
|
||||
|
||||
if (areServerElementsSupported() && getGame() != V_GAME_MAFIA_ONE) {
|
||||
let entrancePickup = null;
|
||||
@@ -1652,7 +1652,7 @@ function createPropertyEntranceBlip(propertyIndex) {
|
||||
blipModelId = propertyData.entranceBlipModel;
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Creating entrance blip for business ${propertyData.name} (model ${blipModelId})`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating entrance blip for business ${propertyData.name} (model ${blipModelId})`);
|
||||
|
||||
if (areServerElementsSupported()) {
|
||||
let entranceBlip = createGameBlip(propertyData.entrancePosition, blipModelId, 1, getColourByType("propertyColour"));
|
||||
@@ -1697,7 +1697,7 @@ function createPropertyExitPickup(propertyIndex) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Creating exit pickup for business ${propertyData.name}`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating exit pickup for business ${propertyData.name}`);
|
||||
|
||||
let exitPickup = null;
|
||||
if (isGameFeatureSupported("pickup")) {
|
||||
@@ -1764,7 +1764,7 @@ function createPropertyExitBlip(propertyIndex) {
|
||||
blipModelId = propertyData.exitBlipModel;
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Creating exit blip for property ${propertyData.name} (model ${blipModelId})`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating exit blip for property ${propertyData.name} (model ${blipModelId})`);
|
||||
|
||||
let exitBlip = createGameBlip(propertyData.exitPosition, blipModelId, 1, getColourByName("propertyColour"));
|
||||
if (exitBlip != null) {
|
||||
@@ -2270,11 +2270,11 @@ function cachePropertyItems(propertyIndex) {
|
||||
clearArray(getPropertyData(propertyIndex).storageItemCache);
|
||||
|
||||
//let propertyData = getPropertyData(propertyIndex);
|
||||
//logToConsole(LOG_VERBOSE, `[V.RP.Property] Caching business items for business ${propertyIndex} (${propertyData.name}) ...`);
|
||||
//logToConsole(LOG_VERBOSE, `[AGRP.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).storageItemCache = getServerData().items.filter(item => item.ownerType == V_ITEM_OWNER_BIZSTORAGE && item.ownerId == propertyData.databaseId);
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Property] Caching business items for business ${propertyIndex} (${getPropertyData(propertyIndex).name}) ...`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Property] Caching business items for business ${propertyIndex} (${getPropertyData(propertyIndex).name}) ...`);
|
||||
for (let i in getServerData().items) {
|
||||
if (getItemData(i).ownerType == V_ITEM_OWNER_BIZFLOOR && getItemData(i).ownerId == getPropertyData(propertyIndex).databaseId) {
|
||||
getPropertyData(propertyIndex).floorItemCache.push(i);
|
||||
@@ -2283,7 +2283,7 @@ function cachePropertyItems(propertyIndex) {
|
||||
}
|
||||
}
|
||||
|
||||
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})!`);
|
||||
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})!`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -53,7 +53,7 @@ function loadRadioStationsFromDatabase() {
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
|
||||
logToConsole(LOG_INFO, `[V.RP.Radio]: ${tempRadioStations.length} radio stations loaded from database successfully!`);
|
||||
logToConsole(LOG_INFO, `[AGRP.Radio]: ${tempRadioStations.length} radio stations loaded from database successfully!`);
|
||||
return tempRadioStations;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ function playStreamingRadioCommand(command, params, client) {
|
||||
|
||||
let radioStationId = getRadioStationFromParams(params);
|
||||
|
||||
if (getRadioStationData(radioStationId) == -1) {
|
||||
if (radioStationId != 0 && typeof getServerData().radioStations[radioStationId - 1] == "undefined") {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidRadioStation"));
|
||||
return false;
|
||||
}
|
||||
@@ -90,7 +90,7 @@ function playStreamingRadioCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (radioStationId == -1) {
|
||||
if (radioStationId == 0) {
|
||||
getVehicleData(vehicle).streamingRadioStation = -1;
|
||||
getVehicleData(vehicle).needsSaved = true;
|
||||
getPlayerData(client).streamingRadioStation = -1;
|
||||
@@ -105,20 +105,20 @@ function playStreamingRadioCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
getVehicleData(vehicle).streamingRadioStation = radioStationId;
|
||||
getPlayerData(client).streamingRadioStation = radioStationId;
|
||||
meActionToNearbyPlayers(client, getLocaleString(client, "ActionVehicleRadioStationChange", getRadioStationData(radioStationId).name, getRadioStationData(radioStationId).genre));
|
||||
getVehicleData(vehicle).streamingRadioStation = radioStationId - 1;
|
||||
getPlayerData(client).streamingRadioStation = radioStationId - 1;
|
||||
meActionToNearbyPlayers(client, getLocaleString(client, "ActionVehicleRadioStationChange", getRadioStationData(radioStationId - 1).name, getRadioStationData(radioStationId - 1).genre));
|
||||
|
||||
let clients = getClients();
|
||||
for (let i in clients) {
|
||||
if (vehicle == getPlayerVehicle(clients[i])) {
|
||||
playRadioStreamForPlayer(clients[i], getRadioStationData(radioStationId).url, true, getPlayerStreamingRadioVolume(client));
|
||||
playRadioStreamForPlayer(clients[i], getRadioStationData(radioStationId - 1).url, true, getPlayerStreamingRadioVolume(client));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (isPlayerInAnyHouse(client)) {
|
||||
let houseId = getPlayerHouse(client);
|
||||
if (radioStationId == -1) {
|
||||
if (radioStationId == 0) {
|
||||
getHouseData(houseId).streamingRadioStationIndex = -1;
|
||||
getHouseData(houseId).streamingRadioStationIndex = 0;
|
||||
getHouseData(houseId).needsSaved = true;
|
||||
@@ -132,22 +132,22 @@ function playStreamingRadioCommand(command, params, client) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
getHouseData(houseId).streamingRadioStationIndex = radioStationId;
|
||||
getHouseData(houseId).streamingRadioStation = getRadioStationData(radioStationId).databaseId;
|
||||
getHouseData(houseId).streamingRadioStationIndex = radioStationId - 1;
|
||||
getHouseData(houseId).streamingRadioStation = getRadioStationData(radioStationId - 1).databaseId;
|
||||
getHouseData(houseId).needsSaved = true;
|
||||
getPlayerData(client).streamingRadioStation = radioStationId;
|
||||
meActionToNearbyPlayers(client, getLocaleString(client, "ActionHouseRadioStationChange", getRadioStationData(radioStationId).name, getRadioStationData(radioStationId).genre));
|
||||
getPlayerData(client).streamingRadioStation = radioStationId - 1;
|
||||
meActionToNearbyPlayers(client, getLocaleString(client, "ActionHouseRadioStationChange", getRadioStationData(radioStationId - 1).name, getRadioStationData(radioStationId - 1).genre));
|
||||
|
||||
let clients = getClients();
|
||||
for (let i in clients) {
|
||||
if (getEntityData(clients[i], "v.rp.inHouse") == houseId) {
|
||||
playRadioStreamForPlayer(clients[i], getRadioStationData(radioStationId).url, true, getPlayerStreamingRadioVolume(clients[i]));
|
||||
playRadioStreamForPlayer(clients[i], getRadioStationData(radioStationId - 1).url, true, getPlayerStreamingRadioVolume(clients[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (isPlayerInAnyBusiness(client)) {
|
||||
let businessId = getPlayerBusiness(client);
|
||||
if (radioStationId == -1) {
|
||||
if (radioStationId == 0) {
|
||||
getBusinessData(businessId).streamingRadioStation = 0;
|
||||
getBusinessData(businessId).streamingRadioStationIndex = -1;
|
||||
getBusinessData(businessId).needsSaved = true;
|
||||
@@ -161,16 +161,16 @@ function playStreamingRadioCommand(command, params, client) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
getBusinessData(businessId).streamingRadioStationIndex = radioStationId;
|
||||
getBusinessData(businessId).streamingRadioStation = getRadioStationData(radioStationId).databaseId;
|
||||
getBusinessData(businessId).streamingRadioStationIndex = radioStationId - 1;
|
||||
getBusinessData(businessId).streamingRadioStation = getRadioStationData(radioStationId - 1).databaseId;
|
||||
getBusinessData(businessId).needsSaved = true;
|
||||
getPlayerData(client).streamingRadioStation = radioStationId;
|
||||
meActionToNearbyPlayers(client, getLocaleString(client, "ActionBusinessRadioStationChange", getRadioStationData(radioStationId).name, getRadioStationData(radioStationId).genre));
|
||||
getPlayerData(client).streamingRadioStation = radioStationId - 1;
|
||||
meActionToNearbyPlayers(client, getLocaleString(client, "ActionBusinessRadioStationChange", getRadioStationData(radioStationId - 1).name, getRadioStationData(radioStationId - 1).genre));
|
||||
|
||||
let clients = getClients();
|
||||
for (let i in clients) {
|
||||
if (getPlayerBusiness(clients[i]) == businessId) {
|
||||
playRadioStreamForPlayer(clients[i], getRadioStationData(radioStationId).url, true, getPlayerStreamingRadioVolume(clients[i]));
|
||||
playRadioStreamForPlayer(clients[i], getRadioStationData(radioStationId - 1).url, true, getPlayerStreamingRadioVolume(clients[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -242,7 +242,7 @@ function getPlayerStreamingRadioVolume(client) {
|
||||
*
|
||||
*/
|
||||
function showRadioStationListCommand(command, params, client) {
|
||||
let stationList = getServerData().radioStations.map(function (x) { return `{chatBoxListIndex}${toInteger(x.index) + 1}: {MAINCOLOUR}${x.name}`; });
|
||||
let stationList = getServerData().radioStations.map(function (x) { return `{ALTCOLOUR}${toInteger(x.index) + 1}: {MAINCOLOUR}${x.name}`; });
|
||||
|
||||
let chunkedList = splitArrayIntoChunks(stationList, 4);
|
||||
|
||||
@@ -263,6 +263,16 @@ function setAllRadioStationIndexes() {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* @param {number} radioStationId - The data index of the radio station
|
||||
* @return {RadioStationData} The radio station's data (class instance)
|
||||
*/
|
||||
function getRadioStationData(radioStationId) {
|
||||
return getServerData().radioStations[radioStationId];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* This is a command handler function.
|
||||
*
|
||||
@@ -291,12 +301,12 @@ function getRadioStationFromParams(params) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (typeof getServerData().radioStations[params - 1] != "undefined") {
|
||||
return toInteger(params - 1);
|
||||
if (typeof getServerData().radioStations[params] != "undefined") {
|
||||
return toInteger(params);
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -1898,7 +1898,7 @@ function showAccountStaffNotesCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let staffNoteList = getPlayerData(targetClient).accountData.staffNotes.map(function (x, i, a) { return `{chatBoxListIndex}${toInteger(i) + 1}. {ALTCOLOUR}(Added by ${loadAccountFromId(x.whoAdded).name} on ${new Date(x.whenAdded).toLocaleString()}: {MAINCOLOUR}${x.note}` });
|
||||
let staffNoteList = getPlayerData(targetClient).accountData.staffNotes.map(function (x, i, a) { return `{ALTCOLOUR}${toInteger(i) + 1}. (Added by ${loadAccountFromId(x.whoAdded).name} on ${new Date(x.whenAdded).toLocaleString()}: ${x.note}` });
|
||||
|
||||
//let chunkedList = splitArrayIntoChunks(staffNoteList, 1);
|
||||
|
||||
|
||||
@@ -49,9 +49,8 @@ async function initServerScripts() {
|
||||
setAllServerDataIndexes();
|
||||
|
||||
checkServerGameTime();
|
||||
spawnAllServerElements();
|
||||
createAllServerElements();
|
||||
addAllNetworkEventHandlers();
|
||||
addAllCommandHandlers();
|
||||
initAllClients();
|
||||
initTimers();
|
||||
|
||||
@@ -176,16 +175,17 @@ function setAllServerDataIndexes() {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function spawnAllServerElements() {
|
||||
spawnAllBusinessPickups();
|
||||
spawnAllBusinessBlips();
|
||||
spawnAllHousePickups();
|
||||
spawnAllHouseBlips();
|
||||
spawnAllJobPickups();
|
||||
spawnAllJobBlips();
|
||||
spawnAllGroundItemObjects();
|
||||
function createAllServerElements() {
|
||||
createAllBusinessPickups();
|
||||
createAllBusinessBlips();
|
||||
createAllHousePickups();
|
||||
createAllHouseBlips();
|
||||
createAllJobPickups();
|
||||
createAllJobBlips();
|
||||
createAllGroundItemObjects();
|
||||
spawnAllVehicles();
|
||||
spawnAllNPCs();
|
||||
addAllCommandHandlers();
|
||||
|
||||
// Using client-side spheres since server-side ones don't show on GTAC atm (bug)
|
||||
//createAllJobRouteLocationMarkers();
|
||||
|
||||
@@ -220,7 +220,7 @@ function loadSubAccountsFromAccount(accountId) {
|
||||
let jobRankIndex = getJobRankIndexFromDatabaseId(jobIndex, tempSubAccount.jobRank);
|
||||
if (!getJobRankData(jobIndex, jobRankIndex)) {
|
||||
let newJobRankIndex = getLowestJobRank(jobIndex);
|
||||
console.log(`[V.RP.SubAccount]: Job ${jobIndex} has no rank ${tempSubAccount.jobRank}! Using lowest rank ${newJobRankIndex} instead.`);
|
||||
console.log(`[AGRP.SubAccount]: Job ${jobIndex} has no rank ${tempSubAccount.jobRank}! Using lowest rank ${newJobRankIndex} instead.`);
|
||||
tempSubAccount.jobRank = getJobRankData(jobIndex, newJobRankIndex).databaseId;
|
||||
tempSubAccount.jobRankIndex = newJobRankIndex;
|
||||
} else {
|
||||
@@ -339,7 +339,7 @@ function saveSubAccountToDatabase(subAccountData) {
|
||||
// ===========================================================================
|
||||
|
||||
function createSubAccount(accountId, firstName, lastName) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Account] Attempting to create subaccount ${firstName} ${lastName} in database`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Account] Attempting to create subaccount ${firstName} ${lastName} in database`);
|
||||
|
||||
let dbConnection = connectToDatabase();
|
||||
let dbQuery = false;
|
||||
@@ -373,7 +373,7 @@ function showCharacterSelectToClient(client) {
|
||||
|
||||
if (doesPlayerHaveAutoSelectLastCharacterEnabled(client)) {
|
||||
if (getPlayerData(client).subAccounts.length > 0) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.SubAccount] ${getPlayerDisplayForConsole(client)} is being auto-spawned as character ID ${getPlayerLastUsedSubAccount(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.SubAccount] ${getPlayerDisplayForConsole(client)} is being auto-spawned as character ID ${getPlayerLastUsedSubAccount(client)}`);
|
||||
selectCharacter(client, getPlayerLastUsedSubAccount(client));
|
||||
return true;
|
||||
}
|
||||
@@ -381,7 +381,7 @@ function showCharacterSelectToClient(client) {
|
||||
|
||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||
getPlayerData(client).currentSubAccount = 0;
|
||||
logToConsole(LOG_DEBUG, `[V.RP.SubAccount] Setting ${getPlayerDisplayForConsole(client)}'s character to ID ${getPlayerData(client).currentSubAccount}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.SubAccount] Setting ${getPlayerDisplayForConsole(client)}'s character to ID ${getPlayerData(client).currentSubAccount}`);
|
||||
let tempSubAccount = getPlayerData(client).subAccounts[0];
|
||||
let clanName = (tempSubAccount.clan != 0) ? getClanData(getClanIndexFromDatabaseId(tempSubAccount.clan)).name : "None";
|
||||
let lastPlayedText = (tempSubAccount.lastLogin != 0) ? `${msToTime(getCurrentUnixTimestamp() - tempSubAccount.lastLogin)} ago` : "Never";
|
||||
@@ -391,16 +391,16 @@ function showCharacterSelectToClient(client) {
|
||||
//setTimeout(function() {
|
||||
// showCharacterSelectCameraToPlayer(client);
|
||||
//}, 500);
|
||||
logToConsole(LOG_DEBUG, `[V.RP.SubAccount] ${getPlayerDisplayForConsole(client)} is being shown the character select GUI`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.SubAccount] ${getPlayerDisplayForConsole(client)} is being shown the character select GUI`);
|
||||
} else {
|
||||
let charactersList = getPlayerData(client).subAccounts.map((sacct, index) => `{chatBoxListIndex}${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);
|
||||
messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderCharactersListSelf")));
|
||||
for (let i in chunkedList) {
|
||||
messagePlayerNormal(client, chunkedList[i].join("{MAINCOLOUR} • "));
|
||||
}
|
||||
messagePlayerInfo(client, getLocaleString(client, "CharacterSelectHelpText", `{ALTCOLOUR}/usechar{MAINCOLOUR}`, `{ALTCOLOUR}/newchar{MAINCOLOUR}`));
|
||||
logToConsole(LOG_DEBUG, `[V.RP.SubAccount] ${getPlayerDisplayForConsole(client)} is being shown the character select/list message (GUI disabled)`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.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();
|
||||
|
||||
if (doesNameContainInvalidCharacters(firstName) || doesNameContainInvalidCharacters(lastName)) {
|
||||
logToConsole(LOG_INFO | LOG_WARN, `[V.RP.Account] Subaccount ${firstName} ${lastName} could not be created (invalid characters in name)`);
|
||||
logToConsole(LOG_INFO | LOG_WARN, `[AGRP.Account] Subaccount ${firstName} ${lastName} could not be created (invalid characters in name)`);
|
||||
showPlayerNewCharacterFailedGUI(client, "Invalid characters in name!");
|
||||
return false;
|
||||
}
|
||||
@@ -467,7 +467,7 @@ function checkPreviousCharacter(client) {
|
||||
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]);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.SubAccount] Setting ${getPlayerDisplayForConsole(client)}'s character to ID ${getPlayerData(client).currentSubAccount}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.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";
|
||||
showPlayerCharacterSelectGUI(client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.cash, clanName, lastPlayedText, getGameConfig().skins[getGame()][tempSubAccount.skin][0]);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.SubAccount] Setting ${getPlayerDisplayForConsole(client)}'s character to ID ${getPlayerData(client).currentSubAccount}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.SubAccount] Setting ${getPlayerDisplayForConsole(client)}'s character to ID ${getPlayerData(client).currentSubAccount}`);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function selectCharacter(client, characterId = -1) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.SubAccount] ${getPlayerDisplayForConsole(client)} character select called (Character ID ${characterId})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.SubAccount] ${getPlayerDisplayForConsole(client)} character select called (Character ID ${characterId})`);
|
||||
if (characterId != -1) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.SubAccount] ${getPlayerDisplayForConsole(client)} provided character ID (${characterId}) to spawn with`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.SubAccount] ${getPlayerDisplayForConsole(client)} provided character ID (${characterId}) to spawn with`);
|
||||
getPlayerData(client).currentSubAccount = characterId;
|
||||
}
|
||||
|
||||
@@ -511,7 +511,7 @@ function selectCharacter(client, characterId = -1) {
|
||||
|
||||
getPlayerData(client).switchingCharacter = false;
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.SubAccount] Spawning ${getPlayerDisplayForConsole(client)} as character ID ${getPlayerData(client).currentSubAccount} with skin ${skin} (${spawnPosition.x}, ${spawnPosition.y}, ${spawnPosition.z})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.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);
|
||||
getPlayerData(client).pedState = V_PEDSTATE_SPAWNING;
|
||||
|
||||
@@ -520,14 +520,14 @@ function selectCharacter(client, characterId = -1) {
|
||||
onPlayerSpawn(client);
|
||||
} else if (getGame() == V_GAME_MAFIA_ONE) {
|
||||
//spawnPlayer(client, spawnPosition, spawnHeading, 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]})`);
|
||||
//logToConsole(LOG_DEBUG, `[AGRP.SubAccount] Spawning ${getPlayerDisplayForConsole(client)} as ${getGameConfig().skins[getGame()][skin][1]} (${getGameConfig().skins[getGame()][skin][0]})`);
|
||||
spawnPlayer(client, spawnPosition, spawnHeading, getGameConfig().skins[getGame()][skin][0]);
|
||||
onPlayerSpawn(client);
|
||||
}
|
||||
|
||||
//removePlayerKeyBind(client, getKeyIdFromParams("insert"));
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.SubAccount] Spawned ${getPlayerDisplayForConsole(client)} as character ID ${getPlayerData(client).currentSubAccount} with skin ${skin} (${spawnPosition.x}, ${spawnPosition.y}, ${spawnPosition.z})`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.SubAccount] Spawned ${getPlayerDisplayForConsole(client)} as character ID ${getPlayerData(client).currentSubAccount} with skin ${skin} (${spawnPosition.x}, ${spawnPosition.y}, ${spawnPosition.z})`);
|
||||
|
||||
getPlayerCurrentSubAccount(client).lastLogin = getCurrentUnixTimestamp();
|
||||
}
|
||||
@@ -535,14 +535,14 @@ function selectCharacter(client, characterId = -1) {
|
||||
// ===========================================================================
|
||||
|
||||
function switchCharacterCommand(command, params, client) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.SubAccount] ${getPlayerDisplayForConsole(client)} is requesting to switch characters (current character: ${getCharacterFullName(client)} [${getPlayerData(client).currentSubAccount}/${getPlayerCurrentSubAccount(client).databaseId}])`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.SubAccount] ${getPlayerDisplayForConsole(client)} is requesting to switch characters (current character: ${getCharacterFullName(client)} [${getPlayerData(client).currentSubAccount}/${getPlayerCurrentSubAccount(client).databaseId}])`);
|
||||
if (!isPlayerSpawned(client)) {
|
||||
logToConsole(LOG_WARN, `[V.RP.SubAccount] ${getPlayerDisplayForConsole(client)} is not allowed to switch characters (not spawned)`);
|
||||
logToConsole(LOG_WARN, `[AGRP.SubAccount] ${getPlayerDisplayForConsole(client)} is not allowed to switch characters (not spawned)`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isPlayerSwitchingCharacter(client)) {
|
||||
logToConsole(LOG_WARN, `[V.RP.SubAccount] ${getPlayerDisplayForConsole(client)} is not allowed to switch characters (already in switch char mode)`);
|
||||
logToConsole(LOG_WARN, `[AGRP.SubAccount] ${getPlayerDisplayForConsole(client)} is not allowed to switch characters (already in switch char mode)`);
|
||||
messagePlayerError(client, "You are already selecting/switching characters!");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -103,14 +103,14 @@ function initTimers() {
|
||||
// ===========================================================================
|
||||
|
||||
function oneMinuteTimerFunction() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] Checking server game time`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Checking server game time`);
|
||||
checkServerGameTime();
|
||||
|
||||
if (getClients().length > 0) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] Checking rentable vehicles`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Checking rentable vehicles`);
|
||||
checkVehicleRenting();
|
||||
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Event] Updating all player name tags`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Updating all player name tags`);
|
||||
updateAllPlayerNameTags();
|
||||
}
|
||||
}
|
||||
@@ -121,7 +121,6 @@ function tenMinuteTimerFunction() {
|
||||
//showRandomTipToAllPlayers();
|
||||
//saveServerDataToDatabase();
|
||||
//checkInactiveVehicleRespawns();
|
||||
updateVehicleSavedPositions();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -245,15 +244,9 @@ function checkServerGameTime() {
|
||||
removeAllPlayersFromProperties();
|
||||
removeAllPlayersFromVehicles();
|
||||
saveServerDataToDatabase();
|
||||
logToConsole(LOG_INFO | LOG_WARN, `[V.RP.Timers] Changing server map to night`);
|
||||
logToConsole(LOG_INFO | LOG_WARN, `[AGRP.Timers] Changing server map to night`);
|
||||
messageDiscordEventChannel("🌙 Changing server map to night");
|
||||
despawnAllVehicles();
|
||||
despawnAllNPCs();
|
||||
despawnAllGroundItemObjects();
|
||||
game.changeMap(getGameConfig().mainWorldScene[getGame()]);
|
||||
spawnAllVehicles();
|
||||
spawnAllNPCs();
|
||||
spawnAllGroundItemObjects();
|
||||
}
|
||||
} else if (getGameConfig().mainWorldScene[getGame()] == "FREERIDENOC") {
|
||||
if (isServerGoingToChangeMapsSoon(getServerConfig().hour, getServerConfig().minute)) {
|
||||
@@ -265,15 +258,9 @@ function checkServerGameTime() {
|
||||
removeAllPlayersFromProperties();
|
||||
removeAllPlayersFromVehicles();
|
||||
saveServerDataToDatabase();
|
||||
logToConsole(LOG_INFO | LOG_WARN, `[V.RP.Timers] Changing server map to day`);
|
||||
logToConsole(LOG_INFO | LOG_WARN, `[AGRP.Timers] Changing server map to day`);
|
||||
messageDiscordEventChannel("🌞 Changing server map to day");
|
||||
despawnAllVehicles();
|
||||
despawnAllNPCs();
|
||||
despawnAllGroundItemObjects();
|
||||
game.changeMap(getGameConfig().mainWorldScene[getGame()]);
|
||||
spawnAllVehicles();
|
||||
spawnAllNPCs();
|
||||
spawnAllGroundItemObjects();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ function initAllClients() {
|
||||
// ===========================================================================
|
||||
|
||||
function updateServerRules() {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Utilities]: Updating all server rules ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities]: Updating all server rules ...`);
|
||||
|
||||
let timeWeatherRule = [];
|
||||
let tempText = "";
|
||||
@@ -116,7 +116,7 @@ function updateServerRules() {
|
||||
}
|
||||
|
||||
setServerRule("Time & Weather", timeWeatherRule.join(", "));
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Utilities]: All server rules updated successfully!`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities]: All server rules updated successfully!`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -272,7 +272,7 @@ function checkPlayerPedStates() {
|
||||
|
||||
function showConnectCameraToPlayer(client) {
|
||||
if (isFadeCameraSupported()) {
|
||||
fadePlayerCamera(client, true, 1000);
|
||||
fadeCamera(client, true, 1);
|
||||
}
|
||||
|
||||
if (isCustomCameraSupported()) {
|
||||
@@ -517,15 +517,15 @@ function removeAllPlayersFromVehicles() {
|
||||
// ===========================================================================
|
||||
|
||||
function processPlayerEnteringExitingProperty(client) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Utilities]: Processing property enter/exit for player ${getPlayerDisplayForConsole(client)} ...`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities]: Processing property enter/exit for player ${getPlayerDisplayForConsole(client)} ...`);
|
||||
if (getPlayerData(client).enteringExitingProperty == null) {
|
||||
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.Utilities]: Aborting property enter/exit for player ${getPlayerDisplayForConsole(client)}. Assigned property data is null.`);
|
||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.Utilities]: Aborting property enter/exit for player ${getPlayerDisplayForConsole(client)}. Assigned property data is null.`);
|
||||
return false;
|
||||
}
|
||||
|
||||
let pedState = getPlayerData(client).pedState;
|
||||
if (pedState != V_PEDSTATE_ENTERINGPROPERTY && pedState != V_PEDSTATE_EXITINGPROPERTY) {
|
||||
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.Utilities]: Aborting property enter/exit for player ${getPlayerDisplayForConsole(client)}. Ped state is not entering or exiting property.`);
|
||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.Utilities]: Aborting property enter/exit for player ${getPlayerDisplayForConsole(client)}. Ped state is not entering or exiting property.`);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -537,14 +537,14 @@ function processPlayerEnteringExitingProperty(client) {
|
||||
}
|
||||
|
||||
if (propertyData == null || propertyData == false) {
|
||||
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.Utilities]: Aborting property enter/exit for player ${getPlayerDisplayForConsole(client)}. Property is invalid.`);
|
||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.Utilities]: Aborting property enter/exit for player ${getPlayerDisplayForConsole(client)}. Property is invalid.`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pedState == V_PEDSTATE_ENTERINGPROPERTY) {
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Utilities]: Processing property ENTER for player ${getPlayerDisplayForConsole(client)} ...`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Utilities]: Processing property ENTER for player ${getPlayerDisplayForConsole(client)} ...`);
|
||||
if (isGameFeatureSupported("interiorScene") && propertyData.exitScene != "") {
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Utilities]: Player ${getPlayerDisplayForConsole(client)} is entering a property with interior scene (${propertyData.exitScene})`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.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]);
|
||||
onPlayerSpawn(client);
|
||||
} else {
|
||||
@@ -552,17 +552,12 @@ function processPlayerEnteringExitingProperty(client) {
|
||||
setPlayerHeading(client, propertyData.exitRotation);
|
||||
}
|
||||
|
||||
if (isGameFeatureSupported("dimension")) {
|
||||
setPlayerDimension(client, propertyData.exitDimension);
|
||||
}
|
||||
|
||||
if (isGameFeatureSupported("interior")) {
|
||||
setPlayerInterior(client, propertyData.exitInterior);
|
||||
}
|
||||
setPlayerDimension(client, propertyData.exitDimension);
|
||||
setPlayerInterior(client, propertyData.exitInterior);
|
||||
|
||||
setTimeout(function () {
|
||||
if (isFadeCameraSupported()) {
|
||||
fadePlayerCamera(client, true, 1000);
|
||||
fadeCamera(client, true, 1.0);
|
||||
}
|
||||
updateInteriorLightsForPlayer(client, propertyData.interiorLights);
|
||||
}, 1000);
|
||||
@@ -585,9 +580,9 @@ function processPlayerEnteringExitingProperty(client) {
|
||||
getPlayerData(client).enteringExitingProperty = null;
|
||||
getPlayerData(client).pedState = V_PEDSTATE_READY;
|
||||
} else if (pedState == V_PEDSTATE_EXITINGPROPERTY) {
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Utilities]: Processing property EXIT for player ${getPlayerDisplayForConsole(client)} from property ID ${propertyData.index}/${propertyData.databaseId} ...`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Utilities]: Processing property EXIT for player ${getPlayerDisplayForConsole(client)} from property ID ${propertyData.index}/${propertyData.databaseId} ...`);
|
||||
if (isGameFeatureSupported("interiorScene") && propertyData.entranceScene != "") {
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Utilities]: Player ${getPlayerDisplayForConsole(client)} is exiting a property with external interior scene (${propertyData.entranceScene})`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.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]);
|
||||
onPlayerSpawn(client);
|
||||
} else {
|
||||
@@ -595,13 +590,8 @@ function processPlayerEnteringExitingProperty(client) {
|
||||
setPlayerHeading(client, propertyData.entranceRotation);
|
||||
}
|
||||
|
||||
if (isGameFeatureSupported("dimension")) {
|
||||
setPlayerDimension(client, propertyData.entranceDimension);
|
||||
}
|
||||
|
||||
if (isGameFeatureSupported("interior")) {
|
||||
setPlayerInterior(client, propertyData.entranceInterior);
|
||||
}
|
||||
setPlayerDimension(client, propertyData.entranceDimension);
|
||||
setPlayerInterior(client, propertyData.entranceInterior);
|
||||
|
||||
// Check if exiting property was into another house/business
|
||||
let inProperty = false;
|
||||
@@ -622,7 +612,7 @@ function processPlayerEnteringExitingProperty(client) {
|
||||
setTimeout(function () {
|
||||
if (getGame() != V_GAME_MAFIA_ONE && getGame() != V_GAME_GTA_IV) {
|
||||
if (isFadeCameraSupported()) {
|
||||
fadePlayerCamera(client, true, 1000);
|
||||
fadeCamera(client, true, 1.0);
|
||||
}
|
||||
}
|
||||
updateInteriorLightsForPlayer(client, (inProperty != false) ? inProperty.interiorLights : true);
|
||||
|
||||
@@ -104,7 +104,7 @@ class VehicleData {
|
||||
|
||||
// Position and Rotation
|
||||
this.spawnPosition = toVector3(dbAssoc["veh_pos_x"], dbAssoc["veh_pos_y"], dbAssoc["veh_pos_z"]);
|
||||
this.spawnRotation = toFloat(dbAssoc["veh_rot_z"]);
|
||||
this.spawnRotation = toInteger(dbAssoc["veh_rot_z"]);
|
||||
this.spawnLocked = intToBool(toInteger(dbAssoc["veh_spawn_lock"]));
|
||||
this.interior = toInteger(dbAssoc["veh_int"]);
|
||||
this.dimension = toInteger(dbAssoc["veh_vw"]);
|
||||
@@ -193,7 +193,7 @@ function loadVehiclesFromDatabase() {
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
|
||||
logToConsole(LOG_INFO, `[V.RP.Vehicle]: ${tempVehicles.length} vehicles loaded from database successfully!`);
|
||||
logToConsole(LOG_INFO, `[AGRP.Vehicle]: ${tempVehicles.length} vehicles loaded from database successfully!`);
|
||||
return tempVehicles;
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ function saveVehicleToDatabase(vehicleDataId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Vehicle]: Saving vehicle ${tempVehicleData.databaseId} to database ...`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Vehicle]: Saving vehicle ${tempVehicleData.databaseId} to database ...`);
|
||||
let dbConnection = connectToDatabase();
|
||||
if (dbConnection) {
|
||||
if (tempVehicleData.vehicle != false) {
|
||||
@@ -313,7 +313,7 @@ function saveVehicleToDatabase(vehicleDataId) {
|
||||
disconnectFromDatabase(dbConnection);
|
||||
return true;
|
||||
}
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Vehicle]: Saved vehicle ${vehicleDataId} to database!`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Vehicle]: Saved vehicle ${vehicleDataId} to database!`);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -490,10 +490,16 @@ function vehicleLightsCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function deleteVehicleCommand(command, params, client) {
|
||||
let vehicle = getClosestVehicle(getPlayerPosition(client));
|
||||
if (!getPlayerVehicle(client)) {
|
||||
messagePlayerError(client, getLocaleString(client, "MustBeInAVehicle"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (getPlayerVehicle(client)) {
|
||||
vehicle = getPlayerVehicle(client);
|
||||
let vehicle = getPlayerVehicle(client);
|
||||
|
||||
if (!getVehicleData(vehicle)) {
|
||||
messagePlayerError(client, getLocaleString(client, "RandomVehicleCommandsDisabled"));
|
||||
return false;
|
||||
}
|
||||
|
||||
let dataIndex = getEntityData(vehicle, "v.rp.dataSlot");
|
||||
@@ -577,11 +583,6 @@ function vehicleSirenCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function vehicleAdminColourCommand(command, params, client) {
|
||||
if (isGameFeatureSupported("vehicleColour")) {
|
||||
messagePlayerError(client, "Vehicle colours are not supported in this game!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (areParamsEmpty(params) && areThereEnoughParams(params, 2)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
@@ -775,10 +776,6 @@ function rentVehicleCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function enterVehicleAsPassengerCommand(command, params, client) {
|
||||
if (getGame() == V_GAME_MAFIA_ONE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
sendNetworkEventToPlayer("v.rp.passenger", client);
|
||||
}
|
||||
|
||||
@@ -1167,12 +1164,13 @@ function removeVehicleOwnerCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function getVehicleInfoCommand(command, params, client) {
|
||||
let vehicle = getClosestVehicle(getPlayerPosition(client));
|
||||
|
||||
if (getPlayerVehicle(client)) {
|
||||
vehicle = getPlayerVehicle(client);
|
||||
if (!isPlayerInAnyVehicle(client)) {
|
||||
messagePlayerError(client, getLocaleString(client, "MustBeInAVehicle"));
|
||||
return false;
|
||||
}
|
||||
|
||||
let vehicle = getPlayerVehicle(client);
|
||||
|
||||
if (!getVehicleData(vehicle)) {
|
||||
messagePlayerError(client, getLocaleString(client, "RandomVehicleCommandsDisabled"));
|
||||
return false;
|
||||
@@ -1229,7 +1227,7 @@ function getVehicleInfoCommand(command, params, client) {
|
||||
[`Last Driver`, `${vehicleData.lastDriverName}`],
|
||||
];
|
||||
|
||||
let stats = tempStats.map(stat => `{chatBoxListIndex}${stat[0]}: {ALTCOLOUR}${stat[1]}{MAINCOLOUR}`);
|
||||
let stats = tempStats.map(stat => `{MAINCOLOUR}${stat[0]}: {ALTCOLOUR}${stat[1]}{MAINCOLOUR}`);
|
||||
|
||||
messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderVehicleInfo")));
|
||||
let chunkedList = splitArrayIntoChunks(stats, 6);
|
||||
@@ -1490,7 +1488,7 @@ function respawnVehicle(vehicle) {
|
||||
// ===========================================================================
|
||||
|
||||
function spawnVehicle(vehicleData) {
|
||||
logToConsole(LOG_DEBUG, `[V.RP.Vehicle]: Spawning ${getVehicleNameFromModel(vehicleData.model)} at ${vehicleData.spawnPosition.x}, ${vehicleData.spawnPosition.y}, ${vehicleData.spawnPosition.z} with heading ${vehicleData.spawnRotation}`);
|
||||
logToConsole(LOG_DEBUG, `[AGRP.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);
|
||||
|
||||
if (!vehicle) {
|
||||
@@ -1507,25 +1505,25 @@ function spawnVehicle(vehicleData) {
|
||||
vehicle.setRGBColours(vehicleData.colour1RGBA, vehicleData.colour2RGBA);
|
||||
let colour1 = rgbaArrayFromToColour(vehicleData.colour1RGBA);
|
||||
let colour2 = rgbaArrayFromToColour(vehicleData.colour2RGBA);
|
||||
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]}]`);
|
||||
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]}]`);
|
||||
vehicle.setRGBColours(vehicleData.colour1RGBA, vehicleData.colour2RGBA);
|
||||
} else {
|
||||
setVehicleColours(vehicle, 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}`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Vehicle]: Setting vehicle ${vehicle.id}'s colours to ${vehicleData.colour1}, ${vehicleData.colour2}, ${vehicleData.colour3}, ${vehicleData.colour4}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (vehicleData.spawnLocked == true) {
|
||||
setVehicleEngine(vehicle, false);
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Vehicle]: Setting vehicle ${vehicle.id}'s engine to OFF`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Vehicle]: Setting vehicle ${vehicle.id}'s engine to OFF`);
|
||||
} else {
|
||||
setVehicleEngine(vehicle, intToBool(vehicleData.engine));
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Vehicle]: Setting vehicle ${vehicle.id}'s engine to ${toUpperCase(getOnOffFromBool(getVehicleEngine(vehicle)))}`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Vehicle]: Setting vehicle ${vehicle.id}'s engine to ${toUpperCase(getOnOffFromBool(getVehicleEngine(vehicle)))}`);
|
||||
}
|
||||
|
||||
if (typeof vehicle.locked != "undefined") {
|
||||
setVehicleLocked(vehicle, intToBool(vehicleData.locked));
|
||||
logToConsole(LOG_VERBOSE, `[V.RP.Vehicle]: Setting vehicle ${vehicle.id}'s lock state to ${toUpperCase(getOnOffFromBool(getVehicleLocked(vehicle)))}`);
|
||||
logToConsole(LOG_VERBOSE, `[AGRP.Vehicle]: Setting vehicle ${vehicle.id}'s lock state to ${toUpperCase(getOnOffFromBool(getVehicleLocked(vehicle)))}`);
|
||||
}
|
||||
|
||||
//setVehicleHealth(vehicle, 1000);
|
||||
@@ -1590,6 +1588,17 @@ function isVehicleOwnedByJob(vehicle, jobId) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
async function getPlayerNewVehicle(client) {
|
||||
while (true) {
|
||||
if (isPlayerInAnyVehicle(client)) {
|
||||
return getPlayerVehicle(client);
|
||||
}
|
||||
await null;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function createNewDealershipVehicle(modelIndex, spawnPosition, spawnRotation, price, dealershipId, interior = 0, dimension = 0) {
|
||||
let vehicle = createGameVehicle(modelIndex, spawnPosition, spawnRotation);
|
||||
if (!vehicle) {
|
||||
@@ -1800,7 +1809,7 @@ function setAllVehicleIndexes() {
|
||||
getServerData().vehicles[i].index = i;
|
||||
|
||||
if (getServerData().vehicles[i].streamingRadioStation != 0) {
|
||||
getServerData().vehicles[i].streamingRadioStationIndex = getRadioStationIdFromDatabaseId(getServerData().vehicles[i].streamingRadioStation);
|
||||
getServerData().vehicles[i].streamingRadioStationIndex = getRadioStationIndexFromDatabase(getServerData().vehicles[i].streamingRadioStation);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1865,14 +1874,9 @@ function getVehicleTrunkPosition(vehicle) {
|
||||
// ===========================================================================
|
||||
|
||||
function removeAllOccupantsFromVehicle(vehicle) {
|
||||
let clients = getClients();
|
||||
for (let i in clients) {
|
||||
if (clients[i].player != null) {
|
||||
if (clients[i].player.vehicle != null) {
|
||||
if (clients[i].player.vehicle == vehicle) {
|
||||
removePlayerFromVehicle(clients[i]);
|
||||
}
|
||||
}
|
||||
for (let i = 0; i <= 16; i++) {
|
||||
if (vehicle.getOccupant(i) != null) {
|
||||
removePlayerFromVehicle(vehicle.getOccupant(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1916,24 +1920,4 @@ function isPlayerInVehicleDriverSeat(client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function despawnAllVehicles() {
|
||||
for (let i in getServerData().vehicles) {
|
||||
destroyGameElement(getServerData().vehicles[i].vehicle);
|
||||
getServerData().vehicles[i].vehicle = null;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function updateVehicleSavedPositions() {
|
||||
for (let i in getServerData().vehicles) {
|
||||
if (!getServerData().vehicles[i].spawnLocked) {
|
||||
getServerData().vehicles[i].spawnPosition = getVehiclePosition(getServerData().vehicles[i].vehicle);
|
||||
getServerData().vehicles[i].spawnRotation = getVehicleHeading(getServerData().vehicles[i].vehicle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
File diff suppressed because it is too large
Load Diff
@@ -182,7 +182,7 @@ let serverColours = {
|
||||
businessBlue: "0099FF",
|
||||
houseGreen: "11CC11",
|
||||
clanOrange: "FF9900",
|
||||
vehiclePurple: "B19CD9",
|
||||
vehiclePurple: "960096",
|
||||
jobYellow: "FFFF00",
|
||||
adminOrange: "ED4337",
|
||||
chatBoxListIndex: "0099FF",
|
||||
@@ -206,7 +206,7 @@ let serverColours = {
|
||||
firefighterRed: toColour(205, 60, 60, 255),
|
||||
busDriverGreen: toColour(50, 160, 50, 255),
|
||||
taxiDriverYellow: toColour(240, 230, 100, 255),
|
||||
deliveryPurple: toColour(150, 0, 150, 255),
|
||||
deliveryPurple: toColour(177, 156, 217, 255),
|
||||
civilianWhite: toColour(200, 200, 200, 255),
|
||||
burntYellow: toColour(210, 210, 0, 255),
|
||||
burntOrange: toColour(210, 120, 0, 255),
|
||||
@@ -214,7 +214,7 @@ let serverColours = {
|
||||
softYellow: toColour(234, 198, 126, 255),
|
||||
businessBlue: toColour(0, 153, 255, 255),
|
||||
houseGreen: toColour(17, 204, 17, 255),
|
||||
vehiclePurple: toColour(150, 0, 150, 255),
|
||||
vehiclePurple: toColour(177, 156, 217, 255),
|
||||
chatBoxListIndex: toColour(0, 153, 255, 255),
|
||||
npcPink: toColour(219, 112, 147, 255),
|
||||
adminOrange: toColour(205, 60, 60, 255),
|
||||
@@ -1748,7 +1748,7 @@ function areWorldLabelsSupported() {
|
||||
|
||||
function isGameFeatureSupported(featureName) {
|
||||
if (typeof supportedFeatures[featureName] === "undefined") {
|
||||
logToConsole(LOG_WARN, `[V.RP.Utilities] Game feature support error. Unknown feature name: ${featureName}`);
|
||||
logToConsole(LOG_WARN, `[AGRP.Utilities] Game feature support error. Unknown feature name: ${featureName}`);
|
||||
if (isServerScript()) {
|
||||
submitBugReport(null, `[AUTOMATED REPORT] Game feature support error. Unknown feature name: ${featureName}`);
|
||||
return false;
|
||||
@@ -2302,15 +2302,6 @@ function removeHexColoursFromString(str) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function removeSlashesFromString(str) {
|
||||
let matchRegex = /\//gi;
|
||||
str.replace(matchRegex, ``);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
async function waitUntil(condition) {
|
||||
return new Promise((resolve) => {
|
||||
let interval = setInterval(() => {
|
||||
@@ -2657,11 +2648,11 @@ function fixCharacterName(name) {
|
||||
function getCurrentTimeStampWithTimeZone(timeZone) {
|
||||
let date = new Date();
|
||||
|
||||
//let utcDate = new Date(date.toLocaleString('en-US', { timeZone: "UTC" }));
|
||||
//let tzDate = new Date(date.toLocaleString('en-US', { timeZone: timeZone }));
|
||||
//let offset = utcDate.getTime() - tzDate.getTime();
|
||||
let utcDate = new Date(date.toLocaleString('en-US', { timeZone: "UTC" }));
|
||||
let tzDate = new Date(date.toLocaleString('en-US', { timeZone: timeZone }));
|
||||
let offset = utcDate.getTime() - tzDate.getTime();
|
||||
|
||||
//date.setTime(date.getTime() + offset);
|
||||
date.setTime(date.getTime() + offset);
|
||||
|
||||
return date;
|
||||
};
|
||||
@@ -3184,15 +3175,7 @@ function getAnimationFromParams(params) {
|
||||
* @return {AnimationData} The animation's data (array)
|
||||
*/
|
||||
function getAnimationData(animationSlot, gameId = getGame()) {
|
||||
if (animationSlot == -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (typeof getGameConfig().animations[gameId][animationSlot] != "undefined") {
|
||||
return getGameConfig().animations[gameId][animationSlot];
|
||||
}
|
||||
|
||||
return false;
|
||||
return getGameConfig().animations[gameId][animationSlot];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
Reference in New Issue
Block a user