Compare commits
64 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8b02904515 | ||
|
|
a39acd67d0 | ||
|
|
f6e452ee0e | ||
|
|
e8c658acff | ||
|
|
06bb1d2c61 | ||
|
|
902072b6a2 | ||
|
|
441eaca65d | ||
|
|
e4221198c6 | ||
|
|
3eaf6f2452 | ||
|
|
2b17deb25a | ||
|
|
9e4ae75fbe | ||
|
|
ad8c459839 | ||
|
|
889d7898c3 | ||
|
|
a374702da2 | ||
|
|
1b2168c39d | ||
|
|
3ab59fa3f8 | ||
|
|
ae96568c0a | ||
|
|
c0f7d1ce02 | ||
|
|
0ed30452f6 | ||
|
|
68f7bb1db7 | ||
|
|
ce73e81f89 | ||
|
|
297ce51323 | ||
|
|
8ca2e84e62 | ||
|
|
ae0178717c | ||
|
|
9322d793e6 | ||
|
|
f755de8de6 | ||
|
|
fd703e969a | ||
|
|
f3df3a37e6 | ||
|
|
711c429363 | ||
|
|
736857e120 | ||
|
|
f23a98f182 | ||
|
|
350a42eef5 | ||
|
|
a098fec203 | ||
|
|
2028d34a0c | ||
|
|
4db0882d4c | ||
|
|
7169dc65ba | ||
|
|
3b509da887 | ||
|
|
2d7e7f5a6e | ||
|
|
89118b8426 | ||
|
|
c168e80258 | ||
|
|
82f4d31b3b | ||
|
|
0934a86023 | ||
|
|
afce71dd19 | ||
|
|
734446c4f0 | ||
|
|
03e939a4af | ||
|
|
ba3c5533e7 | ||
|
|
8aa8e843b7 | ||
|
|
ea9135e898 | ||
|
|
4d13ab33e4 | ||
|
|
1553d19fdd | ||
|
|
bca6816fad | ||
|
|
5c2cb68bb7 | ||
|
|
436bbc753a | ||
|
|
2ce7d35971 | ||
|
|
42c31ed2ef | ||
|
|
bacdc063d4 | ||
|
|
77114a14a3 | ||
|
|
66109a8fe9 | ||
|
|
07187b99ce | ||
|
|
dd04ec0bb3 | ||
|
|
9004e51928 | ||
|
|
094387dc41 | ||
|
|
145906042b | ||
|
|
1e91698e05 |
4
meta.xml
4
meta.xml
@@ -119,14 +119,16 @@
|
|||||||
<script src="scripts/client/afk.js" type="client" language="javascript" />
|
<script src="scripts/client/afk.js" type="client" language="javascript" />
|
||||||
<script src="scripts/client/animation.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/business.js" type="client" language="javascript" />
|
||||||
<script src="scripts/client/core.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/chat.js" type="client" language="javascript" />
|
||||||
|
<script src="scripts/client/core.js" type="client" language="javascript" />
|
||||||
<script src="scripts/client/cursor.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/economy.js" type="client" language="javascript" />
|
||||||
<script src="scripts/client/event.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/gui.js" type="client" language="javascript" />
|
||||||
<script src="scripts/client/gps.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/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/item.js" type="client" language="javascript" />
|
||||||
<script src="scripts/client/job.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" />
|
<script src="scripts/client/keybind.js" type="client" language="javascript" />
|
||||||
|
|||||||
6
package.json
Normal file
6
package.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"name": "v-roleplay",
|
||||||
|
"main": "index.js",
|
||||||
|
"version": "1.3",
|
||||||
|
"mod": "MafiaMP"
|
||||||
|
}
|
||||||
@@ -22,7 +22,7 @@ function makePedPlayAnimation(pedId, animationSlot, positionOffset) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let animationData = getAnimationData(animationSlot);
|
let animationData = getAnimationData(animationSlot);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Animation] Playing animation ${animationData[0]} for ped ${pedId}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Animation] Playing animation ${animationData[0]} for ped ${pedId}`);
|
||||||
|
|
||||||
let freezePlayer = false;
|
let freezePlayer = false;
|
||||||
switch (animationData.moveType) {
|
switch (animationData.moveType) {
|
||||||
|
|||||||
@@ -35,10 +35,19 @@ function initBusinessScript() {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked, hasItems, entranceFee) {
|
function receiveBusinessFromServer(businessId, isDeleted, name, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked, hasItems, entranceFee) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Business] Received business ${businessId} (${name}) from server`);
|
logToConsole(LOG_DEBUG, `[V.RP.Business] Received business ${businessId} (${name}) from server`);
|
||||||
|
|
||||||
if (!areServerElementsSupported() || getGame() == V_GAME_MAFIA_ONE || getGame() == V_GAME_GTA_IV) {
|
if (!areServerElementsSupported() || getGame() == V_GAME_MAFIA_ONE || getGame() == V_GAME_GTA_IV) {
|
||||||
|
if (isDeleted == true) {
|
||||||
|
if (getGame() == V_GAME_GTA_IV) {
|
||||||
|
natives.removeBlipAndClearIndex(getBusinessData(businessId).blipId);
|
||||||
|
}
|
||||||
|
|
||||||
|
getServerData().businesses.splice(businessId, 1);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (getBusinessData(businessId) != false) {
|
if (getBusinessData(businessId) != false) {
|
||||||
let businessData = getBusinessData(businessId);
|
let businessData = getBusinessData(businessId);
|
||||||
businessData.name = name;
|
businessData.name = name;
|
||||||
@@ -52,20 +61,22 @@ function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel
|
|||||||
businessData.locked = locked;
|
businessData.locked = locked;
|
||||||
businessData.entranceFee = entranceFee;
|
businessData.entranceFee = entranceFee;
|
||||||
|
|
||||||
if (hasInterior && !hasItems) {
|
if (businessData.buyPrice > 0) {
|
||||||
businessData.labelInfoType = V_PROPLABEL_INFO_ENTER;
|
businessData.labelInfoType = V_PROPLABEL_INFO_BUYBIZ;
|
||||||
} else if (!hasInterior && hasItems) {
|
|
||||||
businessData.labelInfoType = V_PROPLABEL_INFO_BUY;
|
|
||||||
} else {
|
} else {
|
||||||
if (businessData.buyPrice > 0) {
|
if (hasInterior && !hasItems) {
|
||||||
businessData.labelInfoType = V_PROPLABEL_INFO_BUYBIZ;
|
businessData.labelInfoType = V_PROPLABEL_INFO_ENTER;
|
||||||
|
} else if (!hasInterior && hasItems) {
|
||||||
|
businessData.labelInfoType = V_PROPLABEL_INFO_BUY;
|
||||||
|
} else {
|
||||||
|
businessData.labelInfoType = V_PROPLABEL_INFO_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Business] Business ${businessId} already exists. Checking blip ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Business] Business ${businessId} already exists. Checking blip ...`);
|
||||||
if (blipModel == -1) {
|
if (blipModel == -1) {
|
||||||
if (businessData.blipId != -1) {
|
if (businessData.blipId != -1) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Business] Business ${businessId}'s blip has been removed by the server`);
|
logToConsole(LOG_DEBUG, `[V.RP.Business] Business ${businessId}'s blip has been removed by the server`);
|
||||||
if (getGame() == V_GAME_GTA_IV) {
|
if (getGame() == V_GAME_GTA_IV) {
|
||||||
natives.removeBlipAndClearIndex(getBusinessData(businessId).blipId);
|
natives.removeBlipAndClearIndex(getBusinessData(businessId).blipId);
|
||||||
} else {
|
} else {
|
||||||
@@ -75,11 +86,11 @@ function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel
|
|||||||
//businesses.splice(businessData.index, 1);
|
//businesses.splice(businessData.index, 1);
|
||||||
//setAllBusinessDataIndexes();
|
//setAllBusinessDataIndexes();
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Business] Business ${businessId}'s blip is unchanged`);
|
logToConsole(LOG_DEBUG, `[V.RP.Business] Business ${businessId}'s blip is unchanged`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (businessData.blipId != -1) {
|
if (businessData.blipId != -1) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Business] Business ${businessId}'s blip has been changed by the server`);
|
logToConsole(LOG_DEBUG, `[V.RP.Business] Business ${businessId}'s blip has been changed by the server`);
|
||||||
if (getGame() == V_GAME_GTA_IV) {
|
if (getGame() == V_GAME_GTA_IV) {
|
||||||
natives.setBlipCoordinates(businessData.blipId, businessData.entrancePosition);
|
natives.setBlipCoordinates(businessData.blipId, businessData.entrancePosition);
|
||||||
natives.changeBlipSprite(businessData.blipId, businessData.blipModel);
|
natives.changeBlipSprite(businessData.blipId, businessData.blipModel);
|
||||||
@@ -92,20 +103,20 @@ function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel
|
|||||||
if (blipId != -1) {
|
if (blipId != -1) {
|
||||||
tempBusinessData.blipId = blipId;
|
tempBusinessData.blipId = blipId;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Business] Business ${businessId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Business] Business ${businessId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Business] Business ${businessId} doesn't exist. Adding ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Business] Business ${businessId} doesn't exist. Adding ...`);
|
||||||
let tempBusinessData = new BusinessData(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems);
|
let tempBusinessData = new BusinessData(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems);
|
||||||
if (blipModel != -1) {
|
if (blipModel != -1) {
|
||||||
let blipId = createGameBlip(tempBusinessData.blipModel, tempBusinessData.entrancePosition, tempBusinessData.name);
|
let blipId = createGameBlip(tempBusinessData.blipModel, tempBusinessData.entrancePosition, tempBusinessData.name);
|
||||||
if (blipId != -1) {
|
if (blipId != -1) {
|
||||||
tempBusinessData.blipId = blipId;
|
tempBusinessData.blipId = blipId;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Business] Business ${businessId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Business] Business ${businessId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Business] Business ${businessId} has no blip.`);
|
logToConsole(LOG_DEBUG, `[V.RP.Business] Business ${businessId} has no blip.`);
|
||||||
}
|
}
|
||||||
getServerData().businesses.push(tempBusinessData);
|
getServerData().businesses.push(tempBusinessData);
|
||||||
setAllBusinessDataIndexes();
|
setAllBusinessDataIndexes();
|
||||||
@@ -143,3 +154,9 @@ function setAllBusinessDataIndexes() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
function removeBusinessesFromClient() {
|
||||||
|
getServerData().businesses.splice(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
@@ -12,24 +12,29 @@ let cameraFadeIn = false;
|
|||||||
let cameraFadeStart = 0;
|
let cameraFadeStart = 0;
|
||||||
let cameraFadeDuration = 0;
|
let cameraFadeDuration = 0;
|
||||||
let cameraFadeColour = 0;
|
let cameraFadeColour = 0;
|
||||||
|
let cameraFadeAlpha = 0;
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function processCameraFadeRendering() {
|
function processCameraFadeRendering() {
|
||||||
if (cameraFadeEnabled) {
|
if (cameraFadeEnabled) {
|
||||||
|
logToConsole(LOG_VERBOSE, `[V.RP.Camera] Camera fade enabled`);
|
||||||
let finishTime = cameraFadeStart + cameraFadeDuration;
|
let finishTime = cameraFadeStart + cameraFadeDuration;
|
||||||
if (sdl.ticks >= finishTime) {
|
if (sdl.ticks >= finishTime) {
|
||||||
|
logToConsole(LOG_VERBOSE, `[V.RP.Camera] Camera fade finished`);
|
||||||
cameraFadeEnabled = false;
|
cameraFadeEnabled = false;
|
||||||
cameraFadeDuration = 0;
|
cameraFadeDuration = 0;
|
||||||
cameraFadeStart = 0;
|
cameraFadeStart = 0;
|
||||||
} else {
|
} else {
|
||||||
|
logToConsole(LOG_VERBOSE, `[V.RP.Camera] Camera fade processing`);
|
||||||
let currentTick = sdl.ticks - cameraFadeStart;
|
let currentTick = sdl.ticks - cameraFadeStart;
|
||||||
let progressPercent = Math.ceil(currentTick * 100 / cameraFadeDuration);
|
let progressPercent = Math.ceil(currentTick * 100 / cameraFadeDuration);
|
||||||
let rgbaArray = rgbaArrayFromToColour(cameraFadeColour);
|
let rgbaArray = rgbaArrayFromToColour(cameraFadeColour);
|
||||||
|
|
||||||
let alpha = (cameraFadeIn) ? Math.ceil(255 / progressPercent) : Math.ceil(progressPercent / 255);
|
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})`);
|
||||||
|
|
||||||
cameraFadeColour = toColour(rgbaArray[0], rgbaArray[1], rgbaArray[2], alpha);
|
cameraFadeColour = toColour(rgbaArray[0], rgbaArray[1], rgbaArray[2], cameraFadeAlpha);
|
||||||
graphics.drawRectangle(null, toVector2(0, 0), toVector2(game.width, game.height), cameraFadeColour, cameraFadeColour, cameraFadeColour, cameraFadeColour);
|
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) {
|
function receiveChatBoxMessageFromServer(messageString, colour, hour, minute, second) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Chat]: Received chatbox message from server: ${messageString}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Chat]: Received chatbox message from server: ${messageString}`);
|
||||||
|
|
||||||
// Just in case it's hidden by auto hide
|
// Just in case it's hidden by auto hide
|
||||||
//setChatWindowEnabled(true);
|
//setChatWindowEnabled(true);
|
||||||
@@ -77,16 +77,16 @@ function receiveChatBoxMessageFromServer(messageString, colour, hour, minute, se
|
|||||||
outputString = `${timeStampString}${messageString}`;
|
outputString = `${timeStampString}${messageString}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Chat]: Changed colours in string: ${outputString}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Chat]: Changed colours in string: ${outputString}`);
|
||||||
outputString = replaceColoursInMessage(`${outputString}`);
|
outputString = replaceColoursInMessage(`${outputString}`);
|
||||||
|
|
||||||
if (chatEmojiEnabled == true) {
|
if (chatEmojiEnabled == true) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Chat]: Enabled emoji in string: ${outputString}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Chat]: Enabled emoji in string: ${outputString}`);
|
||||||
outputString = replaceEmojiInMessage(outputString);
|
outputString = replaceEmojiInMessage(outputString);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (profanityFilterEnabled == true) {
|
if (profanityFilterEnabled == true) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Chat]: Removed profanity in string: ${outputString}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Chat]: Removed profanity in string: ${outputString}`);
|
||||||
outputString = replaceProfanityInMessage(outputString);
|
outputString = replaceProfanityInMessage(outputString);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,17 +32,21 @@ function addAllEventHandlers() {
|
|||||||
addEventHandler("OnMouseWheel", onMouseWheel);
|
addEventHandler("OnMouseWheel", onMouseWheel);
|
||||||
addEventHandler("OnEntityProcess", onEntityProcess);
|
addEventHandler("OnEntityProcess", onEntityProcess);
|
||||||
|
|
||||||
if (findResourceByName("v-events") != null) {
|
if (getGame() <= V_GAME_GTA_SA) {
|
||||||
if (findResourceByName("v-events").isStarted) {
|
if (findResourceByName("v-events") != null) {
|
||||||
addEventHandler("OnPedEnteredVehicleEx", onPedEnteredVehicle);
|
if (findResourceByName("v-events").isStarted) {
|
||||||
addEventHandler("OnPedExitedVehicleEx", onPedExitedVehicle);
|
addEventHandler("OnPedEnteredVehicleEx", onPedEnteredVehicle);
|
||||||
addEventHandler("OnPedEnteredSphereEx", onPedEnteredSphere);
|
addEventHandler("OnPedExitedVehicleEx", onPedExitedVehicle);
|
||||||
addEventHandler("OnPedExitedSphereEx", onPedExitedSphere);
|
addEventHandler("OnPedEnteredSphereEx", onPedEnteredSphere);
|
||||||
|
addEventHandler("OnPedExitedSphereEx", onPedExitedSphere);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getGame() == V_GAME_MAFIA_ONE) {
|
if (getGame() == V_GAME_MAFIA_ONE) {
|
||||||
addEventHandler("OnMapLoaded", onMapLoaded);
|
addEventHandler("OnMapLoaded", onMapLoaded);
|
||||||
|
addEventHandler("OnPedEnteringVehicle", onPedEnteredVehicle);
|
||||||
|
addEventHandler("OnPedExitingVehicle", onPedExitedVehicle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,14 +60,20 @@ function onResourceStart(event, resource) {
|
|||||||
removeEventHandler("OnPedEnteredSphereEx");
|
removeEventHandler("OnPedEnteredSphereEx");
|
||||||
removeEventHandler("OnPedExitedSphereEx");
|
removeEventHandler("OnPedExitedSphereEx");
|
||||||
|
|
||||||
addEventHandler("OnPedEnteredVehicleEx", onPedEnteredVehicle);
|
if (getGame() <= V_GAME_GTA_SA) {
|
||||||
addEventHandler("OnPedExitedVehicleEx", onPedExitedVehicle);
|
if (findResourceByName("v-events") != null) {
|
||||||
addEventHandler("OnPedEnteredSphereEx", onPedEnteredSphere);
|
if (findResourceByName("v-events").isStarted) {
|
||||||
addEventHandler("OnPedExitedSphereEx", onPedExitedSphere);
|
addEventHandler("OnPedEnteredVehicleEx", onPedEnteredVehicle);
|
||||||
|
addEventHandler("OnPedExitedVehicleEx", onPedExitedVehicle);
|
||||||
|
addEventHandler("OnPedEnteredSphereEx", onPedEnteredSphere);
|
||||||
|
addEventHandler("OnPedExitedSphereEx", onPedExitedSphere);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (resource == thisResource) {
|
if (resource == thisResource) {
|
||||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.Event] onResourceStart called - Sending signal to server`);
|
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.Event] onResourceStart called - Sending signal to server`);
|
||||||
localPlayerMoneyInterval = setInterval(updateLocalPlayerMoney, 1000 * 5);
|
localPlayerMoneyInterval = setInterval(updateLocalPlayerMoney, 1000 * 5);
|
||||||
sendResourceStartedSignalToServer();
|
sendResourceStartedSignalToServer();
|
||||||
}
|
}
|
||||||
@@ -73,7 +83,7 @@ function onResourceStart(event, resource) {
|
|||||||
|
|
||||||
function onResourceStop(event, resource) {
|
function onResourceStop(event, resource) {
|
||||||
if (resource == thisResource) {
|
if (resource == thisResource) {
|
||||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.Event] onResourceStop called - Sending signal to server`);
|
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.Event] onResourceStop called - Sending signal to server`);
|
||||||
sendResourceStoppedSignalToServer();
|
sendResourceStoppedSignalToServer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -82,7 +92,7 @@ function onResourceStop(event, resource) {
|
|||||||
|
|
||||||
function onResourceReady(event, resource) {
|
function onResourceReady(event, resource) {
|
||||||
if (resource == thisResource) {
|
if (resource == thisResource) {
|
||||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.Event] onResourceReady called - Sending signal to server`);
|
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.Event] onResourceReady called - Sending signal to server`);
|
||||||
loadLocaleConfig();
|
loadLocaleConfig();
|
||||||
sendResourceReadySignalToServer();
|
sendResourceReadySignalToServer();
|
||||||
}
|
}
|
||||||
@@ -91,7 +101,8 @@ function onResourceReady(event, resource) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onProcess(event, deltaTime) {
|
function onProcess(event, deltaTime) {
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Event] onProcess`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Event] onProcess`);
|
||||||
|
|
||||||
if (localPlayer == null) {
|
if (localPlayer == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -126,7 +137,7 @@ function onKeyUp(event, keyCode, scanCode, keyModifiers) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onDrawnHUD(event) {
|
function onDrawnHUD(event) {
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Event] HUD drawn`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Event] HUD drawn`);
|
||||||
processMouseCursorRendering();
|
processMouseCursorRendering();
|
||||||
|
|
||||||
if (!renderHUD) {
|
if (!renderHUD) {
|
||||||
@@ -145,12 +156,14 @@ function onDrawnHUD(event) {
|
|||||||
processSkinSelectRendering();
|
processSkinSelectRendering();
|
||||||
processNameTagRendering();
|
processNameTagRendering();
|
||||||
processInteriorLightsRendering();
|
processInteriorLightsRendering();
|
||||||
|
processCustomHUDRendering();
|
||||||
|
processCameraFadeRendering();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPedWasted(event, wastedPed, killerPed, weapon, pedPiece) {
|
function onPedWasted(event, wastedPed, killerPed, weapon, pedPiece) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Ped ${wastedPed.name} died`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Ped ${wastedPed.name} died`);
|
||||||
wastedPed.clearWeapons();
|
wastedPed.clearWeapons();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,7 +176,7 @@ function onElementStreamIn(event, element) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPedExitedVehicle(event, ped, vehicle, seat) {
|
function onPedExitedVehicle(event, ped, vehicle, seat) {
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Event] Local player exited vehicle`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Event] Local player exited vehicle`);
|
||||||
//sendNetworkEventToServer("v.rp.onPlayerExitVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
//sendNetworkEventToServer("v.rp.onPlayerExitVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
||||||
|
|
||||||
cruiseControlEnabled = false;
|
cruiseControlEnabled = false;
|
||||||
@@ -187,7 +200,7 @@ function onPedExitedVehicle(event, ped, vehicle, seat) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPedExitingVehicle(event, ped, vehicle, seat) {
|
function onPedExitingVehicle(event, ped, vehicle, seat) {
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Event] Local player exited vehicle`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Event] Local player exited vehicle`);
|
||||||
//sendNetworkEventToServer("v.rp.onPlayerExitVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
//sendNetworkEventToServer("v.rp.onPlayerExitVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
||||||
|
|
||||||
if (localPlayer != null) {
|
if (localPlayer != null) {
|
||||||
@@ -201,7 +214,7 @@ function onPedExitingVehicle(event, ped, vehicle, seat) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPedEnteredVehicle(event, ped, vehicle, seat) {
|
function onPedEnteredVehicle(event, ped, vehicle, seat) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Ped entered vehicle`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Ped entered vehicle`);
|
||||||
//sendNetworkEventToServer("v.rp.onPlayerEnterVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
//sendNetworkEventToServer("v.rp.onPlayerEnterVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
||||||
|
|
||||||
cruiseControlEnabled = false;
|
cruiseControlEnabled = false;
|
||||||
@@ -229,7 +242,7 @@ function onPedEnteredVehicle(event, ped, vehicle, seat) {
|
|||||||
function onPedInflictDamage(event, damagedEntity, damagerEntity, weaponId, healthLoss, pedPiece) {
|
function onPedInflictDamage(event, damagedEntity, damagerEntity, weaponId, healthLoss, pedPiece) {
|
||||||
//let damagerEntityString = (!isNull(damagedEntity)) ? `${damagerEntity.name} (${damagerEntity.name}, ${damagerEntity.type} - ${typeof damagerEntity})` : `Unknown ped`;
|
//let damagerEntityString = (!isNull(damagedEntity)) ? `${damagerEntity.name} (${damagerEntity.name}, ${damagerEntity.type} - ${typeof damagerEntity})` : `Unknown ped`;
|
||||||
//let damagedEntityString = (!isNull(damagedEntity)) ? `${damagedEntity.name} (${damagedEntity.name}, ${damagedEntity.type} - ${typeof damagedEntity})` : `Unknown ped`;
|
//let damagedEntityString = (!isNull(damagedEntity)) ? `${damagedEntity.name} (${damagedEntity.name}, ${damagedEntity.type} - ${typeof damagedEntity})` : `Unknown ped`;
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Event] ${damagerEntityString} damaged ${damagedEntityString}'s '${pedPiece} with weapon ${weaponId}`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Event] ${damagerEntityString} damaged ${damagedEntityString}'s '${pedPiece} with weapon ${weaponId}`);
|
||||||
if (!isNull(damagedEntity) && !isNull(damagerEntity)) {
|
if (!isNull(damagedEntity) && !isNull(damagerEntity)) {
|
||||||
if (damagedEntity.isType(ELEMENT_PLAYER)) {
|
if (damagedEntity.isType(ELEMENT_PLAYER)) {
|
||||||
if (damagedEntity == localPlayer) {
|
if (damagedEntity == localPlayer) {
|
||||||
@@ -294,7 +307,7 @@ function onEntityProcess(event, entity) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onMapLoaded(mapName) {
|
function onMapLoaded(event, mapName) {
|
||||||
sendNetworkEventToServer("v.rp.mapLoaded", mapName);
|
sendNetworkEventToServer("v.rp.mapLoaded", mapName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ let gpsBlipBlinkTimer = null;
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showGPSLocation(position, colour) {
|
function showGPSLocation(position, colour) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GPS] Showing gps location`);
|
logToConsole(LOG_DEBUG, `[V.RP.GPS] Showing gps location`);
|
||||||
if (getMultiplayerMod() == V_MPMOD_GTAC) {
|
if (getMultiplayerMod() == V_MPMOD_GTAC) {
|
||||||
if (getGame() == V_GAME_GTA_SA) {
|
if (getGame() == V_GAME_GTA_SA) {
|
||||||
// Server-side spheres don't show in GTA SA for some reason.
|
// Server-side spheres don't show in GTA SA for some reason.
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ function initGUIScript() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initGUI() {
|
function initGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Initializing GUI ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Initializing GUI ...`);
|
||||||
|
|
||||||
initLoginGUI();
|
initLoginGUI();
|
||||||
initRegisterGUI();
|
initRegisterGUI();
|
||||||
@@ -73,7 +73,7 @@ function initGUI() {
|
|||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
guiReady = true;
|
guiReady = true;
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] All GUI created successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] All GUI created successfully!`);
|
||||||
|
|
||||||
sendNetworkEventToServer("v.rp.guiReady", true);
|
sendNetworkEventToServer("v.rp.guiReady", true);
|
||||||
};
|
};
|
||||||
@@ -81,7 +81,7 @@ function initGUI() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function closeAllWindows() {
|
function closeAllWindows() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Closing all GUI windows`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Closing all GUI windows`);
|
||||||
infoDialog.window.shown = false;
|
infoDialog.window.shown = false;
|
||||||
yesNoDialog.window.shown = false;
|
yesNoDialog.window.shown = false;
|
||||||
errorDialog.window.shown = false;
|
errorDialog.window.shown = false;
|
||||||
@@ -208,7 +208,7 @@ function isAnyGUIActive() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setGUIColours(red1, green1, blue1, red2, green2, blue2, red3, green3, blue3) {
|
function setGUIColours(red1, green1, blue1, red2, green2, blue2, red3, green3, blue3) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Received new GUI colours from server: ${red1}, ${green1}, ${blue1} / ${red2}, ${green2}, ${blue2} / ${red3}, ${green3}, ${blue3}`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Received new GUI colours from server: ${red1}, ${green1}, ${blue1} / ${red2}, ${green2}, ${blue2} / ${red3}, ${green3}, ${blue3}`);
|
||||||
primaryColour = [red1, green1, blue1];
|
primaryColour = [red1, green1, blue1];
|
||||||
secondaryColour = [red2, green2, blue2];
|
secondaryColour = [red2, green2, blue2];
|
||||||
primaryTextColour = [red3, green3, blue3];
|
primaryTextColour = [red3, green3, blue3];
|
||||||
@@ -228,45 +228,45 @@ function hideAllGUI() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function processGUIKeyPress(keyCode) {
|
function processGUIKeyPress(keyCode) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Processing key press: ${keyCode}`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Processing key press: ${keyCode}`);
|
||||||
|
|
||||||
if (!guiReady) {
|
if (!guiReady) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isAnyGUIActive()) {
|
if (!isAnyGUIActive()) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] GUI is not active. Cancelling keypress processing.`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] GUI is not active. Cancelling keypress processing.`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keyCode == SDLK_RETURN || keyCode == SDLK_RETURN2) {
|
if (keyCode == SDLK_RETURN || keyCode == SDLK_RETURN2) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Key press is submit (${guiSubmitKey})`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Key press is submit (${guiSubmitKey})`);
|
||||||
if (guiSubmitKey != false) {
|
if (guiSubmitKey != false) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Calling submit key function`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Calling submit key function`);
|
||||||
guiSubmitKey.call();
|
guiSubmitKey.call();
|
||||||
}
|
}
|
||||||
} else if (keyCode == getKeyIdFromParams("left") || keyCode == getKeyIdFromParams("a")) {
|
} else if (keyCode == getKeyIdFromParams("left") || keyCode == getKeyIdFromParams("a")) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Key press is left (${guiLeftKey})`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Key press is left (${guiLeftKey})`);
|
||||||
if (guiLeftKey != false) {
|
if (guiLeftKey != false) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Calling left key function`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Calling left key function`);
|
||||||
guiLeftKey.call();
|
guiLeftKey.call();
|
||||||
}
|
}
|
||||||
} else if (keyCode == getKeyIdFromParams("right") || keyCode == getKeyIdFromParams("d")) {
|
} else if (keyCode == getKeyIdFromParams("right") || keyCode == getKeyIdFromParams("d")) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Key press is right (${guiRightKey})`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Key press is right (${guiRightKey})`);
|
||||||
if (guiRightKey != false) {
|
if (guiRightKey != false) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Calling right key function`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Calling right key function`);
|
||||||
guiRightKey.call();
|
guiRightKey.call();
|
||||||
}
|
}
|
||||||
} else if (keyCode == getKeyIdFromParams("down") || keyCode == getKeyIdFromParams("s")) {
|
} else if (keyCode == getKeyIdFromParams("down") || keyCode == getKeyIdFromParams("s")) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Key press is down (${guiDownKey})`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Key press is down (${guiDownKey})`);
|
||||||
if (guiDownKey != false) {
|
if (guiDownKey != false) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Calling down key function`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Calling down key function`);
|
||||||
guiDownKey.call();
|
guiDownKey.call();
|
||||||
}
|
}
|
||||||
} else if (keyCode == getKeyIdFromParams("up") || keyCode == getKeyIdFromParams("w")) {
|
} else if (keyCode == getKeyIdFromParams("up") || keyCode == getKeyIdFromParams("w")) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Key press is up (${guiUpKey})`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Key press is up (${guiUpKey})`);
|
||||||
if (guiUpKey != false) {
|
if (guiUpKey != false) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Calling up key function`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Calling up key function`);
|
||||||
guiUpKey.call();
|
guiUpKey.call();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ let twoFactorAuth = {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initTwoFactorAuthenticationGUI() {
|
function initTwoFactorAuthenticationGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating two factor auth GUI ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating two factor auth GUI ...`);
|
||||||
twoFactorAuth.window = mexui.window(game.width / 2 - 150, game.height / 2 - 129, 300, 258, 'LOGIN', {
|
twoFactorAuth.window = mexui.window(game.width / 2 - 150, game.height / 2 - 129, 300, 258, 'LOGIN', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||||
@@ -94,14 +94,14 @@ function initTwoFactorAuthenticationGUI() {
|
|||||||
},
|
},
|
||||||
}, checkTwoFactorAuth);
|
}, checkTwoFactorAuth);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created two factor auth GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created two factor auth GUI`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showTwoFactorAuthGUI() {
|
function showTwoFactorAuthGUI() {
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing two-factor authentication window`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing two-factor authentication window`);
|
||||||
setChatWindowEnabled(false);
|
setChatWindowEnabled(false);
|
||||||
mexui.setInput(true);
|
mexui.setInput(true);
|
||||||
twoFactorAuth.window.shown = true;
|
twoFactorAuth.window.shown = true;
|
||||||
@@ -112,7 +112,7 @@ function showTwoFactorAuthGUI() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function twoFactorAuthFailed(errorMessage) {
|
function twoFactorAuthFailed(errorMessage) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports two-factor authentication failed. Reason: ${errorMessage}`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Server reports two-factor authentication failed. Reason: ${errorMessage}`);
|
||||||
twoFactorAuth.messageLabel.text = errorMessage;
|
twoFactorAuth.messageLabel.text = errorMessage;
|
||||||
twoFactorAuth.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
twoFactorAuth.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
||||||
twoFactorAuth.codeInput.text = "";
|
twoFactorAuth.codeInput.text = "";
|
||||||
@@ -121,14 +121,14 @@ function twoFactorAuthFailed(errorMessage) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function twoFactorAuthSuccess() {
|
function twoFactorAuthSuccess() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports two-factor authentication was successful`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Server reports two-factor authentication was successful`);
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function checkTwoFactorAuth() {
|
function checkTwoFactorAuth() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Checking two-factor authentication with server ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Checking two-factor authentication with server ...`);
|
||||||
sendNetworkEventToServer("v.rp.2fa", twoFactorAuth.codeInput.lines[0]);
|
sendNetworkEventToServer("v.rp.2fa", twoFactorAuth.codeInput.lines[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ let passwordChange = {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initChangePasswordGUI() {
|
function initChangePasswordGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating password change GUI ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating password change GUI ...`);
|
||||||
passwordChange.window = mexui.window(game.width / 2 - 130, game.height / 2 - 125, 300, 250, 'Change Password', {
|
passwordChange.window = mexui.window(game.width / 2 - 130, game.height / 2 - 125, 300, 250, 'Change Password', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||||
@@ -110,13 +110,13 @@ function initChangePasswordGUI() {
|
|||||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||||
},
|
},
|
||||||
}, checkChangePassword);
|
}, checkChangePassword);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created change password GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created change password GUI`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function passwordChangeFailed(errorMessage) {
|
function passwordChangeFailed(errorMessage) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports change password failed. Reason: ${errorMessage}`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Server reports change password failed. Reason: ${errorMessage}`);
|
||||||
passwordChange.messageLabel.text = errorMessage;
|
passwordChange.messageLabel.text = errorMessage;
|
||||||
passwordChange.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
passwordChange.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
||||||
passwordChange.passwordInput.text = "";
|
passwordChange.passwordInput.text = "";
|
||||||
@@ -127,14 +127,14 @@ function passwordChangeFailed(errorMessage) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function checkChangePassword() {
|
function checkChangePassword() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Checking password change with server ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Checking password change with server ...`);
|
||||||
sendNetworkEventToServer("v.rp.checkChangePassword", passwordChange.passwordInput.lines[0], passwordChange.confirmPasswordInput.lines[0]);
|
sendNetworkEventToServer("v.rp.checkChangePassword", passwordChange.passwordInput.lines[0], passwordChange.confirmPasswordInput.lines[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showChangePasswordGUI(errorMessage) {
|
function showChangePasswordGUI(errorMessage) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing change password window`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing change password window`);
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
setChatWindowEnabled(false);
|
setChatWindowEnabled(false);
|
||||||
mexui.setInput(true);
|
mexui.setInput(true);
|
||||||
@@ -149,7 +149,7 @@ function showChangePasswordGUI(errorMessage) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function passwordChangeSuccess() {
|
function passwordChangeSuccess() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports password change was successful`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Server reports password change was successful`);
|
||||||
guiSubmitKey = false;
|
guiSubmitKey = false;
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ let characterSelect = {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initCharacterSelectGUI() {
|
function initCharacterSelectGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating character select GUI ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating character select GUI ...`);
|
||||||
characterSelect.window = mexui.window(game.width / 2 - 215, game.height / 2 - 83, 430, 190, 'SELECT CHARACTER', {
|
characterSelect.window = mexui.window(game.width / 2 - 215, game.height / 2 - 83, 430, 190, 'SELECT CHARACTER', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||||
@@ -31,13 +31,13 @@ function initCharacterSelectGUI() {
|
|||||||
title: {
|
title: {
|
||||||
textSize: 12.0,
|
textSize: 12.0,
|
||||||
textFont: mainFont,
|
textFont: mainFont,
|
||||||
textColour: toColour(0, 0, 0, 255),
|
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
|
||||||
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
|
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
|
||||||
},
|
},
|
||||||
icon: {
|
icon: {
|
||||||
textSize: 10.0,
|
textSize: 10.0,
|
||||||
textFont: mainFont,
|
textFont: mainFont,
|
||||||
textColour: toColour(0, 0, 0, 255),
|
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
|
||||||
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
|
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -150,14 +150,14 @@ function initCharacterSelectGUI() {
|
|||||||
borderColour: toColour(0, 0, 0, 0),
|
borderColour: toColour(0, 0, 0, 0),
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created character select GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created character select GUI`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showCharacterSelectGUI(firstName, lastName, cash, clan, lastPlayed, skinId) {
|
function showCharacterSelectGUI(firstName, lastName, cash, clan, lastPlayed, skinId) {
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing character selection window`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing character selection window`);
|
||||||
setChatWindowEnabled(false);
|
setChatWindowEnabled(false);
|
||||||
mexui.setInput(true);
|
mexui.setInput(true);
|
||||||
characterSelect.nameText.text = `${firstName} ${lastName}`;
|
characterSelect.nameText.text = `${firstName} ${lastName}`;
|
||||||
@@ -178,35 +178,35 @@ function showCharacterSelectGUI(firstName, lastName, cash, clan, lastPlayed, ski
|
|||||||
|
|
||||||
function showNewCharacter() {
|
function showNewCharacter() {
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing new character dialog window`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing new character dialog window`);
|
||||||
showNewCharacterGUI();
|
showNewCharacterGUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function selectNextCharacter() {
|
function selectNextCharacter() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Requesting next character info from server for character select window`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Requesting next character info from server for character select window`);
|
||||||
sendNetworkEventToServer("v.rp.nextCharacter");
|
sendNetworkEventToServer("v.rp.nextCharacter");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function selectPreviousCharacter() {
|
function selectPreviousCharacter() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Requesting previous character info from server for character select window`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Requesting previous character info from server for character select window`);
|
||||||
sendNetworkEventToServer("v.rp.previousCharacter");
|
sendNetworkEventToServer("v.rp.previousCharacter");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function selectThisCharacter() {
|
function selectThisCharacter() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Tell server the current shown character was selected in character select window`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Tell server the current shown character was selected in character select window`);
|
||||||
sendNetworkEventToServer("v.rp.selectCharacter");
|
sendNetworkEventToServer("v.rp.selectCharacter");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function switchCharacterSelectGUI(firstName, lastName, cash, clan, lastPlayed, skinId) {
|
function switchCharacterSelectGUI(firstName, lastName, cash, clan, lastPlayed, skinId) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Updating character info with data from server`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Updating character info with data from server`);
|
||||||
setChatWindowEnabled(false);
|
setChatWindowEnabled(false);
|
||||||
characterSelect.window.shown = false;
|
characterSelect.window.shown = false;
|
||||||
characterSelect.nameText.text = `${firstName} ${lastName}`;
|
characterSelect.nameText.text = `${firstName} ${lastName}`;
|
||||||
@@ -229,7 +229,7 @@ function switchCharacterSelectGUI(firstName, lastName, cash, clan, lastPlayed, s
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function characterSelectSuccess() {
|
function characterSelectSuccess() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports character selection was successful`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Server reports character selection was successful`);
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ let errorDialog = {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initErrorDialogGUI() {
|
function initErrorDialogGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating error GUI ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating error GUI ...`);
|
||||||
errorDialog.window = mexui.window(getScreenWidth() / 2 - 200, getScreenHeight() / 2 - 70, 400, 140, 'ERROR', {
|
errorDialog.window = mexui.window(getScreenWidth() / 2 - 200, getScreenHeight() / 2 - 70, 400, 140, 'ERROR', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||||
@@ -58,14 +58,14 @@ function initErrorDialogGUI() {
|
|||||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
|
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
|
||||||
},
|
},
|
||||||
}, closeErrorDialog);
|
}, closeErrorDialog);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created error GUI ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created error GUI ...`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showErrorGUI(errorMessage, errorTitle, buttonText) {
|
function showErrorGUI(errorMessage, errorTitle, buttonText) {
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing error window. Error: ${errorTitle} - ${errorMessage}`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing error window. Error: ${errorTitle} - ${errorMessage}`);
|
||||||
setChatWindowEnabled(false);
|
setChatWindowEnabled(false);
|
||||||
mexui.setInput(true);
|
mexui.setInput(true);
|
||||||
errorDialog.messageLabel.text = errorMessage;
|
errorDialog.messageLabel.text = errorMessage;
|
||||||
@@ -77,7 +77,7 @@ function showErrorGUI(errorMessage, errorTitle, buttonText) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function closeErrorDialog() {
|
function closeErrorDialog() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Closing error dialog`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Closing error dialog`);
|
||||||
errorDialog.window.shown = false;
|
errorDialog.window.shown = false;
|
||||||
mexui.setInput(false);
|
mexui.setInput(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ let fiveCardPokerGUI = {
|
|||||||
|
|
||||||
function initFiveCardPokerGUI() {
|
function initFiveCardPokerGUI() {
|
||||||
// Render a five card poker game in MexUI
|
// Render a five card poker game in MexUI
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating five-card poker GUI ...`);
|
//logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating five-card poker GUI ...`);
|
||||||
fiveCardPokerGUI.window = mexui.window(game.width / 2 - 200, game.height - 150, 400, 400, 'Five Card Poker', {
|
fiveCardPokerGUI.window = mexui.window(game.width / 2 - 200, game.height - 150, 400, 400, 'Five Card Poker', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], 0),
|
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], 0),
|
||||||
@@ -33,7 +33,7 @@ function initFiveCardPokerGUI() {
|
|||||||
|
|
||||||
fiveCardPokerGUI.window.shown = false;
|
fiveCardPokerGUI.window.shown = false;
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created five card poker GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created five card poker GUI`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -22,7 +22,7 @@ let dealerCards = [];
|
|||||||
|
|
||||||
function initBlackJackGUI() {
|
function initBlackJackGUI() {
|
||||||
// Render a blackjack game in MexUI
|
// Render a blackjack game in MexUI
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating blackjack GUI ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating blackjack GUI ...`);
|
||||||
blackJackGUI.window = mexui.window(game.width / 2 - 200, game.height - 150, 400, 400, 'Blackjack', {
|
blackJackGUI.window = mexui.window(game.width / 2 - 200, game.height - 150, 400, 400, 'Blackjack', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], 0),
|
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], 0),
|
||||||
@@ -42,7 +42,7 @@ function initBlackJackGUI() {
|
|||||||
|
|
||||||
blackJackGUI.window.shown = false;
|
blackJackGUI.window.shown = false;
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created blackjack GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created blackjack GUI`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -16,7 +16,7 @@ let infoDialog = {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initInfoDialogGUI() {
|
function initInfoDialogGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating info dialog GUI ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating info dialog GUI ...`);
|
||||||
infoDialog.window = mexui.window(getScreenWidth() / 2 - 200, getScreenHeight() / 2 - 70, 400, 140, 'Information', {
|
infoDialog.window = mexui.window(getScreenWidth() / 2 - 200, getScreenHeight() / 2 - 70, 400, 140, 'Information', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||||
@@ -57,13 +57,13 @@ function initInfoDialogGUI() {
|
|||||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
|
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
|
||||||
},
|
},
|
||||||
}, closeInfoDialog);
|
}, closeInfoDialog);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created info dialog GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created info dialog GUI`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function closeInfoDialog() {
|
function closeInfoDialog() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Closing info dialog`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Closing info dialog`);
|
||||||
infoDialog.window.shown = false;
|
infoDialog.window.shown = false;
|
||||||
mexui.setInput(false);
|
mexui.setInput(false);
|
||||||
}
|
}
|
||||||
@@ -72,7 +72,7 @@ function closeInfoDialog() {
|
|||||||
|
|
||||||
function showInfoGUI(infoMessage, infoTitle, buttonText) {
|
function showInfoGUI(infoMessage, infoTitle, buttonText) {
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing info dialog window. Info: ${infoTitle} - ${infoMessage}`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing info dialog window. Info: ${infoTitle} - ${infoMessage}`);
|
||||||
mexui.setInput(true);
|
mexui.setInput(true);
|
||||||
infoDialog.messageLabel.text = infoMessage;
|
infoDialog.messageLabel.text = infoMessage;
|
||||||
infoDialog.okayButton.text = buttonText;
|
infoDialog.okayButton.text = buttonText;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ function initInventoryGUI() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function closeAllInventoryGUI() {
|
function closeAllInventoryGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Closing all inventory GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Closing all inventory GUI`);
|
||||||
for (let i in inventoryGUI) {
|
for (let i in inventoryGUI) {
|
||||||
inventoryGUI[i].window.shown = false;
|
inventoryGUI[i].window.shown = false;
|
||||||
}
|
}
|
||||||
@@ -36,7 +36,7 @@ function closeAllInventoryGUI() {
|
|||||||
|
|
||||||
function showInventoryGUI(inventoryIndex, items) {
|
function showInventoryGUI(inventoryIndex, items) {
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing inventory window. Index: ${inventoryIndex}`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing inventory window. Index: ${inventoryIndex}`);
|
||||||
inventoryGUI[inventoryIndex].window.shown = true;
|
inventoryGUI[inventoryIndex].window.shown = true;
|
||||||
mexui.setInput(true);
|
mexui.setInput(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ function initInventoryBulkGUI() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function closeAllInventoryBulkGUI() {
|
function closeAllInventoryBulkGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Closing all bulk inventory GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Closing all bulk inventory GUI`);
|
||||||
for (let i in inventoryBulkGUI) {
|
for (let i in inventoryBulkGUI) {
|
||||||
inventoryBulkGUI[i].window.shown = false;
|
inventoryBulkGUI[i].window.shown = false;
|
||||||
}
|
}
|
||||||
@@ -36,7 +36,7 @@ function closeAllInventoryBulkGUI() {
|
|||||||
|
|
||||||
function showInventoryBulkGUI(inventoryIndex, items) {
|
function showInventoryBulkGUI(inventoryIndex, items) {
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing bulk inventory window. Index: ${inventoryIndex}`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing bulk inventory window. Index: ${inventoryIndex}`);
|
||||||
inventoryBulkGUI[inventoryIndex].window.shown = true;
|
inventoryBulkGUI[inventoryIndex].window.shown = true;
|
||||||
mexui.setInput(true);
|
mexui.setInput(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ let listDialog = {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initListGUI() {
|
function initListGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating list dialog GUI ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating list dialog GUI ...`);
|
||||||
listDialog.window = mexui.window(game.width / 2 - 200, game.height / 2 - 70, 400, 500, 'List', {
|
listDialog.window = mexui.window(game.width / 2 - 200, game.height / 2 - 70, 400, 500, 'List', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||||
@@ -72,14 +72,14 @@ function initListGUI() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created list dialog GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created list dialog GUI`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showListGUI() {
|
function showListGUI() {
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing list window`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing list window`);
|
||||||
setChatWindowEnabled(false);
|
setChatWindowEnabled(false);
|
||||||
mexui.setInput(true);
|
mexui.setInput(true);
|
||||||
listDialog.window.shown = true;
|
listDialog.window.shown = true;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ let flagImageGap = toVector2(5, 5);
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initLocaleChooserGUI() {
|
function initLocaleChooserGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating locale chooser GUI ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating locale chooser GUI ...`);
|
||||||
localeChooser.window = mexui.window(game.width / 2 - 200, game.height - 150, 60, 60, 'Choose a language', {
|
localeChooser.window = mexui.window(game.width / 2 - 200, game.height - 150, 60, 60, 'Choose a language', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], 0),
|
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], 0),
|
||||||
@@ -39,13 +39,13 @@ function initLocaleChooserGUI() {
|
|||||||
|
|
||||||
localeChooser.window.shown = false;
|
localeChooser.window.shown = false;
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created locale chooser GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created locale chooser GUI`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function closeLocaleChooserGUI() {
|
function closeLocaleChooserGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Closing locale chooser window`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Closing locale chooser window`);
|
||||||
localeChooser.window.shown = false;
|
localeChooser.window.shown = false;
|
||||||
for (let i in localeChooser.flagImages) {
|
for (let i in localeChooser.flagImages) {
|
||||||
localeChooser.flagImages[i].shown = false;
|
localeChooser.flagImages[i].shown = false;
|
||||||
@@ -63,7 +63,7 @@ function showLocaleChooserGUI(position = toVector2(0.0, 0.0)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//closeAllWindows();
|
//closeAllWindows();
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing locale chooser window`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing locale chooser window`);
|
||||||
mexui.setInput(true);
|
mexui.setInput(true);
|
||||||
localeChooser.window.shown = true;
|
localeChooser.window.shown = true;
|
||||||
|
|
||||||
@@ -85,14 +85,14 @@ function toggleLocaleChooserGUI() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function localeChooserSetLocale(localeId) {
|
function localeChooserSetLocale(localeId) {
|
||||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.GUI] Asking server to change locale to ${localeId}`);
|
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.GUI] Asking server to change locale to ${localeId}`);
|
||||||
sendLocaleSelectToServer(localeId);
|
sendLocaleSelectToServer(localeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function resetLocaleChooserOptions() {
|
function resetLocaleChooserOptions() {
|
||||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.GUI] Resetting locale chooser options`);
|
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.GUI] Resetting locale chooser options`);
|
||||||
|
|
||||||
// let tempLocaleOptions = getServerData().localeOptions; // getAvailableLocaleOptions();
|
// let tempLocaleOptions = getServerData().localeOptions; // getAvailableLocaleOptions();
|
||||||
let tempLocaleOptions = getAvailableLocaleOptions();
|
let tempLocaleOptions = getAvailableLocaleOptions();
|
||||||
@@ -116,7 +116,7 @@ function resetLocaleChooserOptions() {
|
|||||||
|
|
||||||
localeChooser.flagImages[i].shown = false;
|
localeChooser.flagImages[i].shown = false;
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.GUI] Created locale chooser option ${tempLocaleOptions[i].englishName} with image ${imagePath}`);
|
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.GUI] Created locale chooser option ${tempLocaleOptions[i].englishName} with image ${imagePath}`);
|
||||||
|
|
||||||
//localeChooser.activeRingImages.push(activeRingImage);
|
//localeChooser.activeRingImages.push(activeRingImage);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ let loginHTML =
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initLoginGUI() {
|
function initLoginGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating login GUI ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating login GUI ...`);
|
||||||
login.window = mexui.window(getScreenWidth() / 2 - 150, getScreenHeight() / 2 - 135, 300, 275, 'LOGIN', {
|
login.window = mexui.window(getScreenWidth() / 2 - 150, getScreenHeight() / 2 - 135, 300, 275, 'LOGIN', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||||
@@ -143,14 +143,14 @@ function initLoginGUI() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created login GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created login GUI`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showLoginGUI() {
|
function showLoginGUI() {
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing login window`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing login window`);
|
||||||
setChatWindowEnabled(false);
|
setChatWindowEnabled(false);
|
||||||
mexui.setInput(true);
|
mexui.setInput(true);
|
||||||
login.window.shown = true;
|
login.window.shown = true;
|
||||||
@@ -164,14 +164,14 @@ function showLoginGUI() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function checkLogin() {
|
function checkLogin() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Checking login with server ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Checking login with server ...`);
|
||||||
sendNetworkEventToServer("v.rp.checkLogin", login.passwordInput.lines[0]);
|
sendNetworkEventToServer("v.rp.checkLogin", login.passwordInput.lines[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loginFailed(errorMessage) {
|
function loginFailed(errorMessage) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports login failed`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Server reports login failed`);
|
||||||
login.messageLabel.text = errorMessage;
|
login.messageLabel.text = errorMessage;
|
||||||
login.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
login.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
||||||
login.passwordInput.text = "";
|
login.passwordInput.text = "";
|
||||||
@@ -180,7 +180,7 @@ function loginFailed(errorMessage) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loginSuccess() {
|
function loginSuccess() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports login was successful`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Server reports login was successful`);
|
||||||
guiSubmitKey = false;
|
guiSubmitKey = false;
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
}
|
}
|
||||||
@@ -189,7 +189,7 @@ function loginSuccess() {
|
|||||||
|
|
||||||
function switchToPasswordResetGUI() {
|
function switchToPasswordResetGUI() {
|
||||||
//closeAllWindows();
|
//closeAllWindows();
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing password reset dialog window`);
|
//logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing password reset dialog window`);
|
||||||
//showResetPasswordGUI();
|
//showResetPasswordGUI();
|
||||||
sendNetworkEventToServer("v.rp.checkResetPassword", "");
|
sendNetworkEventToServer("v.rp.checkResetPassword", "");
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ let newCharacter = {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initNewCharacterGUI() {
|
function initNewCharacterGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating new character GUI ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating new character GUI ...`);
|
||||||
newCharacter.window = mexui.window(getScreenWidth() / 2 - 150, getScreenHeight() / 2 - 115, 300, 230, 'NEW CHARACTER', {
|
newCharacter.window = mexui.window(getScreenWidth() / 2 - 150, getScreenHeight() / 2 - 115, 300, 230, 'NEW CHARACTER', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||||
@@ -110,13 +110,13 @@ function initNewCharacterGUI() {
|
|||||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||||
},
|
},
|
||||||
}, checkNewCharacter);
|
}, checkNewCharacter);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created new character GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created new character GUI`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function newCharacterFailed(errorMessage) {
|
function newCharacterFailed(errorMessage) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports new character creation failed. Reason: ${errorMessage}`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Server reports new character creation failed. Reason: ${errorMessage}`);
|
||||||
newCharacter.messageLabel.text = errorMessage;
|
newCharacter.messageLabel.text = errorMessage;
|
||||||
newCharacter.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
newCharacter.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
||||||
newCharacter.firstNameInput.text = "";
|
newCharacter.firstNameInput.text = "";
|
||||||
@@ -134,7 +134,7 @@ function newCharacterFailed(errorMessage) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function checkNewCharacter() {
|
function checkNewCharacter() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Checking new character with server ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Checking new character with server ...`);
|
||||||
if (newCharacter.firstNameInput.lines[0].length < 2) {
|
if (newCharacter.firstNameInput.lines[0].length < 2) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -152,7 +152,7 @@ function checkNewCharacter() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showNewCharacterGUI() {
|
function showNewCharacterGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing new character window`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing new character window`);
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
setChatWindowEnabled(false);
|
setChatWindowEnabled(false);
|
||||||
mexui.setInput(true);
|
mexui.setInput(true);
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ let register = {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initRegisterGUI() {
|
function initRegisterGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating register GUI ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating register GUI ...`);
|
||||||
register.window = mexui.window(getScreenWidth() / 2 - 150, getScreenHeight() / 2 - 150, 300, 300, 'Register', {
|
register.window = mexui.window(getScreenWidth() / 2 - 150, getScreenHeight() / 2 - 150, 300, 300, 'Register', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||||
@@ -130,13 +130,13 @@ function initRegisterGUI() {
|
|||||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||||
},
|
},
|
||||||
}, checkRegistration);
|
}, checkRegistration);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created register GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created register GUI`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function registrationFailed(errorMessage) {
|
function registrationFailed(errorMessage) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports registration failed. Reason: ${errorMessage}`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Server reports registration failed. Reason: ${errorMessage}`);
|
||||||
register.messageLabel.text = errorMessage;
|
register.messageLabel.text = errorMessage;
|
||||||
register.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
register.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
||||||
register.passwordInput.text = "";
|
register.passwordInput.text = "";
|
||||||
@@ -147,14 +147,14 @@ function registrationFailed(errorMessage) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function checkRegistration() {
|
function checkRegistration() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Checking registration with server ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Checking registration with server ...`);
|
||||||
sendNetworkEventToServer("v.rp.checkRegistration", register.passwordInput.lines[0], register.confirmPasswordInput.lines[0], register.emailInput.lines[0]);
|
sendNetworkEventToServer("v.rp.checkRegistration", register.passwordInput.lines[0], register.confirmPasswordInput.lines[0], register.emailInput.lines[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showRegistrationGUI() {
|
function showRegistrationGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing registration window`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing registration window`);
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
setChatWindowEnabled(false);
|
setChatWindowEnabled(false);
|
||||||
mexui.setInput(true);
|
mexui.setInput(true);
|
||||||
@@ -170,7 +170,7 @@ function showRegistrationGUI() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function registrationSuccess() {
|
function registrationSuccess() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports registration was successful`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Server reports registration was successful`);
|
||||||
guiSubmitKey = false;
|
guiSubmitKey = false;
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ let passwordReset = {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initResetPasswordGUI() {
|
function initResetPasswordGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating password reset GUI ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Creating password reset GUI ...`);
|
||||||
passwordReset.window = mexui.window(getScreenWidth() / 2 - 150, getScreenHeight() / 2 - 135, 300, 275, 'RESET PASSWORD', {
|
passwordReset.window = mexui.window(getScreenWidth() / 2 - 150, getScreenHeight() / 2 - 135, 300, 275, 'RESET PASSWORD', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||||
@@ -120,14 +120,14 @@ function initResetPasswordGUI() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created password reset GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created password reset GUI`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showResetPasswordGUI() {
|
function showResetPasswordGUI() {
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing password reset window`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing password reset window`);
|
||||||
setChatWindowEnabled(false);
|
setChatWindowEnabled(false);
|
||||||
mexui.setInput(true);
|
mexui.setInput(true);
|
||||||
passwordReset.window.shown = true;
|
passwordReset.window.shown = true;
|
||||||
@@ -141,14 +141,14 @@ function showResetPasswordGUI() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function checkResetPassword() {
|
function checkResetPassword() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Checking password reset with server (${passwordReset.emailInput.lines[0]}) ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Checking password reset with server (${passwordReset.emailInput.lines[0]}) ...`);
|
||||||
sendNetworkEventToServer("v.rp.checkResetPassword", passwordReset.emailInput.lines[0]);
|
sendNetworkEventToServer("v.rp.checkResetPassword", passwordReset.emailInput.lines[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function resetPasswordFailed(errorMessage) {
|
function resetPasswordFailed(errorMessage) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Server reports password reset failed`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Server reports password reset failed`);
|
||||||
passwordReset.messageLabel.text = errorMessage;
|
passwordReset.messageLabel.text = errorMessage;
|
||||||
passwordReset.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
passwordReset.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
|
||||||
passwordReset.emailInput.text = "";
|
passwordReset.emailInput.text = "";
|
||||||
@@ -157,7 +157,7 @@ function resetPasswordFailed(errorMessage) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function resetPasswordCodeInputGUI() {
|
function resetPasswordCodeInputGUI() {
|
||||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.GUI] Server reports password reset email confirmation was successful. Asking for code ...`);
|
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.GUI] Server reports password reset email confirmation was successful. Asking for code ...`);
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
|
|
||||||
passwordReset.messageLabel.text = getLocaleString("GUIResetPasswordCodeInputLabel");
|
passwordReset.messageLabel.text = getLocaleString("GUIResetPasswordCodeInputLabel");
|
||||||
@@ -172,7 +172,7 @@ function resetPasswordCodeInputGUI() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function resetPasswordEmailInputGUI() {
|
function resetPasswordEmailInputGUI() {
|
||||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.GUI] Server reports password reset request was approved. Asking for email ...`);
|
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.GUI] Server reports password reset request was approved. Asking for email ...`);
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
|
|
||||||
passwordReset.messageLabel.text = getLocaleString("GUIResetPasswordConfirmEmailLabel");
|
passwordReset.messageLabel.text = getLocaleString("GUIResetPasswordConfirmEmailLabel");
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ let yesNoDialog = {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initYesNoDialogGUI() {
|
function initYesNoDialogGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created prompt GUI ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created prompt GUI ...`);
|
||||||
yesNoDialog.window = mexui.window(game.width / 2 - 200, game.height / 2 - 70, 400, 140, 'Question', {
|
yesNoDialog.window = mexui.window(game.width / 2 - 200, game.height / 2 - 70, 400, 140, 'Question', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||||
@@ -73,14 +73,14 @@ function initYesNoDialogGUI() {
|
|||||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
|
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
|
||||||
},
|
},
|
||||||
}, yesNoDialogAnswerNo);
|
}, yesNoDialogAnswerNo);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Created prompt GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Created prompt GUI`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showYesNoPromptGUI(promptMessage, promptTitle, yesButtonText, noButtonText) {
|
function showYesNoPromptGUI(promptMessage, promptTitle, yesButtonText, noButtonText) {
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing prompt window. Prompt: ${promptTitle} - ${promptMessage}`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Showing prompt window. Prompt: ${promptTitle} - ${promptMessage}`);
|
||||||
mexui.setInput(true);
|
mexui.setInput(true);
|
||||||
|
|
||||||
yesNoDialog.messageLabel.text = "";
|
yesNoDialog.messageLabel.text = "";
|
||||||
@@ -99,7 +99,7 @@ function showYesNoPromptGUI(promptMessage, promptTitle, yesButtonText, noButtonT
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function yesNoDialogAnswerNo() {
|
function yesNoDialogAnswerNo() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Responding with answer NO to server prompt`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Responding with answer NO to server prompt`);
|
||||||
sendNetworkEventToServer("v.rp.promptAnswerNo");
|
sendNetworkEventToServer("v.rp.promptAnswerNo");
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
}
|
}
|
||||||
@@ -107,7 +107,7 @@ function yesNoDialogAnswerNo() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function yesNoDialogAnswerYes() {
|
function yesNoDialogAnswerYes() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.GUI] Responding with answer YES to server prompt`);
|
logToConsole(LOG_DEBUG, `[V.RP.GUI] Responding with answer YES to server prompt`);
|
||||||
sendNetworkEventToServer("v.rp.promptAnswerYes");
|
sendNetworkEventToServer("v.rp.promptAnswerYes");
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,10 +25,19 @@ class HouseData {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function receiveHouseFromServer(houseId, description, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked) {
|
function receiveHouseFromServer(houseId, isDeleted, description, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.House] Received house ${houseId} (${name}) from server`);
|
logToConsole(LOG_DEBUG, `[V.RP.House] Received house ${houseId} (${name}) from server`);
|
||||||
|
|
||||||
if (!areServerElementsSupported() || getGame() == V_GAME_MAFIA_ONE || getGame() == V_GAME_GTA_IV) {
|
if (!areServerElementsSupported() || getGame() == V_GAME_MAFIA_ONE || getGame() == V_GAME_GTA_IV) {
|
||||||
|
if (isDeleted == true) {
|
||||||
|
if (getGame() == V_GAME_GTA_IV) {
|
||||||
|
natives.removeBlipAndClearIndex(getHouseData(houseId).blipId);
|
||||||
|
}
|
||||||
|
|
||||||
|
getServerData().houses.splice(houseId, 1);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (getHouseData(houseId) != false) {
|
if (getHouseData(houseId) != false) {
|
||||||
let houseData = getHouseData(houseId);
|
let houseData = getHouseData(houseId);
|
||||||
houseData.description = description;
|
houseData.description = description;
|
||||||
@@ -46,14 +55,18 @@ function receiveHouseFromServer(houseId, description, entrancePosition, blipMode
|
|||||||
if (houseData.rentPrice > 0) {
|
if (houseData.rentPrice > 0) {
|
||||||
houseData.labelInfoType = V_PROPLABEL_INFO_RENTHOUSE;
|
houseData.labelInfoType = V_PROPLABEL_INFO_RENTHOUSE;
|
||||||
} else {
|
} else {
|
||||||
houseData.labelInfoType = V_PROPLABEL_INFO_ENTER;
|
if (houseData.hasInterior) {
|
||||||
|
houseData.labelInfoType = V_PROPLABEL_INFO_ENTER;
|
||||||
|
} else {
|
||||||
|
houseData.labelInfoType = V_PROPLABEL_INFO_NONE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.House] House ${houseId} already exists. Checking blip ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.House] House ${houseId} already exists. Checking blip ...`);
|
||||||
if (blipModel == -1) {
|
if (blipModel == -1) {
|
||||||
if (houseData.blipId != -1) {
|
if (houseData.blipId != -1) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.House] House ${houseId}'s blip has been removed by the server`);
|
logToConsole(LOG_DEBUG, `[V.RP.House] House ${houseId}'s blip has been removed by the server`);
|
||||||
if (getGame() == V_GAME_GTA_IV) {
|
if (getGame() == V_GAME_GTA_IV) {
|
||||||
natives.removeBlipAndClearIndex(getHouseData(houseId).blipId);
|
natives.removeBlipAndClearIndex(getHouseData(houseId).blipId);
|
||||||
} else {
|
} else {
|
||||||
@@ -61,11 +74,11 @@ function receiveHouseFromServer(houseId, description, entrancePosition, blipMode
|
|||||||
}
|
}
|
||||||
houseData.blipId = -1;
|
houseData.blipId = -1;
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.House] House ${houseId}'s blip is unchanged`);
|
logToConsole(LOG_DEBUG, `[V.RP.House] House ${houseId}'s blip is unchanged`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (houseData.blipId != -1) {
|
if (houseData.blipId != -1) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.House] House ${houseId}'s blip has been changed by the server`);
|
logToConsole(LOG_DEBUG, `[V.RP.House] House ${houseId}'s blip has been changed by the server`);
|
||||||
if (getGame() == V_GAME_GTA_IV) {
|
if (getGame() == V_GAME_GTA_IV) {
|
||||||
natives.setBlipCoordinates(houseData.blipId, houseData.entrancePosition);
|
natives.setBlipCoordinates(houseData.blipId, houseData.entrancePosition);
|
||||||
natives.changeBlipSprite(houseData.blipId, houseData.blipModel);
|
natives.changeBlipSprite(houseData.blipId, houseData.blipModel);
|
||||||
@@ -78,20 +91,20 @@ function receiveHouseFromServer(houseId, description, entrancePosition, blipMode
|
|||||||
if (blipId != -1) {
|
if (blipId != -1) {
|
||||||
houseData.blipId = blipId;
|
houseData.blipId = blipId;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.House] House ${houseId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
logToConsole(LOG_DEBUG, `[V.RP.House] House ${houseId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.House] House ${houseId} doesn't exist. Adding ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.House] House ${houseId} doesn't exist. Adding ...`);
|
||||||
let tempHouseData = new HouseData(houseId, description, entrancePosition, blipModel, pickupModel, hasInterior);
|
let tempHouseData = new HouseData(houseId, description, entrancePosition, blipModel, pickupModel, hasInterior);
|
||||||
if (blipModel != -1) {
|
if (blipModel != -1) {
|
||||||
let blipId = createGameBlip(tempHouseData.blipModel, tempHouseData.entrancePosition, "House");
|
let blipId = createGameBlip(tempHouseData.blipModel, tempHouseData.entrancePosition, "House");
|
||||||
if (blipId != -1) {
|
if (blipId != -1) {
|
||||||
tempHouseData.blipId = blipId;
|
tempHouseData.blipId = blipId;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.House] House ${houseId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
logToConsole(LOG_DEBUG, `[V.RP.House] House ${houseId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.House] House ${houseId} has no blip.`);
|
logToConsole(LOG_DEBUG, `[V.RP.House] House ${houseId} has no blip.`);
|
||||||
}
|
}
|
||||||
getServerData().houses.push(tempHouseData);
|
getServerData().houses.push(tempHouseData);
|
||||||
setAllHouseDataIndexes();
|
setAllHouseDataIndexes();
|
||||||
@@ -125,3 +138,9 @@ function setAllHouseDataIndexes() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
function removeHousesFromClient() {
|
||||||
|
getServerData().houses.splice(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
58
scripts/client/hud.js
Normal file
58
scripts/client/hud.js
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
// ===========================================================================
|
||||||
|
// 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) {
|
function updatePlayerHotBar(activeSlot, itemsArray) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Main] Updating hotbar`);
|
logToConsole(LOG_DEBUG, `[V.RP.Main] Updating hotbar`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -42,21 +42,21 @@ function initJobScript() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocalPlayerJobType(tempJobType) {
|
function setLocalPlayerJobType(tempJobType) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Set local player job type to ${tempJobType}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] Set local player job type to ${tempJobType}`);
|
||||||
localPlayerJobType = tempJobType;
|
localPlayerJobType = tempJobType;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocalPlayerWorkingState(tempWorking) {
|
function setLocalPlayerWorkingState(tempWorking) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Setting working state to ${tempWorking}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] Setting working state to ${tempWorking}`);
|
||||||
localPlayerWorking = tempWorking;
|
localPlayerWorking = tempWorking;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showJobRouteLocation(position, colour) {
|
function showJobRouteLocation(position, colour) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Showing job route location at ${position.x}, ${position.y}, ${position.z}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] Showing job route location at ${position.x}, ${position.y}, ${position.z}`);
|
||||||
hideJobRouteLocation();
|
hideJobRouteLocation();
|
||||||
if (getMultiplayerMod() == V_MPMOD_GTAC) {
|
if (getMultiplayerMod() == V_MPMOD_GTAC) {
|
||||||
if (getGame() == V_GAME_GTA_SA) {
|
if (getGame() == V_GAME_GTA_SA) {
|
||||||
@@ -80,7 +80,7 @@ function showJobRouteLocation(position, colour) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function enteredJobRouteSphere() {
|
function enteredJobRouteSphere() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Entered job route sphere`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] Entered job route sphere`);
|
||||||
hideJobRouteLocation();
|
hideJobRouteLocation();
|
||||||
tellServerPlayerArrivedAtJobRouteLocation();
|
tellServerPlayerArrivedAtJobRouteLocation();
|
||||||
}
|
}
|
||||||
@@ -114,7 +114,7 @@ function blinkJobRouteLocationBlip(times, position, colour) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function hideJobRouteLocation() {
|
function hideJobRouteLocation() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Hiding job route location`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] Hiding job route location`);
|
||||||
|
|
||||||
if (jobRouteLocationBlip != null) {
|
if (jobRouteLocationBlip != null) {
|
||||||
destroyElement(jobRouteLocationBlip);
|
destroyElement(jobRouteLocationBlip);
|
||||||
@@ -136,10 +136,19 @@ function hideJobRouteLocation() {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function receiveJobFromServer(jobId, jobLocationId, name, position, blipModel, pickupModel) {
|
function receiveJobFromServer(jobId, isDeleted, jobLocationId, name, position, blipModel, pickupModel) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Received job ${jobId} (${name}) from server`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] Received job ${jobId} (${name}) from server`);
|
||||||
|
|
||||||
if (!areServerElementsSupported() || getGame() == V_GAME_MAFIA_ONE || getGame() == V_GAME_GTA_IV) {
|
if (!areServerElementsSupported() || getGame() == V_GAME_MAFIA_ONE || getGame() == V_GAME_GTA_IV) {
|
||||||
|
if (isDeleted == true) {
|
||||||
|
if (getGame() == V_GAME_GTA_IV) {
|
||||||
|
natives.removeBlipAndClearIndex(getJobData(jobId).blipId);
|
||||||
|
}
|
||||||
|
|
||||||
|
getServerData().jobs.splice(jobs, 1);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (getJobData(jobId) != false) {
|
if (getJobData(jobId) != false) {
|
||||||
let jobData = getJobData(jobId);
|
let jobData = getJobData(jobId);
|
||||||
jobData.jobLocationId = jobLocationId;
|
jobData.jobLocationId = jobLocationId;
|
||||||
@@ -148,10 +157,10 @@ function receiveJobFromServer(jobId, jobLocationId, name, position, blipModel, p
|
|||||||
jobData.blipModel = blipModel;
|
jobData.blipModel = blipModel;
|
||||||
jobData.pickupModel = pickupModel;
|
jobData.pickupModel = pickupModel;
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Job ${jobId} already exists. Checking blip ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] Job ${jobId} already exists. Checking blip ...`);
|
||||||
if (blipModel == -1) {
|
if (blipModel == -1) {
|
||||||
if (jobData.blipId != -1) {
|
if (jobData.blipId != -1) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Job ${jobId}'s blip has been removed by the server`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] Job ${jobId}'s blip has been removed by the server`);
|
||||||
if (getGame() == V_GAME_GTA_IV) {
|
if (getGame() == V_GAME_GTA_IV) {
|
||||||
natives.removeBlipAndClearIndex(getJobData(jobId).blipId);
|
natives.removeBlipAndClearIndex(getJobData(jobId).blipId);
|
||||||
} else {
|
} else {
|
||||||
@@ -159,11 +168,11 @@ function receiveJobFromServer(jobId, jobLocationId, name, position, blipModel, p
|
|||||||
}
|
}
|
||||||
jobData.blipId = -1;
|
jobData.blipId = -1;
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Job ${jobId}'s blip is unchanged`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] Job ${jobId}'s blip is unchanged`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (jobData.blipId != -1) {
|
if (jobData.blipId != -1) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Job ${jobId}'s blip has been changed by the server`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] Job ${jobId}'s blip has been changed by the server`);
|
||||||
if (getGame() == V_GAME_GTA_IV) {
|
if (getGame() == V_GAME_GTA_IV) {
|
||||||
natives.setBlipCoordinates(jobData.blipId, jobData.position);
|
natives.setBlipCoordinates(jobData.blipId, jobData.position);
|
||||||
natives.changeBlipSprite(jobData.blipId, jobData.blipModel);
|
natives.changeBlipSprite(jobData.blipId, jobData.blipModel);
|
||||||
@@ -176,20 +185,20 @@ function receiveJobFromServer(jobId, jobLocationId, name, position, blipModel, p
|
|||||||
if (blipId != -1) {
|
if (blipId != -1) {
|
||||||
jobData.blipId = blipId;
|
jobData.blipId = blipId;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Job ${jobId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] Job ${jobId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Job ${jobId} doesn't exist. Adding ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] Job ${jobId} doesn't exist. Adding ...`);
|
||||||
let tempJobData = new JobData(jobId, jobLocationId, name, position, blipModel, pickupModel);
|
let tempJobData = new JobData(jobId, jobLocationId, name, position, blipModel, pickupModel);
|
||||||
if (blipModel != -1) {
|
if (blipModel != -1) {
|
||||||
let blipId = createGameBlip(blipModel, tempJobData.position, tempJobData.name);
|
let blipId = createGameBlip(blipModel, tempJobData.position, tempJobData.name);
|
||||||
if (blipId != -1) {
|
if (blipId != -1) {
|
||||||
tempJobData.blipId = blipId;
|
tempJobData.blipId = blipId;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Job ${jobId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] Job ${jobId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Job ${jobId} has no blip.`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] Job ${jobId} has no blip.`);
|
||||||
}
|
}
|
||||||
getServerData().jobs.push(tempJobData);
|
getServerData().jobs.push(tempJobData);
|
||||||
setAllJobDataIndexes();
|
setAllJobDataIndexes();
|
||||||
@@ -217,8 +226,14 @@ function getJobData(jobId) {
|
|||||||
|
|
||||||
function setAllJobDataIndexes() {
|
function setAllJobDataIndexes() {
|
||||||
for (let i in getServerData().jobs) {
|
for (let i in getServerData().jobs) {
|
||||||
jobs[i].index = i;
|
getServerData().jobs[i].index = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
function removeJobsFromClient() {
|
||||||
|
getServerData().jobs.splice(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
@@ -23,7 +23,7 @@ function initKeyBindScript() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function bindAccountKey(key, keyState) {
|
function bindAccountKey(key, keyState) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.KeyBind]: Binded key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
logToConsole(LOG_DEBUG, `[V.RP.KeyBind]: Binded key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
||||||
keyBinds.push(toInteger(key));
|
keyBinds.push(toInteger(key));
|
||||||
bindKey(toInteger(key), keyState, function (event) {
|
bindKey(toInteger(key), keyState, function (event) {
|
||||||
if (isAnyGUIActive()) {
|
if (isAnyGUIActive()) {
|
||||||
@@ -32,14 +32,14 @@ function bindAccountKey(key, keyState) {
|
|||||||
|
|
||||||
if (hasKeyBindDelayElapsed()) {
|
if (hasKeyBindDelayElapsed()) {
|
||||||
if (canLocalPlayerUseKeyBinds()) {
|
if (canLocalPlayerUseKeyBinds()) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.KeyBind]: Using keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
logToConsole(LOG_DEBUG, `[V.RP.KeyBind]: Using keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
||||||
lastKeyBindUse = sdl.ticks;
|
lastKeyBindUse = sdl.ticks;
|
||||||
tellServerPlayerUsedKeyBind(key);
|
tellServerPlayerUsedKeyBind(key);
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.KeyBind]: Failed to use keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key}) - Not allowed to use keybinds!`);
|
logToConsole(LOG_DEBUG, `[V.RP.KeyBind]: Failed to use keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key}) - Not allowed to use keybinds!`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.KeyBind]: Failed to use keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key}) - Not enough time has passed since last keybind use!`);
|
logToConsole(LOG_DEBUG, `[V.RP.KeyBind]: Failed to use keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key}) - Not enough time has passed since last keybind use!`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -47,7 +47,7 @@ function bindAccountKey(key, keyState) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function unBindAccountKey(key) {
|
function unBindAccountKey(key) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.KeyBind]: Unbinded key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
logToConsole(LOG_DEBUG, `[V.RP.KeyBind]: Unbinded key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
||||||
unbindKey(key);
|
unbindKey(key);
|
||||||
keyBinds.splice(keyBinds.indexOf(key), 1);
|
keyBinds.splice(keyBinds.indexOf(key), 1);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ function renderPropertyEntranceLabel(name, position, locked, isBusiness, price,
|
|||||||
screenPosition = getScreenFromWorldPosition(position);
|
screenPosition = getScreenFromWorldPosition(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Label] World [${position.x}, ${position.y}, ${position.z}] to screen [${screenPosition.x}, ${screenPosition.y}, ${screenPosition.z}]`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Label] World [${position.x}, ${position.y}, ${position.z}] to screen [${screenPosition.x}, ${screenPosition.y}, ${screenPosition.z}]`);
|
||||||
|
|
||||||
if (screenPosition.x < 0 || screenPosition.x > game.width) {
|
if (screenPosition.x < 0 || screenPosition.x > game.width) {
|
||||||
return false;
|
return false;
|
||||||
@@ -140,7 +140,7 @@ function renderPropertyEntranceLabel(name, position, locked, isBusiness, price,
|
|||||||
let infoText = "";
|
let infoText = "";
|
||||||
switch (labelInfoType) {
|
switch (labelInfoType) {
|
||||||
case V_PROPLABEL_INFO_ENTER: {
|
case V_PROPLABEL_INFO_ENTER: {
|
||||||
if (enterPropertyKey) {
|
if (enterPropertyKey != null) {
|
||||||
infoText = getLocaleString("PropertyEnterKeyPressLabel", toUpperCase(getKeyNameFromId(enterPropertyKey)));
|
infoText = getLocaleString("PropertyEnterKeyPressLabel", toUpperCase(getKeyNameFromId(enterPropertyKey)));
|
||||||
} else {
|
} else {
|
||||||
infoText = getLocaleString("PropertyEnterCommandLabel", "/enter");
|
infoText = getLocaleString("PropertyEnterCommandLabel", "/enter");
|
||||||
@@ -174,7 +174,7 @@ function renderPropertyEntranceLabel(name, position, locked, isBusiness, price,
|
|||||||
}
|
}
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
if (enterPropertyKey) {
|
if (enterPropertyKey != null) {
|
||||||
infoText = getLocaleString("PropertyEnterKeyPressLabel", toUpperCase(getKeyNameFromId(enterPropertyKey)));
|
infoText = getLocaleString("PropertyEnterKeyPressLabel", toUpperCase(getKeyNameFromId(enterPropertyKey)));
|
||||||
} else {
|
} else {
|
||||||
infoText = getLocaleString("PropertyEnterCommandLabel", "/enter");
|
infoText = getLocaleString("PropertyEnterCommandLabel", "/enter");
|
||||||
@@ -348,10 +348,10 @@ function processLabelRendering() {
|
|||||||
if (getGame() == V_GAME_GTA_IV || getGame() == V_GAME_GTA_IV_EFLC) {
|
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);
|
natives.drawColouredCylinder(getPosBelowPos(job.position, 1.0), 0.0, 0.0, 255, 255, 0, 255);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (getDistance(localPlayer.position, job.position) <= 5.0) {
|
if (getDistance(localPlayer.position, job.position) <= propertyPickupRenderDistance) {
|
||||||
renderJobLabel(job.name, job.position, job.jobType);
|
renderJobLabel(job.name, job.position, job.jobType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ function loadLocaleConfig() {
|
|||||||
function loadAllLocaleStrings() {
|
function loadAllLocaleStrings() {
|
||||||
let localeOptions = getServerData().localeOptions;
|
let localeOptions = getServerData().localeOptions;
|
||||||
for (let i in localeOptions) {
|
for (let i in localeOptions) {
|
||||||
logToConsole(LOG_INFO, `[AGRP.Locale] Loading locale strings for ${localeOptions[i].englishName} (${i})`);
|
logToConsole(LOG_INFO, `[V.RP.Locale] Loading locale strings for ${localeOptions[i].englishName} (${i})`);
|
||||||
let localeStringFile = loadTextFile(`locale/${localeOptions[i].stringsFile}`);
|
let localeStringFile = loadTextFile(`locale/${localeOptions[i].stringsFile}`);
|
||||||
let localeStringData = JSON.parse(localeStringFile);
|
let localeStringData = JSON.parse(localeStringFile);
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ function loadAllLocaleStrings() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocale(tempLocaleId) {
|
function setLocale(tempLocaleId) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Locale] Setting locale to ${tempLocaleId} (${getServerData().localeOptions[tempLocaleId].englishName})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Locale] Setting locale to ${tempLocaleId} (${getServerData().localeOptions[tempLocaleId].englishName})`);
|
||||||
localLocaleId = tempLocaleId;
|
localLocaleId = tempLocaleId;
|
||||||
resetGUIStrings();
|
resetGUIStrings();
|
||||||
}
|
}
|
||||||
@@ -53,7 +53,7 @@ function processLogoRendering() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setServerLogoRenderState(state) {
|
function setServerLogoRenderState(state) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Main] Server logo ${(state) ? "enabled" : "disabled"}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Main] Server logo ${(state) ? "enabled" : "disabled"}`);
|
||||||
renderLogo = state;
|
renderLogo = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ function loadBigGameMessageFont() {
|
|||||||
|
|
||||||
fontStream = openFile("files/fonts/aurora-bold-condensed.ttf");
|
fontStream = openFile("files/fonts/aurora-bold-condensed.ttf");
|
||||||
if (fontStream != null) {
|
if (fontStream != null) {
|
||||||
tempBigGameMessageFonts["AuroraBdCnBT"] = lucasFont.createFont(fontStream, 20.0);
|
tempBigGameMessageFonts["AuroraBdCnBT"] = lucasFont.createFont(fontStream, 28.0);
|
||||||
fontStream.close();
|
fontStream.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ function processSmallGameMessageRendering() {
|
|||||||
logToConsole(LOG_VERBOSE, "[V.RP.Messaging]: Processing small game message rendering ...");
|
logToConsole(LOG_VERBOSE, "[V.RP.Messaging]: Processing small game message rendering ...");
|
||||||
if (renderSmallGameMessage) {
|
if (renderSmallGameMessage) {
|
||||||
if (smallGameMessageText != "") {
|
if (smallGameMessageText != "") {
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Messaging]: Rendering small game message: ${smallGameMessageText}`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Messaging]: Rendering small game message: ${smallGameMessageText}`);
|
||||||
if (smallGameMessageFonts[smallGameMessageFontName] != null) {
|
if (smallGameMessageFonts[smallGameMessageFontName] != null) {
|
||||||
smallGameMessageFonts[smallGameMessageFontName].render(smallGameMessageText, [0, game.height - 90], game.width, 0.5, 0.0, smallGameMessageFonts[smallGameMessageFontName].size, smallGameMessageColour, true, true, false, true);
|
smallGameMessageFonts[smallGameMessageFontName].render(smallGameMessageText, [0, game.height - 90], game.width, 0.5, 0.0, smallGameMessageFonts[smallGameMessageFontName].size, smallGameMessageColour, true, true, false, true);
|
||||||
}
|
}
|
||||||
@@ -89,7 +89,7 @@ function processSmallGameMessageRendering() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showSmallGameMessage(text, colour, duration, fontName) {
|
function showSmallGameMessage(text, colour, duration, fontName) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Messaging] Showing small game message '${text}' using font ${fontName} for ${duration}ms`);
|
logToConsole(LOG_DEBUG, `[V.RP.Messaging] Showing small game message '${text}' using font ${fontName} for ${duration}ms`);
|
||||||
if (smallGameMessageText != "") {
|
if (smallGameMessageText != "") {
|
||||||
clearTimeout(smallGameMessageTimer);
|
clearTimeout(smallGameMessageTimer);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ function addAllNetworkHandlers() {
|
|||||||
|
|
||||||
// Job
|
// Job
|
||||||
addNetworkEventHandler("v.rp.job", receiveJobFromServer);
|
addNetworkEventHandler("v.rp.job", receiveJobFromServer);
|
||||||
|
addNetworkEventHandler("v.rp.removeJobs", removeJobsFromClient);
|
||||||
addNetworkEventHandler("v.rp.working", setLocalPlayerWorkingState);
|
addNetworkEventHandler("v.rp.working", setLocalPlayerWorkingState);
|
||||||
addNetworkEventHandler("v.rp.jobType", setLocalPlayerJobType);
|
addNetworkEventHandler("v.rp.jobType", setLocalPlayerJobType);
|
||||||
addNetworkEventHandler("v.rp.showJobRouteLocation", showJobRouteLocation);
|
addNetworkEventHandler("v.rp.showJobRouteLocation", showJobRouteLocation);
|
||||||
@@ -64,6 +65,7 @@ function addAllNetworkHandlers() {
|
|||||||
|
|
||||||
// Vehicle
|
// Vehicle
|
||||||
addNetworkEventHandler("v.rp.vehicle", receiveVehicleFromServer);
|
addNetworkEventHandler("v.rp.vehicle", receiveVehicleFromServer);
|
||||||
|
addNetworkEventHandler("v.rp.removeVehicles", removeVehiclesFromClient);
|
||||||
addNetworkEventHandler("v.rp.veh.lights", setVehicleLights);
|
addNetworkEventHandler("v.rp.veh.lights", setVehicleLights);
|
||||||
addNetworkEventHandler("v.rp.veh.engine", setVehicleEngine);
|
addNetworkEventHandler("v.rp.veh.engine", setVehicleEngine);
|
||||||
addNetworkEventHandler("v.rp.veh.repair", repairVehicle);
|
addNetworkEventHandler("v.rp.veh.repair", repairVehicle);
|
||||||
@@ -117,9 +119,11 @@ function addAllNetworkHandlers() {
|
|||||||
|
|
||||||
// Business
|
// Business
|
||||||
addNetworkEventHandler("v.rp.business", receiveBusinessFromServer);
|
addNetworkEventHandler("v.rp.business", receiveBusinessFromServer);
|
||||||
|
addNetworkEventHandler("v.rp.removeBusinesses", removeBusinessesFromClient);
|
||||||
|
|
||||||
// House
|
// House
|
||||||
addNetworkEventHandler("v.rp.house", receiveHouseFromServer);
|
addNetworkEventHandler("v.rp.house", receiveHouseFromServer);
|
||||||
|
addNetworkEventHandler("v.rp.removeHouses", removeHousesFromClient);
|
||||||
|
|
||||||
// GPS
|
// GPS
|
||||||
addNetworkEventHandler("v.rp.showGPSBlip", showGPSLocation);
|
addNetworkEventHandler("v.rp.showGPSBlip", showGPSLocation);
|
||||||
@@ -188,7 +192,7 @@ function sendResourceStoppedSignalToServer() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function set2DRendering(hudState, labelState, smallGameMessageState, scoreboardState, hotBarState, itemActionDelayState) {
|
function set2DRendering(hudState, labelState, smallGameMessageState, scoreboardState, hotBarState, itemActionDelayState) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Main] Updating render states (HUD: ${hudState}, Labels: ${labelState}, Bottom Text: ${smallGameMessageState}, Scoreboard: ${scoreboardState}, HotBar: ${hotBarState}, Item Action Delay: ${itemActionDelayState})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Main] Updating render states (HUD: ${hudState}, Labels: ${labelState}, Bottom Text: ${smallGameMessageState}, Scoreboard: ${scoreboardState}, HotBar: ${hotBarState}, Item Action Delay: ${itemActionDelayState})`);
|
||||||
renderHUD = hudState;
|
renderHUD = hudState;
|
||||||
|
|
||||||
if (getGame() == V_GAME_GTA_IV) {
|
if (getGame() == V_GAME_GTA_IV) {
|
||||||
@@ -213,9 +217,10 @@ function set2DRendering(hudState, labelState, smallGameMessageState, scoreboardS
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onServerSpawnedLocalPlayer(state) {
|
function onServerSpawnedLocalPlayer(state) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Main] Setting spawned state to ${state}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Main] Setting spawned state to ${state}`);
|
||||||
isSpawned = state;
|
isSpawned = state;
|
||||||
setUpInitialGame();
|
setUpInitialGame();
|
||||||
|
calledDeathEvent = false;
|
||||||
if (state) {
|
if (state) {
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
calledDeathEvent = false;
|
calledDeathEvent = false;
|
||||||
@@ -278,7 +283,12 @@ function anchorBoat(vehicleId) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setEnterPropertyKey(key) {
|
function setEnterPropertyKey(key) {
|
||||||
enterPropertyKey = key;
|
if (key == -1) {
|
||||||
|
enterPropertyKey = null;
|
||||||
|
} else {
|
||||||
|
enterPropertyKey = key;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -336,7 +346,7 @@ function setLocalPlayerInfiniteRun(state) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocalPlayerSkin(skinId) {
|
function setLocalPlayerSkin(skinId) {
|
||||||
logToConsole(LOG_INFO, `[AGRP.Server] Setting locale player skin to ${skinId}`);
|
logToConsole(LOG_INFO, `[V.RP.Server] Setting locale player skin to ${skinId}`);
|
||||||
if (getGame() == V_GAME_GTA_IV) {
|
if (getGame() == V_GAME_GTA_IV) {
|
||||||
if (natives.isModelInCdimage(skinId)) {
|
if (natives.isModelInCdimage(skinId)) {
|
||||||
natives.requestModel(skinId);
|
natives.requestModel(skinId);
|
||||||
@@ -379,7 +389,17 @@ function changeScene(sceneName) {
|
|||||||
natives.initCutscene(cutsceneName);
|
natives.initCutscene(cutsceneName);
|
||||||
}
|
}
|
||||||
} else if (getGame() == V_GAME_MAFIA_ONE) {
|
} else if (getGame() == V_GAME_MAFIA_ONE) {
|
||||||
game.changeMap(sceneName);
|
renderHUD = false;
|
||||||
|
renderHotBar = false;
|
||||||
|
renderInteriorLights = false;
|
||||||
|
renderItemActionDelay = false;
|
||||||
|
renderLabels = false;
|
||||||
|
renderLogo = false;
|
||||||
|
renderScoreBoard = false;
|
||||||
|
renderSmallGameMessage = false;
|
||||||
|
setTimeout(function () {
|
||||||
|
game.changeMap(sceneName, false);
|
||||||
|
}, 250);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ function initClientScripts() {
|
|||||||
initEventScript();
|
initEventScript();
|
||||||
initSkinSelectScript();
|
initSkinSelectScript();
|
||||||
initCursorScript();
|
initCursorScript();
|
||||||
|
initCustomHUDScript();
|
||||||
|
|
||||||
addAllNetworkHandlers();
|
addAllNetworkHandlers();
|
||||||
}
|
}
|
||||||
@@ -190,8 +191,8 @@ function setUpInitialGame() {
|
|||||||
// Some last steps
|
// Some last steps
|
||||||
//natives.loadAllObjectsNow();
|
//natives.loadAllObjectsNow();
|
||||||
} else if (getGame() == V_GAME_MAFIA_ONE) {
|
} else if (getGame() == V_GAME_MAFIA_ONE) {
|
||||||
game.mapEnabled = false;
|
game.mapEnabled = true;
|
||||||
game.setTrafficEnabled(false);
|
//game.setTrafficEnabled(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,24 +19,27 @@ function processSync(event, deltaTime) {
|
|||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (localPlayer.health <= 0) {
|
|
||||||
if (!calledDeathEvent) {
|
if (calledDeathEvent == false) {
|
||||||
logToConsole(LOG_DEBUG, `Local player died`);
|
if (localPlayer.health <= 0) {
|
||||||
localPlayer.clearWeapons();
|
if (!calledDeathEvent) {
|
||||||
calledDeathEvent = true;
|
logToConsole(LOG_DEBUG, `Local player died`);
|
||||||
sendNetworkEventToServer("v.rp.playerDeath");
|
localPlayer.clearWeapons();
|
||||||
|
calledDeathEvent = true;
|
||||||
|
sendNetworkEventToServer("v.rp.playerDeath");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (localPlayer.health <= 0) {
|
//if (localPlayer.health <= 0) {
|
||||||
if (!calledDeathEvent) {
|
// if (!calledDeathEvent) {
|
||||||
logToConsole(LOG_DEBUG, `Local player died`);
|
// logToConsole(LOG_DEBUG, `Local player died`);
|
||||||
localPlayer.clearWeapons();
|
// localPlayer.clearWeapons();
|
||||||
calledDeathEvent = true;
|
// calledDeathEvent = true;
|
||||||
sendNetworkEventToServer("v.rp.playerDeath");
|
// sendNetworkEventToServer("v.rp.playerDeath");
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
if (streamingRadioElement) {
|
if (streamingRadioElement) {
|
||||||
//streamingRadio.volume = getStreamingRadioVolumeForPosition(streamingRadio.position);
|
//streamingRadio.volume = getStreamingRadioVolumeForPosition(streamingRadio.position);
|
||||||
|
|||||||
@@ -8,14 +8,14 @@
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocalPlayerFrozenState(state) {
|
function setLocalPlayerFrozenState(state) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Setting frozen state to ${state}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Setting frozen state to ${state}`);
|
||||||
gui.showCursor(state, !state);
|
gui.showCursor(state, !state);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocalPlayerControlState(controlState, cursorState = false) {
|
function setLocalPlayerControlState(controlState, cursorState = false) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Setting control state to ${controlState} (Cursor: ${cursorState})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Setting control state to ${controlState} (Cursor: ${cursorState})`);
|
||||||
controlsEnabled = controlState;
|
controlsEnabled = controlState;
|
||||||
game.setPlayerControl(controlState);
|
game.setPlayerControl(controlState);
|
||||||
if (getGame() == V_GAME_GTA_III || getGame() == V_GAME_GTA_VC) {
|
if (getGame() == V_GAME_GTA_III || getGame() == V_GAME_GTA_VC) {
|
||||||
@@ -29,14 +29,14 @@ function setLocalPlayerControlState(controlState, cursorState = false) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function fadeLocalCamera(state, duration, colour) {
|
function fadeLocalCamera(state, duration, colour) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Fading camera ${(state) ? "in" : "out"} for ${time}ms`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Fading camera ${(state) ? "in" : "out"} for ${duration}ms`);
|
||||||
|
|
||||||
cameraFadeDuration = duration;
|
cameraFadeDuration = duration;
|
||||||
cameraFadeStart = sdl.ticks;
|
cameraFadeStart = sdl.ticks;
|
||||||
cameraFadeEnabled = true;
|
|
||||||
cameraFadeIn = state;
|
cameraFadeIn = state;
|
||||||
cameraFadeColour = colour;
|
cameraFadeColour = colour;
|
||||||
cameraFadeAlpha = (state) ? 255 : 0;
|
cameraFadeAlpha = (state) ? 255 : 0;
|
||||||
|
cameraFadeEnabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -48,7 +48,7 @@ function removeLocalPlayerFromVehicle() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function restoreLocalCamera() {
|
function restoreLocalCamera() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Camera restored`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Camera restored`);
|
||||||
if (isGameFeatureSupported("customCamera")) {
|
if (isGameFeatureSupported("customCamera")) {
|
||||||
game.restoreCamera(true);
|
game.restoreCamera(true);
|
||||||
}
|
}
|
||||||
@@ -57,7 +57,7 @@ function restoreLocalCamera() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocalCameraLookAt(cameraPosition, cameraLookAt) {
|
function setLocalCameraLookAt(cameraPosition, cameraLookAt) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Set camera to look at [${cameraLookAt.x}, ${cameraLookAt.y}, ${cameraLookAt.z}] from [${cameraPosition.x}, ${cameraPosition.y}, ${cameraPosition.z}]`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Set camera to look at [${cameraLookAt.x}, ${cameraLookAt.y}, ${cameraLookAt.z}] from [${cameraPosition.x}, ${cameraPosition.y}, ${cameraPosition.z}]`);
|
||||||
if (isCustomCameraSupported()) {
|
if (isCustomCameraSupported()) {
|
||||||
game.setCameraLookAt(cameraPosition, cameraLookAt, true);
|
game.setCameraLookAt(cameraPosition, cameraLookAt, true);
|
||||||
}
|
}
|
||||||
@@ -66,15 +66,15 @@ function setLocalCameraLookAt(cameraPosition, cameraLookAt) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function clearLocalPlayerOwnedPeds() {
|
function clearLocalPlayerOwnedPeds() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Clearing all self-owned peds ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Clearing all self-owned peds ...`);
|
||||||
clearSelfOwnedPeds();
|
clearSelfOwnedPeds();
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] All self-owned peds cleared`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] All self-owned peds cleared`);
|
||||||
};
|
};
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setCityAmbienceState(state, clearElements = false) {
|
function setCityAmbienceState(state, clearElements = false) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Ambient civilians and traffic ${(state) ? "enabled" : "disabled"}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Ambient civilians and traffic ${(state) ? "enabled" : "disabled"}`);
|
||||||
game.setTrafficEnabled(state);
|
game.setTrafficEnabled(state);
|
||||||
|
|
||||||
if (getMultiplayerMod() == V_MPMOD_GTAC) {
|
if (getMultiplayerMod() == V_MPMOD_GTAC) {
|
||||||
@@ -134,7 +134,7 @@ function enterVehicleAsPassenger() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function giveLocalPlayerWeapon(weaponId, ammo, active) {
|
function giveLocalPlayerWeapon(weaponId, ammo, active) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Giving weapon ${weaponId} with ${ammo} ammo`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Giving weapon ${weaponId} with ${ammo} ammo`);
|
||||||
forceWeapon = weaponId;
|
forceWeapon = weaponId;
|
||||||
if (getGame() == V_GAME_MAFIA_ONE) {
|
if (getGame() == V_GAME_MAFIA_ONE) {
|
||||||
localPlayer.giveWeapon(weaponId, 0, ammo);
|
localPlayer.giveWeapon(weaponId, 0, ammo);
|
||||||
@@ -155,7 +155,7 @@ function giveLocalPlayerWeapon(weaponId, ammo, active) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function clearLocalPlayerWeapons(clearData) {
|
function clearLocalPlayerWeapons(clearData) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Clearing weapons`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Clearing weapons`);
|
||||||
localPlayer.clearWeapons();
|
localPlayer.clearWeapons();
|
||||||
if (clearData == true) {
|
if (clearData == true) {
|
||||||
forceWeapon = 0;
|
forceWeapon = 0;
|
||||||
@@ -173,7 +173,7 @@ function getClosestVehicle(pos) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocalPlayerPosition(position) {
|
function setLocalPlayerPosition(position) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Setting position to ${position.x}, ${position.y}, ${position.z}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Setting position to ${position.x}, ${position.y}, ${position.z}`);
|
||||||
if (typeof localPlayer.velocity != "undefined") {
|
if (typeof localPlayer.velocity != "undefined") {
|
||||||
localPlayer.velocity = toVector3(0.0, 0.0, 0.0);
|
localPlayer.velocity = toVector3(0.0, 0.0, 0.0);
|
||||||
}
|
}
|
||||||
@@ -186,7 +186,7 @@ function setLocalPlayerPosition(position) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocalPlayerHeading(heading) {
|
function setLocalPlayerHeading(heading) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Setting heading to ${heading}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Setting heading to ${heading}`);
|
||||||
if (typeof localPlayer.heading != "undefined") {
|
if (typeof localPlayer.heading != "undefined") {
|
||||||
localPlayer.heading = heading;
|
localPlayer.heading = heading;
|
||||||
}
|
}
|
||||||
@@ -195,7 +195,7 @@ function setLocalPlayerHeading(heading) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocalPlayerInterior(interior) {
|
function setLocalPlayerInterior(interior) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Setting interior to ${interior}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Setting interior to ${interior}`);
|
||||||
if (getMultiplayerMod() == V_MPMOD_GTAC) {
|
if (getMultiplayerMod() == V_MPMOD_GTAC) {
|
||||||
if (!isGTAIV()) {
|
if (!isGTAIV()) {
|
||||||
localPlayer.interior = interior;
|
localPlayer.interior = interior;
|
||||||
@@ -224,7 +224,11 @@ function setLocalPlayerInterior(interior) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setSnowState(falling, ground, forceGround) {
|
function setSnowState(falling, ground, forceGround) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Setting falling snow to ${falling} and ground snow to ${ground}`);
|
if (!isGameFeatureSupported("snow")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Setting falling snow to ${falling} and ground snow to ${ground}`);
|
||||||
snowing = falling;
|
snowing = falling;
|
||||||
//snow.force = ground;
|
//snow.force = ground;
|
||||||
//if (forceGround == true) {
|
//if (forceGround == true) {
|
||||||
@@ -238,13 +242,16 @@ function setSnowState(falling, ground, forceGround) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocalPlayerHealth(health) {
|
function setLocalPlayerHealth(health) {
|
||||||
|
if (localPlayer == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
localPlayer.health = health;
|
localPlayer.health = health;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function playPedSpeech(pedName, speechId) {
|
function playPedSpeech(pedName, speechId) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Making ${pedName}'s ped talk (${speechId})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Making ${pedName}'s ped talk (${speechId})`);
|
||||||
if (getMultiplayerMod() == V_MPMOD_GTAC) {
|
if (getMultiplayerMod() == V_MPMOD_GTAC) {
|
||||||
game.SET_CHAR_SAY(int, int);
|
game.SET_CHAR_SAY(int, int);
|
||||||
}
|
}
|
||||||
@@ -253,7 +260,7 @@ function playPedSpeech(pedName, speechId) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function clearLocalPedState() {
|
function clearLocalPedState() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Clearing local ped state`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Clearing local ped state`);
|
||||||
localPlayer.clearObjective();
|
localPlayer.clearObjective();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,7 +274,7 @@ function getWeaponSlot(weaponId) {
|
|||||||
|
|
||||||
function setLocalPlayerDrunkEffect(amount, duration) {
|
function setLocalPlayerDrunkEffect(amount, duration) {
|
||||||
if (getMultiplayerMod() == V_MPMOD_GTAC) {
|
if (getMultiplayerMod() == V_MPMOD_GTAC) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Drunk effect set to ${amount} for ${duration} ms`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Drunk effect set to ${amount} for ${duration} ms`);
|
||||||
drunkEffectAmount = 0;
|
drunkEffectAmount = 0;
|
||||||
drunkEffectDurationTimer = setInterval(function () {
|
drunkEffectDurationTimer = setInterval(function () {
|
||||||
drunkEffectAmount = drunkEffectAmount;
|
drunkEffectAmount = drunkEffectAmount;
|
||||||
@@ -285,11 +292,13 @@ function setLocalPlayerDrunkEffect(amount, duration) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getLocalPlayerVehicleSeat() {
|
function getLocalPlayerVehicleSeat() {
|
||||||
for (let i = 0; i <= 4; i++) {
|
return inVehicleSeat;
|
||||||
if (localPlayer.vehicle.getOccupant(i) == localPlayer) {
|
|
||||||
return i;
|
//for (let i = 0; i <= 4; i++) {
|
||||||
}
|
// if (localPlayer.vehicle.getOccupant(i) == localPlayer) {
|
||||||
}
|
// return i;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -317,7 +326,7 @@ function clearSelfOwnedVehicles() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setMouseCameraState(state) {
|
function setMouseCameraState(state) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] ${(state) ? "Enabled" : "Disabled"} mouse camera`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] ${(state) ? "Enabled" : "Disabled"} mouse camera`);
|
||||||
mouseCameraEnabled = state;
|
mouseCameraEnabled = state;
|
||||||
SetStandardControlsEnabled(!mouseCameraEnabled);
|
SetStandardControlsEnabled(!mouseCameraEnabled);
|
||||||
}
|
}
|
||||||
@@ -325,28 +334,28 @@ function setMouseCameraState(state) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function toggleMouseCursor() {
|
function toggleMouseCursor() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] ${(!gui.cursorEnabled) ? "Enabled" : "Disabled"} mouse cursor`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] ${(!gui.cursorEnabled) ? "Enabled" : "Disabled"} mouse cursor`);
|
||||||
gui.showCursor(!gui.cursorEnabled, gui.cursorEnabled);
|
gui.showCursor(!gui.cursorEnabled, gui.cursorEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function toggleMouseCursor() {
|
function toggleMouseCursor() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] ${(!gui.cursorEnabled) ? "Enabled" : "Disabled"} mouse cursor`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] ${(!gui.cursorEnabled) ? "Enabled" : "Disabled"} mouse cursor`);
|
||||||
setMouseCameraState(!mouseCameraEnabled);
|
setMouseCameraState(!mouseCameraEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setPlayerWeaponDamageEvent(clientName, eventType) {
|
function setPlayerWeaponDamageEvent(clientName, eventType) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Set ${clientName} damage event type to ${eventType}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Set ${clientName} damage event type to ${eventType}`);
|
||||||
weaponDamageEvent[clientName] = eventType;
|
weaponDamageEvent[clientName] = eventType;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setPlayerWeaponDamageEnabled(clientName, state) {
|
function setPlayerWeaponDamageEnabled(clientName, state) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] ${(state) ? "Enabled" : "Disabled"} damage from ${clientName}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] ${(state) ? "Enabled" : "Disabled"} damage from ${clientName}`);
|
||||||
weaponDamageEnabled[clientName] = state;
|
weaponDamageEnabled[clientName] = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -401,7 +410,9 @@ function processLocalPlayerVehicleControlState() {
|
|||||||
if (localPlayer.vehicle != null) {
|
if (localPlayer.vehicle != null) {
|
||||||
if (doesEntityDataExist(localPlayer.vehicle, "v.rp.engine")) {
|
if (doesEntityDataExist(localPlayer.vehicle, "v.rp.engine")) {
|
||||||
if (getEntityData(localPlayer.vehicle, "v.rp.engine") == false) {
|
if (getEntityData(localPlayer.vehicle, "v.rp.engine") == false) {
|
||||||
localPlayer.vehicle.engine = false;
|
if (localPlayer.vehicle.engine == true) {
|
||||||
|
localPlayer.vehicle.engine = false;
|
||||||
|
}
|
||||||
//localPlayer.vehicle.netFlags.sendSync = false;
|
//localPlayer.vehicle.netFlags.sendSync = false;
|
||||||
if (!localPlayer.vehicle.engine) {
|
if (!localPlayer.vehicle.engine) {
|
||||||
if (typeof localPlayer.vehicle.velocity != "undefined") {
|
if (typeof localPlayer.vehicle.velocity != "undefined") {
|
||||||
@@ -470,7 +481,7 @@ function getVehicleForNetworkEvent(vehicle) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setMinuteDuration(minuteDuration) {
|
function setMinuteDuration(minuteDuration) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Setting minute duration to ${minuteDuration}ms`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Setting minute duration to ${minuteDuration}ms`);
|
||||||
|
|
||||||
if (isTimeSupported()) {
|
if (isTimeSupported()) {
|
||||||
game.time.minuteDuration = minuteDuration;
|
game.time.minuteDuration = minuteDuration;
|
||||||
@@ -615,7 +626,7 @@ function updateLocalPlayerMoney() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocalPlayerMoney(amount) {
|
function setLocalPlayerMoney(amount) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Setting local player money`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Setting local player money`);
|
||||||
localPlayerMoney = amount;
|
localPlayerMoney = amount;
|
||||||
updateLocalPlayerMoney();
|
updateLocalPlayerMoney();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class VehicleData {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function receiveVehicleFromServer(vehicleId, position, model, colour1, colour2, colour3 = 0, colour4 = 0, locked = false, lights = false, engine = false, licensePlate = "") {
|
function receiveVehicleFromServer(vehicleId, position, model, colour1, colour2, colour3 = 0, colour4 = 0, locked = false, lights = false, engine = false, licensePlate = "") {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Vehicle] Received vehicle ${vehicleId} (${getVehicleNameFromModel(model, getGame())}) from server`);
|
logToConsole(LOG_DEBUG, `[V.RP.Vehicle] Received vehicle ${vehicleId} (${getVehicleNameFromModel(model, getGame())}) from server`);
|
||||||
|
|
||||||
if (getGame() != V_GAME_GTA_IV) {
|
if (getGame() != V_GAME_GTA_IV) {
|
||||||
return false;
|
return false;
|
||||||
@@ -52,7 +52,7 @@ function receiveVehicleFromServer(vehicleId, position, model, colour1, colour2,
|
|||||||
|
|
||||||
let vehicle = natives.getVehicleFromNetworkId(vehicleId.ivNetworkId);
|
let vehicle = natives.getVehicleFromNetworkId(vehicleId.ivNetworkId);
|
||||||
} else {
|
} else {
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Vehicle] Vehicle ${vehicleId} doesn't exist. Adding ...`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Vehicle] Vehicle ${vehicleId} doesn't exist. Adding ...`);
|
||||||
//let tempVehicleData = new VehicleData(vehicleId, name, position, blipModel, pickupModel);
|
//let tempVehicleData = new VehicleData(vehicleId, name, position, blipModel, pickupModel);
|
||||||
|
|
||||||
//vehicles.push(tempVehicleData);
|
//vehicles.push(tempVehicleData);
|
||||||
@@ -164,3 +164,11 @@ function getVehicleSpeed(vehicle) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
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)) {
|
if (doesPlayerHaveGUIEnabled(client)) {
|
||||||
getPlayerData(client).accountData.settings = addBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
getPlayerData(client).accountData.settings = addBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
||||||
messagePlayerNormal(client, getLocaleString(client, "GUIAccountSettingToggle", `{softRed}${toUpperCase(getLocaleString(client, "Off"))}{MAINCOLOUR}`));
|
messagePlayerNormal(client, getLocaleString(client, "GUIAccountSettingToggle", `{softRed}${toUpperCase(getLocaleString(client, "Off"))}{MAINCOLOUR}`));
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has toggled GUI for their account OFF.`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} has toggled GUI for their account OFF.`);
|
||||||
} else {
|
} else {
|
||||||
getPlayerData(client).accountData.settings = removeBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
getPlayerData(client).accountData.settings = removeBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
||||||
messagePlayerNormal(client, getLocaleString(client, "GUIAccountSettingToggle", `{softGreen}${toUpperCase(getLocaleString(client, "On"))}{MAINCOLOUR}`));
|
messagePlayerNormal(client, getLocaleString(client, "GUIAccountSettingToggle", `{softGreen}${toUpperCase(getLocaleString(client, "On"))}{MAINCOLOUR}`));
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has toggled GUI for their account ON.`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} has toggled GUI for their account ON.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isPlayerLoggedIn(client)) {
|
if (!isPlayerLoggedIn(client)) {
|
||||||
if (getPlayerData().accountData.databaseId != 0) {
|
if (getPlayerData().accountData.databaseId != 0) {
|
||||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
showPlayerLoginGUI(client);
|
showPlayerLoginGUI(client);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI`);
|
||||||
} else {
|
} else {
|
||||||
hideAllPlayerGUI(client);
|
hideAllPlayerGUI(client);
|
||||||
messagePlayerNormal(client, getLocaleString(client, "WelcomeBack", getServerName(), getPlayerName(client), "{ALTCOLOUR}/login{MAINCOLOUR}"));
|
messagePlayerNormal(client, getLocaleString(client, "WelcomeBack", getServerName(), getPlayerName(client), "{ALTCOLOUR}/login{MAINCOLOUR}"));
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled)`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
showPlayerRegistrationGUI(client);
|
showPlayerRegistrationGUI(client);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI`);
|
||||||
} else {
|
} else {
|
||||||
hideAllPlayerGUI(client);
|
hideAllPlayerGUI(client);
|
||||||
messagePlayerNormal(client, getLocaleString(client, "WelcomeNewPlayer", getServerName(), getPlayerName(client), "{ALTCOLOUR}/register{MAINCOLOUR}"));
|
messagePlayerNormal(client, getLocaleString(client, "WelcomeNewPlayer", getServerName(), getPlayerName(client), "{ALTCOLOUR}/register{MAINCOLOUR}"));
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register message (GUI disabled)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register message (GUI disabled)`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -323,11 +323,11 @@ function toggleAccountLoginAttemptNotificationsCommand(command, params, client)
|
|||||||
if (doesPlayerHaveLoginAlertsEnabled(client)) {
|
if (doesPlayerHaveLoginAlertsEnabled(client)) {
|
||||||
getPlayerData(client).accountData.settings = removeBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
getPlayerData(client).accountData.settings = removeBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
||||||
messagePlayerNormal(client, `⚙️ You turned ${getBoolRedGreenInlineColour(false)}OFF{MAINCOLOUR} notification by email when somebody tries to login to your account`);
|
messagePlayerNormal(client, `⚙️ You turned ${getBoolRedGreenInlineColour(false)}OFF{MAINCOLOUR} notification by email when somebody tries to login to your account`);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has toggled the login attempt email notifications OFF for their account`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} has toggled the login attempt email notifications OFF for their account`);
|
||||||
} else {
|
} else {
|
||||||
getPlayerData(client).accountData.settings = addBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
getPlayerData(client).accountData.settings = addBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
||||||
messagePlayerNormal(client, `⚙️ You turned ${getBoolRedGreenInlineColour(true)}ON{MAINCOLOUR} notification by email when somebody tries to login to your account`);
|
messagePlayerNormal(client, `⚙️ You turned ${getBoolRedGreenInlineColour(true)}ON{MAINCOLOUR} notification by email when somebody tries to login to your account`);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has toggled the login attempt email notifications OFF for their account`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} has toggled the login attempt email notifications OFF for their account`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -341,14 +341,14 @@ function toggleAccountServerLogoCommand(command, params, client) {
|
|||||||
if (!doesPlayerHaveLogoEnabled(client)) {
|
if (!doesPlayerHaveLogoEnabled(client)) {
|
||||||
getPlayerData(client).accountData.settings = removeBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
getPlayerData(client).accountData.settings = removeBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
||||||
messagePlayerSuccess(client, getLocaleString(client, "AccountServerLogoSet", `${getBoolRedGreenInlineColour(true)}${getLocaleString(client, "On")}{MAINCOLOUR}`));
|
messagePlayerSuccess(client, getLocaleString(client, "AccountServerLogoSet", `${getBoolRedGreenInlineColour(true)}${getLocaleString(client, "On")}{MAINCOLOUR}`));
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has toggled the server logo ON for their account`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} has toggled the server logo ON for their account`);
|
||||||
if (getServerConfig().showLogo) {
|
if (getServerConfig().showLogo) {
|
||||||
updatePlayerShowLogoState(client, true);
|
updatePlayerShowLogoState(client, true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
getPlayerData(client).accountData.settings = addBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
getPlayerData(client).accountData.settings = addBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
||||||
messagePlayerSuccess(client, getLocaleString(client, "AccountServerLogoSet", `${getBoolRedGreenInlineColour(false)}${getLocaleString(client, "Off")}{MAINCOLOUR}`));
|
messagePlayerSuccess(client, getLocaleString(client, "AccountServerLogoSet", `${getBoolRedGreenInlineColour(false)}${getLocaleString(client, "Off")}{MAINCOLOUR}`));
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has toggled the server logo OFF for their account`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} has toggled the server logo OFF for their account`);
|
||||||
updatePlayerShowLogoState(client, false);
|
updatePlayerShowLogoState(client, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -377,11 +377,11 @@ function toggleAccountTwoFactorAuthCommand(command, params, client) {
|
|||||||
if (!doesPlayerHaveTwoFactorAuthEnabled(client)) {
|
if (!doesPlayerHaveTwoFactorAuthEnabled(client)) {
|
||||||
getPlayerData(client).accountData.settings = addBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
getPlayerData(client).accountData.settings = addBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
||||||
messagePlayerSuccess(client, getLocaleString(client, "TwoFactorAuthSet", `${getBoolRedGreenInlineColour(true)}${getLocaleString(client, "On")}{MAINCOLOUR}`));
|
messagePlayerSuccess(client, getLocaleString(client, "TwoFactorAuthSet", `${getBoolRedGreenInlineColour(true)}${getLocaleString(client, "On")}{MAINCOLOUR}`));
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has toggled two-factor authentication ON for their account`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} has toggled two-factor authentication ON for their account`);
|
||||||
} else {
|
} else {
|
||||||
getPlayerData(client).accountData.settings = removeBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
getPlayerData(client).accountData.settings = removeBitFlag(getPlayerData(client).accountData.settings, flagValue);
|
||||||
messagePlayerSuccess(client, getLocaleString(client, "TwoFactorAuthSet", `${getBoolRedGreenInlineColour(false)}${toUpperCase(getLocaleString(client, "Off"))}{MAINCOLOUR}`));
|
messagePlayerSuccess(client, getLocaleString(client, "TwoFactorAuthSet", `${getBoolRedGreenInlineColour(false)}${toUpperCase(getLocaleString(client, "Off"))}{MAINCOLOUR}`));
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has toggled two-factor authentication OFF for their account`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} has toggled two-factor authentication OFF for their account`);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -828,7 +828,7 @@ function saltAccountInfo(name, password) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loginSuccess(client) {
|
function loginSuccess(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} successfully logged in.`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} successfully logged in.`);
|
||||||
getPlayerData(client).loggedIn = true;
|
getPlayerData(client).loggedIn = true;
|
||||||
|
|
||||||
if (getPlayerData(client).loginTimeout != null) {
|
if (getPlayerData(client).loginTimeout != null) {
|
||||||
@@ -839,7 +839,7 @@ function loginSuccess(client) {
|
|||||||
updateConnectionLogOnAuth(client, getPlayerData(client).accountData.databaseId);
|
updateConnectionLogOnAuth(client, getPlayerData(client).accountData.databaseId);
|
||||||
|
|
||||||
if (doesPlayerHaveStaffPermission(client, "Developer") || doesPlayerHaveStaffPermission(client, "ManageServer")) {
|
if (doesPlayerHaveStaffPermission(client, "Developer") || doesPlayerHaveStaffPermission(client, "ManageServer")) {
|
||||||
logToConsole(LOG_WARN, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} has needed permissions and is being given administrator access`);
|
logToConsole(LOG_WARN, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} has needed permissions and is being given administrator access`);
|
||||||
setPlayerNativeAdminState(client, true);
|
setPlayerNativeAdminState(client, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -851,11 +851,11 @@ function loginSuccess(client) {
|
|||||||
}, 3500);
|
}, 3500);
|
||||||
|
|
||||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the error GUI (not a tester).`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the error GUI (not a tester).`);
|
||||||
showPlayerErrorGUI(client, getLocaleString(client, "NotATester"), getLocaleString(client, "AccessDenied"));
|
showPlayerErrorGUI(client, getLocaleString(client, "NotATester"), getLocaleString(client, "AccessDenied"));
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the "not a tester" error message (GUI disabled).`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the "not a tester" error message (GUI disabled).`);
|
||||||
messagePlayerError(client, getLocaleString(client, "NotATester"));
|
messagePlayerError(client, getLocaleString(client, "NotATester"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -866,10 +866,10 @@ function loginSuccess(client) {
|
|||||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
showPlayerPrompt(client, getLocaleString(client, "NoCharactersGUIMessage"), getLocaleString(client, "NoCharactersGUIWindowTitle"), getLocaleString(client, "Yes"), getLocaleString(client, "No"));
|
showPlayerPrompt(client, getLocaleString(client, "NoCharactersGUIMessage"), getLocaleString(client, "NoCharactersGUIWindowTitle"), getLocaleString(client, "Yes"), getLocaleString(client, "No"));
|
||||||
getPlayerData(client).promptType = V_PROMPT_CREATEFIRSTCHAR;
|
getPlayerData(client).promptType = V_PROMPT_CREATEFIRSTCHAR;
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the no characters prompt GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the no characters prompt GUI`);
|
||||||
} else {
|
} else {
|
||||||
messagePlayerAlert(client, getLocaleString(client, "NoCharactersChatMessage", `{ALTCOLOUR}/newchar{MAINCOLOUR}`));
|
messagePlayerAlert(client, getLocaleString(client, "NoCharactersChatMessage", `{ALTCOLOUR}/newchar{MAINCOLOUR}`));
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the no characters message (GUI disabled)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the no characters message (GUI disabled)`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
showCharacterSelectToClient(client);
|
showCharacterSelectToClient(client);
|
||||||
@@ -935,6 +935,10 @@ function saveAccountToDatabase(accountData) {
|
|||||||
let dbQuery2 = queryDatabase(dbConnection, queryString2);
|
let dbQuery2 = queryDatabase(dbConnection, queryString2);
|
||||||
freeDatabaseQuery(dbQuery2);
|
freeDatabaseQuery(dbQuery2);
|
||||||
|
|
||||||
|
//saveAllAccountCommandAliasesToDatabase(accountData);
|
||||||
|
//saveAllAccountStaffNotesToDatabase(accountData);
|
||||||
|
//saveAllAccountKeyBindsToDatabase(accountData);
|
||||||
|
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1010,6 +1014,39 @@ 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) {
|
function saveAccountContactsToDatabase(accountContactData) {
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
@@ -1033,7 +1070,7 @@ function saveAccountContactsToDatabase(accountContactData) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
async function createAccount(name, password, email = "") {
|
function createAccount(name, password, email = "") {
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
|
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
@@ -1068,7 +1105,7 @@ function checkLogin(client, password) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isPlayerLoggedIn(client)) {
|
if (isPlayerLoggedIn(client)) {
|
||||||
logToConsole(LOG_WARN, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} attempted to login but is already logged in`);
|
logToConsole(LOG_WARN, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} attempted to login but is already logged in`);
|
||||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
showPlayerLoginSuccessGUI(client);
|
showPlayerLoginSuccessGUI(client);
|
||||||
} else {
|
} else {
|
||||||
@@ -1079,25 +1116,25 @@ function checkLogin(client, password) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isPlayerRegistered(client)) {
|
if (!isPlayerRegistered(client)) {
|
||||||
logToConsole(LOG_WARN, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} attempted to login but is not registered`);
|
logToConsole(LOG_WARN, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} attempted to login but is not registered`);
|
||||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
showPlayerRegistrationGUI(client);
|
showPlayerRegistrationGUI(client);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI`);
|
||||||
} else {
|
} else {
|
||||||
messagePlayerError(client, "Your name is not registered! Use /register to make an account.");
|
messagePlayerError(client, "Your name is not registered! Use /register to make an account.");
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register message (GUI disabled)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register message (GUI disabled)`);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (areParamsEmpty(password)) {
|
if (areParamsEmpty(password)) {
|
||||||
logToConsole(LOG_WARN, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} attempted to login but failed (empty password). ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining`);
|
logToConsole(LOG_WARN, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} attempted to login but failed (empty password). ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining`);
|
||||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
showPlayerLoginFailedGUI(client, getLocaleString(client, "LoginFailedInvalidPassword", getPlayerData(client).loginAttemptsRemaining));
|
showPlayerLoginFailedGUI(client, getLocaleString(client, "LoginFailedInvalidPassword", getPlayerData(client).loginAttemptsRemaining));
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
|
||||||
} else {
|
} else {
|
||||||
messagePlayerError(client, getLocaleString(client, "LoginFailedNoPassword", getPlayerData(client).loginAttemptsRemaining));
|
messagePlayerError(client, getLocaleString(client, "LoginFailedNoPassword", getPlayerData(client).loginAttemptsRemaining));
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled) with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled) with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disabling email login alerts for now. It hangs the server for a couple seconds. Need a way to thread it.
|
// Disabling email login alerts for now. It hangs the server for a couple seconds. Need a way to thread it.
|
||||||
@@ -1108,13 +1145,13 @@ function checkLogin(client, password) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isAccountPasswordCorrect(getPlayerData(client).accountData, hashAccountPassword(getPlayerName(client), password))) {
|
if (!isAccountPasswordCorrect(getPlayerData(client).accountData, hashAccountPassword(getPlayerName(client), password))) {
|
||||||
logToConsole(LOG_WARN, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} attempted to login but failed (wrong password). ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining`);
|
logToConsole(LOG_WARN, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} attempted to login but failed (wrong password). ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining`);
|
||||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
showPlayerLoginFailedGUI(client, getLocaleString(client, "LoginFailedInvalidPassword", getPlayerData(client).loginAttemptsRemaining));
|
showPlayerLoginFailedGUI(client, getLocaleString(client, "LoginFailedInvalidPassword", getPlayerData(client).loginAttemptsRemaining));
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
|
||||||
} else {
|
} else {
|
||||||
messagePlayerError(client, getLocaleString(client, "LoginFailedInvalidPassword", getPlayerData(client).loginAttemptsRemaining));
|
messagePlayerError(client, getLocaleString(client, "LoginFailedInvalidPassword", getPlayerData(client).loginAttemptsRemaining));
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled) with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled) with ${getPlayerData(client).loginAttemptsRemaining} login attempts remaining alert.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disabling email login alerts for now. It hangs the server for a couple seconds. Need a way to thread it.
|
// Disabling email login alerts for now. It hangs the server for a couple seconds. Need a way to thread it.
|
||||||
@@ -1147,7 +1184,7 @@ function checkLogin(client, password) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function checkRegistration(client, password, confirmPassword = "", emailAddress = "") {
|
function checkRegistration(client, password, confirmPassword = "", emailAddress = "") {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: Checking registration for ${getPlayerName(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account]: Checking registration for ${getPlayerName(client)}`);
|
||||||
|
|
||||||
if (isPlayerRegistered(client)) {
|
if (isPlayerRegistered(client)) {
|
||||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
@@ -1268,11 +1305,11 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
|
|||||||
}, 5000);
|
}, 5000);
|
||||||
|
|
||||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the error GUI (not a tester).`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the error GUI (not a tester).`);
|
||||||
showPlayerErrorGUI(client, getLocaleString(client, "NotATester"), getLocaleString(client, "AccessDenied"));
|
showPlayerErrorGUI(client, getLocaleString(client, "NotATester"), getLocaleString(client, "AccessDenied"));
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the "not a tester" error message (GUI disabled).`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the "not a tester" error message (GUI disabled).`);
|
||||||
messagePlayerError(client, getLocaleString(client, "NotATester"));
|
messagePlayerError(client, getLocaleString(client, "NotATester"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1421,7 +1458,7 @@ function savePlayerToDatabase(client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: Saving client ${getPlayerName(client)} to database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account]: Saving client ${getPlayerName(client)} to database ...`);
|
||||||
saveAccountToDatabase(getPlayerData(client).accountData);
|
saveAccountToDatabase(getPlayerData(client).accountData);
|
||||||
|
|
||||||
if (getPlayerData(client).currentSubAccount != -1) {
|
if (getPlayerData(client).currentSubAccount != -1) {
|
||||||
@@ -1443,7 +1480,7 @@ function savePlayerToDatabase(client) {
|
|||||||
|
|
||||||
saveSubAccountToDatabase(getPlayerCurrentSubAccount(client));
|
saveSubAccountToDatabase(getPlayerCurrentSubAccount(client));
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: Saved client ${getPlayerDisplayForConsole(client)} to database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account]: Saved client ${getPlayerDisplayForConsole(client)} to database successfully!`);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1466,8 +1503,13 @@ function createDefaultAccountServerData(accountDatabaseId) {
|
|||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
let serversAssoc = fetchQueryAssoc(dbConnection, "SELECT * FROM svr_main");
|
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) {
|
for (let i in serversAssoc) {
|
||||||
let dbQueryString = `INSERT INTO acct_svr (acct_svr_acct, acct_svr_svr) VALUES (${accountDatabaseId}, ${serversAssoc[i]["svr_id"]})`;
|
let dbQueryString = `INSERT INTO acct_svr (acct_svr_acct, acct_svr_svr, acct_svr_settings) VALUES (${accountDatabaseId}, ${serversAssoc[i]["svr_id"]}, ${defaultSettings})`;
|
||||||
quickDatabaseQuery(dbQueryString);
|
quickDatabaseQuery(dbQueryString);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1477,7 +1519,7 @@ function createDefaultAccountServerData(accountDatabaseId) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadAccountKeybindsFromDatabase(accountDatabaseID) {
|
function loadAccountKeybindsFromDatabase(accountDatabaseID) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: Loading account keybinds for account ${accountDatabaseID} from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account]: Loading account keybinds for account ${accountDatabaseID} from database ...`);
|
||||||
|
|
||||||
let tempAccountKeybinds = [];
|
let tempAccountKeybinds = [];
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
@@ -1500,21 +1542,21 @@ function loadAccountKeybindsFromDatabase(accountDatabaseID) {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempAccountKeyBindData = new KeyBindData(dbAssoc[i]);
|
let tempAccountKeyBindData = new KeyBindData(dbAssoc[i]);
|
||||||
tempAccountKeybinds.push(tempAccountKeyBindData);
|
tempAccountKeybinds.push(tempAccountKeyBindData);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: Account keybind '${tempAccountKeyBindData.databaseId}' (Key ${tempAccountKeyBindData.key} '${toUpperCase(getKeyNameFromId(tempAccountKeyBindData.key))}') loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account]: Account keybind '${tempAccountKeyBindData.databaseId}' (Key ${tempAccountKeyBindData.key} '${toUpperCase(getKeyNameFromId(tempAccountKeyBindData.key))}') loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: ${tempAccountKeybinds.length} account keybinds for account ${accountDatabaseID} loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account]: ${tempAccountKeybinds.length} account keybinds for account ${accountDatabaseID} loaded from database successfully!`);
|
||||||
return tempAccountKeybinds;
|
return tempAccountKeybinds;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadAccountStaffNotesFromDatabase(accountDatabaseID) {
|
function loadAccountStaffNotesFromDatabase(accountDatabaseID) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: Loading account staff notes for account ${accountDatabaseID} from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account]: Loading account staff notes for account ${accountDatabaseID} from database ...`);
|
||||||
|
|
||||||
let tempAccountStaffNotes = [];
|
let tempAccountStaffNotes = [];
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
@@ -1527,20 +1569,46 @@ function loadAccountStaffNotesFromDatabase(accountDatabaseID) {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempAccountStaffNoteData = new AccountStaffNoteData(dbAssoc[i]);
|
let tempAccountStaffNoteData = new AccountStaffNoteData(dbAssoc[i]);
|
||||||
tempAccountStaffNotes.push(tempAccountStaffNoteData);
|
tempAccountStaffNotes.push(tempAccountStaffNoteData);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: Account staff note '${tempAccountStaffNoteData.databaseId}' loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account]: Account staff note '${tempAccountStaffNoteData.databaseId}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: ${tempAccountStaffNotes.length} account staff notes for account ${accountDatabaseID} loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account]: ${tempAccountStaffNotes.length} account staff notes for account ${accountDatabaseID} loaded from database successfully!`);
|
||||||
return tempAccountStaffNotes;
|
return tempAccountStaffNotes;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
function 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) {
|
function loadAccountContactsFromDatabase(accountDatabaseID) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: Loading account contacts for account ${accountDatabaseID} from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account]: Loading account contacts for account ${accountDatabaseID} from database ...`);
|
||||||
|
|
||||||
let tempAccountContacts = [];
|
let tempAccountContacts = [];
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
@@ -1553,20 +1621,20 @@ function loadAccountContactsFromDatabase(accountDatabaseID) {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempAccountContactData = new AccountContactData(dbAssoc[i]);
|
let tempAccountContactData = new AccountContactData(dbAssoc[i]);
|
||||||
tempAccountContacts.push(tempAccountContactData);
|
tempAccountContacts.push(tempAccountContactData);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: Account contact '${tempAccountContactData.databaseId}' loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account]: Account contact '${tempAccountContactData.databaseId}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: ${tempAccountContacts.length} account contacts for account ${accountDatabaseID} loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account]: ${tempAccountContacts.length} account contacts for account ${accountDatabaseID} loaded from database successfully!`);
|
||||||
return tempAccountContacts;
|
return tempAccountContacts;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadAccountMessagesFromDatabase(accountDatabaseID) {
|
function loadAccountMessagesFromDatabase(accountDatabaseID) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: Loading account messages for account ${accountDatabaseID} from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account]: Loading account messages for account ${accountDatabaseID} from database ...`);
|
||||||
|
|
||||||
let tempAccountMessages = [];
|
let tempAccountMessages = [];
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
@@ -1579,13 +1647,13 @@ function loadAccountMessagesFromDatabase(accountDatabaseID) {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempAccountMessageData = new AccountContactData(dbAssoc[i]);
|
let tempAccountMessageData = new AccountContactData(dbAssoc[i]);
|
||||||
tempAccountMessages.push(tempAccountMessageData);
|
tempAccountMessages.push(tempAccountMessageData);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: Account contact '${tempAccountMessageData.databaseId}' loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account]: Account contact '${tempAccountMessageData.databaseId}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account]: ${tempAccountMessages.length} account messages for account ${accountDatabaseID} loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account]: ${tempAccountMessages.length} account messages for account ${accountDatabaseID} loaded from database successfully!`);
|
||||||
return tempAccountMessages;
|
return tempAccountMessages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,12 @@ function playPlayerAnimationCommand(command, params, client) {
|
|||||||
return false;
|
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) {
|
if (toInteger(animationPositionOffset) < 0 || toInteger(animationPositionOffset) > 3) {
|
||||||
messagePlayerError(client, getLocaleString(client, "InvalidAnimationDistance"));
|
messagePlayerError(client, getLocaleString(client, "InvalidAnimationDistance"));
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ function accountBanCommand(command, params, client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_WARN, `[AGRP.Ban]: ${getPlayerDisplayForConsole(targetClient)} (${getPlayerData(targetClient).accountData.name}) account was banned by ${getPlayerDisplayForConsole(client)}. Reason: ${reason}`);
|
logToConsole(LOG_WARN, `[V.RP.Ban]: ${getPlayerDisplayForConsole(targetClient)} (${getPlayerData(targetClient).accountData.name}) account was banned by ${getPlayerDisplayForConsole(client)}. Reason: ${reason}`);
|
||||||
|
|
||||||
announceAdminAction(`PlayerAccountBanned`, `{ALTCOLOUR}${getPlayerName(targetClient)}{MAINCOLOUR}`);
|
announceAdminAction(`PlayerAccountBanned`, `{ALTCOLOUR}${getPlayerName(targetClient)}{MAINCOLOUR}`);
|
||||||
banAccount(getPlayerData(targetClient).accountData.databaseId, getPlayerData(client).accountData.databaseId, reason);
|
banAccount(getPlayerData(targetClient).accountData.databaseId, getPlayerData(client).accountData.databaseId, reason);
|
||||||
@@ -97,7 +97,7 @@ function subAccountBanCommand(command, params, client, fromDiscord) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_WARN, `[AGRP.Ban]: ${getPlayerDisplayForConsole(targetClient)} (${getPlayerData(targetClient).accountData.name})'s subaccount was banned by ${getPlayerDisplayForConsole(client)}. Reason: ${reason}`);
|
logToConsole(LOG_WARN, `[V.RP.Ban]: ${getPlayerDisplayForConsole(targetClient)} (${getPlayerData(targetClient).accountData.name})'s subaccount was banned by ${getPlayerDisplayForConsole(client)}. Reason: ${reason}`);
|
||||||
|
|
||||||
announceAdminAction(`PlayerCharacterBanned`, `{ALTCOLOUR}${getPlayerName(targetClient)}{MAINCOLOUR}`);
|
announceAdminAction(`PlayerCharacterBanned`, `{ALTCOLOUR}${getPlayerName(targetClient)}{MAINCOLOUR}`);
|
||||||
banSubAccount(getPlayerData(targetClient).currentSubAccountData.databaseId, getPlayerData(client).accountData.databaseId, reason);
|
banSubAccount(getPlayerData(targetClient).currentSubAccountData.databaseId, getPlayerData(client).accountData.databaseId, reason);
|
||||||
|
|||||||
@@ -227,21 +227,21 @@ function loadBusinessesFromDatabase() {
|
|||||||
tempBusinessData.locations = loadBusinessLocationsFromDatabase(tempBusinessData.databaseId);
|
tempBusinessData.locations = loadBusinessLocationsFromDatabase(tempBusinessData.databaseId);
|
||||||
//tempBusinessData.gameScripts = loadBusinessGameScriptsFromDatabase(tempBusinessData.databaseId);
|
//tempBusinessData.gameScripts = loadBusinessGameScriptsFromDatabase(tempBusinessData.databaseId);
|
||||||
tempBusinesses.push(tempBusinessData);
|
tempBusinesses.push(tempBusinessData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Business]: Business '${tempBusinessData.name}' (ID ${tempBusinessData.databaseId}) loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Business]: Business '${tempBusinessData.name}' (ID ${tempBusinessData.databaseId}) loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_INFO, `[AGRP.Business]: ${tempBusinesses.length} businesses loaded from database successfully!`);
|
logToConsole(LOG_INFO, `[V.RP.Business]: ${tempBusinesses.length} businesses loaded from database successfully!`);
|
||||||
return tempBusinesses;
|
return tempBusinesses;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadBusinessLocationsFromDatabase(businessId) {
|
function loadBusinessLocationsFromDatabase(businessId) {
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Business]: Loading business locations for business ${businessId} from database ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Business]: Loading business locations for business ${businessId} from database ...`);
|
||||||
|
|
||||||
let tempBusinessLocations = [];
|
let tempBusinessLocations = [];
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
@@ -255,13 +255,13 @@ function loadBusinessLocationsFromDatabase(businessId) {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempBusinessLocationData = new BusinessLocationData(dbAssoc[i]);
|
let tempBusinessLocationData = new BusinessLocationData(dbAssoc[i]);
|
||||||
tempBusinessLocations.push(tempBusinessLocationData);
|
tempBusinessLocations.push(tempBusinessLocationData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Business]: Location '${tempBusinessLocationData.name}' loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Business]: Location '${tempBusinessLocationData.name}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Business]: ${tempBusinessLocations.length} location for business ${businessId} loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Business]: ${tempBusinessLocations.length} location for business ${businessId} loaded from database successfully!`);
|
||||||
return tempBusinessLocations;
|
return tempBusinessLocations;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -269,7 +269,7 @@ function loadBusinessLocationsFromDatabase(businessId) {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
function loadBusinessGameScriptsFromDatabase(businessId) {
|
function loadBusinessGameScriptsFromDatabase(businessId) {
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Business]: Loading business game scripts for business ${businessId} from database ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Business]: Loading business game scripts for business ${businessId} from database ...`);
|
||||||
|
|
||||||
let tempBusinessGameScripts = [];
|
let tempBusinessGameScripts = [];
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
@@ -284,13 +284,13 @@ function loadBusinessGameScriptsFromDatabase(businessId) {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempBusinessGameScriptData = new BusinessGameScriptData(dbAssoc[i]);
|
let tempBusinessGameScriptData = new BusinessGameScriptData(dbAssoc[i]);
|
||||||
tempBusinessGameScripts.push(tempBusinessGameScriptData);
|
tempBusinessGameScripts.push(tempBusinessGameScriptData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Business]: Game script '${tempBusinessGameScriptData.name}' loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Business]: Game script '${tempBusinessGameScriptData.name}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Business]: ${tempBusinessGameScripts.length} game scripts for business ${businessId} loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Business]: ${tempBusinessGameScripts.length} game scripts for business ${businessId} loaded from database successfully!`);
|
||||||
return tempBusinessGameScripts;
|
return tempBusinessGameScripts;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
@@ -382,8 +382,8 @@ function createBusiness(name, entrancePosition, exitPosition, entrancePickupMode
|
|||||||
setBusinessDataIndexes();
|
setBusinessDataIndexes();
|
||||||
saveAllBusinessesToDatabase();
|
saveAllBusinessesToDatabase();
|
||||||
|
|
||||||
createBusinessPickups(businessId - 1);
|
spawnBusinessPickups(businessId - 1);
|
||||||
createBusinessBlips(businessId - 1);
|
spawnBusinessBlips(businessId - 1);
|
||||||
|
|
||||||
return tempBusinessData;
|
return tempBusinessData;
|
||||||
}
|
}
|
||||||
@@ -460,8 +460,9 @@ function setBusinessNameCommand(command, params, client) {
|
|||||||
|
|
||||||
let oldBusinessName = getBusinessData(businessId).name;
|
let oldBusinessName = getBusinessData(businessId).name;
|
||||||
getBusinessData(businessId).name = newBusinessName;
|
getBusinessData(businessId).name = newBusinessName;
|
||||||
setEntityData(getBusinessData(businessId).entrancePickup, "v.rp.label.name", getBusinessData(businessId).name, true);
|
|
||||||
getBusinessData(businessId).needsSaved = true;
|
getBusinessData(businessId).needsSaved = true;
|
||||||
|
updateBusinessPickupLabelData(businessId);
|
||||||
|
|
||||||
messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} renamed business {businessBlue}${oldBusinessName}{MAINCOLOUR} to {businessBlue}${newBusinessName}`, true);
|
messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} renamed business {businessBlue}${oldBusinessName}{MAINCOLOUR} to {businessBlue}${newBusinessName}`, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -503,6 +504,7 @@ function setBusinessOwnerCommand(command, params, client) {
|
|||||||
getBusinessData(businessId).ownerType = V_BIZ_OWNER_PLAYER;
|
getBusinessData(businessId).ownerType = V_BIZ_OWNER_PLAYER;
|
||||||
getBusinessData(businessId).ownerId = getPlayerCurrentSubAccount(newBusinessOwner).databaseId;
|
getBusinessData(businessId).ownerId = getPlayerCurrentSubAccount(newBusinessOwner).databaseId;
|
||||||
getBusinessData(businessId).needsSaved = true;
|
getBusinessData(businessId).needsSaved = true;
|
||||||
|
updateBusinessPickupLabelData(businessId);
|
||||||
|
|
||||||
messagePlayerSuccess(client, `{MAINCOLOUR}You gave business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} to {ALTCOLOUR}${getCharacterFullName(newBusinessOwner)}`);
|
messagePlayerSuccess(client, `{MAINCOLOUR}You gave business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} to {ALTCOLOUR}${getCharacterFullName(newBusinessOwner)}`);
|
||||||
}
|
}
|
||||||
@@ -545,6 +547,7 @@ function setBusinessJobCommand(command, params, client) {
|
|||||||
getBusinessData(businessId).ownerType = V_BIZ_OWNER_JOB;
|
getBusinessData(businessId).ownerType = V_BIZ_OWNER_JOB;
|
||||||
getBusinessData(businessId).ownerId = getJobData(jobId).databaseId;
|
getBusinessData(businessId).ownerId = getJobData(jobId).databaseId;
|
||||||
getBusinessData(businessId).needsSaved = true;
|
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}`);
|
messagePlayerSuccess(client, `{MAINCOLOUR}You set the owner of business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} to the {jobYellow}${getJobData(jobId).name}`);
|
||||||
}
|
}
|
||||||
@@ -728,8 +731,9 @@ function setBusinessJobCommand(command, params, client) {
|
|||||||
|
|
||||||
getBusinessData(businessId).ownerType = V_BIZ_OWNER_JOB;
|
getBusinessData(businessId).ownerType = V_BIZ_OWNER_JOB;
|
||||||
getBusinessData(businessId).ownerId = getJobData(jobId).databaseId;
|
getBusinessData(businessId).ownerId = getJobData(jobId).databaseId;
|
||||||
|
|
||||||
getBusinessData(businessId).needsSaved = true;
|
getBusinessData(businessId).needsSaved = true;
|
||||||
|
updateBusinessPickupLabelData(businessId);
|
||||||
|
|
||||||
messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}owner to the {jobYellow}${getJobData(jobId).name} {MAINCOLOUR}job`);
|
messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}owner to the {jobYellow}${getJobData(jobId).name} {MAINCOLOUR}job`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -758,8 +762,9 @@ function setBusinessPublicCommand(command, params, client) {
|
|||||||
|
|
||||||
getBusinessData(businessId).ownerType = V_BIZ_OWNER_PUBLIC;
|
getBusinessData(businessId).ownerType = V_BIZ_OWNER_PUBLIC;
|
||||||
getBusinessData(businessId).ownerId = 0;
|
getBusinessData(businessId).ownerId = 0;
|
||||||
|
|
||||||
getBusinessData(businessId).needsSaved = true;
|
getBusinessData(businessId).needsSaved = true;
|
||||||
|
updateBusinessPickupLabelData(businessId);
|
||||||
|
|
||||||
messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}owner set to {ALTCOLOUR}public`);
|
messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name} {MAINCOLOUR}owner set to {ALTCOLOUR}public`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -789,6 +794,7 @@ function removeBusinessOwnerCommand(command, params, client) {
|
|||||||
getBusinessData(businessId).ownerType = V_BIZ_OWNER_NONE;
|
getBusinessData(businessId).ownerType = V_BIZ_OWNER_NONE;
|
||||||
getBusinessData(businessId).ownerId = -1;
|
getBusinessData(businessId).ownerId = -1;
|
||||||
getBusinessData(businessId).needsSaved = true;
|
getBusinessData(businessId).needsSaved = true;
|
||||||
|
updateBusinessPickupLabelData(businessId);
|
||||||
|
|
||||||
messagePlayerSuccess(client, `{MAINCOLOUR}You removed business {businessBlue}${getBusinessData(businessId).name}'s{MAINCOLOUR} owner`);
|
messagePlayerSuccess(client, `{MAINCOLOUR}You removed business {businessBlue}${getBusinessData(businessId).name}'s{MAINCOLOUR} owner`);
|
||||||
}
|
}
|
||||||
@@ -819,8 +825,8 @@ function toggleBusinessInteriorLightsCommand(command, params, client) {
|
|||||||
|
|
||||||
getBusinessData(businessId).interiorLights = !getBusinessData(businessId).interiorLights;
|
getBusinessData(businessId).interiorLights = !getBusinessData(businessId).interiorLights;
|
||||||
updateBusinessInteriorLightsForOccupants(businessId);
|
updateBusinessInteriorLightsForOccupants(businessId);
|
||||||
|
|
||||||
getBusinessData(businessId).needsSaved = true;
|
getBusinessData(businessId).needsSaved = true;
|
||||||
|
|
||||||
meActionToNearbyPlayers(client, `turns ${toLowerCase(getOnOffFromBool(getBusinessData(businessId).interiorLights))} the business lights`);
|
meActionToNearbyPlayers(client, `turns ${toLowerCase(getOnOffFromBool(getBusinessData(businessId).interiorLights))} the business lights`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -852,6 +858,7 @@ function setBusinessEntranceFeeCommand(command, params, client) {
|
|||||||
getBusinessData(businessId).entranceFee = entranceFee;
|
getBusinessData(businessId).entranceFee = entranceFee;
|
||||||
getBusinessData(businessId).needsSaved = true;
|
getBusinessData(businessId).needsSaved = true;
|
||||||
updateBusinessPickupLabelData(businessId);
|
updateBusinessPickupLabelData(businessId);
|
||||||
|
|
||||||
messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} entrance fee to {ALTCOLOUR}${getCurrencyString(entranceFee)}`);
|
messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} entrance fee to {ALTCOLOUR}${getCurrencyString(entranceFee)}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -881,6 +888,8 @@ function setBusinessPaintBallCommand(command, params, client) {
|
|||||||
|
|
||||||
getBusinessData(businessId).type = V_BIZ_TYPE_PAINTBALL;
|
getBusinessData(businessId).type = V_BIZ_TYPE_PAINTBALL;
|
||||||
getBusinessData(businessId).needsSaved = true;
|
getBusinessData(businessId).needsSaved = true;
|
||||||
|
updateBusinessPickupLabelData(businessId);
|
||||||
|
|
||||||
messagePlayerSuccess(client, getLocaleString(client, "BusinessIsNowPaintBall"));
|
messagePlayerSuccess(client, getLocaleString(client, "BusinessIsNowPaintBall"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1139,8 +1148,8 @@ function setBusinessInteriorTypeCommand(command, params, client) {
|
|||||||
|
|
||||||
//deleteBusinessExitPickup(businessId);
|
//deleteBusinessExitPickup(businessId);
|
||||||
//deleteBusinessExitBlip(businessId);
|
//deleteBusinessExitBlip(businessId);
|
||||||
//createBusinessExitBlip(businessId);
|
//spawnBusinessExitBlip(businessId);
|
||||||
//createBusinessExitPickup(businessId);
|
//spawnBusinessExitPickup(businessId);
|
||||||
|
|
||||||
resetBusinessPickups(businessId);
|
resetBusinessPickups(businessId);
|
||||||
|
|
||||||
@@ -1198,8 +1207,8 @@ function addBusinessPropertyTemplateEntities(command, params, client) {
|
|||||||
|
|
||||||
//deleteBusinessExitPickup(businessId);
|
//deleteBusinessExitPickup(businessId);
|
||||||
//deleteBusinessExitBlip(businessId);
|
//deleteBusinessExitBlip(businessId);
|
||||||
//createBusinessExitBlip(businessId);
|
//spawnBusinessExitBlip(businessId);
|
||||||
//createBusinessExitPickup(businessId);
|
//spawnBusinessExitPickup(businessId);
|
||||||
|
|
||||||
resetBusinessPickups(businessId);
|
resetBusinessPickups(businessId);
|
||||||
|
|
||||||
@@ -1301,6 +1310,7 @@ function giveDefaultItemsToBusinessCommand(command, params, client) {
|
|||||||
|
|
||||||
cacheBusinessItems(businessId);
|
cacheBusinessItems(businessId);
|
||||||
updateBusinessPickupLabelData(businessId);
|
updateBusinessPickupLabelData(businessId);
|
||||||
|
|
||||||
messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} gave business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} the default items for ${typeParam}`, true);
|
messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} gave business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} the default items for ${typeParam}`, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1326,6 +1336,7 @@ function setBusinessDealershipCommand(command, params, client) {
|
|||||||
getBusinessData(businessId).labelHelpType == V_PROPLABEL_INFO_ENTERVEHICLE;
|
getBusinessData(businessId).labelHelpType == V_PROPLABEL_INFO_ENTERVEHICLE;
|
||||||
getBusinessData(businessId).type = V_BIZ_TYPE_DEALERSHIP;
|
getBusinessData(businessId).type = V_BIZ_TYPE_DEALERSHIP;
|
||||||
updateBusinessPickupLabelData(businessId);
|
updateBusinessPickupLabelData(businessId);
|
||||||
|
|
||||||
messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set the type of business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} to dealership`, true);
|
messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} set the type of business {businessBlue}${getBusinessData(businessId).name}{MAINCOLOUR} to dealership`, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1468,9 +1479,9 @@ function setBusinessBuyPriceCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getBusinessData(businessId).buyPrice = amount;
|
getBusinessData(businessId).buyPrice = amount;
|
||||||
setEntityData(getBusinessData(businessId).entrancePickup, "v.rp.label.price", getBusinessData(businessId).buyPrice, true);
|
|
||||||
|
|
||||||
getBusinessData(businessId).needsSaved = true;
|
getBusinessData(businessId).needsSaved = true;
|
||||||
|
updateBusinessPickupLabelData(businessId);
|
||||||
|
|
||||||
messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name}'s{MAINCOLOUR} for-sale price to {ALTCOLOUR}${getCurrencyString(amount)}`);
|
messagePlayerSuccess(client, `{MAINCOLOUR}You set business {businessBlue}${getBusinessData(businessId).name}'s{MAINCOLOUR} for-sale price to {ALTCOLOUR}${getCurrencyString(amount)}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1554,7 +1565,7 @@ function orderItemForBusinessCommand(command, params, client) {
|
|||||||
let value = getItemTypeData(itemType).orderValue;
|
let value = getItemTypeData(itemType).orderValue;
|
||||||
let businessId = getPlayerBusiness(client);
|
let businessId = getPlayerBusiness(client);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Business] ${getPlayerDisplayForConsole(client)} is ordering ${amount} ${splitParams.slice(0, -2).join(" ")}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Business] ${getPlayerDisplayForConsole(client)} is ordering ${amount} ${splitParams.slice(0, -2).join(" ")}`);
|
||||||
|
|
||||||
if (!getBusinessData(businessId)) {
|
if (!getBusinessData(businessId)) {
|
||||||
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
|
messagePlayerError(client, getLocaleString(client, "InvalidBusiness"));
|
||||||
@@ -1573,23 +1584,14 @@ function orderItemForBusinessCommand(command, params, client) {
|
|||||||
getPlayerData(client).businessOrderBusiness = businessId;
|
getPlayerData(client).businessOrderBusiness = businessId;
|
||||||
getPlayerData(client).businessOrderItem = itemType;
|
getPlayerData(client).businessOrderItem = itemType;
|
||||||
getPlayerData(client).businessOrderCost = orderTotalCost;
|
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");
|
showPlayerPrompt(client, `Ordering ${amount} ${getPluralForm(getItemTypeData(itemType).name)} will cost a total of ${getCurrencyString(orderTotalCost)}`, "Business Order Cost");
|
||||||
getPlayerData(client).promptType = V_PROMPT_BIZORDER;
|
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) {
|
function orderItemForBusiness(businessId, itemType, amount) {
|
||||||
if (getBusinessData(businessId).till < orderTotalCost) {
|
if (getBusinessData(businessId).till < orderTotalCost) {
|
||||||
let neededAmount = orderTotalCost - getBusinessData(businessId).till;
|
let neededAmount = orderTotalCost - getBusinessData(businessId).till;
|
||||||
@@ -1695,8 +1697,8 @@ function moveBusinessEntranceCommand(command, params, client) {
|
|||||||
|
|
||||||
//deleteBusinessEntranceBlip(businessId);
|
//deleteBusinessEntranceBlip(businessId);
|
||||||
//deleteBusinessEntrancePickup(businessId);
|
//deleteBusinessEntrancePickup(businessId);
|
||||||
//createBusinessEntranceBlip(businessId);
|
//spawnBusinessEntranceBlip(businessId);
|
||||||
//createBusinessEntrancePickup(businessId);
|
//spawnBusinessEntrancePickup(businessId);
|
||||||
|
|
||||||
resetBusinessPickups(businessId);
|
resetBusinessPickups(businessId);
|
||||||
resetBusinessBlips(businessId);
|
resetBusinessBlips(businessId);
|
||||||
@@ -1736,8 +1738,8 @@ function moveBusinessExitCommand(command, params, client) {
|
|||||||
deleteBusinessExitBlip(businessId);
|
deleteBusinessExitBlip(businessId);
|
||||||
deleteBusinessExitPickup(businessId);
|
deleteBusinessExitPickup(businessId);
|
||||||
|
|
||||||
createBusinessExitBlip(businessId);
|
spawnBusinessExitBlip(businessId);
|
||||||
createBusinessExitPickup(businessId);
|
spawnBusinessExitPickup(businessId);
|
||||||
|
|
||||||
getBusinessData(businessId).needsSaved = true;
|
getBusinessData(businessId).needsSaved = true;
|
||||||
|
|
||||||
@@ -1893,7 +1895,7 @@ function saveBusinessToDatabase(businessId) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Business]: Saving business '${tempBusinessData.name}' to database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Business]: Saving business '${tempBusinessData.name}' to database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
let safeBusinessName = escapeDatabaseString(dbConnection, tempBusinessData.name);
|
let safeBusinessName = escapeDatabaseString(dbConnection, tempBusinessData.name);
|
||||||
@@ -1949,7 +1951,7 @@ function saveBusinessToDatabase(businessId) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Business]: Saved business '${tempBusinessData.name}' to database!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Business]: Saved business '${tempBusinessData.name}' to database!`);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1962,14 +1964,14 @@ function saveBusinessToDatabase(businessId) {
|
|||||||
* @return {Boolean} Whether or not the server pickups were created
|
* @return {Boolean} Whether or not the server pickups were created
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function createAllBusinessPickups() {
|
function spawnAllBusinessPickups() {
|
||||||
if (!getServerConfig().createBusinessPickups) {
|
if (!getServerConfig().createBusinessPickups) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i in getServerData().businesses) {
|
for (let i in getServerData().businesses) {
|
||||||
createBusinessEntrancePickup(i);
|
spawnBusinessEntrancePickup(i);
|
||||||
createBusinessExitPickup(i);
|
spawnBusinessExitPickup(i);
|
||||||
updateBusinessPickupLabelData(i);
|
updateBusinessPickupLabelData(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1984,7 +1986,7 @@ function createAllBusinessPickups() {
|
|||||||
* @return {Boolean} Whether or not the server blips were created
|
* @return {Boolean} Whether or not the server blips were created
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function createAllBusinessBlips() {
|
function spawnAllBusinessBlips() {
|
||||||
if (!getServerConfig().createBusinessBlips) {
|
if (!getServerConfig().createBusinessBlips) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1994,8 +1996,8 @@ function createAllBusinessBlips() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (let i in getServerData().businesses) {
|
for (let i in getServerData().businesses) {
|
||||||
createBusinessEntranceBlip(i);
|
spawnBusinessEntranceBlip(i);
|
||||||
createBusinessExitBlip(i);
|
spawnBusinessExitBlip(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2008,7 +2010,7 @@ function createAllBusinessBlips() {
|
|||||||
* @return {Boolean} Whether or not the blip was created
|
* @return {Boolean} Whether or not the blip was created
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function createBusinessEntrancePickup(businessId) {
|
function spawnBusinessEntrancePickup(businessId) {
|
||||||
if (!getServerConfig().createBusinessPickups) {
|
if (!getServerConfig().createBusinessPickups) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2019,7 +2021,7 @@ function createBusinessEntrancePickup(businessId) {
|
|||||||
// return false;
|
// return false;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating entrance pickup for business ${businessData.name}`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Creating entrance pickup for business ${businessData.name}`);
|
||||||
|
|
||||||
if (areServerElementsSupported() && getGame() != V_GAME_MAFIA_ONE && getGame() != V_GAME_GTA_IV) {
|
if (areServerElementsSupported() && getGame() != V_GAME_MAFIA_ONE && getGame() != V_GAME_GTA_IV) {
|
||||||
let entrancePickup = null;
|
let entrancePickup = null;
|
||||||
@@ -2071,7 +2073,7 @@ function createBusinessEntrancePickup(businessId) {
|
|||||||
* @return {Boolean} Whether or not the blip was created
|
* @return {Boolean} Whether or not the blip was created
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function createBusinessEntranceBlip(businessId) {
|
function spawnBusinessEntranceBlip(businessId) {
|
||||||
if (!getServerConfig().createBusinessBlips) {
|
if (!getServerConfig().createBusinessBlips) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2096,7 +2098,7 @@ function createBusinessEntranceBlip(businessId) {
|
|||||||
blipModelId = businessData.entranceBlipModel;
|
blipModelId = businessData.entranceBlipModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating entrance blip for business ${businessData.name} (model ${blipModelId})`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Creating entrance blip for business ${businessData.name} (model ${blipModelId})`);
|
||||||
|
|
||||||
if (areServerElementsSupported() && getGame() != V_GAME_MAFIA_ONE && getGame() != V_GAME_GTA_IV) {
|
if (areServerElementsSupported() && getGame() != V_GAME_MAFIA_ONE && getGame() != V_GAME_GTA_IV) {
|
||||||
let entranceBlip = createGameBlip(businessData.entrancePosition, blipModelId, 1, getColourByType("businessBlue"));
|
let entranceBlip = createGameBlip(businessData.entrancePosition, blipModelId, 1, getColourByType("businessBlue"));
|
||||||
@@ -2129,7 +2131,7 @@ function createBusinessEntranceBlip(businessId) {
|
|||||||
* @return {Boolean} Whether or not the pickup was created
|
* @return {Boolean} Whether or not the pickup was created
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function createBusinessExitPickup(businessId) {
|
function spawnBusinessExitPickup(businessId) {
|
||||||
if (!areServerElementsSupported()) {
|
if (!areServerElementsSupported()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2148,7 +2150,7 @@ function createBusinessExitPickup(businessId) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating exit pickup for business ${businessData.name}`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Creating exit pickup for business ${businessData.name}`);
|
||||||
|
|
||||||
let exitPickup = null;
|
let exitPickup = null;
|
||||||
if (isGameFeatureSupported("pickup")) {
|
if (isGameFeatureSupported("pickup")) {
|
||||||
@@ -2191,7 +2193,7 @@ function createBusinessExitPickup(businessId) {
|
|||||||
* @return {Boolean} Whether or not the blip was created
|
* @return {Boolean} Whether or not the blip was created
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function createBusinessExitBlip(businessId) {
|
function spawnBusinessExitBlip(businessId) {
|
||||||
if (!areServerElementsSupported()) {
|
if (!areServerElementsSupported()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2220,7 +2222,7 @@ function createBusinessExitBlip(businessId) {
|
|||||||
blipModelId = businessData.exitBlipModel;
|
blipModelId = businessData.exitBlipModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating exit blip for business ${businessData.name} (model ${blipModelId})`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Creating exit blip for business ${businessData.name} (model ${blipModelId})`);
|
||||||
|
|
||||||
let exitBlip = createGameBlip(businessData.exitPosition, blipModelId, 1, getColourByName("businessBlue"));
|
let exitBlip = createGameBlip(businessData.exitPosition, blipModelId, 1, getColourByName("businessBlue"));
|
||||||
if (exitBlip != null) {
|
if (exitBlip != null) {
|
||||||
@@ -2271,6 +2273,7 @@ function deleteBusiness(businessId, whoDeleted = 0) {
|
|||||||
removePlayersFromBusiness(businessId);
|
removePlayersFromBusiness(businessId);
|
||||||
|
|
||||||
getServerData().businesses.splice(businessId, 1);
|
getServerData().businesses.splice(businessId, 1);
|
||||||
|
updateBusinessPickupLabelData(businessId);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -2411,7 +2414,7 @@ function deleteBusinessEntrancePickup(businessId) {
|
|||||||
//removeFromWorld(getBusinessData(businessId).entrancePickup);
|
//removeFromWorld(getBusinessData(businessId).entrancePickup);
|
||||||
deleteGameElement(getBusinessData(businessId).entrancePickup);
|
deleteGameElement(getBusinessData(businessId).entrancePickup);
|
||||||
getBusinessData(businessId).entrancePickup = null;
|
getBusinessData(businessId).entrancePickup = null;
|
||||||
|
updateBusinessPickupLabelData(businessId);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2510,8 +2513,8 @@ function reloadAllBusinessesCommand(command, params, client) {
|
|||||||
//forceAllPlayersToStopWorking();
|
//forceAllPlayersToStopWorking();
|
||||||
clearArray(getServerData().businesses);
|
clearArray(getServerData().businesses);
|
||||||
getServerData().businesses = loadBusinessesFromDatabase();
|
getServerData().businesses = loadBusinessesFromDatabase();
|
||||||
createAllBusinessPickups();
|
spawnAllBusinessPickups();
|
||||||
createAllBusinessBlips();
|
spawnAllBusinessBlips();
|
||||||
setBusinessDataIndexes();
|
setBusinessDataIndexes();
|
||||||
cacheAllBusinessItems();
|
cacheAllBusinessItems();
|
||||||
|
|
||||||
@@ -2841,11 +2844,11 @@ function cacheBusinessItems(businessId) {
|
|||||||
clearArray(getBusinessData(businessId).storageItemCache);
|
clearArray(getBusinessData(businessId).storageItemCache);
|
||||||
|
|
||||||
//let businessData = getBusinessData(businessId);
|
//let businessData = getBusinessData(businessId);
|
||||||
//logToConsole(LOG_VERBOSE, `[AGRP.Business] Caching business items for business ${businessId} (${businessData.name}) ...`);
|
//logToConsole(LOG_VERBOSE, `[V.RP.Business] Caching business items for business ${businessId} (${businessData.name}) ...`);
|
||||||
//getBusinessData(businessId).floorItemCache = getServerData().items.filter(item => item.ownerType == V_ITEM_OWNER_BIZFLOOR && item.ownerId == businessData.databaseId).map(i => i.index);
|
//getBusinessData(businessId).floorItemCache = getServerData().items.filter(item => item.ownerType == V_ITEM_OWNER_BIZFLOOR && item.ownerId == businessData.databaseId).map(i => i.index);
|
||||||
//getBusinessData(businessId).storageItemCache = getServerData().items.filter(item => item.ownerType == V_ITEM_OWNER_BIZSTORAGE && item.ownerId == businessData.databaseId);
|
//getBusinessData(businessId).storageItemCache = getServerData().items.filter(item => item.ownerType == V_ITEM_OWNER_BIZSTORAGE && item.ownerId == businessData.databaseId);
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Business] Caching business items for business ${businessId} (${getBusinessData(businessId).name}) ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Business] Caching business items for business ${businessId} (${getBusinessData(businessId).name}) ...`);
|
||||||
for (let i in getServerData().items) {
|
for (let i in getServerData().items) {
|
||||||
if (getItemData(i).ownerType == V_ITEM_OWNER_BIZFLOOR && getItemData(i).ownerId == getBusinessData(businessId).databaseId) {
|
if (getItemData(i).ownerType == V_ITEM_OWNER_BIZFLOOR && getItemData(i).ownerId == getBusinessData(businessId).databaseId) {
|
||||||
getBusinessData(businessId).floorItemCache.push(i);
|
getBusinessData(businessId).floorItemCache.push(i);
|
||||||
@@ -2854,7 +2857,7 @@ function cacheBusinessItems(businessId) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Business] Successfully cached ${getBusinessData(businessId).floorItemCache.length} floor items and ${getBusinessData(businessId).storageItemCache} storage items for business ${businessId} (${getBusinessData(businessId).name})!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Business] Successfully cached ${getBusinessData(businessId).floorItemCache.length} floor items and ${getBusinessData(businessId).storageItemCache} storage items for business ${businessId} (${getBusinessData(businessId).name})!`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -2869,7 +2872,11 @@ function getBusinessIdFromDatabaseId(databaseId) {
|
|||||||
// Updates all pickup data for a business by businessId
|
// Updates all pickup data for a business by businessId
|
||||||
function updateBusinessPickupLabelData(businessId) {
|
function updateBusinessPickupLabelData(businessId) {
|
||||||
if (!areServerElementsSupported() || getGame() == V_GAME_MAFIA_ONE || getGame() == V_GAME_GTA_IV) {
|
if (!areServerElementsSupported() || getGame() == V_GAME_MAFIA_ONE || getGame() == V_GAME_GTA_IV) {
|
||||||
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));
|
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));
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2926,24 +2933,24 @@ function updateBusinessPickupLabelData(businessId) {
|
|||||||
|
|
||||||
function resetBusinessPickups(businessId) {
|
function resetBusinessPickups(businessId) {
|
||||||
deleteBusinessPickups(businessId);
|
deleteBusinessPickups(businessId);
|
||||||
createBusinessEntrancePickup(businessId);
|
spawnBusinessEntrancePickup(businessId);
|
||||||
createBusinessExitPickup(businessId);
|
spawnBusinessExitPickup(businessId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function resetBusinessBlips(businessId) {
|
function resetBusinessBlips(businessId) {
|
||||||
deleteBusinessBlips(businessId);
|
deleteBusinessBlips(businessId);
|
||||||
createBusinessEntranceBlip(businessId);
|
spawnBusinessEntranceBlip(businessId);
|
||||||
createBusinessExitBlip(businessId);
|
spawnBusinessExitBlip(businessId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function resetAllBusinessPickups(businessId) {
|
function resetAllBusinessPickups(businessId) {
|
||||||
deleteBusinessPickups(businessId);
|
deleteBusinessPickups(businessId);
|
||||||
createBusinessEntrancePickup(businessId);
|
spawnBusinessEntrancePickup(businessId);
|
||||||
createBusinessExitPickup(businessId);
|
spawnBusinessExitPickup(businessId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -2951,15 +2958,15 @@ function resetAllBusinessPickups(businessId) {
|
|||||||
function resetAllBusinessBlips() {
|
function resetAllBusinessBlips() {
|
||||||
for (let i in getServerData().businesses) {
|
for (let i in getServerData().businesses) {
|
||||||
deleteBusinessBlips(i);
|
deleteBusinessBlips(i);
|
||||||
createBusinessBlips(i);
|
spawnBusinessBlips(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function createBusinessBlips(businessId) {
|
function spawnBusinessBlips(businessId) {
|
||||||
createBusinessEntranceBlip(businessId);
|
spawnBusinessEntranceBlip(businessId);
|
||||||
createBusinessExitBlip(businessId);
|
spawnBusinessExitBlip(businessId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -2967,15 +2974,15 @@ function createBusinessBlips(businessId) {
|
|||||||
function resetAllBusinessPickups() {
|
function resetAllBusinessPickups() {
|
||||||
for (let i in getServerData().businesses) {
|
for (let i in getServerData().businesses) {
|
||||||
deleteBusinessPickups(i);
|
deleteBusinessPickups(i);
|
||||||
createBusinessPickups(i);
|
spawnBusinessPickups(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function createBusinessPickups(businessId) {
|
function spawnBusinessPickups(businessId) {
|
||||||
createBusinessEntrancePickup(businessId);
|
spawnBusinessEntrancePickup(businessId);
|
||||||
createBusinessExitPickup(businessId);
|
spawnBusinessExitPickup(businessId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -7,6 +7,17 @@
|
|||||||
// TYPE: Server (JavaScript)
|
// 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() {
|
function initChatScript() {
|
||||||
logToConsole(LOG_INFO, "[V.RP.Chat]: Initializing chat script ...");
|
logToConsole(LOG_INFO, "[V.RP.Chat]: Initializing chat script ...");
|
||||||
logToConsole(LOG_INFO, "[V.RP.Chat]: Chat script initialized successfully!");
|
logToConsole(LOG_INFO, "[V.RP.Chat]: Chat script initialized successfully!");
|
||||||
@@ -38,8 +49,17 @@ function processPlayerChat(client, messageText) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
messageText = messageText.substring(0, 128);
|
messageText = messageText.substring(0, 128);
|
||||||
messagePlayerNormal(null, `💬 ${getCharacterFullName(client)}: {MAINCOLOUR}${messageText}`, getPlayerColour(client));
|
|
||||||
messageDiscordChatChannel(`💬 ${getCharacterFullName(client)}: ${messageText}`);
|
switch (getGlobalConfig().mainChatType) {
|
||||||
|
case V_CHAT_TYPE_TALK:
|
||||||
|
talkToNearbyPlayers(client, messageText);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case V_CHAT_TYPE_GLOBAL:
|
||||||
|
default:
|
||||||
|
chatToAllPlayers(client, messageTest);
|
||||||
|
break;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
messagePlayerNormal(null, `🛡️ (ADMIN) - ${messageText}`);
|
messagePlayerNormal(null, `🛡️ (ADMIN) - ${messageText}`);
|
||||||
}
|
}
|
||||||
@@ -247,8 +267,7 @@ function replyToLastPrivateMessageCommand(command, params, client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
getPlayerData(targetClient).privateMessageReplyTo = client;
|
messagePlayerPrivateMessage(getPlayerData(client).privateMessageReplyTo, client, params);
|
||||||
messagePlayerPrivateMessage(targetClient, client, messageText);
|
|
||||||
|
|
||||||
markPlayerActionTipSeen(client, "ReplyToDirectMessage");
|
markPlayerActionTipSeen(client, "ReplyToDirectMessage");
|
||||||
}
|
}
|
||||||
@@ -417,3 +436,10 @@ function canPlayerUseMegaphone(client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
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.members = loadClanMembersFromDatabase(tempClanData.databaseId);
|
||||||
tempClanData.ranks = loadClanRanksFromDatabase(tempClanData.databaseId);
|
tempClanData.ranks = loadClanRanksFromDatabase(tempClanData.databaseId);
|
||||||
tempClans.push(tempClanData);
|
tempClans.push(tempClanData);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Clan]: Clan '${tempClanData.name}' loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Clan]: Clan '${tempClanData.name}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_INFO, `[AGRP.Clan]: ${tempClans.length} clans loaded from database successfully!`);
|
logToConsole(LOG_INFO, `[V.RP.Clan]: ${tempClans.length} clans loaded from database successfully!`);
|
||||||
return tempClans;
|
return tempClans;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,20 +158,20 @@ function loadClanMembersFromDatabase() {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempClanData = new ClanData(dbAssoc[i]);
|
let tempClanData = new ClanData(dbAssoc[i]);
|
||||||
tempClans.push(tempClanData);
|
tempClans.push(tempClanData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Clan]: Clan '${tempClanData.name}' loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Clan]: Clan '${tempClanData.name}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_INFO, `[AGRP.Clan]: ${tempClans.length} clans loaded from database successfully!`);
|
logToConsole(LOG_INFO, `[V.RP.Clan]: ${tempClans.length} clans loaded from database successfully!`);
|
||||||
return tempClans;
|
return tempClans;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadClanRanksFromDatabase(clanDatabaseId) {
|
function loadClanRanksFromDatabase(clanDatabaseId) {
|
||||||
logToConsole(LOG_INFO, `[AGRP.Clan]: Loading ranks for clan ${clanDatabaseId} from database ...`);
|
logToConsole(LOG_INFO, `[V.RP.Clan]: Loading ranks for clan ${clanDatabaseId} from database ...`);
|
||||||
|
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
let dbAssoc = [];
|
let dbAssoc = [];
|
||||||
@@ -184,13 +184,13 @@ function loadClanRanksFromDatabase(clanDatabaseId) {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempClanRankData = new ClanRankData(dbAssoc[i]);
|
let tempClanRankData = new ClanRankData(dbAssoc[i]);
|
||||||
tempClanRanks.push(tempClanRankData);
|
tempClanRanks.push(tempClanRankData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Clan]: Clan rank '${tempClanRankData.name}' loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Clan]: Clan rank '${tempClanRankData.name}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_INFO, `[AGRP.Clan]: Loaded ranks for clan ${clanDatabaseId} from database successfully!`);
|
logToConsole(LOG_INFO, `[V.RP.Clan]: Loaded ranks for clan ${clanDatabaseId} from database successfully!`);
|
||||||
return tempClanRanks;
|
return tempClanRanks;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1285,10 +1285,10 @@ function setClanRankTitle(clanId, rankId, title) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function saveAllClansToDatabase() {
|
function saveAllClansToDatabase() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Clan]: Saving all server clans to database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Clan]: Saving all server clans to database ...`);
|
||||||
|
|
||||||
if (getServerConfig().devServer) {
|
if (getServerConfig().devServer) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Clan]: Aborting save all clans to database, dev server is enabled.`);
|
logToConsole(LOG_DEBUG, `[V.RP.Clan]: Aborting save all clans to database, dev server is enabled.`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1296,7 +1296,7 @@ function saveAllClansToDatabase() {
|
|||||||
saveClanToDatabase(i);
|
saveClanToDatabase(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_INFO, `[AGRP.Clan]: Saved all server clans to database`);
|
logToConsole(LOG_INFO, `[V.RP.Clan]: Saved all server clans to database`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ function initClientScript() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function resetClientStuff(client) {
|
function resetClientStuff(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities] Resetting client data for ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities] Resetting client data for ${getPlayerDisplayForConsole(client)}`);
|
||||||
|
|
||||||
if (!getPlayerData(client)) {
|
if (!getPlayerData(client)) {
|
||||||
return false;
|
return false;
|
||||||
@@ -207,15 +207,15 @@ function kickAllClients() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initClient(client) {
|
function initClient(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] Initializing client ${getPlayerDisplayForConsole(client)} ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] Initializing client ${getPlayerDisplayForConsole(client)} ...`);
|
||||||
|
|
||||||
if (isConsole(client)) {
|
if (isConsole(client)) {
|
||||||
logToConsole(LOG_DEBUG | LOG_ERROR, `[AGRP.Account] Client initialization failed for ${getPlayerDisplayForConsole(client)}! (is console client)`);
|
logToConsole(LOG_DEBUG | LOG_ERROR, `[V.RP.Account] Client initialization failed for ${getPlayerDisplayForConsole(client)}! (is console client)`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerInitialized[client.index] == true) {
|
if (playerInitialized[client.index] == true) {
|
||||||
logToConsole(LOG_DEBUG | LOG_ERROR, `[AGRP.Account] Client initialization failed for ${getPlayerDisplayForConsole(client)}! (already initialized)`);
|
logToConsole(LOG_DEBUG | LOG_ERROR, `[V.RP.Account] Client initialization failed for ${getPlayerDisplayForConsole(client)}! (already initialized)`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,25 +223,25 @@ function initClient(client) {
|
|||||||
|
|
||||||
//setEntityData(client, "v.rp.isInitialized", true, false);
|
//setEntityData(client, "v.rp.isInitialized", true, false);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] Initializing GUI for ${getPlayerDisplayForConsole(client)} ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] Initializing GUI for ${getPlayerDisplayForConsole(client)} ...`);
|
||||||
sendPlayerCurrencyString(client);
|
sendPlayerCurrencyString(client);
|
||||||
sendPlayerGUIColours(client);
|
sendPlayerGUIColours(client);
|
||||||
sendPlayerGUIInit(client);
|
sendPlayerGUIInit(client);
|
||||||
updatePlayerSnowState(client, getServerConfig().groundSnow);
|
updatePlayerSnowState(client, getServerConfig().groundSnow);
|
||||||
|
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Account] Showing connect camera to ${getPlayerDisplayForConsole(client)} ...`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Account] Showing connect camera to ${getPlayerDisplayForConsole(client)} ...`);
|
||||||
//showConnectCameraToPlayer(client);
|
//showConnectCameraToPlayer(client);
|
||||||
|
|
||||||
messageClient(`Please wait ...`, client, getColourByName("softGreen"));
|
messageClient(`Please wait ...`, client, getColourByName("softGreen"));
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] Waiting for 2.5 seconds to prevent race attack ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] Waiting for 2.5 seconds to prevent race attack ...`);
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
if (client != null) {
|
if (client != null) {
|
||||||
clearChatBox(client);
|
clearChatBox(client);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] Loading account for ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] Loading account for ${getPlayerDisplayForConsole(client)}`);
|
||||||
let tempAccountData = loadAccountFromName(getPlayerName(client), true);
|
let tempAccountData = loadAccountFromName(getPlayerName(client), true);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] Loading subaccounts for ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] Loading subaccounts for ${getPlayerDisplayForConsole(client)}`);
|
||||||
let tempSubAccounts = loadSubAccountsFromAccount(tempAccountData.databaseId);
|
let tempSubAccounts = loadSubAccountsFromAccount(tempAccountData.databaseId);
|
||||||
|
|
||||||
getServerData().clients[getPlayerId(client)] = new ClientData(client, tempAccountData, tempSubAccounts);
|
getServerData().clients[getPlayerId(client)] = new ClientData(client, tempAccountData, tempSubAccounts);
|
||||||
@@ -258,10 +258,10 @@ function initClient(client) {
|
|||||||
playRadioStreamForPlayer(client, getServerIntroMusicURL(), true, getPlayerStreamingRadioVolume(client));
|
playRadioStreamForPlayer(client, getServerIntroMusicURL(), true, getPlayerStreamingRadioVolume(client));
|
||||||
} else {
|
} else {
|
||||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI.`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login GUI.`);
|
||||||
showPlayerLoginGUI(client);
|
showPlayerLoginGUI(client);
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled).`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the login message (GUI disabled).`);
|
||||||
messagePlayerNormal(client, getLocaleString(client, "WelcomeBack", getServerName(), getPlayerName(client), "/login"), getColourByName("softGreen"));
|
messagePlayerNormal(client, getLocaleString(client, "WelcomeBack", getServerName(), getPlayerName(client), "/login"), getColourByName("softGreen"));
|
||||||
|
|
||||||
if (checkForGeoIPModule()) {
|
if (checkForGeoIPModule()) {
|
||||||
@@ -281,10 +281,10 @@ function initClient(client) {
|
|||||||
} else {
|
} else {
|
||||||
sendPlayerLocaleId(client, 0);
|
sendPlayerLocaleId(client, 0);
|
||||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI.`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register GUI.`);
|
||||||
showPlayerRegistrationGUI(client);
|
showPlayerRegistrationGUI(client);
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register message (GUI disabled).`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] ${getPlayerDisplayForConsole(client)} is being shown the register message (GUI disabled).`);
|
||||||
messagePlayerNormal(client, getLocaleString(client, "WelcomeNewPlayer", getServerName(), getPlayerName(client), "/register"), getColourByName("softGreen"));
|
messagePlayerNormal(client, getLocaleString(client, "WelcomeNewPlayer", getServerName(), getPlayerName(client), "/register"), getColourByName("softGreen"));
|
||||||
}
|
}
|
||||||
playRadioStreamForPlayer(client, getServerIntroMusicURL(), true, getPlayerStreamingRadioVolume(client));
|
playRadioStreamForPlayer(client, getServerIntroMusicURL(), true, getPlayerStreamingRadioVolume(client));
|
||||||
|
|||||||
@@ -454,6 +454,8 @@ function loadCommands() {
|
|||||||
new CommandData("language", setLocaleCommand, "<language name>", getStaffFlagValue("None"), true, false, "Sets your language"),
|
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("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("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: [],
|
messaging: [],
|
||||||
misc: [
|
misc: [
|
||||||
@@ -703,20 +705,24 @@ function loadCommands() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function addAllCommandHandlers() {
|
function addAllCommandHandlers() {
|
||||||
|
if (!isGameFeatureSupported("commandHandler")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
let commandCount = 0;
|
let commandCount = 0;
|
||||||
let commands = getCommands();
|
let commands = getCommands();
|
||||||
for (let i in commands) {
|
for (let i in commands) {
|
||||||
for (let j in commands[i]) {
|
for (let j in commands[i]) {
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Command] Adding command handler for ${i} - ${commands[i][j].command}`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Command] Adding command handler for ${i} - ${commands[i][j].command}`);
|
||||||
addCommandHandler(commands[i][j].command, processPlayerCommand);
|
addCommandHandler(commands[i][j].command, processPlayerCommand);
|
||||||
commandCount++;
|
commandCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
removeCommandHandler("help");
|
//removeCommandHandler("help");
|
||||||
addCommandHandler("help", helpCommand);
|
//addCommandHandler("help", helpCommand);
|
||||||
|
|
||||||
logToConsole(LOG_INFO, `[AGRP.Command] ${commandCount} command handlers added!`);
|
logToConsole(LOG_INFO, `[V.RP.Command] ${commandCount} command handlers added!`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -882,6 +888,12 @@ function processPlayerCommand(command, params, client) {
|
|||||||
return true;
|
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 commandData = getCommand(toLowerCase(command));
|
||||||
|
|
||||||
let paramsDisplay = params;
|
let paramsDisplay = params;
|
||||||
@@ -890,7 +902,7 @@ function processPlayerCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!doesCommandExist(toLowerCase(command))) {
|
if (!doesCommandExist(toLowerCase(command))) {
|
||||||
logToConsole(LOG_WARN, `[AGRP.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (invalid command): /${command} ${paramsDisplay}`);
|
logToConsole(LOG_WARN, `[V.RP.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (invalid command): /${command} ${paramsDisplay}`);
|
||||||
|
|
||||||
let possibleCommand = getCommandFromParams(command);
|
let possibleCommand = getCommandFromParams(command);
|
||||||
if (possibleCommand != false && doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(toLowerCase(possibleCommand.command)))) {
|
if (possibleCommand != false && doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(toLowerCase(possibleCommand.command)))) {
|
||||||
@@ -902,7 +914,7 @@ function processPlayerCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!commandData.enabled) {
|
if (!commandData.enabled) {
|
||||||
logToConsole(LOG_WARN, `[AGRP.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (command is disabled): /${command} ${paramsDisplay}`);
|
logToConsole(LOG_WARN, `[V.RP.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (command is disabled): /${command} ${paramsDisplay}`);
|
||||||
messagePlayerError(client, `The command {ALTCOLOUR}/${command}{MAINCOLOUR} is disabled!`);
|
messagePlayerError(client, `The command {ALTCOLOUR}/${command}{MAINCOLOUR} is disabled!`);
|
||||||
messagePlayerError(client, getLocaleString(client, "CommandDisabled", `{ALTCOLOUR}/${command}{MAINCOLOUR}`));
|
messagePlayerError(client, getLocaleString(client, "CommandDisabled", `{ALTCOLOUR}/${command}{MAINCOLOUR}`));
|
||||||
return false;
|
return false;
|
||||||
@@ -910,7 +922,7 @@ function processPlayerCommand(command, params, client) {
|
|||||||
|
|
||||||
if (doesCommandRequireLogin(toLowerCase(command))) {
|
if (doesCommandRequireLogin(toLowerCase(command))) {
|
||||||
if (!isPlayerLoggedIn(client)) {
|
if (!isPlayerLoggedIn(client)) {
|
||||||
logToConsole(LOG_WARN, `[AGRP.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (requires login first): /${command} ${paramsDisplay}`);
|
logToConsole(LOG_WARN, `[V.RP.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (requires login first): /${command} ${paramsDisplay}`);
|
||||||
messagePlayerError(client, getLocaleString(client, "CommandRequiresLogin", `{ALTCOLOUR}/${command}{MAINCOLOUR}`));
|
messagePlayerError(client, getLocaleString(client, "CommandRequiresLogin", `{ALTCOLOUR}/${command}{MAINCOLOUR}`));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -918,7 +930,7 @@ function processPlayerCommand(command, params, client) {
|
|||||||
|
|
||||||
if (isClientFromDiscord(client)) {
|
if (isClientFromDiscord(client)) {
|
||||||
if (!isCommandAllowedOnDiscord(command)) {
|
if (!isCommandAllowedOnDiscord(command)) {
|
||||||
logToConsole(LOG_WARN, `[AGRP.Command] ${getPlayerDisplayForConsole(client)} attempted to use command from discord, but failed (not available on discord): /${command} ${paramsDisplay}`);
|
logToConsole(LOG_WARN, `[V.RP.Command] ${getPlayerDisplayForConsole(client)} attempted to use command from discord, but failed (not available on discord): /${command} ${paramsDisplay}`);
|
||||||
messagePlayerError(client, `The {ALTCOLOUR}/${command}{MAINCOLOUR} command isn't available on discord!`);
|
messagePlayerError(client, `The {ALTCOLOUR}/${command}{MAINCOLOUR} command isn't available on discord!`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -926,13 +938,13 @@ function processPlayerCommand(command, params, client) {
|
|||||||
|
|
||||||
if (!isConsole(client)) {
|
if (!isConsole(client)) {
|
||||||
if (!doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(toLowerCase(command)))) {
|
if (!doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(toLowerCase(command)))) {
|
||||||
logToConsole(LOG_WARN, `[AGRP.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (no permission): /${command} ${paramsDisplay}`);
|
logToConsole(LOG_WARN, `[V.RP.Command] ${getPlayerDisplayForConsole(client)} attempted to use command, but failed (no permission): /${command} ${paramsDisplay}`);
|
||||||
messagePlayerError(client, getLocaleString(client, "CommandNoPermissions", `{ALTCOLOUR}/${toLowerCase(command)}{MAINCOLOUR}`));
|
messagePlayerError(client, getLocaleString(client, "CommandNoPermissions", `{ALTCOLOUR}/${toLowerCase(command)}{MAINCOLOUR}`));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Command] ${getPlayerDisplayForConsole(client)} used command: /${command} ${paramsDisplay}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Command] ${getPlayerDisplayForConsole(client)} used command: /${command} ${paramsDisplay}`);
|
||||||
commandData.handlerFunction(toLowerCase(command), params, client);
|
commandData.handlerFunction(toLowerCase(command), params, client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -125,8 +125,8 @@ class ServerConfigData {
|
|||||||
this.discordBotToken = intToBool(dbAssoc["svr_discord_bot_token"]);
|
this.discordBotToken = intToBool(dbAssoc["svr_discord_bot_token"]);
|
||||||
this.introMusicURL = dbAssoc["svr_intro_music"];
|
this.introMusicURL = dbAssoc["svr_intro_music"];
|
||||||
|
|
||||||
this.useRealTime = intToBool(toInteger(dbAssoc["svr_real_time_enabled"]));
|
this.useRealTime = intToBool(toInteger(dbAssoc["svr_real_time"]));
|
||||||
this.realTimeZone = dbAssoc["svr_real_time_timezone"];
|
this.realTimeZone = toInteger(dbAssoc["svr_real_time_timezone"]);
|
||||||
|
|
||||||
this.discord = {
|
this.discord = {
|
||||||
sendEvents: intToBool(dbAssoc["svr_discord_send_events"]),
|
sendEvents: intToBool(dbAssoc["svr_discord_send_events"]),
|
||||||
@@ -140,8 +140,8 @@ class ServerConfigData {
|
|||||||
passiveIncome: toFloat(dbAssoc["svr_passive_income"]),
|
passiveIncome: toFloat(dbAssoc["svr_passive_income"]),
|
||||||
}
|
}
|
||||||
|
|
||||||
this.devServer = intToBool(toInteger(server.getCVar("agrp_devserver")));
|
this.devServer = intToBool(toInteger(server.getCVar("v_devserver")));
|
||||||
this.testerOnly = intToBool(toInteger(server.getCVar("agrp_testeronly")));
|
this.testerOnly = intToBool(toInteger(server.getCVar("v_testeronly")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -250,6 +250,9 @@ let globalConfig = {
|
|||||||
"ChatBoxTimestamps",
|
"ChatBoxTimestamps",
|
||||||
"ChatEmoji",
|
"ChatEmoji",
|
||||||
],
|
],
|
||||||
|
mainChatType: V_CHAT_TYPE_TALK,
|
||||||
|
nightMapStartHour: 19,
|
||||||
|
nightMapEndHour: 7,
|
||||||
};
|
};
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -266,49 +269,49 @@ function loadGlobalConfig() {
|
|||||||
try {
|
try {
|
||||||
getGlobalConfig().database = loadDatabaseConfig();
|
getGlobalConfig().database = loadDatabaseConfig();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logToConsole(LOG_ERROR, `[AGRP.Config] Failed to load global configuration. Error: ${error}`);
|
logToConsole(LOG_ERROR, `[V.RP.Config] Failed to load global configuration. Error: ${error}`);
|
||||||
thisResource.stop();
|
thisResource.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
getGlobalConfig().economy = loadEconomyConfig();
|
getGlobalConfig().economy = loadEconomyConfig();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logToConsole(LOG_ERROR, `[AGRP.Config] Failed to load economy configuration. Error: ${error}`);
|
logToConsole(LOG_ERROR, `[V.RP.Config] Failed to load economy configuration. Error: ${error}`);
|
||||||
thisResource.stop();
|
thisResource.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
getGlobalConfig().locale = loadLocaleConfig();
|
getGlobalConfig().locale = loadLocaleConfig();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logToConsole(LOG_ERROR, `[AGRP.Config] Failed to load locale configuration. Error: ${error}`);
|
logToConsole(LOG_ERROR, `[V.RP.Config] Failed to load locale configuration. Error: ${error}`);
|
||||||
thisResource.stop();
|
thisResource.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
getGlobalConfig().accents = loadAccentConfig();
|
getGlobalConfig().accents = loadAccentConfig();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logToConsole(LOG_ERROR, `[AGRP.Config] Failed to load accent configuration. Error: ${error}`);
|
logToConsole(LOG_ERROR, `[V.RP.Config] Failed to load accent configuration. Error: ${error}`);
|
||||||
thisResource.stop();
|
thisResource.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
getGlobalConfig().discord = loadDiscordConfig();
|
getGlobalConfig().discord = loadDiscordConfig();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logToConsole(LOG_ERROR, `[AGRP.Config] Failed to load discord configuration. Error: ${error}`);
|
logToConsole(LOG_ERROR, `[V.RP.Config] Failed to load discord configuration. Error: ${error}`);
|
||||||
thisResource.stop();
|
thisResource.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
getGlobalConfig().keyBind = loadKeyBindConfig();
|
getGlobalConfig().keyBind = loadKeyBindConfig();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logToConsole(LOG_ERROR, `[AGRP.Config] Failed to load keybind configuration. Error: ${error}`);
|
logToConsole(LOG_ERROR, `[V.RP.Config] Failed to load keybind configuration. Error: ${error}`);
|
||||||
thisResource.stop();
|
thisResource.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
getGlobalConfig().email = loadEmailConfig();
|
getGlobalConfig().email = loadEmailConfig();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logToConsole(LOG_ERROR, `[AGRP.Config] Failed to load email configuration. Error: ${error}`);
|
logToConsole(LOG_ERROR, `[V.RP.Config] Failed to load email configuration. Error: ${error}`);
|
||||||
thisResource.stop();
|
thisResource.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -379,12 +382,12 @@ function applyConfigToServer(tempServerConfig) {
|
|||||||
updateServerGameTime();
|
updateServerGameTime();
|
||||||
|
|
||||||
//if (isTimeSupported()) {
|
//if (isTimeSupported()) {
|
||||||
// logToConsole(LOG_DEBUG, `[AGRP.Config]: Setting time to to ${tempServerConfig.hour}:${tempServerConfig.minute} with minute duration of ${tempServerConfig.minuteDuration}`);
|
// logToConsole(LOG_DEBUG, `[V.RP.Config]: Setting time to to ${tempServerConfig.hour}:${tempServerConfig.minute} with minute duration of ${tempServerConfig.minuteDuration}`);
|
||||||
// setGameTime(tempServerConfig.hour, tempServerConfig.minute, tempServerConfig.minuteDuration);
|
// setGameTime(tempServerConfig.hour, tempServerConfig.minute, tempServerConfig.minuteDuration);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if (isWeatherSupported()) {
|
if (isWeatherSupported()) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Config]: Setting weather to ${tempServerConfig.weather}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Config]: Setting weather to ${tempServerConfig.weather}`);
|
||||||
game.forceWeather(getWeatherData(tempServerConfig.weather).weatherId);
|
game.forceWeather(getWeatherData(tempServerConfig.weather).weatherId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -394,7 +397,7 @@ function applyConfigToServer(tempServerConfig) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function saveServerConfigToDatabase() {
|
function saveServerConfigToDatabase() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Config]: Saving server ${getServerConfig().databaseId} configuration to database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Config]: Saving server ${getServerConfig().databaseId} configuration to database ...`);
|
||||||
if (getServerConfig().needsSaved) {
|
if (getServerConfig().needsSaved) {
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
@@ -446,6 +449,8 @@ function saveServerConfigToDatabase() {
|
|||||||
["svr_job_blips", getServerConfig().createJobBlips],
|
["svr_job_blips", getServerConfig().createJobBlips],
|
||||||
["svr_job_pickups", getServerConfig().createJobPickups],
|
["svr_job_pickups", getServerConfig().createJobPickups],
|
||||||
["svr_nametag_distance", getServerConfig().nameTagDistance],
|
["svr_nametag_distance", getServerConfig().nameTagDistance],
|
||||||
|
["svr_real_time", boolToInt(getServerConfig().useRealTime)],
|
||||||
|
["svr_real_time_timezone", getServerConfig().realTimeZone],
|
||||||
];
|
];
|
||||||
|
|
||||||
let dbQuery = null;
|
let dbQuery = null;
|
||||||
@@ -458,7 +463,7 @@ function saveServerConfigToDatabase() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Config]: Server ${getServerConfig().databaseId} configuration saved to database!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Config]: Server ${getServerConfig().databaseId} configuration saved to database!`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -932,7 +937,7 @@ function reloadEmailConfigurationCommand(command, params, client) {
|
|||||||
*/
|
*/
|
||||||
function reloadDatabaseConfigurationCommand(command, params, client) {
|
function reloadDatabaseConfigurationCommand(command, params, client) {
|
||||||
if (getDatabaseConfig().usePersistentConnection && isDatabaseConnected(persistentDatabaseConnection)) {
|
if (getDatabaseConfig().usePersistentConnection && isDatabaseConnected(persistentDatabaseConnection)) {
|
||||||
logToConsole(LOG_WARN, `[AGRP.Database] Closing persistent database connection`);
|
logToConsole(LOG_WARN, `[V.RP.Database] Closing persistent database connection`);
|
||||||
persistentDatabaseConnection.close();
|
persistentDatabaseConnection.close();
|
||||||
persistentDatabaseConnection = null;
|
persistentDatabaseConnection = null;
|
||||||
}
|
}
|
||||||
@@ -980,7 +985,7 @@ function getServerIntroMusicURL() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadLocaleConfig() {
|
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`));
|
let localeConfig = JSON.parse(loadTextFile(`config/locale.json`));
|
||||||
if (localeConfig != null) {
|
if (localeConfig != null) {
|
||||||
return localeConfig;
|
return localeConfig;
|
||||||
@@ -990,7 +995,7 @@ function loadLocaleConfig() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadEconomyConfig() {
|
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`));
|
let economyConfig = JSON.parse(loadTextFile(`config/economy.json`));
|
||||||
if (economyConfig != null) {
|
if (economyConfig != null) {
|
||||||
return economyConfig;
|
return economyConfig;
|
||||||
@@ -1000,7 +1005,7 @@ function loadEconomyConfig() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadAccentConfig() {
|
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`));
|
let accentConfig = JSON.parse(loadTextFile(`config/accents.json`));
|
||||||
if (accentConfig != null) {
|
if (accentConfig != null) {
|
||||||
return accentConfig;
|
return accentConfig;
|
||||||
@@ -1010,7 +1015,7 @@ function loadAccentConfig() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadDiscordConfig() {
|
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`));
|
let discordConfig = JSON.parse(loadTextFile(`config/discord.json`));
|
||||||
if (discordConfig != null) {
|
if (discordConfig != null) {
|
||||||
return discordConfig;
|
return discordConfig;
|
||||||
@@ -1021,7 +1026,7 @@ function loadDiscordConfig() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadDatabaseConfig() {
|
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"));
|
let databaseConfig = JSON.parse(loadTextFile("config/database.json"));
|
||||||
if (databaseConfig != null) {
|
if (databaseConfig != null) {
|
||||||
return databaseConfig;
|
return databaseConfig;
|
||||||
@@ -1032,7 +1037,7 @@ function loadDatabaseConfig() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadKeyBindConfig() {
|
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"));
|
let keyBindConfig = JSON.parse(loadTextFile("config/keybind.json"));
|
||||||
if (keyBindConfig != null) {
|
if (keyBindConfig != null) {
|
||||||
return keyBindConfig;
|
return keyBindConfig;
|
||||||
@@ -1043,7 +1048,7 @@ function loadKeyBindConfig() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadEmailConfig() {
|
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"));
|
let emailConfig = JSON.parse(loadTextFile("config/email.json"));
|
||||||
if (emailConfig != null) {
|
if (emailConfig != null) {
|
||||||
return emailConfig;
|
return emailConfig;
|
||||||
@@ -1126,20 +1131,30 @@ function getDatabaseConfig() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadServerConfig() {
|
function loadServerConfig() {
|
||||||
logToConsole(LOG_DEBUG, "[V.RP.Config] Loading server configuration");
|
logToConsole(LOG_DEBUG, "[V.RP.Config] Loading server configuration ...");
|
||||||
|
|
||||||
if (toInteger(server.getCVar("agrp_devserver")) == 1) {
|
if (toInteger(server.getCVar("v_devserver")) == 1) {
|
||||||
serverConfig = loadServerConfigFromGame(getGame());
|
try {
|
||||||
|
serverConfig = loadServerConfigFromGame(getGame());
|
||||||
|
|
||||||
if (serverConfig == false) {
|
if (serverConfig == false) {
|
||||||
logToConsole(LOG_ERROR, `[AGRP.Config] Could not load server configuration for game ${getGame()}`);
|
logToConsole(LOG_ERROR, `[V.RP.Config] Could not load server configuration for game ${getGame()}`);
|
||||||
|
server.shutdown();
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
logToConsole(LOG_ERROR, `[V.RP.Config] Could not load server configuration for game ${getGame()} (${error})`);
|
||||||
server.shutdown();
|
server.shutdown();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
serverConfig = loadServerConfigFromGameAndPort(getGame(), getServerPort());
|
try {
|
||||||
|
serverConfig = loadServerConfigFromGameAndPort(getGame(), getServerPort());
|
||||||
|
|
||||||
if (serverConfig == false) {
|
if (serverConfig == false) {
|
||||||
logToConsole(LOG_ERROR, `[AGRP.Config] Could not load server configuration for game ${getGame()} and port ${getServerPort()}`);
|
logToConsole(LOG_ERROR, `[V.RP.Config] Could not load server configuration for game ${getGame()} and port ${getServerPort()}`);
|
||||||
|
server.shutdown();
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
logToConsole(LOG_ERROR, `[V.RP.Config] Could not load server configuration for game ${getGame()} (${error})`);
|
||||||
server.shutdown();
|
server.shutdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -643,9 +643,9 @@ function fixAllServerBlipsCommand(command, params, client) {
|
|||||||
deleteGameElement(blip);
|
deleteGameElement(blip);
|
||||||
});
|
});
|
||||||
|
|
||||||
createAllJobBlips();
|
spawnAllJobBlips();
|
||||||
createAllBusinessBlips();
|
spawnAllBusinessBlips();
|
||||||
createAllHouseBlips();
|
spawnAllHouseBlips();
|
||||||
|
|
||||||
messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} reset all server blips`);
|
messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} reset all server blips`);
|
||||||
}
|
}
|
||||||
@@ -658,9 +658,9 @@ function fixAllServerPickupsCommand(command, params, client) {
|
|||||||
deleteGameElement(pickup);
|
deleteGameElement(pickup);
|
||||||
});
|
});
|
||||||
|
|
||||||
createAllJobPickups();
|
spawnAllJobPickups();
|
||||||
createAllBusinessPickups();
|
spawnAllBusinessPickups();
|
||||||
createAllHousePickups();
|
spawnAllHousePickups();
|
||||||
|
|
||||||
messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} reset all server pickups`);
|
messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} reset all server pickups`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,33 +15,8 @@ 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) {
|
function onPlayerConnect(event, ipAddress, port) {
|
||||||
logToConsole(LOG_INFO, `[AGRP.Event] onPlayerConnect - Client connecting (IP: ${ipAddress})`);
|
logToConsole(LOG_INFO, `[V.RP.Event] onPlayerConnect - Client connecting (IP: ${ipAddress})`);
|
||||||
//if(isIpAddressBanned(ipAddress)) {
|
//if(isIpAddressBanned(ipAddress)) {
|
||||||
// messagePlayerError(client, "You are banned from this server!");
|
// messagePlayerError(client, "You are banned from this server!");
|
||||||
// return false;
|
// return false;
|
||||||
@@ -51,7 +26,7 @@ function onPlayerConnect(event, ipAddress, port) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPlayerJoin(event, client) {
|
function onPlayerJoin(event, client) {
|
||||||
logToConsole(LOG_INFO, `[AGRP.Event] onPlayerJoin - Client ${getPlayerDisplayForConsole(client)} joining from ${getPlayerIP(client)}`);
|
logToConsole(LOG_INFO, `[V.RP.Event] onPlayerJoin - Client ${getPlayerDisplayForConsole(client)} joining from ${getPlayerIP(client)}`);
|
||||||
|
|
||||||
playerResourceReady[getPlayerId(client)] = false;
|
playerResourceReady[getPlayerId(client)] = false;
|
||||||
playerResourceStarted[getPlayerId(client)] = false;
|
playerResourceStarted[getPlayerId(client)] = false;
|
||||||
@@ -72,7 +47,7 @@ function onPlayerJoin(event, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPlayerJoined(event, client) {
|
function onPlayerJoined(event, client) {
|
||||||
logToConsole(LOG_INFO, `[AGRP.Event] onPlayerJoined - Client ${getPlayerDisplayForConsole(client)} joined from ${getPlayerIP(client)}`);
|
logToConsole(LOG_INFO, `[V.RP.Event] onPlayerJoined - Client ${getPlayerDisplayForConsole(client)} joined from ${getPlayerIP(client)}`);
|
||||||
//initClient(client);
|
//initClient(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,7 +184,7 @@ function onPedExitingVehicle(event, ped, vehicle) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onResourceStart(event, resource) {
|
function onResourceStart(event, resource) {
|
||||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Resource ${resource.name} started!`);
|
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Resource ${resource.name} started!`);
|
||||||
|
|
||||||
if (resource == thisResource) {
|
if (resource == thisResource) {
|
||||||
//messageAdmins(`{MAINCOLOUR}Resource {ALTCOLOUR}${resource.name}{MAINCOLOUR} started!`);
|
//messageAdmins(`{MAINCOLOUR}Resource {ALTCOLOUR}${resource.name}{MAINCOLOUR} started!`);
|
||||||
@@ -220,7 +195,7 @@ function onResourceStart(event, resource) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onResourceStop(event, resource) {
|
function onResourceStop(event, resource) {
|
||||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Resource ${resource.name} stopped!`);
|
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Resource ${resource.name} stopped!`);
|
||||||
|
|
||||||
//if(resource != thisResource) {
|
//if(resource != thisResource) {
|
||||||
// messageAdmins(`{MAINCOLOUR}Resource {ALTCOLOUR}${resource.name}{MAINCOLOUR} stopped!`);
|
// messageAdmins(`{MAINCOLOUR}Resource {ALTCOLOUR}${resource.name}{MAINCOLOUR} stopped!`);
|
||||||
@@ -239,6 +214,8 @@ function onResourceStop(event, resource) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPedEnteredSphere(event, ped, sphere) {
|
function onPedEnteredSphere(event, ped, sphere) {
|
||||||
|
logToConsole(LOG_WARN | LOG_VERBOSE, `[V.RP.Event] OnPedEnteredSphere event called`);
|
||||||
|
|
||||||
if (ped == null) {
|
if (ped == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -247,7 +224,7 @@ function onPedEnteredSphere(event, ped, sphere) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} entered sphere ${sphere.id}!`);
|
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Ped ${ped.id} entered sphere ${sphere.id}!`);
|
||||||
//if (ped.isType(ELEMENT_PLAYER)) {
|
//if (ped.isType(ELEMENT_PLAYER)) {
|
||||||
// let client = getClientFromPlayerElement(ped);
|
// let client = getClientFromPlayerElement(ped);
|
||||||
|
|
||||||
@@ -263,6 +240,8 @@ function onPedEnteredSphere(event, ped, sphere) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPedExitedSphere(event, ped, sphere) {
|
function onPedExitedSphere(event, ped, sphere) {
|
||||||
|
logToConsole(LOG_WARN | LOG_VERBOSE, `[V.RP.Event] OnPedExitedSphere event called`);
|
||||||
|
|
||||||
if (ped == null) {
|
if (ped == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -271,7 +250,7 @@ function onPedExitedSphere(event, ped, sphere) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} exited sphere ${sphere.id}!`);
|
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Ped ${ped.id} exited sphere ${sphere.id}!`);
|
||||||
//if (ped.isType(ELEMENT_PLAYER)) {
|
//if (ped.isType(ELEMENT_PLAYER)) {
|
||||||
// let client = getClientFromPlayerElement(ped);
|
// let client = getClientFromPlayerElement(ped);
|
||||||
//}
|
//}
|
||||||
@@ -280,6 +259,8 @@ function onPedExitedSphere(event, ped, sphere) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPedPickupPickedUp(event, ped, pickup) {
|
function onPedPickupPickedUp(event, ped, pickup) {
|
||||||
|
logToConsole(LOG_WARN | LOG_VERBOSE, `[V.RP.Event] OnPedPickupPickedUp event called`);
|
||||||
|
|
||||||
if (ped == null) {
|
if (ped == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -288,7 +269,7 @@ function onPedPickupPickedUp(event, ped, pickup) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} picked up pickup ${pickup.id}!`);
|
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Ped ${ped.id} picked up pickup ${pickup.id}!`);
|
||||||
|
|
||||||
if (ped.isType(ELEMENT_PLAYER)) {
|
if (ped.isType(ELEMENT_PLAYER)) {
|
||||||
let client = getClientFromPlayerElement(ped);
|
let client = getClientFromPlayerElement(ped);
|
||||||
@@ -305,7 +286,7 @@ function onPedPickupPickedUp(event, ped, pickup) {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
function onPedWasted(event, ped, killerPed, weapon, pedPiece) {
|
function onPedWasted(event, ped, killerPed, weapon, pedPiece) {
|
||||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} wasted by ped ${killerPed.id}!`);
|
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Ped ${ped.id} wasted by ped ${killerPed.id}!`);
|
||||||
|
|
||||||
if (ped.isType(ELEMENT_PLAYER)) {
|
if (ped.isType(ELEMENT_PLAYER)) {
|
||||||
let killerClient = null;
|
let killerClient = null;
|
||||||
@@ -319,8 +300,13 @@ function onPedWasted(event, ped, killerPed, weapon, pedPiece) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPlayerDeath(client, killer, weapon, pedPiece) {
|
function onPlayerDeath(client, killer, weapon = 0, pedPiece = 0) {
|
||||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Player ${getPlayerDisplayForConsole(client)} died!`);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
logToConsole(LOG_INFO, `${getPlayerDisplayForConsole(client)} died.`);
|
logToConsole(LOG_INFO, `${getPlayerDisplayForConsole(client)} died.`);
|
||||||
getPlayerData(client).pedState = V_PEDSTATE_DEAD;
|
getPlayerData(client).pedState = V_PEDSTATE_DEAD;
|
||||||
@@ -328,7 +314,7 @@ function onPlayerDeath(client, killer, weapon, pedPiece) {
|
|||||||
setPlayerControlState(client, false);
|
setPlayerControlState(client, false);
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
if (isFadeCameraSupported()) {
|
if (isFadeCameraSupported()) {
|
||||||
fadeCamera(client, false, 1.0);
|
fadePlayerCamera(client, false, 1000);
|
||||||
}
|
}
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
if (isPlayerInPaintBall(client)) {
|
if (isPlayerInPaintBall(client)) {
|
||||||
@@ -350,6 +336,7 @@ function onPlayerDeath(client, killer, weapon, pedPiece) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
respawnPlayerForPaintBall(client);
|
respawnPlayerForPaintBall(client);
|
||||||
|
getPlayerData(client).pedState = V_PEDSTATE_READY;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (getPlayerCurrentSubAccount(client).inJail) {
|
if (getPlayerCurrentSubAccount(client).inJail) {
|
||||||
@@ -363,14 +350,14 @@ function onPlayerDeath(client, killer, weapon, pedPiece) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
spawnPlayer(client, closestJail.position, closestJail.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
spawnPlayer(client, closestJail.position, closestJail.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
||||||
|
|
||||||
if (isFadeCameraSupported()) {
|
if (isFadeCameraSupported()) {
|
||||||
fadeCamera(client, true, 1.0);
|
fadePlayerCamera(client, true, 1000);
|
||||||
}
|
}
|
||||||
updatePlayerSpawnedState(client, true);
|
updatePlayerSpawnedState(client, true);
|
||||||
makePlayerStopAnimation(client);
|
makePlayerStopAnimation(client);
|
||||||
setPlayerControlState(client, true);
|
setPlayerControlState(client, true);
|
||||||
resetPlayerBlip(client);
|
resetPlayerBlip(client);
|
||||||
|
getPlayerData(client).pedState = V_PEDSTATE_READY;
|
||||||
} else {
|
} else {
|
||||||
let closestHospital = getClosestHospital(getPlayerPosition(client));
|
let closestHospital = getClosestHospital(getPlayerPosition(client));
|
||||||
despawnPlayer(client);
|
despawnPlayer(client);
|
||||||
@@ -384,13 +371,14 @@ function onPlayerDeath(client, killer, weapon, pedPiece) {
|
|||||||
spawnPlayer(client, closestHospital.position, closestHospital.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
spawnPlayer(client, closestHospital.position, closestHospital.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
||||||
|
|
||||||
if (isFadeCameraSupported()) {
|
if (isFadeCameraSupported()) {
|
||||||
fadeCamera(client, true, 1.0);
|
fadePlayerCamera(client, true, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
updatePlayerSpawnedState(client, true);
|
updatePlayerSpawnedState(client, true);
|
||||||
makePlayerStopAnimation(client);
|
makePlayerStopAnimation(client);
|
||||||
setPlayerControlState(client, true);
|
setPlayerControlState(client, true);
|
||||||
resetPlayerBlip(client);
|
resetPlayerBlip(client);
|
||||||
|
getPlayerData(client).pedState = V_PEDSTATE_READY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 2000);
|
}, 2000);
|
||||||
@@ -413,7 +401,13 @@ function onPlayerDeath(client, killer, weapon, pedPiece) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPedSpawn(ped) {
|
function onPedSpawn(ped) {
|
||||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} spawned!`);
|
logToConsole(LOG_WARN | LOG_VERBOSE, `[V.RP.Event] OnPedSpawn event called`);
|
||||||
|
|
||||||
|
if (ped != null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Ped ${ped.id} spawned!`);
|
||||||
|
|
||||||
//if (ped.type == ELEMENT_PLAYER) {
|
//if (ped.type == ELEMENT_PLAYER) {
|
||||||
// if (getGame() != V_GAME_MAFIA_ONE) {
|
// if (getGame() != V_GAME_MAFIA_ONE) {
|
||||||
@@ -426,14 +420,14 @@ function onPedSpawn(ped) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
async function onPlayerSpawn(client) {
|
async function onPlayerSpawn(client) {
|
||||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Player ${getPlayerDisplayForConsole(client)} spawned!`);
|
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Player ${getPlayerDisplayForConsole(client)} spawned!`);
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Event] Checking for ${getPlayerDisplayForConsole(client)}'s player ped`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Event] Checking for ${getPlayerDisplayForConsole(client)}'s player ped`);
|
||||||
//if(getPlayerPed(client) == null) {
|
//if(getPlayerPed(client) == null) {
|
||||||
// logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)}'s player element not set yet. Rechecking ...`);
|
// logToConsole(LOG_DEBUG, `[V.RP.Event] ${getPlayerDisplayForConsole(client)}'s player element not set yet. Rechecking ...`);
|
||||||
// setTimeout(onPlayerSpawn, 500, client);
|
// setTimeout(onPlayerSpawn, 500, client);
|
||||||
// return false;
|
// return false;
|
||||||
//}
|
//}
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)}'s player ped is valid. Continuing spawn processing ...`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Event] ${getPlayerDisplayForConsole(client)}'s player ped is valid. Continuing spawn processing ...`);
|
||||||
|
|
||||||
if (areServerElementsSupported()) {
|
if (areServerElementsSupported()) {
|
||||||
await waitUntil(() => client != null && getPlayerPed(client) != null);
|
await waitUntil(() => client != null && getPlayerPed(client) != null);
|
||||||
@@ -441,53 +435,53 @@ async function onPlayerSpawn(client) {
|
|||||||
|
|
||||||
stopRadioStreamForPlayer(client);
|
stopRadioStreamForPlayer(client);
|
||||||
|
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Event] Checking ${getPlayerDisplayForConsole(client)}'s player data`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Event] Checking ${getPlayerDisplayForConsole(client)}'s player data`);
|
||||||
if (!getPlayerData(client)) {
|
if (!getPlayerData(client)) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)}'s player data is invalid. Kicking them from server.`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] ${getPlayerDisplayForConsole(client)}'s player data is invalid. Kicking them from server.`);
|
||||||
getPlayerData(targetClient).customDisconnectReason = "Desync";
|
getPlayerData(targetClient).customDisconnectReason = "Desync";
|
||||||
disconnectPlayer(client);
|
disconnectPlayer(client);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Event] Checking ${getPlayerDisplayForConsole(client)}'s login status`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Event] Checking ${getPlayerDisplayForConsole(client)}'s login status`);
|
||||||
if (!isPlayerLoggedIn(client)) {
|
if (!isPlayerLoggedIn(client)) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)} is NOT logged in. Despawning their player.`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] ${getPlayerDisplayForConsole(client)} is NOT logged in. Despawning their player.`);
|
||||||
getPlayerData(targetClient).customDisconnectReason = "Desync";
|
getPlayerData(targetClient).customDisconnectReason = "Desync";
|
||||||
disconnectPlayer(client);
|
disconnectPlayer(client);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Event] Checking ${getPlayerDisplayForConsole(client)}'s selected character status`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Event] Checking ${getPlayerDisplayForConsole(client)}'s selected character status`);
|
||||||
if (getPlayerData(client).currentSubAccount == -1) {
|
if (getPlayerData(client).currentSubAccount == -1) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)} has NOT selected a character. Despawning their player.`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] ${getPlayerDisplayForConsole(client)} has NOT selected a character. Despawning their player.`);
|
||||||
getPlayerData(targetClient).customDisconnectReason = "Desync";
|
getPlayerData(targetClient).customDisconnectReason = "Desync";
|
||||||
disconnectPlayer(client);
|
disconnectPlayer(client);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)}'s player data is valid. Continuing spawn processing ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] ${getPlayerDisplayForConsole(client)}'s player data is valid. Continuing spawn processing ...`);
|
||||||
|
|
||||||
if (isGameFeatureSupported("pedScale")) {
|
if (isGameFeatureSupported("pedScale")) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped scale (${getPlayerCurrentSubAccount(client).pedScale})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped scale (${getPlayerCurrentSubAccount(client).pedScale})`);
|
||||||
setEntityData(getPlayerPed(client), "v.rp.scale", getPlayerCurrentSubAccount(client).pedScale, true);
|
setEntityData(getPlayerPed(client), "v.rp.scale", getPlayerCurrentSubAccount(client).pedScale, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (isPlayerSwitchingCharacter(client) || isPlayerCreatingCharacter(client)) {
|
//if (isPlayerSwitchingCharacter(client) || isPlayerCreatingCharacter(client)) {
|
||||||
// logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)}'s ped is being used for character selection/creation. No further spawn processing needed'`);
|
// logToConsole(LOG_DEBUG, `[V.RP.Event] ${getPlayerDisplayForConsole(client)}'s ped is being used for character selection/creation. No further spawn processing needed'`);
|
||||||
// return false;
|
// return false;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if (isCustomCameraSupported()) {
|
if (isCustomCameraSupported()) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Restoring ${getPlayerDisplayForConsole(client)}'s camera`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Restoring ${getPlayerDisplayForConsole(client)}'s camera`);
|
||||||
restorePlayerCamera(client);
|
restorePlayerCamera(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (areServerElementsSupported()) {
|
if (areServerElementsSupported()) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Storing ${getPlayerDisplayForConsole(client)} ped in client data `);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Storing ${getPlayerDisplayForConsole(client)} ped in client data `);
|
||||||
getPlayerData(client).ped = getPlayerPed(client);
|
getPlayerData(client).ped = getPlayerPed(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Sending ${getPlayerDisplayForConsole(client)} the 'now playing as' message`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Sending ${getPlayerDisplayForConsole(client)} the 'now playing as' message`);
|
||||||
messagePlayerAlert(client, `You are now playing as: {businessBlue}${getCharacterFullName(client)}`, getColourByName("white"));
|
messagePlayerAlert(client, `You are now playing as: {businessBlue}${getCharacterFullName(client)}`, getColourByName("white"));
|
||||||
//messagePlayerNormal(client, "This server is in early development and may restart at any time for updates.", getColourByName("orange"));
|
//messagePlayerNormal(client, "This server is in early development and may restart at any time for updates.", getColourByName("orange"));
|
||||||
//messagePlayerNormal(client, "Please report any bugs using /bug and suggestions using /idea", getColourByName("yellow"));
|
//messagePlayerNormal(client, "Please report any bugs using /bug and suggestions using /idea", getColourByName("yellow"));
|
||||||
@@ -501,65 +495,65 @@ async function onPlayerSpawn(client) {
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
if (isGameFeatureSupported("interior")) {
|
if (isGameFeatureSupported("interior")) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Setting player interior for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).interior}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Setting player interior for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).interior}`);
|
||||||
setPlayerInterior(client, getPlayerCurrentSubAccount(client).interior);
|
setPlayerInterior(client, getPlayerCurrentSubAccount(client).interior);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Setting player dimension for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).dimension}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Setting player dimension for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).dimension}`);
|
||||||
setPlayerDimension(client, getPlayerCurrentSubAccount(client).dimension);
|
setPlayerDimension(client, getPlayerCurrentSubAccount(client).dimension);
|
||||||
|
|
||||||
//if(getPlayerCurrentSubAccount(client).interior != 0 || getPlayerCurrentSubAccount(client).dimension != 0) {
|
//if(getPlayerCurrentSubAccount(client).interior != 0 || getPlayerCurrentSubAccount(client).dimension != 0) {
|
||||||
// updateAllInteriorVehiclesForPlayer(client, getPlayerCurrentSubAccount(client).interior, getPlayerCurrentSubAccount(client).dimension);
|
// updateAllInteriorVehiclesForPlayer(client, getPlayerCurrentSubAccount(client).interior, getPlayerCurrentSubAccount(client).dimension);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Setting player health for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).health}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Setting player health for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).health}`);
|
||||||
setPlayerHealth(client, getPlayerCurrentSubAccount(client).health);
|
setPlayerHealth(client, getPlayerCurrentSubAccount(client).health);
|
||||||
|
|
||||||
if (isGameFeatureSupported("pedArmour")) {
|
if (isGameFeatureSupported("pedArmour")) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Setting player armour for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).armour}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Setting player armour for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).armour}`);
|
||||||
setPlayerArmour(client, getPlayerCurrentSubAccount(client).armour);
|
setPlayerArmour(client, getPlayerCurrentSubAccount(client).armour);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Sending ${getPlayerDisplayForConsole(client)}'s job type to their client (${getJobIndexFromDatabaseId(getPlayerCurrentSubAccount(client))})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Sending ${getPlayerDisplayForConsole(client)}'s job type to their client (${getJobIndexFromDatabaseId(getPlayerCurrentSubAccount(client))})`);
|
||||||
sendPlayerJobType(client, getPlayerCurrentSubAccount(client).job);
|
sendPlayerJobType(client, getPlayerCurrentSubAccount(client).job);
|
||||||
|
|
||||||
if (isGameFeatureSupported("rendering2D")) {
|
if (isGameFeatureSupported("rendering2D")) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Enabling all rendering states for ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Enabling all rendering states for ${getPlayerDisplayForConsole(client)}`);
|
||||||
setPlayer2DRendering(client, true, true, true, true, true, true);
|
setPlayer2DRendering(client, true, true, true, true, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (isGameFeatureSupported("snow")) {
|
//if (isGameFeatureSupported("snow")) {
|
||||||
// logToConsole(LOG_DEBUG, `[AGRP.Event] Sending snow states to ${getPlayerDisplayForConsole(client)}`);
|
// logToConsole(LOG_DEBUG, `[V.RP.Event] Sending snow states to ${getPlayerDisplayForConsole(client)}`);
|
||||||
// updatePlayerSnowState(client, true);
|
// updatePlayerSnowState(client, true);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if (areServerElementsSupported() && isGameFeatureSupported("walkStyle")) {
|
if (areServerElementsSupported() && isGameFeatureSupported("walkStyle")) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Setting player walking style for ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Setting player walking style for ${getPlayerDisplayForConsole(client)}`);
|
||||||
setEntityData(getPlayerPed(client), "v.rp.walkStyle", getPlayerCurrentSubAccount(client).walkStyle, true);
|
setEntityData(getPlayerPed(client), "v.rp.walkStyle", getPlayerCurrentSubAccount(client).walkStyle, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isGameFeatureSupported("fightStyle")) {
|
if (isGameFeatureSupported("fightStyle")) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Setting player fighting style for ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Setting player fighting style for ${getPlayerDisplayForConsole(client)}`);
|
||||||
setPlayerFightStyle(client, getPlayerCurrentSubAccount(client).fightStyle);
|
setPlayerFightStyle(client, getPlayerCurrentSubAccount(client).fightStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isGameFeatureSupported("rendering2D")) {
|
if (isGameFeatureSupported("rendering2D")) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Updating logo state for ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Updating logo state for ${getPlayerDisplayForConsole(client)}`);
|
||||||
updatePlayerShowLogoState(client, (getServerConfig().showLogo && doesPlayerHaveLogoEnabled(client)));
|
updatePlayerShowLogoState(client, (getServerConfig().showLogo && doesPlayerHaveLogoEnabled(client)));
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Caching ${getPlayerDisplayForConsole(client)}'s hotbar items`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Caching ${getPlayerDisplayForConsole(client)}'s hotbar items`);
|
||||||
cachePlayerHotBarItems(client);
|
cachePlayerHotBarItems(client);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Syncing ${getPlayerDisplayForConsole(client)}'s hotbar`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Syncing ${getPlayerDisplayForConsole(client)}'s hotbar`);
|
||||||
updatePlayerHotBar(client);
|
updatePlayerHotBar(client);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Setting ${getPlayerDisplayForConsole(client)}'s switchchar state to false`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Setting ${getPlayerDisplayForConsole(client)}'s switchchar state to false`);
|
||||||
getPlayerData(client).switchingCharacter = false;
|
getPlayerData(client).switchingCharacter = false;
|
||||||
|
|
||||||
if (!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "enter")) {
|
if (!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "enter")) {
|
||||||
let keyId = getPlayerKeyBindForCommand(client, "enter");
|
let keyId = getPlayerKeyBindForCommand(client, "enter");
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendPlayerEnterPropertyKey(client, keyId.key);
|
sendPlayerEnterPropertyKey(client, keyId.key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -590,7 +584,7 @@ async function onPlayerSpawn(client) {
|
|||||||
//sendPlayerPedPartsAndProps(client);
|
//sendPlayerPedPartsAndProps(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped state to ready`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped state to ready`);
|
||||||
getPlayerData(client).pedState = V_PEDSTATE_READY;
|
getPlayerData(client).pedState = V_PEDSTATE_READY;
|
||||||
|
|
||||||
if (areServerElementsSupported()) {
|
if (areServerElementsSupported()) {
|
||||||
@@ -600,16 +594,16 @@ async function onPlayerSpawn(client) {
|
|||||||
//}, 1000);
|
//}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Syncing ${getPlayerDisplayForConsole(client)}'s cash ${getPlayerCurrentSubAccount(client).cash}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Syncing ${getPlayerDisplayForConsole(client)}'s cash ${getPlayerCurrentSubAccount(client).cash}`);
|
||||||
updatePlayerCash(client);
|
updatePlayerCash(client);
|
||||||
|
|
||||||
if (isGameFeatureSupported("customNametag")) {
|
if (isGameFeatureSupported("customNametag")) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Sending player nametag distance to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Sending player nametag distance to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNameTagDistanceToClient(client, getServerConfig().nameTagDistance);
|
sendNameTagDistanceToClient(client, getServerConfig().nameTagDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!areServerElementsSupported() || getGame() == V_GAME_MAFIA_ONE || getGame() == V_GAME_GTA_IV) {
|
if (!areServerElementsSupported() || getGame() == V_GAME_MAFIA_ONE || getGame() == V_GAME_GTA_IV) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Sending properties, jobs, and vehicles to ${getPlayerDisplayForConsole(client)} (no server elements)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Sending properties, jobs, and vehicles to ${getPlayerDisplayForConsole(client)} (no server elements)`);
|
||||||
sendAllBusinessesToPlayer(client);
|
sendAllBusinessesToPlayer(client);
|
||||||
sendAllHousesToPlayer(client);
|
sendAllHousesToPlayer(client);
|
||||||
if (getGame() != V_GAME_GTA_IV) {
|
if (getGame() != V_GAME_GTA_IV) {
|
||||||
@@ -622,7 +616,7 @@ async function onPlayerSpawn(client) {
|
|||||||
sendAllVehiclesToPlayer(client);
|
sendAllVehiclesToPlayer(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Updating spawned state for ${getPlayerDisplayForConsole(client)} to true`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Updating spawned state for ${getPlayerDisplayForConsole(client)} to true`);
|
||||||
updatePlayerSpawnedState(client, true);
|
updatePlayerSpawnedState(client, true);
|
||||||
|
|
||||||
getPlayerData(client).payDayTickStart = sdl.ticks;
|
getPlayerData(client).payDayTickStart = sdl.ticks;
|
||||||
@@ -630,7 +624,7 @@ async function onPlayerSpawn(client) {
|
|||||||
// Locales are handled via resource files now. No need to send anymore, but kept in case revert is needed.
|
// Locales are handled via resource files now. No need to send anymore, but kept in case revert is needed.
|
||||||
//sendPlayerLocaleStrings(client);
|
//sendPlayerLocaleStrings(client);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Updating all player name tags`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Updating all player name tags`);
|
||||||
updateAllPlayerNameTags();
|
updateAllPlayerNameTags();
|
||||||
|
|
||||||
setPlayerWeaponDamageEvent(client, V_WEAPON_DAMAGE_EVENT_NORMAL);
|
setPlayerWeaponDamageEvent(client, V_WEAPON_DAMAGE_EVENT_NORMAL);
|
||||||
@@ -687,7 +681,9 @@ async function onPlayerSpawn(client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPlayerCommand(event, client, command, params) {
|
function onPlayerCommand(event, client, command, params) {
|
||||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Player used command ${command}!`);
|
logToConsole(LOG_WARN | LOG_VERBOSE, `[V.RP.Event] OnPlayerCommand event called`);
|
||||||
|
|
||||||
|
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Player used command ${command}!`);
|
||||||
|
|
||||||
if (!doesCommandExist(command)) {
|
if (!doesCommandExist(command)) {
|
||||||
processPlayerCommand(command, params, client);
|
processPlayerCommand(command, params, client);
|
||||||
@@ -697,6 +693,8 @@ function onPlayerCommand(event, client, command, params) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPedExitedVehicle(event, ped, vehicle, seat) {
|
function onPedExitedVehicle(event, ped, vehicle, seat) {
|
||||||
|
logToConsole(LOG_WARN | LOG_VERBOSE, `[V.RP.Event] OnPedExitedVehicle event called`);
|
||||||
|
|
||||||
if (ped == null) {
|
if (ped == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -705,7 +703,7 @@ function onPedExitedVehicle(event, ped, vehicle, seat) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} exited vehicle ${vehicle.id} from seat ${seat}!`);
|
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Ped ${ped.id} exited vehicle ${vehicle.id} from seat ${seat}!`);
|
||||||
|
|
||||||
if (getVehicleData(vehicle) == false) {
|
if (getVehicleData(vehicle) == false) {
|
||||||
return false;
|
return false;
|
||||||
@@ -738,7 +736,7 @@ function onPedExitedVehicle(event, ped, vehicle, seat) {
|
|||||||
|
|
||||||
getVehicleData(vehicle).lastActiveTime = getCurrentUnixTimestamp();
|
getVehicleData(vehicle).lastActiveTime = getCurrentUnixTimestamp();
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)} exited a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("v.rp.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] ${getPlayerDisplayForConsole(client)} exited a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("v.rp.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -746,28 +744,34 @@ function onPedExitedVehicle(event, ped, vehicle, seat) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPedEnteredVehicle(event, ped, vehicle, seat) {
|
function onPedEnteredVehicle(event, ped, vehicle, seat) {
|
||||||
|
logToConsole(LOG_WARN | LOG_VERBOSE, `[V.RP.Event] OnPedEnteredVehicle event called`);
|
||||||
|
|
||||||
if (ped == null) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vehicle == null) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} entered vehicle ${vehicle.id} in seat ${seat}!`);
|
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Ped ${ped.id} entered vehicle ${vehicle.id} in seat ${seat}!`);
|
||||||
|
|
||||||
if (ped.isType(ELEMENT_PLAYER)) {
|
if (ped.isType(ELEMENT_PLAYER)) {
|
||||||
let client = getClientFromPlayerElement(ped);
|
let client = getClientFromPlayerElement(ped);
|
||||||
if (client != null) {
|
if (client != null) {
|
||||||
if (getPlayerData(client) == false) {
|
if (getPlayerData(client) == false) {
|
||||||
|
logToConsole(LOG_ERROR | LOG_DEBUG, `[V.RP.Event] ${getPlayerDisplayForConsole(client)} entered vehicle ${vehicle.id} in seat ${seat}, but player data is false`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!getVehicleData(vehicle)) {
|
if (!getVehicleData(vehicle)) {
|
||||||
|
logToConsole(LOG_ERROR | LOG_DEBUG, `[V.RP.Event] ${getPlayerDisplayForConsole(client)} entered vehicle ${vehicle.id} in seat ${seat}, but vehicle data is false`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] ${getPlayerDisplayForConsole(client)} entered a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("v.rp.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] ${getPlayerDisplayForConsole(client)} entered a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("v.rp.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
|
||||||
|
|
||||||
getPlayerData(client).lastVehicle = vehicle;
|
getPlayerData(client).lastVehicle = vehicle;
|
||||||
getVehicleData(vehicle).lastActiveTime = getCurrentUnixTimestamp();
|
getVehicleData(vehicle).lastActiveTime = getCurrentUnixTimestamp();
|
||||||
@@ -870,6 +874,8 @@ function onPedEnteredVehicle(event, ped, vehicle, seat) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPedEnteringVehicle(event, ped, vehicle, seat) {
|
function onPedEnteringVehicle(event, ped, vehicle, seat) {
|
||||||
|
logToConsole(LOG_WARN | LOG_VERBOSE, `[V.RP.Event] OnPedEnteringVehicle event called`);
|
||||||
|
|
||||||
if (ped == null) {
|
if (ped == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -878,7 +884,7 @@ function onPedEnteringVehicle(event, ped, vehicle, seat) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} is entering vehicle ${vehicle.id} in seat ${seat}!`);
|
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Ped ${ped.id} is entering vehicle ${vehicle.id} in seat ${seat}!`);
|
||||||
|
|
||||||
if (ped.isType(ELEMENT_PLAYER)) {
|
if (ped.isType(ELEMENT_PLAYER)) {
|
||||||
let client = getClientFromPlayerElement(ped);
|
let client = getClientFromPlayerElement(ped);
|
||||||
@@ -894,6 +900,8 @@ function onPedEnteringVehicle(event, ped, vehicle, seat) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPedExitingVehicle(event, ped, vehicle, seat) {
|
function onPedExitingVehicle(event, ped, vehicle, seat) {
|
||||||
|
logToConsole(LOG_WARN | LOG_VERBOSE, `[V.RP.Event] OnPedExitingVehicle event called`);
|
||||||
|
|
||||||
if (ped == null) {
|
if (ped == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -902,7 +910,7 @@ function onPedExitingVehicle(event, ped, vehicle, seat) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_WARN | LOG_DEBUG, `[AGRP.Event] Ped ${ped.id} is exiting vehicle ${vehicle.id} in seat ${seat}!`);
|
logToConsole(LOG_WARN | LOG_DEBUG, `[V.RP.Event] Ped ${ped.id} is exiting vehicle ${vehicle.id} in seat ${seat}!`);
|
||||||
|
|
||||||
if (ped.isType(ELEMENT_PLAYER)) {
|
if (ped.isType(ELEMENT_PLAYER)) {
|
||||||
let client = getClientFromPlayerElement(ped);
|
let client = getClientFromPlayerElement(ped);
|
||||||
@@ -930,12 +938,12 @@ function onPlayerExitingVehicle(client, vehicle, seat) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPedFall(ped) {
|
function onPedFall(ped) {
|
||||||
if (ped.isType(ELEMENT_PLAYER)) {
|
//if (ped.isType(ELEMENT_PLAYER)) {
|
||||||
let client = getClientFromPlayerElement(ped);
|
// let client = getClientFromPlayerElement(ped);
|
||||||
if (client != null) {
|
// if (client != null) {
|
||||||
processPlayerDeath(client);
|
// processPlayerDeath(client);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -45,8 +45,8 @@ class GateData {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initGateScript() {
|
function initGateScript() {
|
||||||
logToConsole(LOG_INFO, `[AGRP.Gate]: Initializing gate script ...`);
|
logToConsole(LOG_INFO, `[V.RP.Gate]: Initializing gate script ...`);
|
||||||
logToConsole(LOG_INFO, `[AGRP.Gate]: Gate script initialized successfully!`);
|
logToConsole(LOG_INFO, `[V.RP.Gate]: Gate script initialized successfully!`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -193,7 +193,7 @@ function saveGateToDatabase(gateId) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Gate]: Saving gate ${tempGateData.databaseId} to database ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Gate]: Saving gate ${tempGateData.databaseId} to database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
let safeGateName = escapeDatabaseString(tempGateData.name);
|
let safeGateName = escapeDatabaseString(tempGateData.name);
|
||||||
@@ -227,7 +227,7 @@ function saveGateToDatabase(gateId) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Gate]: Saved gate ${gateDataId} to database!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Gate]: Saved gate ${gateDataId} to database!`);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -248,13 +248,13 @@ function loadGatesFromDatabase() {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempGateData = new GateData(dbAssoc[i]);
|
let tempGateData = new GateData(dbAssoc[i]);
|
||||||
tempGates.push(tempGateData);
|
tempGates.push(tempGateData);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Gate]: Gate '${tempGateData.name}' loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Gate]: Gate '${tempGateData.name}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_INFO, `[AGRP.Gate]: ${tempGates.length} gates loaded from database successfully!`);
|
logToConsole(LOG_INFO, `[V.RP.Gate]: ${tempGates.length} gates loaded from database successfully!`);
|
||||||
return tempGates;
|
return tempGates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initHelpScript() {
|
function initHelpScript() {
|
||||||
logToConsole(LOG_INFO, `[AGRP.Help]: Initializing help script ...`);
|
logToConsole(LOG_INFO, `[V.RP.Help]: Initializing help script ...`);
|
||||||
logToConsole(LOG_INFO, `[AGRP.Help]: Help script initialized successfully!`);
|
logToConsole(LOG_INFO, `[V.RP.Help]: Help script initialized successfully!`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -187,12 +187,12 @@ function loadHousesFromDatabase() {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempHouseData = new HouseData(dbAssoc[i]);
|
let tempHouseData = new HouseData(dbAssoc[i]);
|
||||||
tempHouses.push(tempHouseData);
|
tempHouses.push(tempHouseData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.House]: House '${tempHouseData.description}' (ID ${tempHouseData.databaseId}) loaded!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.House]: House '${tempHouseData.description}' (ID ${tempHouseData.databaseId}) loaded!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
logToConsole(LOG_INFO, `[AGRP.House]: ${tempHouses.length} houses loaded from database successfully!`);
|
logToConsole(LOG_INFO, `[V.RP.House]: ${tempHouses.length} houses loaded from database successfully!`);
|
||||||
return tempHouses;
|
return tempHouses;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -462,7 +462,7 @@ function setHousePickupCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
deleteHouseEntrancePickup(houseId);
|
deleteHouseEntrancePickup(houseId);
|
||||||
createHouseEntrancePickup(houseId);
|
spawnHouseEntrancePickup(houseId);
|
||||||
|
|
||||||
getHouseData(houseId).needsSaved = true;
|
getHouseData(houseId).needsSaved = true;
|
||||||
|
|
||||||
@@ -527,8 +527,8 @@ function setHouseInteriorTypeCommand(command, params, client) {
|
|||||||
|
|
||||||
deleteHouseEntrancePickup(houseId);
|
deleteHouseEntrancePickup(houseId);
|
||||||
deleteHouseExitPickup(houseId);
|
deleteHouseExitPickup(houseId);
|
||||||
createHouseEntrancePickup(houseId);
|
spawnHouseEntrancePickup(houseId);
|
||||||
createHouseExitPickup(houseId);
|
spawnHouseExitPickup(houseId);
|
||||||
|
|
||||||
getHouseData(houseId).needsSaved = true;
|
getHouseData(houseId).needsSaved = true;
|
||||||
|
|
||||||
@@ -654,8 +654,8 @@ function moveHouseExitCommand(command, params, client) {
|
|||||||
|
|
||||||
deleteHouseExitPickup(houseId);
|
deleteHouseExitPickup(houseId);
|
||||||
deleteHouseExitBlip(houseId);
|
deleteHouseExitBlip(houseId);
|
||||||
createHouseExitPickup(houseId);
|
spawnHouseExitPickup(houseId);
|
||||||
createHouseExitBlip(houseId);
|
spawnHouseExitBlip(houseId);
|
||||||
|
|
||||||
getHouseData(houseId).needsSaved = true;
|
getHouseData(houseId).needsSaved = true;
|
||||||
|
|
||||||
@@ -798,8 +798,8 @@ function createHouse(description, entrancePosition, exitPosition, entrancePickup
|
|||||||
saveHouseToDatabase(houseId - 1);
|
saveHouseToDatabase(houseId - 1);
|
||||||
setHouseDataIndexes();
|
setHouseDataIndexes();
|
||||||
|
|
||||||
createHousePickups(houseId - 1);
|
spawnHousePickups(houseId - 1);
|
||||||
createHouseBlips(houseId - 1);
|
spawnHouseBlips(houseId - 1);
|
||||||
|
|
||||||
return houseId - 1;
|
return houseId - 1;
|
||||||
}
|
}
|
||||||
@@ -877,9 +877,9 @@ function getPlayerHouse(client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function saveAllHousesToDatabase() {
|
function saveAllHousesToDatabase() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.House]: Saving all server houses to database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.House]: Saving all server houses to database ...`);
|
||||||
if (getServerConfig().devServer) {
|
if (getServerConfig().devServer) {
|
||||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.House]: Aborting save all houses to database, dev server is enabled.`);
|
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.House]: Aborting save all houses to database, dev server is enabled.`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -888,7 +888,7 @@ function saveAllHousesToDatabase() {
|
|||||||
saveHouseToDatabase(i);
|
saveHouseToDatabase(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logToConsole(LOG_INFO, `[AGRP.House]: Saved all server houses to database`);
|
logToConsole(LOG_INFO, `[V.RP.House]: Saved all server houses to database`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -900,7 +900,7 @@ function saveHouseToDatabase(houseId) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.House]: Saving house '${tempHouseData.description}' to database ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.House]: Saving house '${tempHouseData.description}' to database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
let safeHouseDescription = escapeDatabaseString(dbConnection, tempHouseData.description);
|
let safeHouseDescription = escapeDatabaseString(dbConnection, tempHouseData.description);
|
||||||
@@ -954,7 +954,7 @@ function saveHouseToDatabase(houseId) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.House]: Saved house '${tempHouseData.description}' to database!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.House]: Saved house '${tempHouseData.description}' to database!`);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -968,7 +968,7 @@ function saveHouseLocationToDatabase(houseId, locationId) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.House]: Saving house location ${locationId} for house ${houseId} to database ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.House]: Saving house location ${locationId} for house ${houseId} to database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
let data = [
|
let data = [
|
||||||
@@ -1009,32 +1009,32 @@ function saveHouseLocationToDatabase(houseId, locationId) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.House]: Saved location ${locationId} for house ${houseId} to database`);
|
logToConsole(LOG_VERBOSE, `[V.RP.House]: Saved location ${locationId} for house ${houseId} to database`);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function createAllHousePickups() {
|
function spawnAllHousePickups() {
|
||||||
for (let i in getServerData().houses) {
|
for (let i in getServerData().houses) {
|
||||||
createHouseEntrancePickup(i);
|
spawnHouseEntrancePickup(i);
|
||||||
createHouseExitPickup(i);
|
spawnHouseExitPickup(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function createAllHouseBlips() {
|
function spawnAllHouseBlips() {
|
||||||
for (let i in getServerData().houses) {
|
for (let i in getServerData().houses) {
|
||||||
createHouseEntranceBlip(i);
|
spawnHouseEntranceBlip(i);
|
||||||
createHouseExitBlip(i);
|
spawnHouseExitBlip(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function createHouseEntrancePickup(houseId) {
|
function spawnHouseEntrancePickup(houseId) {
|
||||||
if (!getServerConfig().createHousePickups) {
|
if (!getServerConfig().createHousePickups) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1082,7 +1082,7 @@ function createHouseEntrancePickup(houseId) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function createHouseEntranceBlip(houseId) {
|
function spawnHouseEntranceBlip(houseId) {
|
||||||
if (!areServerElementsSupported()) {
|
if (!areServerElementsSupported()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1139,7 +1139,7 @@ function createHouseEntranceBlip(houseId) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function createHouseExitPickup(houseId) {
|
function spawnHouseExitPickup(houseId) {
|
||||||
if (!areServerElementsSupported()) {
|
if (!areServerElementsSupported()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1189,7 +1189,7 @@ function createHouseExitPickup(houseId) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function createHouseExitBlip(houseId) {
|
function spawnHouseExitBlip(houseId) {
|
||||||
if (!areServerElementsSupported()) {
|
if (!areServerElementsSupported()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1702,8 +1702,8 @@ function canPlayerLockUnlockHouse(client, houseId) {
|
|||||||
function resetHousePickups(houseId) {
|
function resetHousePickups(houseId) {
|
||||||
deleteHouseEntrancePickup(houseId);
|
deleteHouseEntrancePickup(houseId);
|
||||||
deleteHouseExitPickup(houseId);
|
deleteHouseExitPickup(houseId);
|
||||||
createHouseEntrancePickup(houseId);
|
spawnHouseEntrancePickup(houseId);
|
||||||
createHouseExitPickup(houseId);
|
spawnHouseExitPickup(houseId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1711,8 +1711,8 @@ function resetHousePickups(houseId) {
|
|||||||
function resetHouseBlips(houseId) {
|
function resetHouseBlips(houseId) {
|
||||||
deleteHouseEntranceBlip(houseId);
|
deleteHouseEntranceBlip(houseId);
|
||||||
deleteHouseExitBlip(houseId);
|
deleteHouseExitBlip(houseId);
|
||||||
createHouseEntranceBlip(houseId);
|
spawnHouseEntranceBlip(houseId);
|
||||||
createHouseExitBlip(houseId);
|
spawnHouseExitBlip(houseId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1830,15 +1830,15 @@ function deleteAllHousePickups() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function createHouseBlips(houseId) {
|
function createHouseBlips(houseId) {
|
||||||
createHouseEntranceBlip(houseId);
|
spawnHouseEntranceBlip(houseId);
|
||||||
createHouseExitBlip(houseId);
|
spawnHouseExitBlip(houseId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function createHousePickups(houseId) {
|
function createHousePickups(houseId) {
|
||||||
createHouseEntrancePickup(houseId);
|
spawnHouseEntrancePickup(houseId);
|
||||||
createHouseExitPickup(houseId);
|
spawnHouseExitPickup(houseId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
59
scripts/server/index.js
Normal file
59
scripts/server/index.js
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
// 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() {
|
function loadItemsFromDatabase() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Item]: Loading items from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Item]: Loading items from database ...`);
|
||||||
let tempItems = [];
|
let tempItems = [];
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
let dbAssoc = [];
|
let dbAssoc = [];
|
||||||
@@ -299,19 +299,19 @@ function loadItemsFromDatabase() {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempItemData = new ItemData(dbAssoc[i]);
|
let tempItemData = new ItemData(dbAssoc[i]);
|
||||||
tempItems.push(tempItemData);
|
tempItems.push(tempItemData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Item]: Loaded item ${tempItemData.databaseId} (type ${tempItemData.itemType})} from database`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Item]: Loaded item ${tempItemData.databaseId} (type ${tempItemData.itemType})} from database`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Item]: Loaded ${tempItems.length} items from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Item]: Loaded ${tempItems.length} items from database ...`);
|
||||||
return tempItems;
|
return tempItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadItemTypesFromDatabase() {
|
function loadItemTypesFromDatabase() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Item]: Loading item types from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Item]: Loading item types from database ...`);
|
||||||
let tempItemTypes = [];
|
let tempItemTypes = [];
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
let dbAssoc = [];
|
let dbAssoc = [];
|
||||||
@@ -323,13 +323,13 @@ function loadItemTypesFromDatabase() {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempItemTypeData = new ItemTypeData(dbAssoc[i]);
|
let tempItemTypeData = new ItemTypeData(dbAssoc[i]);
|
||||||
tempItemTypes.push(tempItemTypeData);
|
tempItemTypes.push(tempItemTypeData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Item]: Loaded item type ${tempItemTypeData.name} (id ${tempItemTypeData.databaseId}} from database`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Item]: Loaded item type ${tempItemTypeData.name} (id ${tempItemTypeData.databaseId}} from database`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Item]: Loaded ${tempItemTypes.length} item types from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Item]: Loaded ${tempItemTypes.length} item types from database ...`);
|
||||||
return tempItemTypes;
|
return tempItemTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -356,13 +356,13 @@ function createGroundItem(itemTypeId, value, position, dimension = 0) {
|
|||||||
let itemIndex = createItem(itemTypeId, value, V_ITEM_OWNER_GROUND, 0);
|
let itemIndex = createItem(itemTypeId, value, V_ITEM_OWNER_GROUND, 0);
|
||||||
getItemData(itemIndex).position = position;
|
getItemData(itemIndex).position = position;
|
||||||
getItemData(itemIndex).dimension = dimension;
|
getItemData(itemIndex).dimension = dimension;
|
||||||
createGroundItemObject(itemIndex);
|
spawnGroundItemObject(itemIndex);
|
||||||
return itemIndex;
|
return itemIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function createGroundItemObject(itemId) {
|
function spawnGroundItemObject(itemId) {
|
||||||
if (!getItemData(itemId)) {
|
if (!getItemData(itemId)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1352,7 +1352,7 @@ function playerUseItem(client, hotBarSlot) {
|
|||||||
let itemIndex = getPlayerData(client).hotBarItems[hotBarSlot];
|
let itemIndex = getPlayerData(client).hotBarItems[hotBarSlot];
|
||||||
|
|
||||||
if (itemIndex == -1) {
|
if (itemIndex == -1) {
|
||||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.Item] ${getPlayerDisplayForConsole(client)} tried to use an empty hotbar slot ${hotBarSlot}`);
|
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.Item] ${getPlayerDisplayForConsole(client)} tried to use an empty hotbar slot ${hotBarSlot}`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1366,7 +1366,7 @@ function playerUseItem(client, hotBarSlot) {
|
|||||||
let itemTypeData = getItemTypeData(itemData.itemTypeIndex);
|
let itemTypeData = getItemTypeData(itemData.itemTypeIndex);
|
||||||
let hotBarItems = getPlayerData(client).hotBarItems;
|
let hotBarItems = getPlayerData(client).hotBarItems;
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Item] ${getPlayerDisplayForConsole(client)} used a ${itemTypeData.name} (use type ${itemTypeData.useType} - ${typeof itemTypeData.useType}) item (ID: ${itemData.index}/${itemData.databaseId}, TypeID: ${itemTypeData.index}/${itemTypeData.databaseId})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Item] ${getPlayerDisplayForConsole(client)} used a ${itemTypeData.name} (use type ${itemTypeData.useType} - ${typeof itemTypeData.useType}) item (ID: ${itemData.index}/${itemData.databaseId}, TypeID: ${itemTypeData.index}/${itemTypeData.databaseId})`);
|
||||||
|
|
||||||
markPlayerActionTipSeen(client, "UseItemKeyAfterEquipping");
|
markPlayerActionTipSeen(client, "UseItemKeyAfterEquipping");
|
||||||
|
|
||||||
@@ -1772,7 +1772,7 @@ function playerDropItem(client, hotBarSlot) {
|
|||||||
getItemData(itemId).position = getPosInFrontOfPos(getPlayerPosition(client), getPlayerHeading(client), getItemTypeData(getItemData(itemId).itemTypeIndex).dropFrontDistance);
|
getItemData(itemId).position = getPosInFrontOfPos(getPlayerPosition(client), getPlayerHeading(client), getItemTypeData(getItemData(itemId).itemTypeIndex).dropFrontDistance);
|
||||||
getItemData(itemId).dimension = getPlayerDimension(client);
|
getItemData(itemId).dimension = getPlayerDimension(client);
|
||||||
//getItemData(itemId).interior = getPlayerInterior(client);
|
//getItemData(itemId).interior = getPlayerInterior(client);
|
||||||
createGroundItemObject(itemId);
|
spawnGroundItemObject(itemId);
|
||||||
getItemData(itemId).needsSaved = true;
|
getItemData(itemId).needsSaved = true;
|
||||||
getServerData().groundItemCache.push(itemId);
|
getServerData().groundItemCache.push(itemId);
|
||||||
}
|
}
|
||||||
@@ -1909,7 +1909,7 @@ function playerSwitchItem(client, newHotBarSlot) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let currentHotBarSlot = getPlayerData(client).activeHotBarSlot;
|
let currentHotBarSlot = getPlayerData(client).activeHotBarSlot;
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Item] ${getPlayerDisplayForConsole(client)} switched from hotbar slot ${currentHotBarSlot} to ${newHotBarSlot}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Item] ${getPlayerDisplayForConsole(client)} switched from hotbar slot ${currentHotBarSlot} to ${newHotBarSlot}`);
|
||||||
|
|
||||||
let currentHotBarItem = -1;
|
let currentHotBarItem = -1;
|
||||||
let newHotBarItem = -1;
|
let newHotBarItem = -1;
|
||||||
@@ -2137,9 +2137,9 @@ function cacheAllGroundItems() {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function createAllGroundItemObjects() {
|
function spawnAllGroundItemObjects() {
|
||||||
for (let i in getServerData().groundItemCache) {
|
for (let i in getServerData().groundItemCache) {
|
||||||
createGroundItemObject(getServerData().groundItemCache[i]);
|
spawnGroundItemObject(getServerData().groundItemCache[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2564,7 +2564,7 @@ function saveItemToDatabase(itemId) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Item]: Saving item '${itemData.index}' to database ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Item]: Saving item '${itemData.index}' to database ...`);
|
||||||
|
|
||||||
let position = getItemPosition(itemId);
|
let position = getItemPosition(itemId);
|
||||||
|
|
||||||
@@ -2621,7 +2621,7 @@ function saveItemTypeToDatabase(itemTypeId) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Item]: Saving item type '${itemTypeData.name}' to database ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Item]: Saving item type '${itemTypeData.name}' to database ...`);
|
||||||
|
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
@@ -2753,7 +2753,7 @@ function getItemTypeIndexFromDatabaseId(databaseId) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function playerItemActionDelayComplete(client) {
|
function playerItemActionDelayComplete(client) {
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Item]: Player ${getPlayerDisplayForConsole(client)} item action delay complete (State: ${getPlayerData(client).itemActionState})`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Item]: Player ${getPlayerDisplayForConsole(client)} item action delay complete (State: ${getPlayerData(client).itemActionState})`);
|
||||||
switch (getPlayerData(client).itemActionState) {
|
switch (getPlayerData(client).itemActionState) {
|
||||||
case V_ITEM_ACTION_USE:
|
case V_ITEM_ACTION_USE:
|
||||||
playerUseItem(client, getPlayerData(client).itemActionItem);
|
playerUseItem(client, getPlayerData(client).itemActionItem);
|
||||||
@@ -3294,3 +3294,14 @@ 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.routes = loadJobRoutesFromDatabase(tempJobData.databaseId);
|
||||||
tempJobData.ranks = loadJobRanksFromDatabase(tempJobData.databaseId);
|
tempJobData.ranks = loadJobRanksFromDatabase(tempJobData.databaseId);
|
||||||
tempJobs.push(tempJobData);
|
tempJobs.push(tempJobData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Job '${tempJobData.name}' loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Job '${tempJobData.name}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: ${tempJobs.length} jobs loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: ${tempJobs.length} jobs loaded from database successfully!`);
|
||||||
return tempJobs;
|
return tempJobs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -599,7 +599,7 @@ function loadAllJobLocationsFromDatabase() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadJobRanksFromDatabase(jobDatabaseId) {
|
function loadJobRanksFromDatabase(jobDatabaseId) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Loading ranks for job ${jobDatabaseId} from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Loading ranks for job ${jobDatabaseId} from database ...`);
|
||||||
|
|
||||||
let tempJobRanks = [];
|
let tempJobRanks = [];
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
@@ -612,20 +612,20 @@ function loadJobRanksFromDatabase(jobDatabaseId) {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempJobRankData = new JobRankData(dbAssoc[i]);
|
let tempJobRankData = new JobRankData(dbAssoc[i]);
|
||||||
tempJobRanks.push(tempJobRankData);
|
tempJobRanks.push(tempJobRankData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Job rank '${tempJobRankData.name}' loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Job rank '${tempJobRankData.name}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: ${tempJobRanks.length} ranks for job ${jobDatabaseId} loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: ${tempJobRanks.length} ranks for job ${jobDatabaseId} loaded from database successfully!`);
|
||||||
return tempJobRanks;
|
return tempJobRanks;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadJobRoutesFromDatabase(jobDatabaseId) {
|
function loadJobRoutesFromDatabase(jobDatabaseId) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Loading job routes for job ${jobDatabaseId} from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Loading job routes for job ${jobDatabaseId} from database ...`);
|
||||||
|
|
||||||
let tempJobRoutes = [];
|
let tempJobRoutes = [];
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
@@ -639,20 +639,20 @@ function loadJobRoutesFromDatabase(jobDatabaseId) {
|
|||||||
let tempJobRouteData = new JobRouteData(dbAssoc[i]);
|
let tempJobRouteData = new JobRouteData(dbAssoc[i]);
|
||||||
tempJobRouteData.locations = loadJobRouteLocationsFromDatabase(tempJobRouteData.databaseId);
|
tempJobRouteData.locations = loadJobRouteLocationsFromDatabase(tempJobRouteData.databaseId);
|
||||||
tempJobRoutes.push(tempJobRouteData);
|
tempJobRoutes.push(tempJobRouteData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Job route '${tempJobRouteData.name}' loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Job route '${tempJobRouteData.name}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: ${tempJobRoutes.length} job routes for job ${jobDatabaseId} loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: ${tempJobRoutes.length} job routes for job ${jobDatabaseId} loaded from database successfully!`);
|
||||||
return tempJobRoutes;
|
return tempJobRoutes;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadJobRouteLocationsFromDatabase(jobRouteId) {
|
function loadJobRouteLocationsFromDatabase(jobRouteId) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Loading locations for job route ${jobRouteId} from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Loading locations for job route ${jobRouteId} from database ...`);
|
||||||
|
|
||||||
let tempJobRouteLocations = [];
|
let tempJobRouteLocations = [];
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
@@ -665,20 +665,20 @@ function loadJobRouteLocationsFromDatabase(jobRouteId) {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempJobRouteLocationData = new JobRouteLocationData(dbAssoc[i]);
|
let tempJobRouteLocationData = new JobRouteLocationData(dbAssoc[i]);
|
||||||
tempJobRouteLocations.push(tempJobRouteLocationData);
|
tempJobRouteLocations.push(tempJobRouteLocationData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Job route location '${tempJobRouteLocationData.databaseId}' loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Job route location '${tempJobRouteLocationData.databaseId}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: ${tempJobRouteLocations.length} locations for job route ${jobRouteId} loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: ${tempJobRouteLocations.length} locations for job route ${jobRouteId} loaded from database successfully!`);
|
||||||
return tempJobRouteLocations;
|
return tempJobRouteLocations;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadJobEquipmentsFromDatabase(jobDatabaseId) {
|
function loadJobEquipmentsFromDatabase(jobDatabaseId) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Loading job equipments for job ${jobDatabaseId} from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Loading job equipments for job ${jobDatabaseId} from database ...`);
|
||||||
|
|
||||||
let tempJobEquipments = [];
|
let tempJobEquipments = [];
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
@@ -692,20 +692,20 @@ function loadJobEquipmentsFromDatabase(jobDatabaseId) {
|
|||||||
let tempJobEquipmentData = new JobEquipmentData(dbAssoc[i]);
|
let tempJobEquipmentData = new JobEquipmentData(dbAssoc[i]);
|
||||||
tempJobEquipmentData.items = loadJobEquipmentItemsFromDatabase(tempJobEquipmentData.databaseId);
|
tempJobEquipmentData.items = loadJobEquipmentItemsFromDatabase(tempJobEquipmentData.databaseId);
|
||||||
tempJobEquipments.push(tempJobEquipmentData);
|
tempJobEquipments.push(tempJobEquipmentData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Job equipment '${tempJobEquipmentData.name}' loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Job equipment '${tempJobEquipmentData.name}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: ${tempJobEquipments.length} job equipments for job ${jobDatabaseId} loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: ${tempJobEquipments.length} job equipments for job ${jobDatabaseId} loaded from database successfully!`);
|
||||||
return tempJobEquipments;
|
return tempJobEquipments;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadJobLocationsFromDatabase(jobDatabaseId) {
|
function loadJobLocationsFromDatabase(jobDatabaseId) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Loading job locations for job ${jobDatabaseId} from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Loading job locations for job ${jobDatabaseId} from database ...`);
|
||||||
|
|
||||||
let tempJobLocations = [];
|
let tempJobLocations = [];
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
@@ -718,20 +718,20 @@ function loadJobLocationsFromDatabase(jobDatabaseId) {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempJobLocationData = new JobLocationData(dbAssoc[i]);
|
let tempJobLocationData = new JobLocationData(dbAssoc[i]);
|
||||||
tempJobLocations.push(tempJobLocationData);
|
tempJobLocations.push(tempJobLocationData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Job location '${tempJobLocationData.databaseId}' loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Job location '${tempJobLocationData.databaseId}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: ${tempJobLocations.length} job locations for job ${jobDatabaseId} loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: ${tempJobLocations.length} job locations for job ${jobDatabaseId} loaded from database successfully!`);
|
||||||
return tempJobLocations;
|
return tempJobLocations;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadJobUniformsFromDatabase(jobDatabaseId) {
|
function loadJobUniformsFromDatabase(jobDatabaseId) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Loading job uniforms for job ${jobDatabaseId} from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Loading job uniforms for job ${jobDatabaseId} from database ...`);
|
||||||
|
|
||||||
let tempJobUniforms = [];
|
let tempJobUniforms = [];
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
@@ -744,20 +744,20 @@ function loadJobUniformsFromDatabase(jobDatabaseId) {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempJobUniformData = new JobUniformData(dbAssoc[i]);
|
let tempJobUniformData = new JobUniformData(dbAssoc[i]);
|
||||||
tempJobUniforms.push(tempJobUniformData);
|
tempJobUniforms.push(tempJobUniformData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Job uniform '${tempJobUniformData.databaseId}' loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Job uniform '${tempJobUniformData.databaseId}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: ${tempJobUniforms.length} job uniforms for job ${jobDatabaseId} loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: ${tempJobUniforms.length} job uniforms for job ${jobDatabaseId} loaded from database successfully!`);
|
||||||
return tempJobUniforms;
|
return tempJobUniforms;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadJobEquipmentItemsFromDatabase(jobEquipmentDatabaseId) {
|
function loadJobEquipmentItemsFromDatabase(jobEquipmentDatabaseId) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Loading job equipment items for job equipment ${jobEquipmentDatabaseId} from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Loading job equipment items for job equipment ${jobEquipmentDatabaseId} from database ...`);
|
||||||
|
|
||||||
let tempJobEquipmentItems = [];
|
let tempJobEquipmentItems = [];
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
@@ -770,40 +770,40 @@ function loadJobEquipmentItemsFromDatabase(jobEquipmentDatabaseId) {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempJobEquipmentItemData = new JobEquipmentItemData(dbAssoc[i]);
|
let tempJobEquipmentItemData = new JobEquipmentItemData(dbAssoc[i]);
|
||||||
tempJobEquipmentItems.push(tempJobEquipmentItemData);
|
tempJobEquipmentItems.push(tempJobEquipmentItemData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Job equipment item '${tempJobEquipmentItemData.databaseId}' loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Job equipment item '${tempJobEquipmentItemData.databaseId}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: ${tempJobEquipmentItems.length} job equipment items for equipment ${jobEquipmentDatabaseId} loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: ${tempJobEquipmentItems.length} job equipment items for equipment ${jobEquipmentDatabaseId} loaded from database successfully!`);
|
||||||
return tempJobEquipmentItems;
|
return tempJobEquipmentItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function createAllJobBlips() {
|
function spawnAllJobBlips() {
|
||||||
if (!getServerConfig().createJobBlips) {
|
if (!getServerConfig().createJobBlips) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Spawning all job location blips ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] Spawning all job location blips ...`);
|
||||||
for (let i in getServerData().jobs) {
|
for (let i in getServerData().jobs) {
|
||||||
for (let j in getServerData().jobs[i].locations) {
|
for (let j in getServerData().jobs[i].locations) {
|
||||||
createJobLocationBlip(i, j);
|
spawnJobLocationBlip(i, j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] All job location blips spawned!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] All job location blips spawned!`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function createAllJobPickups() {
|
function spawnAllJobPickups() {
|
||||||
if (!getServerConfig().createJobPickups) {
|
if (!getServerConfig().createJobPickups) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] Spawning all job location pickups ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] Spawning all job location pickups ...`);
|
||||||
let pickupCount = 0;
|
let pickupCount = 0;
|
||||||
for (let i in getServerData().jobs) {
|
for (let i in getServerData().jobs) {
|
||||||
if (getServerData().jobs[i].pickupModel != 0) {
|
if (getServerData().jobs[i].pickupModel != 0) {
|
||||||
@@ -819,11 +819,11 @@ function createAllJobPickups() {
|
|||||||
setElementDimension(getServerData().jobs[i].locations[j].pickup, getServerData().jobs[i].locations[j].dimension);
|
setElementDimension(getServerData().jobs[i].locations[j].pickup, getServerData().jobs[i].locations[j].dimension);
|
||||||
addToWorld(getServerData().jobs[i].locations[j].pickup);
|
addToWorld(getServerData().jobs[i].locations[j].pickup);
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job] Job '${getServerData().jobs[i].name}' location pickup ${j} spawned!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job] Job '${getServerData().jobs[i].name}' location pickup ${j} spawned!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job] All job location pickups (${pickupCount}) spawned!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job] All job location pickups (${pickupCount}) spawned!`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -943,6 +943,11 @@ function takeJobCommand(command, params, client) {
|
|||||||
let closestJobLocation = getClosestJobLocation(getPlayerPosition(client), getPlayerDimension(client));
|
let closestJobLocation = getClosestJobLocation(getPlayerPosition(client), getPlayerDimension(client));
|
||||||
let jobData = getJobData(closestJobLocation.jobIndex);
|
let jobData = getJobData(closestJobLocation.jobIndex);
|
||||||
|
|
||||||
|
if (closestJobLocation == false) {
|
||||||
|
messagePlayerError(client, getLocaleString(client, "NoJobLocationCloseEnough"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (closestJobLocation.position.distance(getPlayerPosition(client)) > getGlobalConfig().takeJobDistance) {
|
if (closestJobLocation.position.distance(getPlayerPosition(client)) > getGlobalConfig().takeJobDistance) {
|
||||||
messagePlayerError(client, getLocaleString(client, "NoJobLocationCloseEnough"));
|
messagePlayerError(client, getLocaleString(client, "NoJobLocationCloseEnough"));
|
||||||
return false;
|
return false;
|
||||||
@@ -1550,8 +1555,8 @@ function reloadAllJobsCommand(command, params, client) {
|
|||||||
|
|
||||||
Promise.resolve().then(() => {
|
Promise.resolve().then(() => {
|
||||||
getServerData().jobs = loadJobsFromDatabase();
|
getServerData().jobs = loadJobsFromDatabase();
|
||||||
createAllJobPickups();
|
spawnAllJobPickups();
|
||||||
createAllJobBlips();
|
spawnAllJobBlips();
|
||||||
});
|
});
|
||||||
|
|
||||||
announceAdminAction("AllJobsReloaded");
|
announceAdminAction("AllJobsReloaded");
|
||||||
@@ -1560,6 +1565,11 @@ function reloadAllJobsCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function createJobCommand(command, params, client) {
|
function createJobCommand(command, params, client) {
|
||||||
|
if (areParamsEmpty(params)) {
|
||||||
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
createJob(params);
|
createJob(params);
|
||||||
|
|
||||||
messagePlayerSuccess(client, `Job {jobYellow}${params} {MAINCOLOUR}created!`);
|
messagePlayerSuccess(client, `Job {jobYellow}${params} {MAINCOLOUR}created!`);
|
||||||
@@ -2720,11 +2730,11 @@ function saveJobToDatabase(jobData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (jobData.needsSaved == false) {
|
if (jobData.needsSaved == false) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Job ${jobData.name} doesn't need saved. Skipping ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Job ${jobData.name} doesn't need saved. Skipping ...`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saving job ${jobData.name} to database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saving job ${jobData.name} to database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
let safeName = escapeDatabaseString(dbConnection, jobData.name);
|
let safeName = escapeDatabaseString(dbConnection, jobData.name);
|
||||||
@@ -2761,7 +2771,7 @@ function saveJobToDatabase(jobData) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saved job ${jobData.name} to database!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saved job ${jobData.name} to database!`);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2775,11 +2785,11 @@ function saveJobRankToDatabase(jobRankData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (jobRankData.needsSaved == false) {
|
if (jobRankData.needsSaved == false) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Job route ${jobRankData.name} (DB ID ${jobRankData.databaseId}) doesn't need saved. Skipping ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Job route ${jobRankData.name} (DB ID ${jobRankData.databaseId}) doesn't need saved. Skipping ...`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saving job route ${jobRankData.name} to database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saving job route ${jobRankData.name} to database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
let safeName = escapeDatabaseString(dbConnection, jobRankData.name);
|
let safeName = escapeDatabaseString(dbConnection, jobRankData.name);
|
||||||
@@ -2810,7 +2820,7 @@ function saveJobRankToDatabase(jobRankData) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saved job rank ${jobRankData.name} to database!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saved job rank ${jobRankData.name} to database!`);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2824,11 +2834,11 @@ function saveJobRouteToDatabase(jobRouteData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (jobRouteData.needsSaved == false) {
|
if (jobRouteData.needsSaved == false) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Job route ${jobRouteData.name} (DB ID ${jobRouteData.databaseId}) doesn't need saved. Skipping ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Job route ${jobRouteData.name} (DB ID ${jobRouteData.databaseId}) doesn't need saved. Skipping ...`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saving job route ${jobRouteData.name} to database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saving job route ${jobRouteData.name} to database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
let safeName = escapeDatabaseString(dbConnection, jobRouteData.name);
|
let safeName = escapeDatabaseString(dbConnection, jobRouteData.name);
|
||||||
@@ -2869,7 +2879,7 @@ function saveJobRouteToDatabase(jobRouteData) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saved job route ${jobRouteData.name} to database!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saved job route ${jobRouteData.name} to database!`);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2883,11 +2893,11 @@ function saveJobRouteLocationToDatabase(jobRouteLocationData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (jobRouteLocationData.needsSaved == false) {
|
if (jobRouteLocationData.needsSaved == false) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Job route location ${jobRouteLocationData.name} (DB ID ${jobRouteLocationData.databaseId}) doesn't need saved. Skipping ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Job route location ${jobRouteLocationData.name} (DB ID ${jobRouteLocationData.databaseId}) doesn't need saved. Skipping ...`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saving job route location ${jobRouteLocationData.name} to database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saving job route location ${jobRouteLocationData.name} to database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
let safeName = escapeDatabaseString(dbConnection, jobRouteLocationData.name);
|
let safeName = escapeDatabaseString(dbConnection, jobRouteLocationData.name);
|
||||||
@@ -2919,7 +2929,7 @@ function saveJobRouteLocationToDatabase(jobRouteLocationData) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saved job route location ${jobRoutePositionData.name} (${jobRouteLocationData.databaseId}) to database!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saved job route location ${jobRoutePositionData.name} (${jobRouteLocationData.databaseId}) to database!`);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2933,11 +2943,11 @@ function saveJobLocationToDatabase(jobLocationData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!jobLocationData.needsSaved) {
|
if (!jobLocationData.needsSaved) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Job location ${jobLocationData.name} (${jobLocationData.databaseId}) doesn't need saved. Skipping ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Job location ${jobLocationData.name} (${jobLocationData.databaseId}) doesn't need saved. Skipping ...`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saving job location ${jobLocationData.databaseId} to database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saving job location ${jobLocationData.databaseId} to database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
let data = [
|
let data = [
|
||||||
@@ -2968,7 +2978,7 @@ function saveJobLocationToDatabase(jobLocationData) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saved job location ${jobLocationData.databaseId} to database`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saved job location ${jobLocationData.databaseId} to database`);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -2982,11 +2992,11 @@ function saveJobEquipmentToDatabase(jobEquipmentData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!jobEquipmentData.needsSaved) {
|
if (!jobEquipmentData.needsSaved) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Job equipment ${jobEquipmentData.name} (${jobEquipmentData.databaseId}) doesn't need saved. Skipping ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Job equipment ${jobEquipmentData.name} (${jobEquipmentData.databaseId}) doesn't need saved. Skipping ...`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saving job equipment ${jobEquipmentData.databaseId} to database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saving job equipment ${jobEquipmentData.databaseId} to database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
let safeName = escapeDatabaseString(dbConnection, jobEquipmentData.name);
|
let safeName = escapeDatabaseString(dbConnection, jobEquipmentData.name);
|
||||||
@@ -3014,7 +3024,7 @@ function saveJobEquipmentToDatabase(jobEquipmentData) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saved job equipment ${jobEquipmentData.databaseId} to database`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saved job equipment ${jobEquipmentData.databaseId} to database`);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -3028,11 +3038,11 @@ function saveJobEquipmentItemToDatabase(jobEquipmentItemData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!jobEquipmentItemData.needsSaved) {
|
if (!jobEquipmentItemData.needsSaved) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Job equipment item ${jobEquipmentItemData.databaseId} doesn't need saved. Skipping ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Job equipment item ${jobEquipmentItemData.databaseId} doesn't need saved. Skipping ...`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saving job equipment weapon ${jobEquipmentItemData.databaseId} to database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saving job equipment weapon ${jobEquipmentItemData.databaseId} to database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
let data = [
|
let data = [
|
||||||
@@ -3059,7 +3069,7 @@ function saveJobEquipmentItemToDatabase(jobEquipmentItemData) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saved job equipment weapon ${jobEquipmentItemData.databaseId} to database`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saved job equipment weapon ${jobEquipmentItemData.databaseId} to database`);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -3073,11 +3083,11 @@ function saveJobUniformToDatabase(jobUniformData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!jobUniformData.needSaved) {
|
if (!jobUniformData.needSaved) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Job uniform ${jobUniformData.databaseId} doesn't need saved. Skipping ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Job uniform ${jobUniformData.databaseId} doesn't need saved. Skipping ...`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saving job uniform ${jobUniformData.databaseId} to database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saving job uniform ${jobUniformData.databaseId} to database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
let safeName = escapeDatabaseString(dbConnection, jobUniformData.name);
|
let safeName = escapeDatabaseString(dbConnection, jobUniformData.name);
|
||||||
@@ -3106,7 +3116,7 @@ function saveJobUniformToDatabase(jobUniformData) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Job]: Saved job uniform ${jobUniformData.databaseId} to database`);
|
logToConsole(LOG_DEBUG, `[V.RP.Job]: Saved job uniform ${jobUniformData.databaseId} to database`);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -3174,7 +3184,7 @@ function createJobLocationPickup(jobId, locationId) {
|
|||||||
|
|
||||||
let tempJobData = getJobData(jobId);
|
let tempJobData = getJobData(jobId);
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating pickup for location ${locationId} of the ${tempJobData.name} job`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Creating pickup for location ${locationId} of the ${tempJobData.name} job`);
|
||||||
|
|
||||||
if (tempJobData.pickupModel != -1) {
|
if (tempJobData.pickupModel != -1) {
|
||||||
let pickupModelId = -1;
|
let pickupModelId = -1;
|
||||||
@@ -3187,17 +3197,19 @@ function createJobLocationPickup(jobId, locationId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (areServerElementsSupported()) {
|
if (areServerElementsSupported()) {
|
||||||
let pickup = createGamePickup(pickupModelId, tempJobData.locations[locationId].position, getGameConfig().pickupTypes[getGame()].job);
|
if (isGameFeatureSupported("pickup")) {
|
||||||
if (pickup != false) {
|
let pickup = createGamePickup(pickupModelId, tempJobData.locations[locationId].position, getGameConfig().pickupTypes[getGame()].job);
|
||||||
tempJobData.locations[locationId].pickup = pickup;
|
if (pickup != false) {
|
||||||
setElementDimension(pickup, tempJobData.locations[locationId].dimension);
|
tempJobData.locations[locationId].pickup = pickup;
|
||||||
setElementOnAllDimensions(pickup, false);
|
setElementDimension(pickup, tempJobData.locations[locationId].dimension);
|
||||||
setEntityData(pickup, "v.rp.owner.type", V_PICKUP_JOB, false);
|
setElementOnAllDimensions(pickup, false);
|
||||||
setEntityData(pickup, "v.rp.owner.id", locationId, false);
|
setEntityData(pickup, "v.rp.owner.type", V_PICKUP_JOB, false);
|
||||||
setEntityData(pickup, "v.rp.label.type", V_LABEL_JOB, true);
|
setEntityData(pickup, "v.rp.owner.id", locationId, false);
|
||||||
setEntityData(pickup, "v.rp.label.name", tempJobData.name, true);
|
setEntityData(pickup, "v.rp.label.type", V_LABEL_JOB, true);
|
||||||
setEntityData(pickup, "v.rp.label.jobType", tempJobData.databaseId, true);
|
setEntityData(pickup, "v.rp.label.name", tempJobData.name, true);
|
||||||
addToWorld(pickup);
|
setEntityData(pickup, "v.rp.label.jobType", tempJobData.databaseId, true);
|
||||||
|
addToWorld(pickup);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let blipModelId = -1;
|
let blipModelId = -1;
|
||||||
@@ -3216,7 +3228,7 @@ function createJobLocationPickup(jobId, locationId) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function createJobLocationBlip(jobId, locationId) {
|
function spawnJobLocationBlip(jobId, locationId) {
|
||||||
if (!getServerConfig().createJobBlips) {
|
if (!getServerConfig().createJobBlips) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -3418,14 +3430,14 @@ function respawnPlayerLastJobVehicle(client) {
|
|||||||
|
|
||||||
function resetAllJobBlips() {
|
function resetAllJobBlips() {
|
||||||
deleteAllJobBlips();
|
deleteAllJobBlips();
|
||||||
createAllJobBlips();
|
spawnAllJobBlips();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function resetAllJobPickups() {
|
function resetAllJobPickups() {
|
||||||
deleteAllJobPickups();
|
deleteAllJobPickups();
|
||||||
createAllJobPickups();
|
spawnAllJobPickups();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -3551,7 +3563,11 @@ function createJobUniformCommand(command, params, client) {
|
|||||||
|
|
||||||
let splitParams = params.split(" ");
|
let splitParams = params.split(" ");
|
||||||
let jobId = getJobFromParams(getParam(params, " ", 1));
|
let jobId = getJobFromParams(getParam(params, " ", 1));
|
||||||
let skinIndex = getSkinModelIndexFromParams(splitParams.slice(1).join(" "), getGame());
|
let skinIndex = getPlayerCurrentSubAccount(client).skin;
|
||||||
|
|
||||||
|
if (areThereEnoughParams(params, 2, " ")) {
|
||||||
|
skinIndex = getSkinModelIndexFromParams(splitParams.slice(1).join(" "), getGame());
|
||||||
|
}
|
||||||
|
|
||||||
if (!getJobData(jobId)) {
|
if (!getJobData(jobId)) {
|
||||||
messagePlayerError(client, getLocaleString(client, "InvalidJob"));
|
messagePlayerError(client, getLocaleString(client, "InvalidJob"));
|
||||||
@@ -3564,7 +3580,7 @@ function createJobUniformCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
createJobUniform(jobId, skinIndex);
|
createJobUniform(jobId, skinIndex);
|
||||||
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}`);
|
messageAdmins(`{adminOrange}${getPlayerName(client)}{MAINCOLOUR} created uniform with skin {ALTCOLOUR}${getSkinNameFromIndex(skinIndex)} (${getGameConfig().skins[skinIndex][0]}){MAINCOLOUR} for job {jobYellow}${getJobData(jobId).name}`);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,8 @@ function addKeyBindCommand(command, params, client) {
|
|||||||
let tempCommand = getParam(params, " ", 2);
|
let tempCommand = getParam(params, " ", 2);
|
||||||
let tempParams = (splitParams.length > 2) ? splitParams.slice(2).join(" ") : "";
|
let tempParams = (splitParams.length > 2) ? splitParams.slice(2).join(" ") : "";
|
||||||
|
|
||||||
|
tempCommand = removeSlashesFromString(tempCommand);
|
||||||
|
|
||||||
if (!keyId) {
|
if (!keyId) {
|
||||||
messagePlayerError(client, getLocaleString(client, "InvalidKeyBindName"));
|
messagePlayerError(client, getLocaleString(client, "InvalidKeyBindName"));
|
||||||
messagePlayerTip(client, getLocaleString(client, "KeyBindNameTip"));
|
messagePlayerTip(client, getLocaleString(client, "KeyBindNameTip"));
|
||||||
@@ -61,7 +63,7 @@ function addKeyBindCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addPlayerKeyBind(client, keyId, tempCommand, tempParams);
|
addPlayerKeyBind(client, keyId, tempCommand, tempParams);
|
||||||
messagePlayerSuccess(client, getLocaleString(client, "KeyBindRemoved", `{ALTCOLOUR}${toUpperCase(getKeyNameFromId(keyId))}{MAINCOLOUR}`, `{ALTCOLOUR}/${tempCommand} ${tempParams}`));
|
messagePlayerSuccess(client, getLocaleString(client, "KeyBindAdded", `{ALTCOLOUR}${toUpperCase(getKeyNameFromId(keyId))}{MAINCOLOUR}`, `{ALTCOLOUR}/${tempCommand} ${tempParams}`));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -106,7 +108,7 @@ function copyKeyBindsToServerCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function addPlayerKeyBind(client, keyId, command, params, tempKey = false) {
|
function addPlayerKeyBind(client, keyId, command, params, tempKey = false) {
|
||||||
let keyBindData = new KeyBindData(false, keys, `${command} ${params}`);
|
let keyBindData = new KeyBindData(false, keyId, `${command} ${params}`);
|
||||||
if (tempKey == true) {
|
if (tempKey == true) {
|
||||||
keyBindData.databaseId = -1;
|
keyBindData.databaseId = -1;
|
||||||
}
|
}
|
||||||
@@ -116,7 +118,7 @@ function addPlayerKeyBind(client, keyId, command, params, tempKey = false) {
|
|||||||
|
|
||||||
if (!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "enter")) {
|
if (!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "enter")) {
|
||||||
let keyId = getPlayerKeyBindForCommand(client, "enter");
|
let keyId = getPlayerKeyBindForCommand(client, "enter");
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendPlayerEnterPropertyKey(client, keyId.key);
|
sendPlayerEnterPropertyKey(client, keyId.key);
|
||||||
} else {
|
} else {
|
||||||
sendPlayerEnterPropertyKey(client, false);
|
sendPlayerEnterPropertyKey(client, false);
|
||||||
@@ -140,8 +142,8 @@ function removePlayerKeyBind(client, keyId) {
|
|||||||
|
|
||||||
if (!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "enter")) {
|
if (!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "enter")) {
|
||||||
let keyId = getPlayerKeyBindForCommand(client, "enter");
|
let keyId = getPlayerKeyBindForCommand(client, "enter");
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendPlayerEnterPropertyKey(client, keyId.key);
|
sendPlayerEnterPropertyKey(client, -1);
|
||||||
} else {
|
} else {
|
||||||
sendPlayerEnterPropertyKey(client, false);
|
sendPlayerEnterPropertyKey(client, false);
|
||||||
}
|
}
|
||||||
@@ -208,7 +210,7 @@ function playerUsedKeyBind(client, key, duration = 0) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.KeyBind] ${getPlayerDisplayForConsole(client)} used keybind ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
logToConsole(LOG_DEBUG, `[V.RP.KeyBind] ${getPlayerDisplayForConsole(client)} used keybind ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
||||||
if (!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForKey(client, key)) {
|
if (!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForKey(client, key)) {
|
||||||
let keyBindData = getPlayerKeyBindForKey(client, key);
|
let keyBindData = getPlayerKeyBindForKey(client, key);
|
||||||
if (keyBindData.enabled) {
|
if (keyBindData.enabled) {
|
||||||
@@ -238,7 +240,7 @@ function sendAccountKeyBindsToClient(client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showKeyBindListCommand(command, params, client) {
|
function showKeyBindListCommand(command, params, client) {
|
||||||
let keybindList = getPlayerData(client).keyBinds.map(function (x) { return `{ALTCOLOUR}${toUpperCase(getKeyNameFromId(x.key))}: {MAINCOLOUR}${x.commandString}`; });
|
let keybindList = getPlayerData(client).keyBinds.map(function (x) { return `{chatBoxListIndex}${toUpperCase(getKeyNameFromId(x.key))}: {MAINCOLOUR}${x.commandString}`; });
|
||||||
|
|
||||||
let chunkedList = splitArrayIntoChunks(keybindList, 6);
|
let chunkedList = splitArrayIntoChunks(keybindList, 6);
|
||||||
|
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ function getLocaleString(client, stringName, ...args) {
|
|||||||
|
|
||||||
let tempString = getRawLocaleString(getPlayerData(client).locale, stringName);
|
let tempString = getRawLocaleString(getPlayerData(client).locale, stringName);
|
||||||
if (tempString == "" || tempString == null || typeof tempString == "undefined") {
|
if (tempString == "" || tempString == null || typeof tempString == "undefined") {
|
||||||
logToConsole(LOG_WARN, `[AGRP.Locale] Locale string missing for ${stringName} on language ${getLocaleData(getPlayerData(client).locale).englishName}`);
|
logToConsole(LOG_WARN, `[V.RP.Locale] Locale string missing for ${stringName} on language ${getLocaleData(getPlayerData(client).locale).englishName}`);
|
||||||
submitBugReport(client, `(AUTOMATED REPORT) Locale string "${stringName}" is missing for "${getPlayerLocaleName(client)}"`);
|
submitBugReport(client, `(AUTOMATED REPORT) Locale string "${stringName}" is missing for "${getPlayerLocaleName(client)}"`);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@@ -57,7 +57,7 @@ function getLocaleString(client, stringName, ...args) {
|
|||||||
function getLanguageLocaleString(localeId, stringName, ...args) {
|
function getLanguageLocaleString(localeId, stringName, ...args) {
|
||||||
let tempString = getRawLocaleString(localeId, stringName);
|
let tempString = getRawLocaleString(localeId, stringName);
|
||||||
if (tempString == "" || tempString == null || typeof tempString == "undefined") {
|
if (tempString == "" || tempString == null || typeof tempString == "undefined") {
|
||||||
logToConsole(LOG_WARN, `[AGRP.Locale] Locale string missing for ${stringName} on language ${getLocaleData(localeId).englishName}`);
|
logToConsole(LOG_WARN, `[V.RP.Locale] Locale string missing for ${stringName} on language ${getLocaleData(localeId).englishName}`);
|
||||||
submitBugReport(null, `(AUTOMATED REPORT) Locale string "${stringName}" is missing for "${getLocaleData(localeId).englishName}"`);
|
submitBugReport(null, `(AUTOMATED REPORT) Locale string "${stringName}" is missing for "${getLocaleData(localeId).englishName}"`);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@@ -74,7 +74,7 @@ function getLanguageLocaleString(localeId, stringName, ...args) {
|
|||||||
function getLanguageGroupedLocaleString(localeId, stringName, index, ...args) {
|
function getLanguageGroupedLocaleString(localeId, stringName, index, ...args) {
|
||||||
let tempString = getRawGroupedLocaleString(localeId, stringName, index);
|
let tempString = getRawGroupedLocaleString(localeId, stringName, index);
|
||||||
if (tempString == "" || tempString == null || typeof tempString == "undefined") {
|
if (tempString == "" || tempString == null || typeof tempString == "undefined") {
|
||||||
logToConsole(LOG_WARN, `[AGRP.Locale] Locale string missing for index ${index} of "${stringName}" on language ${getLocaleData(localeId).englishName}`);
|
logToConsole(LOG_WARN, `[V.RP.Locale] Locale string missing for index ${index} of "${stringName}" on language ${getLocaleData(localeId).englishName}`);
|
||||||
submitBugReport(null, `(AUTOMATED REPORT) Locale string index ${index} of "${stringName}" is missing for "${getLocaleData(localeId).englishName}"`);
|
submitBugReport(null, `(AUTOMATED REPORT) Locale string index ${index} of "${stringName}" is missing for "${getLocaleData(localeId).englishName}"`);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@@ -106,7 +106,7 @@ function getGroupedLocaleString(client, stringName, index, ...args) {
|
|||||||
|
|
||||||
function getRawLocaleString(localeId, stringName) {
|
function getRawLocaleString(localeId, stringName) {
|
||||||
if (typeof getLocaleStrings()[localeId][stringName] == "undefined") {
|
if (typeof getLocaleStrings()[localeId][stringName] == "undefined") {
|
||||||
logToConsole(LOG_WARN, `[AGRP.Locale] Locale string missing for ${getLocaleStrings()[localeId][stringName]} on language ${getLocaleData(localeId).englishName}[${localeId}]`);
|
logToConsole(LOG_WARN, `[V.RP.Locale] Locale string missing for ${getLocaleStrings()[localeId][stringName]} on language ${getLocaleData(localeId).englishName}[${localeId}]`);
|
||||||
submitBugReport(null, `(AUTOMATED REPORT) Locale string is missing for "${getLocaleStrings()[localeId][stringName]}" on language ${getLocaleData(localeId).englishName}[${localeId}]`);
|
submitBugReport(null, `(AUTOMATED REPORT) Locale string is missing for "${getLocaleStrings()[localeId][stringName]}" on language ${getLocaleData(localeId).englishName}[${localeId}]`);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@@ -127,7 +127,7 @@ function getRawLocaleString(localeId, stringName) {
|
|||||||
|
|
||||||
function getRawGroupedLocaleString(localeId, stringName, index) {
|
function getRawGroupedLocaleString(localeId, stringName, index) {
|
||||||
if (typeof getLocaleStrings()[localeId][stringName][index] == "undefined") {
|
if (typeof getLocaleStrings()[localeId][stringName][index] == "undefined") {
|
||||||
logToConsole(LOG_WARN, `[AGRP.Locale] Grouped locale string missing for index ${index} of string ${getLocaleStrings()[localeId][stringName][index]} on language ${getLocaleData(localeId).englishName}[${localeId}]`);
|
logToConsole(LOG_WARN, `[V.RP.Locale] Grouped locale string missing for index ${index} of string ${getLocaleStrings()[localeId][stringName][index]} on language ${getLocaleData(localeId).englishName}[${localeId}]`);
|
||||||
submitBugReport(null, `(AUTOMATED REPORT) Grouped locale string is missing for index ${index} of string "${getLocaleStrings()[localeId][stringName][index]}" on language ${getLocaleData(localeId).englishName}[${localeId}]`);
|
submitBugReport(null, `(AUTOMATED REPORT) Grouped locale string is missing for index ${index} of string "${getLocaleStrings()[localeId][stringName][index]}" on language ${getLocaleData(localeId).englishName}[${localeId}]`);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -367,7 +367,7 @@ function enterExitPropertyCommand(command, params, client) {
|
|||||||
|
|
||||||
if (closestProperty.exitScene != "" && isGameFeatureSupported("interiorScene")) {
|
if (closestProperty.exitScene != "" && isGameFeatureSupported("interiorScene")) {
|
||||||
getPlayerCurrentSubAccount(client).spawnPosition = closestProperty.exitPosition;
|
getPlayerCurrentSubAccount(client).spawnPosition = closestProperty.exitPosition;
|
||||||
if (isMainWorldScene(closestProperty.exitScene) || closestProperty.exitScene == "AGRP.MAINWORLD") {
|
if (isMainWorldScene(closestProperty.exitScene) || closestProperty.exitScene == "V.MAINWORLD") {
|
||||||
setPlayerScene(client, getGameConfig().mainWorldScene[getGame()]);
|
setPlayerScene(client, getGameConfig().mainWorldScene[getGame()]);
|
||||||
} else {
|
} else {
|
||||||
setPlayerScene(client, closestProperty.exitScene);
|
setPlayerScene(client, closestProperty.exitScene);
|
||||||
@@ -376,7 +376,7 @@ function enterExitPropertyCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isFadeCameraSupported()) {
|
if (isFadeCameraSupported()) {
|
||||||
fadeCamera(client, false, 1.0);
|
fadePlayerCamera(client, false, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
@@ -399,9 +399,11 @@ function enterExitPropertyCommand(command, params, client) {
|
|||||||
|
|
||||||
if (closestProperty.entranceScene != "" && isGameFeatureSupported("interiorScene")) {
|
if (closestProperty.entranceScene != "" && isGameFeatureSupported("interiorScene")) {
|
||||||
getPlayerCurrentSubAccount(client).spawnPosition = closestProperty.entrancePosition;
|
getPlayerCurrentSubAccount(client).spawnPosition = closestProperty.entrancePosition;
|
||||||
if (isMainWorldScene(closestProperty.entranceScene) || closestProperty.entranceScene == "AGRP.MAINWORLD") {
|
if (isMainWorldScene(closestProperty.entranceScene) || closestProperty.entranceScene == "V.MAINWORLD") {
|
||||||
|
destroyGameElement(client.player);
|
||||||
setPlayerScene(client, getGameConfig().mainWorldScene[getGame()]);
|
setPlayerScene(client, getGameConfig().mainWorldScene[getGame()]);
|
||||||
} else {
|
} else {
|
||||||
|
destroyGameElement(client.player);
|
||||||
setPlayerScene(client, closestProperty.entranceScene);
|
setPlayerScene(client, closestProperty.entranceScene);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -409,7 +411,7 @@ function enterExitPropertyCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isFadeCameraSupported()) {
|
if (isFadeCameraSupported()) {
|
||||||
fadeCamera(client, false, 1.0);
|
fadePlayerCamera(client, false, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
@@ -417,7 +419,7 @@ function enterExitPropertyCommand(command, params, client) {
|
|||||||
}, 1100);
|
}, 1100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Misc] ${getPlayerDisplayForConsole(client)} exited business ${inBusiness.name}[${inBusiness.index}/${inBusiness.databaseId}]`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Misc] ${getPlayerDisplayForConsole(client)} exited business ${inBusiness.name}[${inBusiness.index}/${inBusiness.databaseId}]`);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -925,7 +927,7 @@ function processPlayerDeath(client) {
|
|||||||
updatePlayerSpawnedState(client, false);
|
updatePlayerSpawnedState(client, false);
|
||||||
setPlayerControlState(client, false);
|
setPlayerControlState(client, false);
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
fadePlayerCamera(client, false, 1000);
|
fadePlayerCamera(client, false, 2000);
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
if (isPlayerInPaintBall(client)) {
|
if (isPlayerInPaintBall(client)) {
|
||||||
respawnPlayerForPaintBall(client);
|
respawnPlayerForPaintBall(client);
|
||||||
@@ -942,7 +944,7 @@ function processPlayerDeath(client) {
|
|||||||
|
|
||||||
spawnPlayer(client, closestJail.position, closestJail.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
spawnPlayer(client, closestJail.position, closestJail.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
||||||
|
|
||||||
fadePlayerCamera(client, true, 1000);
|
fadePlayerCamera(client, true, 2000);
|
||||||
updatePlayerSpawnedState(client, true);
|
updatePlayerSpawnedState(client, true);
|
||||||
makePlayerStopAnimation(client);
|
makePlayerStopAnimation(client);
|
||||||
setPlayerControlState(client, true);
|
setPlayerControlState(client, true);
|
||||||
@@ -958,7 +960,7 @@ function processPlayerDeath(client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
spawnPlayer(client, closestHospital.position, closestHospital.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
spawnPlayer(client, closestHospital.position, closestHospital.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
||||||
fadePlayerCamera(client, true, 1000);
|
fadePlayerCamera(client, true, 2000);
|
||||||
updatePlayerSpawnedState(client, true);
|
updatePlayerSpawnedState(client, true);
|
||||||
makePlayerStopAnimation(client);
|
makePlayerStopAnimation(client);
|
||||||
setPlayerControlState(client, true);
|
setPlayerControlState(client, true);
|
||||||
|
|||||||
@@ -7,6 +7,25 @@
|
|||||||
// TYPE: Server (JavaScript)
|
// 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 = [
|
let builtInCommands = [
|
||||||
"refresh",
|
"refresh",
|
||||||
"restart",
|
"restart",
|
||||||
@@ -826,24 +845,24 @@ function getPlayerWeapon(client) {
|
|||||||
function connectToDatabase() {
|
function connectToDatabase() {
|
||||||
if (getDatabaseConfig().usePersistentConnection) {
|
if (getDatabaseConfig().usePersistentConnection) {
|
||||||
if (persistentDatabaseConnection == null) {
|
if (persistentDatabaseConnection == null) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Initializing database connection ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Database] Initializing database connection ...`);
|
||||||
persistentDatabaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port);
|
persistentDatabaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port, getDatabaseConfig().useSSL);
|
||||||
if (persistentDatabaseConnection.error) {
|
if (persistentDatabaseConnection.error) {
|
||||||
logToConsole(LOG_ERROR, `[AGRP.Database] Database connection error: ${persistentDatabaseConnection.error}`);
|
logToConsole(LOG_ERROR, `[V.RP.Database] Database connection error: ${persistentDatabaseConnection.error}`);
|
||||||
persistentDatabaseConnection = null;
|
persistentDatabaseConnection = null;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Database connection successful!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Database] Database connection successful!`);
|
||||||
return persistentDatabaseConnection;
|
return persistentDatabaseConnection;
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Using existing database connection.`);
|
logToConsole(LOG_DEBUG, `[V.RP.Database] Using existing database connection.`);
|
||||||
return persistentDatabaseConnection;
|
return persistentDatabaseConnection;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let databaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port);
|
let databaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port, getDatabaseConfig().useSSL);
|
||||||
if (databaseConnection.error) {
|
if (databaseConnection.error) {
|
||||||
logToConsole(LOG_ERROR, `[AGRP.Database] Database connection error: ${persistentDatabaseConnection.error}`);
|
logToConsole(LOG_ERROR, `[V.RP.Database] Database connection error: ${persistentDatabaseConnection.error}`);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return databaseConnection;
|
return databaseConnection;
|
||||||
@@ -857,9 +876,9 @@ function disconnectFromDatabase(dbConnection, force = false) {
|
|||||||
if (!getDatabaseConfig().usePersistentConnection || force == true) {
|
if (!getDatabaseConfig().usePersistentConnection || force == true) {
|
||||||
try {
|
try {
|
||||||
dbConnection.close();
|
dbConnection.close();
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Database connection closed successfully`);
|
logToConsole(LOG_DEBUG, `[V.RP.Database] Database connection closed successfully`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logToConsole(LOG_ERROR, `[AGRP.Database] Database connection could not be closed! (Error: ${error})`);
|
logToConsole(LOG_ERROR, `[V.RP.Database] Database connection could not be closed! (Error: ${error})`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -868,7 +887,7 @@ function disconnectFromDatabase(dbConnection, force = false) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function queryDatabase(dbConnection, queryString, useThread = false) {
|
function queryDatabase(dbConnection, queryString, useThread = false) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Query string: ${queryString}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Database] Query string: ${queryString}`);
|
||||||
if (useThread == true) {
|
if (useThread == true) {
|
||||||
Promise.resolve().then(() => {
|
Promise.resolve().then(() => {
|
||||||
let queryResult = dbConnection.query(queryString);
|
let queryResult = dbConnection.query(queryString);
|
||||||
@@ -942,19 +961,19 @@ function quickDatabaseQuery(queryString) {
|
|||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
let insertId = 0;
|
let insertId = 0;
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Database] Query string: ${queryString}`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Database] Query string: ${queryString}`);
|
||||||
let dbQuery = queryDatabase(dbConnection, queryString);
|
let dbQuery = queryDatabase(dbConnection, queryString);
|
||||||
if (getDatabaseInsertId(dbConnection)) {
|
if (getDatabaseInsertId(dbConnection)) {
|
||||||
insertId = getDatabaseInsertId(dbConnection);
|
insertId = getDatabaseInsertId(dbConnection);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Query returned insert id ${insertId}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Database] Query returned insert id ${insertId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dbQuery) {
|
if (dbQuery) {
|
||||||
try {
|
try {
|
||||||
freeDatabaseQuery(dbQuery);
|
freeDatabaseQuery(dbQuery);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Query result free'd successfully`);
|
logToConsole(LOG_DEBUG, `[V.RP.Database] Query result free'd successfully`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logToConsole(LOG_ERROR, `[AGRP.Database] Query result could not be free'd! (Error: ${error})`);
|
logToConsole(LOG_ERROR, `[V.RP.Database] Query result could not be free'd! (Error: ${error})`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1006,9 +1025,9 @@ function setConstantsAsGlobalVariablesInDatabase() {
|
|||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
let entries = Object.entries(global);
|
let entries = Object.entries(global);
|
||||||
for (let i in entries) {
|
for (let i in entries) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Checking entry ${i} (${entries[i]})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Database] Checking entry ${i} (${entries[i]})`);
|
||||||
if (toString(i).slice(0, 3).indexOf("V_") != -1) {
|
if (toString(i).slice(0, 3).indexOf("V_") != -1) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Adding ${i} (${entries[i]}) to database global variables`);
|
logToConsole(LOG_DEBUG, `[V.RP.Database] Adding ${i} (${entries[i]}) to database global variables`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1193,7 +1212,7 @@ function setVehicleHealth(vehicle, health) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function givePlayerWeapon(client, weaponId, ammo, active = true) {
|
function givePlayerWeapon(client, weaponId, ammo, active = true) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to give weapon (Weapon: ${weaponId}, Ammo: ${ammo})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to give weapon (Weapon: ${weaponId}, Ammo: ${ammo})`);
|
||||||
sendNetworkEventToPlayer("v.rp.giveWeapon", client, weaponId, ammo, active);
|
sendNetworkEventToPlayer("v.rp.giveWeapon", client, weaponId, ammo, active);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1447,7 +1466,7 @@ function hideElementForPlayer(element, client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Native.Connected] Hiding element ${element.id} for player ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Native.Connected] Hiding element ${element.id} for player ${getPlayerDisplayForConsole(client)}`);
|
||||||
element.setExistsFor(client, false);
|
element.setExistsFor(client, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1462,7 +1481,7 @@ function showElementForPlayer(element, client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Native.Connected] Showing element ${element.id} for player ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Native.Connected] Showing element ${element.id} for player ${getPlayerDisplayForConsole(client)}`);
|
||||||
element.setExistsFor(client, true);
|
element.setExistsFor(client, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
1364
scripts/server/native/mafiamp.js
Normal file
1364
scripts/server/native/mafiamp.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -7,6 +7,26 @@
|
|||||||
// TYPE: Server (JavaScript)
|
// 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 = [
|
let builtInCommands = [
|
||||||
"refresh",
|
"refresh",
|
||||||
"restart",
|
"restart",
|
||||||
@@ -742,24 +762,24 @@ function getPlayerWeapon(client) {
|
|||||||
function connectToDatabase() {
|
function connectToDatabase() {
|
||||||
if (getDatabaseConfig().usePersistentConnection) {
|
if (getDatabaseConfig().usePersistentConnection) {
|
||||||
if (persistentDatabaseConnection == null) {
|
if (persistentDatabaseConnection == null) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Initializing database connection ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Database] Initializing database connection ...`);
|
||||||
persistentDatabaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port);
|
persistentDatabaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port, getDatabaseConfig().useSSL);
|
||||||
if (persistentDatabaseConnection.error) {
|
if (persistentDatabaseConnection.error) {
|
||||||
logToConsole(LOG_ERROR, `[AGRP.Database] Database connection error: ${persistentDatabaseConnection.error}`);
|
logToConsole(LOG_ERROR, `[V.RP.Database] Database connection error: ${persistentDatabaseConnection.error}`);
|
||||||
persistentDatabaseConnection = null;
|
persistentDatabaseConnection = null;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Database connection successful!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Database] Database connection successful!`);
|
||||||
return persistentDatabaseConnection;
|
return persistentDatabaseConnection;
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Using existing database connection.`);
|
logToConsole(LOG_DEBUG, `[V.RP.Database] Using existing database connection.`);
|
||||||
return persistentDatabaseConnection;
|
return persistentDatabaseConnection;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let databaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port);
|
let databaseConnection = module.mysql.connect(getDatabaseConfig().host, getDatabaseConfig().user, getDatabaseConfig().pass, getDatabaseConfig().name, getDatabaseConfig().port, getDatabaseConfig().useSSL);
|
||||||
if (databaseConnection.error) {
|
if (databaseConnection.error) {
|
||||||
logToConsole(LOG_ERROR, `[AGRP.Database] Database connection error: ${persistentDatabaseConnection.error}`);
|
logToConsole(LOG_ERROR, `[V.RP.Database] Database connection error: ${persistentDatabaseConnection.error}`);
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return databaseConnection;
|
return databaseConnection;
|
||||||
@@ -773,9 +793,9 @@ function disconnectFromDatabase(dbConnection) {
|
|||||||
if (!getDatabaseConfig().usePersistentConnection) {
|
if (!getDatabaseConfig().usePersistentConnection) {
|
||||||
try {
|
try {
|
||||||
dbConnection.close();
|
dbConnection.close();
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Database connection closed successfully`);
|
logToConsole(LOG_DEBUG, `[V.RP.Database] Database connection closed successfully`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logToConsole(LOG_ERROR, `[AGRP.Database] Database connection could not be closed! (Error: ${error})`);
|
logToConsole(LOG_ERROR, `[V.RP.Database] Database connection could not be closed! (Error: ${error})`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -784,7 +804,7 @@ function disconnectFromDatabase(dbConnection) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function queryDatabase(dbConnection, queryString, useThread = false) {
|
function queryDatabase(dbConnection, queryString, useThread = false) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Query string: ${queryString}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Database] Query string: ${queryString}`);
|
||||||
if (useThread == true) {
|
if (useThread == true) {
|
||||||
Promise.resolve().then(() => {
|
Promise.resolve().then(() => {
|
||||||
let queryResult = dbConnection.query(queryString);
|
let queryResult = dbConnection.query(queryString);
|
||||||
@@ -849,19 +869,19 @@ function quickDatabaseQuery(queryString) {
|
|||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
let insertId = 0;
|
let insertId = 0;
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Database] Query string: ${queryString}`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Database] Query string: ${queryString}`);
|
||||||
let dbQuery = queryDatabase(dbConnection, queryString);
|
let dbQuery = queryDatabase(dbConnection, queryString);
|
||||||
if (getDatabaseInsertId(dbConnection)) {
|
if (getDatabaseInsertId(dbConnection)) {
|
||||||
insertId = getDatabaseInsertId(dbConnection);
|
insertId = getDatabaseInsertId(dbConnection);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Query returned insert id ${insertId}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Database] Query returned insert id ${insertId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dbQuery) {
|
if (dbQuery) {
|
||||||
try {
|
try {
|
||||||
freeDatabaseQuery(dbQuery);
|
freeDatabaseQuery(dbQuery);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Database] Query result free'd successfully`);
|
logToConsole(LOG_DEBUG, `[V.RP.Database] Query result free'd successfully`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logToConsole(LOG_ERROR, `[AGRP.Database] Query result could not be free'd! (Error: ${error})`);
|
logToConsole(LOG_ERROR, `[V.RP.Database] Query result could not be free'd! (Error: ${error})`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -998,7 +1018,7 @@ function setVehicleHealth(vehicle, health) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function givePlayerWeapon(client, weaponId, ammo, active = true) {
|
function givePlayerWeapon(client, weaponId, ammo, active = true) {
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to give weapon (Weapon: ${weaponId}, Ammo: ${ammo})`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to give weapon (Weapon: ${weaponId}, Ammo: ${ammo})`);
|
||||||
//sendNetworkEventToPlayer("v.rp.giveWeapon", client, weaponId, ammo, active);
|
//sendNetworkEventToPlayer("v.rp.giveWeapon", client, weaponId, ammo, active);
|
||||||
client.giveWeapon(weaponId, ammo);
|
client.giveWeapon(weaponId, ammo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ function addAllNetworkEventHandlers() {
|
|||||||
|
|
||||||
// Event
|
// Event
|
||||||
addNetworkEventHandler("v.rp.pickup", onPlayerNearPickup);
|
addNetworkEventHandler("v.rp.pickup", onPlayerNearPickup);
|
||||||
addNetworkEventHandler("v.rp.playerDeath", onPlayerDeath);
|
addNetworkEventHandler("v.rp.playerDeath", processPlayerDeath);
|
||||||
|
|
||||||
// Job
|
// Job
|
||||||
addNetworkEventHandler("v.rp.arrivedAtJobRouteLocation", playerArrivedAtJobRouteLocation);
|
addNetworkEventHandler("v.rp.arrivedAtJobRouteLocation", playerArrivedAtJobRouteLocation);
|
||||||
@@ -87,14 +87,14 @@ function updatePlayerNameTag(client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending ${getPlayerDisplayForConsole(client)}'s updated nametag to all players`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending ${getPlayerDisplayForConsole(client)}'s updated nametag to all players`);
|
||||||
sendNetworkEventToPlayer("v.rp.nametag", null, getPlayerName(client), getPlayerNameForNameTag(client), getPlayerColour(client), getPlayerData(client).afk, getPlayerPing(client));
|
sendNetworkEventToPlayer("v.rp.nametag", null, getPlayerName(client), getPlayerNameForNameTag(client), getPlayerColour(client), getPlayerData(client).afk, getPlayerPing(client));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function updateAllPlayerNameTags() {
|
function updateAllPlayerNameTags() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending updated nametags to all players`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending updated nametags to all players`);
|
||||||
let clients = getClients();
|
let clients = getClients();
|
||||||
for (let i in clients) {
|
for (let i in clients) {
|
||||||
updatePlayerNameTag(clients[i]);
|
updatePlayerNameTag(clients[i]);
|
||||||
@@ -104,7 +104,7 @@ function updateAllPlayerNameTags() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function updatePlayerPing(client) {
|
function updatePlayerPing(client) {
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Client] Sending ${getPlayerDisplayForConsole(client)}'s ping to all players`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Client] Sending ${getPlayerDisplayForConsole(client)}'s ping to all players`);
|
||||||
sendNetworkEventToPlayer("v.rp.ping", null, getPlayerName(client), getPlayerPing(client));
|
sendNetworkEventToPlayer("v.rp.ping", null, getPlayerName(client), getPlayerPing(client));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ function updatePlayerPing(client) {
|
|||||||
|
|
||||||
function playerClientReady(client) {
|
function playerClientReady(client) {
|
||||||
playerResourceReady[client.index] = true;
|
playerResourceReady[client.index] = true;
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s client resources are downloaded and ready! Started: ${getYesNoFromBool(playerResourceStarted[client.index])}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s client resources are downloaded and ready! Started: ${getYesNoFromBool(playerResourceStarted[client.index])}`);
|
||||||
if (playerResourceStarted[client.index] == true && playerInitialized[client.index] == false) {
|
if (playerResourceStarted[client.index] == true && playerInitialized[client.index] == false) {
|
||||||
initClient(client);
|
initClient(client);
|
||||||
}
|
}
|
||||||
@@ -122,14 +122,14 @@ function playerClientReady(client) {
|
|||||||
|
|
||||||
function playerGUIReady(client) {
|
function playerGUIReady(client) {
|
||||||
playerGUI[client.index] = true;
|
playerGUI[client.index] = true;
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s client GUI is initialized and ready!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s client GUI is initialized and ready!`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function playerClientStarted(client) {
|
function playerClientStarted(client) {
|
||||||
playerResourceStarted[client.index] = true;
|
playerResourceStarted[client.index] = true;
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s client resources are started and running! Ready: ${getYesNoFromBool(playerResourceReady[client.index])}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s client resources are started and running! Ready: ${getYesNoFromBool(playerResourceReady[client.index])}`);
|
||||||
if (playerResourceReady[client.index] == true && playerInitialized[client.index] == false) {
|
if (playerResourceReady[client.index] == true && playerInitialized[client.index] == false) {
|
||||||
initClient(client);
|
initClient(client);
|
||||||
}
|
}
|
||||||
@@ -138,7 +138,7 @@ function playerClientStarted(client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function playerClientStopped(client) {
|
function playerClientStopped(client) {
|
||||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s client resources have stopped (possibly error?)`);
|
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s client resources have stopped (possibly error?)`);
|
||||||
getPlayerData(client).customDisconnectReason = "ClientScriptVerificationFail";
|
getPlayerData(client).customDisconnectReason = "ClientScriptVerificationFail";
|
||||||
//disconnectPlayer(client);
|
//disconnectPlayer(client);
|
||||||
}
|
}
|
||||||
@@ -146,7 +146,7 @@ function playerClientStopped(client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showSmallGameMessage(client, text, colour, duration, fontName = "Roboto") {
|
function showSmallGameMessage(client, text, colour, duration, fontName = "Roboto") {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing game message to ${getPlayerDisplayForConsole(client)} (${text}) for ${duration} milliseconds`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing game message to ${getPlayerDisplayForConsole(client)} (${text}) for ${duration} milliseconds`);
|
||||||
|
|
||||||
if (getGame() <= V_GAME_GTA_IV_EFLC) {
|
if (getGame() <= V_GAME_GTA_IV_EFLC) {
|
||||||
fontName = "Pricedown";
|
fontName = "Pricedown";
|
||||||
@@ -163,7 +163,7 @@ function enableCityAmbienceForPlayer(client, clearElements = false) {
|
|||||||
// return false;
|
// return false;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`);
|
||||||
//sendNetworkEventToPlayer("v.rp.ambience", client, true);
|
//sendNetworkEventToPlayer("v.rp.ambience", client, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,21 +174,21 @@ function disableCityAmbienceForPlayer(client, clearElements = false) {
|
|||||||
// return false;
|
// return false;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`);
|
||||||
//sendNetworkEventToPlayer("v.rp.ambience", client, false, clearElements);
|
//sendNetworkEventToPlayer("v.rp.ambience", client, false, clearElements);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function clearPlayerOwnedPeds(client) {
|
function clearPlayerOwnedPeds(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Clearing peds owned by ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Clearing peds owned by ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.clearPeds", client);
|
sendNetworkEventToPlayer("v.rp.clearPeds", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function updatePlayerSpawnedState(client, state) {
|
function updatePlayerSpawnedState(client, state) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Setting ${getPlayerDisplayForConsole(client)}'s spawned state ${toUpperCase(getOnOffFromBool(state))}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Setting ${getPlayerDisplayForConsole(client)}'s spawned state ${toUpperCase(getOnOffFromBool(state))}`);
|
||||||
getPlayerData(client).spawned = true;
|
getPlayerData(client).spawned = true;
|
||||||
sendNetworkEventToPlayer("v.rp.spawned", client, state);
|
sendNetworkEventToPlayer("v.rp.spawned", client, state);
|
||||||
}
|
}
|
||||||
@@ -196,21 +196,21 @@ function updatePlayerSpawnedState(client, state) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setPlayerControlState(client, state) {
|
function setPlayerControlState(client, state) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Setting ${getPlayerDisplayForConsole(client)}'s control state ${toUpperCase(getOnOffFromBool(state))}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Setting ${getPlayerDisplayForConsole(client)}'s control state ${toUpperCase(getOnOffFromBool(state))}`);
|
||||||
sendNetworkEventToPlayer("v.rp.control", client, state, !state);
|
sendNetworkEventToPlayer("v.rp.control", client, state, !state);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function updatePlayerShowLogoState(client, state) {
|
function updatePlayerShowLogoState(client, state) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Setting ${getPlayerDisplayForConsole(client)}'s logo state ${toUpperCase(getOnOffFromBool(state))}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Setting ${getPlayerDisplayForConsole(client)}'s logo state ${toUpperCase(getOnOffFromBool(state))}`);
|
||||||
sendNetworkEventToPlayer("v.rp.logo", client, state);
|
sendNetworkEventToPlayer("v.rp.logo", client, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function restorePlayerCamera(client) {
|
function restorePlayerCamera(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Restoring ${getPlayerDisplayForConsole(client)}'s camera`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Restoring ${getPlayerDisplayForConsole(client)}'s camera`);
|
||||||
sendNetworkEventToPlayer("v.rp.restoreCamera", client);
|
sendNetworkEventToPlayer("v.rp.restoreCamera", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -223,7 +223,7 @@ function setPlayer2DRendering(client, hudState = false, labelState = false, smal
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function syncPlayerProperties(client) {
|
function syncPlayerProperties(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to sync ${getPlayerDisplayForConsole(client)}'s player ped properties`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending signal to sync ${getPlayerDisplayForConsole(client)}'s player ped properties`);
|
||||||
sendNetworkEventToPlayer("v.rp.syncElement", null, getPlayerPed(client).id);
|
sendNetworkEventToPlayer("v.rp.syncElement", null, getPlayerPed(client).id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,7 +231,7 @@ function syncPlayerProperties(client) {
|
|||||||
|
|
||||||
function updatePlayerSnowState(client, forceGroundSnow = false) {
|
function updatePlayerSnowState(client, forceGroundSnow = false) {
|
||||||
if (isSnowSupported(getGame())) {
|
if (isSnowSupported(getGame())) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Setting ${getPlayerDisplayForConsole(client)}'s snow state (Falling: ${toUpperCase(getOnOffFromBool(getServerConfig().fallingSnow))}, Ground: ${toUpperCase(getOnOffFromBool(getServerConfig().groundSnow))})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Setting ${getPlayerDisplayForConsole(client)}'s snow state (Falling: ${toUpperCase(getOnOffFromBool(getServerConfig().fallingSnow))}, Ground: ${toUpperCase(getOnOffFromBool(getServerConfig().groundSnow))})`);
|
||||||
sendNetworkEventToPlayer("v.rp.snow", client, getServerConfig().fallingSnow, getServerConfig().groundSnow, forceGroundSnow);
|
sendNetworkEventToPlayer("v.rp.snow", client, getServerConfig().fallingSnow, getServerConfig().groundSnow, forceGroundSnow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -239,7 +239,7 @@ function updatePlayerSnowState(client, forceGroundSnow = false) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function updatePlayerHotBar(client) {
|
function updatePlayerHotBar(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending updated hotbar data to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending updated hotbar data to ${getPlayerDisplayForConsole(client)}`);
|
||||||
let tempHotBarItems = [];
|
let tempHotBarItems = [];
|
||||||
for (let i in getPlayerData(client).hotBarItems) {
|
for (let i in getPlayerData(client).hotBarItems) {
|
||||||
let itemImage = "";
|
let itemImage = "";
|
||||||
@@ -262,14 +262,14 @@ function updatePlayerHotBar(client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setPlayerWeaponDamageEnabled(client, state) {
|
function setPlayerWeaponDamageEnabled(client, state) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending weapon damage state for ${getPlayerDisplayForConsole(client)} to all players`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending weapon damage state for ${getPlayerDisplayForConsole(client)} to all players`);
|
||||||
sendNetworkEventToPlayer("v.rp.weaponDamageEnabled", null, getPlayerName(client), state);
|
sendNetworkEventToPlayer("v.rp.weaponDamageEnabled", null, getPlayerName(client), state);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setPlayerWeaponDamageEvent(client, eventType) {
|
function setPlayerWeaponDamageEvent(client, eventType) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending weapon damage event (${eventType}) for ${getPlayerDisplayForConsole(client)} to all players`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending weapon damage event (${eventType}) for ${getPlayerDisplayForConsole(client)} to all players`);
|
||||||
sendNetworkEventToPlayer("v.rp.weaponDamageEvent", null, getPlayerName(client), eventType);
|
sendNetworkEventToPlayer("v.rp.weaponDamageEvent", null, getPlayerName(client), eventType);
|
||||||
getPlayerData(client).weaponDamageEvent = eventType;
|
getPlayerData(client).weaponDamageEvent = eventType;
|
||||||
}
|
}
|
||||||
@@ -277,259 +277,259 @@ function setPlayerWeaponDamageEvent(client, eventType) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendJobRouteLocationToPlayer(client, position, colour) {
|
function sendJobRouteLocationToPlayer(client, position, colour) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending job route location data to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending job route location data to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.showJobRouteLocation", client, position, colour);
|
sendNetworkEventToPlayer("v.rp.showJobRouteLocation", client, position, colour);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerLoginSuccessGUI(client) {
|
function showPlayerLoginSuccessGUI(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending login success GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending login success GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.loginSuccess", client);
|
sendNetworkEventToPlayer("v.rp.loginSuccess", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerLoginFailedGUI(client, errorMessage) {
|
function showPlayerLoginFailedGUI(client, errorMessage) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending login failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending login failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.loginFailed", client, errorMessage);
|
sendNetworkEventToPlayer("v.rp.loginFailed", client, errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerRegistrationSuccessGUI(client) {
|
function showPlayerRegistrationSuccessGUI(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending registration success GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending registration success GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.registrationSuccess", client);
|
sendNetworkEventToPlayer("v.rp.registrationSuccess", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerRegistrationFailedGUI(client, errorMessage) {
|
function showPlayerRegistrationFailedGUI(client, errorMessage) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending registration failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending registration failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.registrationFailed", client, errorMessage);
|
sendNetworkEventToPlayer("v.rp.registrationFailed", client, errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendPlayerGUIColours(client) {
|
function sendPlayerGUIColours(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending GUI colours to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending GUI colours to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.guiColour", client, getServerConfig().guiColourPrimary[0], getServerConfig().guiColourPrimary[1], getServerConfig().guiColourPrimary[2], getServerConfig().guiColourSecondary[0], getServerConfig().guiColourSecondary[1], getServerConfig().guiColourSecondary[2], getServerConfig().guiTextColourPrimary[0], getServerConfig().guiTextColourPrimary[1], getServerConfig().guiTextColourPrimary[2]);
|
sendNetworkEventToPlayer("v.rp.guiColour", client, getServerConfig().guiColourPrimary[0], getServerConfig().guiColourPrimary[1], getServerConfig().guiColourPrimary[2], getServerConfig().guiColourSecondary[0], getServerConfig().guiColourSecondary[1], getServerConfig().guiColourSecondary[2], getServerConfig().guiTextColourPrimary[0], getServerConfig().guiTextColourPrimary[1], getServerConfig().guiTextColourPrimary[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendPlayerGUIInit(client) {
|
function sendPlayerGUIInit(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending GUI init signal to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending GUI init signal to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.guiInit", client);
|
sendNetworkEventToPlayer("v.rp.guiInit", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerLoginGUI(client, errorMessage = "") {
|
function showPlayerLoginGUI(client, errorMessage = "") {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show login GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending show login GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.showLogin", client);
|
sendNetworkEventToPlayer("v.rp.showLogin", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerRegistrationGUI(client, errorMessage = "") {
|
function showPlayerRegistrationGUI(client, errorMessage = "") {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show registration GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending show registration GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.showRegistration", client);
|
sendNetworkEventToPlayer("v.rp.showRegistration", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerNewCharacterGUI(client) {
|
function showPlayerNewCharacterGUI(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show new character GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending show new character GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.showNewCharacter", client);
|
sendNetworkEventToPlayer("v.rp.showNewCharacter", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerChangePasswordGUI(client, errorMessage = "") {
|
function showPlayerChangePasswordGUI(client, errorMessage = "") {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show change password GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending show change password GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.showChangePassword", client, errorMessage);
|
sendNetworkEventToPlayer("v.rp.showChangePassword", client, errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerResetPasswordCodeInputGUI(client) {
|
function showPlayerResetPasswordCodeInputGUI(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show reset password code input GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending show reset password code input GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.showResetPasswordCodeInput", client);
|
sendNetworkEventToPlayer("v.rp.showResetPasswordCodeInput", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerResetPasswordEmailInputGUI(client) {
|
function showPlayerResetPasswordEmailInputGUI(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show reset password email input GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending show reset password email input GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.showResetPasswordEmailInput", client);
|
sendNetworkEventToPlayer("v.rp.showResetPasswordEmailInput", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerCharacterSelectGUI(client, firstName, lastName, cash, clan, lastPlayed, skin) {
|
function showPlayerCharacterSelectGUI(client, firstName, lastName, cash, clan, lastPlayed, skin) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending character select GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending character select GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.showCharacterSelect", client, firstName, lastName, cash, clan, lastPlayed, skin);
|
sendNetworkEventToPlayer("v.rp.showCharacterSelect", client, firstName, lastName, cash, clan, lastPlayed, skin);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function updatePlayerCharacterSelectGUI(client, firstName, lastName, cash, clan, lastPlayed, skin) {
|
function updatePlayerCharacterSelectGUI(client, firstName, lastName, cash, clan, lastPlayed, skin) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending update character select GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending update character select GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.switchCharacterSelect", client, firstName, lastName, cash, clan, lastPlayed, skin);
|
sendNetworkEventToPlayer("v.rp.switchCharacterSelect", client, firstName, lastName, cash, clan, lastPlayed, skin);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerCharacterSelectSuccessGUI(client) {
|
function showPlayerCharacterSelectSuccessGUI(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending character select success GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending character select success GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.characterSelectSuccess", client);
|
sendNetworkEventToPlayer("v.rp.characterSelectSuccess", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerCharacterSelectFailedGUI(client) {
|
function showPlayerCharacterSelectFailedGUI(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending character select failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending character select failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.characterSelectFailed", client);
|
sendNetworkEventToPlayer("v.rp.characterSelectFailed", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerPromptGUI(client, promptMessage, promptTitle, yesButtonText = "Yes", noButtonText = "No") {
|
function showPlayerPromptGUI(client, promptMessage, promptTitle, yesButtonText = "Yes", noButtonText = "No") {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show prompt GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${promptTitle}, Message: ${promptMessage}, YesButton: ${yesButtonText}, NoButton: ${noButtonText})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending show prompt GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${promptTitle}, Message: ${promptMessage}, YesButton: ${yesButtonText}, NoButton: ${noButtonText})`);
|
||||||
sendNetworkEventToPlayer("v.rp.showPrompt", client, promptMessage, promptTitle, yesButtonText, noButtonText);
|
sendNetworkEventToPlayer("v.rp.showPrompt", client, promptMessage, promptTitle, yesButtonText, noButtonText);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerInfoGUI(client, infoMessage, infoTitle, buttonText = "OK") {
|
function showPlayerInfoGUI(client, infoMessage, infoTitle, buttonText = "OK") {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show info GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${infoTitle}, Message: ${infoMessage})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending show info GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${infoTitle}, Message: ${infoMessage})`);
|
||||||
sendNetworkEventToPlayer("v.rp.showInfo", client, infoMessage, infoTitle, buttonText);
|
sendNetworkEventToPlayer("v.rp.showInfo", client, infoMessage, infoTitle, buttonText);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerErrorGUI(client, errorMessage, errorTitle, buttonText = "OK") {
|
function showPlayerErrorGUI(client, errorMessage, errorTitle, buttonText = "OK") {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending show error GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${errorTitle}, Message: ${errorMessage})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending show error GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${errorTitle}, Message: ${errorMessage})`);
|
||||||
sendNetworkEventToPlayer("v.rp.showError", client, errorMessage, errorTitle, buttonText);
|
sendNetworkEventToPlayer("v.rp.showError", client, errorMessage, errorTitle, buttonText);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendRunCodeToClient(client, code, returnTo) {
|
function sendRunCodeToClient(client, code, returnTo) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending runcode to ${getPlayerDisplayForConsole(client)} (returnTo: ${getPlayerDisplayForConsole(getClientFromIndex(returnTo))}, Code: ${code})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending runcode to ${getPlayerDisplayForConsole(client)} (returnTo: ${getPlayerDisplayForConsole(getClientFromIndex(returnTo))}, Code: ${code})`);
|
||||||
sendNetworkEventToPlayer("v.rp.runCode", client, code, getPlayerId(returnTo));
|
sendNetworkEventToPlayer("v.rp.runCode", client, code, getPlayerId(returnTo));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendPlayerWorkingState(client, state) {
|
function sendPlayerWorkingState(client, state) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending working state (${toUpperCase(getYesNoFromBool(state))}) to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending working state (${toUpperCase(getYesNoFromBool(state))}) to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.working", client, state);
|
sendNetworkEventToPlayer("v.rp.working", client, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendPlayerJobType(client, jobType) {
|
function sendPlayerJobType(client, jobType) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending job type (${jobType}) to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending job type (${jobType}) to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.jobType", client, jobType);
|
sendNetworkEventToPlayer("v.rp.jobType", client, jobType);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendPlayerStopJobRoute(client) {
|
function sendPlayerStopJobRoute(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to abort job route to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending signal to abort job route to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.hideJobRouteLocation", client);
|
sendNetworkEventToPlayer("v.rp.hideJobRouteLocation", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendPlayerMouseCameraToggle(client) {
|
function sendPlayerMouseCameraToggle(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.mouseCamera", client);
|
sendNetworkEventToPlayer("v.rp.mouseCamera", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setPlayerMouseCameraState(client, state) {
|
function setPlayerMouseCameraState(client, state) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.mouseCameraForce", client, state);
|
sendNetworkEventToPlayer("v.rp.mouseCameraForce", client, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendPlayerMouseCursorToggle(client) {
|
function sendPlayerMouseCursorToggle(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to toggle mouse cursor ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending signal to toggle mouse cursor ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.mouseCursor", client);
|
sendNetworkEventToPlayer("v.rp.mouseCursor", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendAddAccountKeyBindToClient(client, key, keyState) {
|
function sendAddAccountKeyBindToClient(client, key, keyState) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending added keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))}, State: ${(keyState) ? "down" : "up"})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending added keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))}, State: ${(keyState) ? "down" : "up"})`);
|
||||||
sendNetworkEventToPlayer("v.rp.addKeyBind", client, toInteger(key), (keyState) ? KEYSTATE_DOWN : KEYSTATE_UP);
|
sendNetworkEventToPlayer("v.rp.addKeyBind", client, toInteger(key), (keyState) ? KEYSTATE_DOWN : KEYSTATE_UP);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendClearKeyBindsToClient(client, key, keyState) {
|
function sendClearKeyBindsToClient(client, key, keyState) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending added keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))}, State: ${(keyState) ? "down" : "up"})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending added keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))}, State: ${(keyState) ? "down" : "up"})`);
|
||||||
sendNetworkEventToPlayer("v.rp.clearKeyBinds", client);
|
sendNetworkEventToPlayer("v.rp.clearKeyBinds", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendRemoveAccountKeyBindToClient(client, key) {
|
function sendRemoveAccountKeyBindToClient(client, key) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending deleted keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending deleted keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))})`);
|
||||||
sendNetworkEventToPlayer("v.rp.delKeyBind", client, toInteger(key));
|
sendNetworkEventToPlayer("v.rp.delKeyBind", client, toInteger(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendPlayerSetPosition(client, position) {
|
function sendPlayerSetPosition(client, position) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending set position signal to ${getPlayerDisplayForConsole(client)} (Position: ${position.x}, ${position.y}, ${position.z})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending set position signal to ${getPlayerDisplayForConsole(client)} (Position: ${position.x}, ${position.y}, ${position.z})`);
|
||||||
sendNetworkEventToPlayer("v.rp.position", client, position);
|
sendNetworkEventToPlayer("v.rp.position", client, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendPlayerSetHeading(client, heading) {
|
function sendPlayerSetHeading(client, heading) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending set heading signal to ${getPlayerDisplayForConsole(client)} (Heading: ${heading})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending set heading signal to ${getPlayerDisplayForConsole(client)} (Heading: ${heading})`);
|
||||||
sendNetworkEventToPlayer("v.rp.heading", client, heading);
|
sendNetworkEventToPlayer("v.rp.heading", client, heading);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendPlayerSetInterior(client, interior) {
|
function sendPlayerSetInterior(client, interior) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending set interior signal to ${getPlayerDisplayForConsole(client)} (Interior: ${interior})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending set interior signal to ${getPlayerDisplayForConsole(client)} (Interior: ${interior})`);
|
||||||
sendNetworkEventToPlayer("v.rp.interior", client, interior);
|
sendNetworkEventToPlayer("v.rp.interior", client, interior);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendPlayerFrozenState(client, state) {
|
function sendPlayerFrozenState(client, state) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending set frozen signal to ${getPlayerDisplayForConsole(client)} (State: ${toUpperCase(getYesNoFromBool(state))})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending set frozen signal to ${getPlayerDisplayForConsole(client)} (State: ${toUpperCase(getYesNoFromBool(state))})`);
|
||||||
sendNetworkEventToPlayer("v.rp.frozen", client, state);
|
sendNetworkEventToPlayer("v.rp.frozen", client, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function clearPlayerWeapons(client, clearData = true) {
|
function clearPlayerWeapons(client, clearData = true) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to clear weapons`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to clear weapons`);
|
||||||
sendNetworkEventToPlayer("v.rp.clearWeapons", client, clearData);
|
sendNetworkEventToPlayer("v.rp.clearWeapons", client, clearData);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerNewCharacterFailedGUI(client, errorMessage) {
|
function showPlayerNewCharacterFailedGUI(client, errorMessage) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending new character failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending new character failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.newCharacterFailed", client, errorMessage);
|
sendNetworkEventToPlayer("v.rp.newCharacterFailed", client, errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendPlayerRemoveFromVehicle(client) {
|
function sendPlayerRemoveFromVehicle(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Sending remove from vehicle signal to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Sending remove from vehicle signal to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.removeFromVehicle", client);
|
sendNetworkEventToPlayer("v.rp.removeFromVehicle", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -547,10 +547,10 @@ function showPlayerItemTakeDelay(client, itemId) {
|
|||||||
if (getItemData(itemId)) {
|
if (getItemData(itemId)) {
|
||||||
let delay = getItemTypeData(getItemData(itemId).itemTypeIndex).pickupDelay;
|
let delay = getItemTypeData(getItemData(itemId).itemTypeIndex).pickupDelay;
|
||||||
if (delay > 0) {
|
if (delay > 0) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
||||||
sendNetworkEventToPlayer("v.rp.showItemActionDelay", client, delay);
|
sendNetworkEventToPlayer("v.rp.showItemActionDelay", client, delay);
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||||
playerItemActionDelayComplete(client);
|
playerItemActionDelayComplete(client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -562,10 +562,10 @@ function showPlayerItemUseDelay(client, itemSlot) {
|
|||||||
if (getItemData(getPlayerData(client).hotBarItems[itemSlot])) {
|
if (getItemData(getPlayerData(client).hotBarItems[itemSlot])) {
|
||||||
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).useDelay;
|
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).useDelay;
|
||||||
if (delay > 0) {
|
if (delay > 0) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
||||||
sendNetworkEventToPlayer("v.rp.showItemActionDelay", client, delay);
|
sendNetworkEventToPlayer("v.rp.showItemActionDelay", client, delay);
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||||
playerItemActionDelayComplete(client);
|
playerItemActionDelayComplete(client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -577,10 +577,10 @@ function showPlayerItemDropDelay(client, itemSlot) {
|
|||||||
if (getItemData(getPlayerData(client).hotBarItems[itemSlot])) {
|
if (getItemData(getPlayerData(client).hotBarItems[itemSlot])) {
|
||||||
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).dropDelay;
|
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).dropDelay;
|
||||||
if (delay > 0) {
|
if (delay > 0) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
||||||
sendNetworkEventToPlayer("v.rp.showItemActionDelay", client, delay);
|
sendNetworkEventToPlayer("v.rp.showItemActionDelay", client, delay);
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||||
playerItemActionDelayComplete(client);
|
playerItemActionDelayComplete(client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -592,10 +592,10 @@ function showPlayerItemPickupDelay(client, itemId) {
|
|||||||
if (getItemData(itemId)) {
|
if (getItemData(itemId)) {
|
||||||
let delay = getItemTypeData(getItemData(itemId).itemTypeIndex).pickupDelay;
|
let delay = getItemTypeData(getItemData(itemId).itemTypeIndex).pickupDelay;
|
||||||
if (delay > 0) {
|
if (delay > 0) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
||||||
sendNetworkEventToPlayer("v.rp.showItemActionDelay", client, delay);
|
sendNetworkEventToPlayer("v.rp.showItemActionDelay", client, delay);
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||||
playerItemActionDelayComplete(client);
|
playerItemActionDelayComplete(client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -607,10 +607,10 @@ function showPlayerItemPutDelay(client, itemSlot) {
|
|||||||
if (getItemData(getPlayerData(client).hotBarItems[itemSlot])) {
|
if (getItemData(getPlayerData(client).hotBarItems[itemSlot])) {
|
||||||
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).putDelay;
|
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).putDelay;
|
||||||
if (delay > 0) {
|
if (delay > 0) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
||||||
sendNetworkEventToPlayer("v.rp.showItemActionDelay", client, delay);
|
sendNetworkEventToPlayer("v.rp.showItemActionDelay", client, delay);
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||||
playerItemActionDelayComplete(client);
|
playerItemActionDelayComplete(client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -623,18 +623,18 @@ function showPlayerItemSwitchDelay(client, itemSlot) {
|
|||||||
if (getPlayerData(client).hotBarItems[itemSlot] != -1) {
|
if (getPlayerData(client).hotBarItems[itemSlot] != -1) {
|
||||||
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).switchDelay;
|
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).switchDelay;
|
||||||
if (delay > 0) {
|
if (delay > 0) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
|
||||||
sendNetworkEventToPlayer("v.rp.showItemActionDelay", client, delay);
|
sendNetworkEventToPlayer("v.rp.showItemActionDelay", client, delay);
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||||
playerItemActionDelayComplete(client);
|
playerItemActionDelayComplete(client);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||||
playerItemActionDelayComplete(client);
|
playerItemActionDelayComplete(client);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
|
||||||
playerSwitchItem(client, itemSlot);
|
playerSwitchItem(client, itemSlot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -642,14 +642,14 @@ function showPlayerItemSwitchDelay(client, itemSlot) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendPlayerDrunkEffect(client, amount, duration) {
|
function sendPlayerDrunkEffect(client, amount, duration) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Setting drunk effect for ${getPlayerDisplayForConsole(client)} to ${amount} for ${duration} milliseconds`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Setting drunk effect for ${getPlayerDisplayForConsole(client)} to ${amount} for ${duration} milliseconds`);
|
||||||
sendNetworkEventToPlayer("v.rp.drunkEffect", client, amount, duration);
|
sendNetworkEventToPlayer("v.rp.drunkEffect", client, amount, duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendPlayerClearPedState(client) {
|
function sendPlayerClearPedState(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Clearing ped state for ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Clearing ped state for ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendNetworkEventToPlayer("v.rp.clearPedState", client);
|
sendNetworkEventToPlayer("v.rp.clearPedState", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -659,29 +659,29 @@ function playerDamagedByPlayer(client, damagerEntityName, weaponId, pedPiece, he
|
|||||||
let damagerEntity = getPlayerFromParams(damagerEntityName);
|
let damagerEntity = getPlayerFromParams(damagerEntityName);
|
||||||
|
|
||||||
if (isNull(damagerEntity)) {
|
if (isNull(damagerEntity)) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager entity from ID is null`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s damager entity from ID is null`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)} was damaged by ${damagerEntity}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)} was damaged by ${damagerEntity}`);
|
||||||
|
|
||||||
if (isNull(damagerEntity)) {
|
if (isNull(damagerEntity)) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager client is INVALID`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s damager client is INVALID`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!getPlayerData(damagerEntity) || !getPlayerData(client)) {
|
if (!getPlayerData(damagerEntity) || !getPlayerData(client)) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager's client data is INVALID`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s damager's client data is INVALID`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager is ${getPlayerDisplayForConsole(damagerEntity)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s damager is ${getPlayerDisplayForConsole(damagerEntity)}`);
|
||||||
|
|
||||||
switch (getPlayerData(damagerEntity).weaponDamageEvent) {
|
switch (getPlayerData(damagerEntity).weaponDamageEvent) {
|
||||||
case V_WEAPON_DAMAGE_EVENT_TAZER:
|
case V_WEAPON_DAMAGE_EVENT_TAZER:
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} is using a tazer`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} is using a tazer`);
|
||||||
if (!isPlayerTazed(client) && !isPlayerHandCuffed(client) && !isPlayerInAnyVehicle(client)) {
|
if (!isPlayerTazed(client) && !isPlayerHandCuffed(client) && !isPlayerInAnyVehicle(client)) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)} was not previously tazed, binded, or in a vehicle. Taze successful`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)} was not previously tazed, binded, or in a vehicle. Taze successful`);
|
||||||
meActionToNearbyPlayers(damagerEntity, `electrifies ${getCharacterFullName(client)} with their tazer`);
|
meActionToNearbyPlayers(damagerEntity, `electrifies ${getCharacterFullName(client)} with their tazer`);
|
||||||
tazePlayer(client);
|
tazePlayer(client);
|
||||||
}
|
}
|
||||||
@@ -694,10 +694,10 @@ function playerDamagedByPlayer(client, damagerEntityName, weaponId, pedPiece, he
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case V_WEAPON_DAMAGE_EVENT_NORMAL:
|
case V_WEAPON_DAMAGE_EVENT_NORMAL:
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} caused ${healthLoss} damage (damage reduction makes it ${(healthLoss * getPlayerData(client).incomingDamageMultiplier)})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} caused ${healthLoss} damage (damage reduction makes it ${(healthLoss * getPlayerData(client).incomingDamageMultiplier)})`);
|
||||||
let remainingDamage = healthLoss * getPlayerData(client).incomingDamageMultiplier;
|
let remainingDamage = healthLoss * getPlayerData(client).incomingDamageMultiplier;
|
||||||
if (getPlayerArmour(client) > 0) {
|
if (getPlayerArmour(client) > 0) {
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s armour was ${getPlayerArmour(client)}, so it was reduced by ${healthLoss}`);
|
//logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s armour was ${getPlayerArmour(client)}, so it was reduced by ${healthLoss}`);
|
||||||
if (getPlayerArmour(client) - remainingDamage < 0) {
|
if (getPlayerArmour(client) - remainingDamage < 0) {
|
||||||
setPlayerArmour(client, 0);
|
setPlayerArmour(client, 0);
|
||||||
remainingDamage = remainingDamage - getPlayerArmour(client);
|
remainingDamage = remainingDamage - getPlayerArmour(client);
|
||||||
@@ -709,7 +709,7 @@ function playerDamagedByPlayer(client, damagerEntityName, weaponId, pedPiece, he
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} caused ${healthLoss} damage (damage reduction makes it ${(healthLoss * getPlayerData(client).incomingDamageMultiplier)})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] ${getPlayerDisplayForConsole(client)}'s damager ${getPlayerDisplayForConsole(damagerEntity)} caused ${healthLoss} damage (damage reduction makes it ${(healthLoss * getPlayerData(client).incomingDamageMultiplier)})`);
|
||||||
setPlayerHealth(client, getPlayerHealth(client) - (healthLoss * getPlayerData(client).incomingDamageMultiplier));
|
setPlayerHealth(client, getPlayerHealth(client) - (healthLoss * getPlayerData(client).incomingDamageMultiplier));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -969,21 +969,21 @@ function sendPlayerChatAutoHideDelay(client, delay) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function playRadioStreamForPlayer(client, streamURL, loop = true, volume = 0, element = false) {
|
function playRadioStreamForPlayer(client, streamURL, loop = true, volume = 0, element = false) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Forcing ${getPlayerDisplayForConsole(client)} to stream ${streamURL}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Forcing ${getPlayerDisplayForConsole(client)} to stream ${streamURL}`);
|
||||||
sendNetworkEventToPlayer("v.rp.radioStream", client, streamURL, loop, volume, element);
|
sendNetworkEventToPlayer("v.rp.radioStream", client, streamURL, loop, volume, element);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function playAudioFileForPlayer(client, audioName, loop = true, volume = 0, element = false) {
|
function playAudioFileForPlayer(client, audioName, loop = true, volume = 0, element = false) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Forcing ${getPlayerDisplayForConsole(client)} to play audio ${audioName}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Forcing ${getPlayerDisplayForConsole(client)} to play audio ${audioName}`);
|
||||||
sendNetworkEventToPlayer("v.rp.audioFileStream", client, audioName, loop, volume);
|
sendNetworkEventToPlayer("v.rp.audioFileStream", client, audioName, loop, volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function stopRadioStreamForPlayer(client) {
|
function stopRadioStreamForPlayer(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Client] Forcing ${getPlayerDisplayForConsole(client)} to stop their radio stream`);
|
logToConsole(LOG_DEBUG, `[V.RP.Client] Forcing ${getPlayerDisplayForConsole(client)} to stop their radio stream`);
|
||||||
sendNetworkEventToPlayer("v.rp.stopRadioStream", client);
|
sendNetworkEventToPlayer("v.rp.stopRadioStream", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1112,53 +1112,59 @@ function setPlayerInfiniteRun(client, state) {
|
|||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
||||||
function sendBusinessToPlayer(client, businessId, name, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked, hasItems) {
|
function sendBusinessToPlayer(client, businessId, isDeleted, name, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked, hasItems) {
|
||||||
sendNetworkEventToPlayer("v.rp.business", client, businessId, 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 sendHouseToPlayer(client, houseId, description, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked) {
|
function sendHouseToPlayer(client, houseId, isDeleted, description, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked) {
|
||||||
sendNetworkEventToPlayer("v.rp.house", client, houseId, description, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked);
|
sendNetworkEventToPlayer("v.rp.house", client, houseId, isDeleted, description, entrancePosition, blipModel, pickupModel, buyPrice, rentPrice, hasInterior, locked);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
||||||
function sendJobToPlayer(client, jobId, jobLocationId, name, position, blipModel, pickupModel) {
|
function sendJobToPlayer(client, jobId, isDeleted, jobLocationId, name, position, blipModel, pickupModel) {
|
||||||
sendNetworkEventToPlayer("v.rp.job", client, jobId, jobLocationId, name, position);
|
sendNetworkEventToPlayer("v.rp.job", client, jobId, isDeleted, jobLocationId, name, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
||||||
function sendVehicleToPlayer(client, vehicleId, model, position, heading, colour1, colour2, colour3, colour4) {
|
function sendVehicleToPlayer(client, vehicleId, isDeleted, model, position, heading, colour1, colour2, colour3, colour4) {
|
||||||
sendNetworkEventToPlayer("v.rp.vehicle", client, vehicleId, model, position, heading, colour1, colour2, colour3, colour4);
|
sendNetworkEventToPlayer("v.rp.vehicle", client, vehicleId, isDeleted, model, position, heading, colour1, colour2, colour3, colour4);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
||||||
function sendAllBusinessesToPlayer(client) {
|
function sendAllBusinessesToPlayer(client) {
|
||||||
|
sendNetworkEventToPlayer("v.rp.removeBusinesses", client);
|
||||||
|
|
||||||
let businesses = getServerData().businesses;
|
let businesses = getServerData().businesses;
|
||||||
for (let i in businesses) {
|
for (let i in businesses) {
|
||||||
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));
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
||||||
function sendAllHousesToPlayer(client) {
|
function sendAllHousesToPlayer(client) {
|
||||||
|
sendNetworkEventToPlayer("v.rp.removeHouses", client);
|
||||||
|
|
||||||
let houses = getServerData().houses;
|
let houses = getServerData().houses;
|
||||||
for (let i in houses) {
|
for (let i in houses) {
|
||||||
sendHouseToPlayer(client, houses[i].index, houses[i].entrancePosition, houses[i].entranceBlipModel, houses[i].entrancePickupModel, houses[i].buyPrice, houses[i].rentPrice, houses[i].hasInterior);
|
sendHouseToPlayer(client, houses[i].index, false, houses[i].entrancePosition, houses[i].entranceBlipModel, houses[i].entrancePickupModel, houses[i].buyPrice, houses[i].rentPrice, houses[i].hasInterior);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
||||||
function sendAllJobsToPlayer(client) {
|
function sendAllJobsToPlayer(client) {
|
||||||
|
sendNetworkEventToPlayer("v.rp.removeJobs", client);
|
||||||
|
|
||||||
let jobs = getServerData().jobs;
|
let jobs = getServerData().jobs;
|
||||||
for (let i in jobs) {
|
for (let i in jobs) {
|
||||||
for (let j in jobs[i].locations) {
|
for (let j in jobs[i].locations) {
|
||||||
sendJobToPlayer(client, jobs[i].index, jobs[i].locations[j].index, jobs[i].name, jobs[i].locations[j].position, jobs[i].pickupModel, jobs[i].blipModel);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1166,9 +1172,11 @@ function sendAllJobsToPlayer(client) {
|
|||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
|
|
||||||
function sendAllVehiclesToPlayer(client) {
|
function sendAllVehiclesToPlayer(client) {
|
||||||
|
sendNetworkEventToPlayer("v.rp.removeVehicles", client);
|
||||||
|
|
||||||
let vehicles = getServerData().vehicles;
|
let vehicles = getServerData().vehicles;
|
||||||
for (let i in vehicles) {
|
for (let i in vehicles) {
|
||||||
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);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1311,6 +1319,11 @@ function playerMapLoaded(client, mapName) {
|
|||||||
|
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
processPlayerEnteringExitingProperty(client);
|
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);
|
}, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ function createNPCCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadNPCsFromDatabase() {
|
function loadNPCsFromDatabase() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.NPC]: Loading NPCs from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.NPC]: Loading NPCs from database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
let tempNPCs = [];
|
let tempNPCs = [];
|
||||||
let dbAssoc = [];
|
let dbAssoc = [];
|
||||||
@@ -263,14 +263,14 @@ function loadNPCsFromDatabase() {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.NPC]: ${tempNPCs.length} NPCs loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.NPC]: ${tempNPCs.length} NPCs loaded from database successfully!`);
|
||||||
return tempNPCs;
|
return tempNPCs;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadNPCTriggersFromDatabase(npcDatabaseId) {
|
function loadNPCTriggersFromDatabase(npcDatabaseId) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.NPC]: Loading NPC triggers for NPC ${npcDatabaseId} from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.NPC]: Loading NPC triggers for NPC ${npcDatabaseId} from database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
let tempNPCTriggers = [];
|
let tempNPCTriggers = [];
|
||||||
let dbAssoc = [];
|
let dbAssoc = [];
|
||||||
@@ -288,14 +288,14 @@ function loadNPCTriggersFromDatabase(npcDatabaseId) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.NPC]: ${tempNPCTriggers.length} NPC triggers loaded for NPC ${npcDatabaseId} from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.NPC]: ${tempNPCTriggers.length} NPC triggers loaded for NPC ${npcDatabaseId} from database successfully!`);
|
||||||
return tempNPCTriggers;
|
return tempNPCTriggers;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadNPCTriggerConditionsFromDatabase(npcTriggerDatabaseId) {
|
function loadNPCTriggerConditionsFromDatabase(npcTriggerDatabaseId) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.NPC]: Loading NPC trigger conditions for trigger ${npcTriggerDatabaseId} from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.NPC]: Loading NPC trigger conditions for trigger ${npcTriggerDatabaseId} from database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
let tempNPCTriggerConditions = [];
|
let tempNPCTriggerConditions = [];
|
||||||
let dbAssoc;
|
let dbAssoc;
|
||||||
@@ -311,14 +311,14 @@ function loadNPCTriggerConditionsFromDatabase(npcTriggerDatabaseId) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.NPC]: ${tempNPCTriggerConditions.length} conditions loaded for trigger ${npcTriggerDatabaseId} from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.NPC]: ${tempNPCTriggerConditions.length} conditions loaded for trigger ${npcTriggerDatabaseId} from database successfully!`);
|
||||||
return tempNPCTriggerConditions;
|
return tempNPCTriggerConditions;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadNPCTriggerResponsesFromDatabase(npcTriggerDatabaseId) {
|
function loadNPCTriggerResponsesFromDatabase(npcTriggerDatabaseId) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.NPC]: Loading NPC trigger responses for trigger ${npcTriggerDatabaseId} from database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.NPC]: Loading NPC trigger responses for trigger ${npcTriggerDatabaseId} from database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
let tempNPCTriggerResponses = [];
|
let tempNPCTriggerResponses = [];
|
||||||
let dbAssoc;
|
let dbAssoc;
|
||||||
@@ -337,7 +337,7 @@ function loadNPCTriggerResponsesFromDatabase(npcTriggerDatabaseId) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.NPC]: ${tempNPCTriggerResponses.length} responses loaded for trigger ${npcTriggerDatabaseId} from database successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.NPC]: ${tempNPCTriggerResponses.length} responses loaded for trigger ${npcTriggerDatabaseId} from database successfully!`);
|
||||||
return tempNPCTriggerResponses;
|
return tempNPCTriggerResponses;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -357,28 +357,28 @@ function saveAllNPCsToDatabase() {
|
|||||||
|
|
||||||
function saveNPCToDatabase(npcDataId) {
|
function saveNPCToDatabase(npcDataId) {
|
||||||
if (getServerConfig().devServer) {
|
if (getServerConfig().devServer) {
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.NPC]: NPC ${npcDataId} can't be saved because server is running as developer only. Aborting save ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.NPC]: NPC ${npcDataId} can't be saved because server is running as developer only. Aborting save ...`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getNPCData(npcDataId) == false) {
|
if (getNPCData(npcDataId) == false) {
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.NPC]: NPC ${npcDataId} data is invalid. Aborting save ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.NPC]: NPC ${npcDataId} data is invalid. Aborting save ...`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let tempNPCData = getNPCData(npcDataId);
|
let tempNPCData = getNPCData(npcDataId);
|
||||||
|
|
||||||
if (tempNPCData.databaseId == -1) {
|
if (tempNPCData.databaseId == -1) {
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.NPC]: NPC ${npcDataId} is a temp NPC. Aborting save ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.NPC]: NPC ${npcDataId} is a temp NPC. Aborting save ...`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tempNPCData.needsSaved) {
|
if (!tempNPCData.needsSaved) {
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.NPC]: NPC ${npcDataId} hasn't changed data. Aborting save ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.NPC]: NPC ${npcDataId} hasn't changed data. Aborting save ...`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.NPC]: Saving NPC ${tempNPCData.databaseId} to database ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.NPC]: Saving NPC ${tempNPCData.databaseId} to database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
if (tempNPCData.ped != false) {
|
if (tempNPCData.ped != false) {
|
||||||
@@ -445,7 +445,7 @@ function saveNPCToDatabase(npcDataId) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.NPC]: Saved NPC ${npcDataId} to database!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.NPC]: Saved NPC ${npcDataId} to database!`);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -757,3 +757,20 @@ function createNPC(skinIndex, position, heading, interior, dimension) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Starting paintball for ${getPlayerDisplayForConsole(client)} ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Starting paintball for ${getPlayerDisplayForConsole(client)} ...`);
|
||||||
if (isPlayerWorking(client)) {
|
if (isPlayerWorking(client)) {
|
||||||
stopWorking(client);
|
stopWorking(client);
|
||||||
}
|
}
|
||||||
@@ -79,7 +79,7 @@ function startPaintBall(client) {
|
|||||||
|
|
||||||
messagePlayerAlert(client, getLocaleString(client, "JoinedPaintBall"));
|
messagePlayerAlert(client, getLocaleString(client, "JoinedPaintBall"));
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Started paintball for ${getPlayerDisplayForConsole(client)} successfully`);
|
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Started paintball for ${getPlayerDisplayForConsole(client)} successfully`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -89,7 +89,7 @@ function stopPaintBall(client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Stopping paintball for ${getPlayerDisplayForConsole(client)} ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Stopping paintball for ${getPlayerDisplayForConsole(client)} ...`);
|
||||||
clearPlayerWeapons(client);
|
clearPlayerWeapons(client);
|
||||||
deletePaintBallItems(client);
|
deletePaintBallItems(client);
|
||||||
restorePlayerTempLockerItems(client);
|
restorePlayerTempLockerItems(client);
|
||||||
@@ -119,13 +119,13 @@ function stopPaintBall(client) {
|
|||||||
|
|
||||||
//checkRemainingPaintBallPlayers(tempBusiness);
|
//checkRemainingPaintBallPlayers(tempBusiness);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Stopped paintball for ${getPlayerDisplayForConsole(client)} successfully`);
|
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Stopped paintball for ${getPlayerDisplayForConsole(client)} successfully`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function givePlayerPaintBallItems(client) {
|
function givePlayerPaintBallItems(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Giving ${getPlayerDisplayForConsole(client)} paintball items ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Giving ${getPlayerDisplayForConsole(client)} paintball items ...`);
|
||||||
for (let i in paintBallItems) {
|
for (let i in paintBallItems) {
|
||||||
let itemId = createItem(paintBallItems[i], 999999, V_ITEM_OWNER_PLAYER, getPlayerCurrentSubAccount(client).databaseId);
|
let itemId = createItem(paintBallItems[i], 999999, V_ITEM_OWNER_PLAYER, getPlayerCurrentSubAccount(client).databaseId);
|
||||||
getItemData(itemId).needsSaved = false;
|
getItemData(itemId).needsSaved = false;
|
||||||
@@ -135,26 +135,26 @@ function givePlayerPaintBallItems(client) {
|
|||||||
getPlayerData(client).paintBallItemCache.push(itemId);
|
getPlayerData(client).paintBallItemCache.push(itemId);
|
||||||
updatePlayerHotBar(client);
|
updatePlayerHotBar(client);
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Gave ${getPlayerDisplayForConsole(client)} paintball items successfully`);
|
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Gave ${getPlayerDisplayForConsole(client)} paintball items successfully`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function deletePaintBallItems(client) {
|
function deletePaintBallItems(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Deleting paintball items for ${getPlayerDisplayForConsole(client)} ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Deleting paintball items for ${getPlayerDisplayForConsole(client)} ...`);
|
||||||
for (let i in getPlayerData(client).paintBallItemCache) {
|
for (let i in getPlayerData(client).paintBallItemCache) {
|
||||||
deleteItem(getPlayerData(client).paintBallItemCache[i]);
|
deleteItem(getPlayerData(client).paintBallItemCache[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
cachePlayerHotBarItems(client);
|
cachePlayerHotBarItems(client);
|
||||||
updatePlayerHotBar(client);
|
updatePlayerHotBar(client);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Deleting paintball items for ${getPlayerDisplayForConsole(client)} successfully`);
|
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Deleting paintball items for ${getPlayerDisplayForConsole(client)} successfully`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function cacheAllPaintBallItemTypes() {
|
function cacheAllPaintBallItemTypes() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Cacheing all paintball item types ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Cacheing all paintball item types ...`);
|
||||||
for (let i in paintBallItemNames[getGame()]) {
|
for (let i in paintBallItemNames[getGame()]) {
|
||||||
let itemTypeId = getItemTypeFromParams(paintBallItemNames[getGame()][i]);
|
let itemTypeId = getItemTypeFromParams(paintBallItemNames[getGame()][i]);
|
||||||
if (itemTypeId != -1 && getItemTypeData(itemTypeId) != false) {
|
if (itemTypeId != -1 && getItemTypeData(itemTypeId) != false) {
|
||||||
@@ -162,13 +162,13 @@ function cacheAllPaintBallItemTypes() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Cached all paintball item types`);
|
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Cached all paintball item types`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function respawnPlayerForPaintBall(client) {
|
function respawnPlayerForPaintBall(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Respawning ${getPlayerDisplayForConsole(client)} for paintball ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Respawning ${getPlayerDisplayForConsole(client)} for paintball ...`);
|
||||||
despawnPlayer(client);
|
despawnPlayer(client);
|
||||||
|
|
||||||
let businessId = getPlayerData(client).paintBallBusiness;
|
let businessId = getPlayerData(client).paintBallBusiness;
|
||||||
@@ -177,13 +177,13 @@ function respawnPlayerForPaintBall(client) {
|
|||||||
|
|
||||||
spawnPlayer(client, getBusinessData(businessId).exitPosition, 0.0, getPlayerSkin(client), getBusinessData(businessId).exitInterior, getBusinessData(businessId).exitDimension);
|
spawnPlayer(client, getBusinessData(businessId).exitPosition, 0.0, getPlayerSkin(client), getBusinessData(businessId).exitInterior, getBusinessData(businessId).exitDimension);
|
||||||
if (isFadeCameraSupported()) {
|
if (isFadeCameraSupported()) {
|
||||||
fadeCamera(client, true, 0.5);
|
fadePlayerCamera(client, true, 500);
|
||||||
}
|
}
|
||||||
updatePlayerSpawnedState(client, true);
|
updatePlayerSpawnedState(client, true);
|
||||||
makePlayerStopAnimation(client);
|
makePlayerStopAnimation(client);
|
||||||
setPlayerControlState(client, true);
|
setPlayerControlState(client, true);
|
||||||
resetPlayerBlip(client);
|
resetPlayerBlip(client);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.PaintBall]: Respawned ${getPlayerDisplayForConsole(client)} for paintball successfully`);
|
logToConsole(LOG_DEBUG, `[V.RP.PaintBall]: Respawned ${getPlayerDisplayForConsole(client)} for paintball successfully`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ function playerPromptAnswerNo(client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Prompt] ${getPlayerDisplayForConsole(client)} answered NO to their prompt (${getPlayerData(client).promptType})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Prompt] ${getPlayerDisplayForConsole(client)} answered NO to their prompt (${getPlayerData(client).promptType})`);
|
||||||
|
|
||||||
switch (getPlayerData(client).promptType) {
|
switch (getPlayerData(client).promptType) {
|
||||||
case V_PROMPT_CREATEFIRSTCHAR:
|
case V_PROMPT_CREATEFIRSTCHAR:
|
||||||
@@ -71,7 +71,7 @@ function playerPromptAnswerYes(client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Prompt] ${getPlayerDisplayForConsole(client)} answered YES to their prompt (${getPlayerData(client).promptType})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Prompt] ${getPlayerDisplayForConsole(client)} answered YES to their prompt (${getPlayerData(client).promptType})`);
|
||||||
|
|
||||||
switch (getPlayerData(client).promptType) {
|
switch (getPlayerData(client).promptType) {
|
||||||
case V_PROMPT_CREATEFIRSTCHAR: {
|
case V_PROMPT_CREATEFIRSTCHAR: {
|
||||||
@@ -82,7 +82,7 @@ function playerPromptAnswerYes(client) {
|
|||||||
case V_PROMPT_BIZORDER: {
|
case V_PROMPT_BIZORDER: {
|
||||||
if (getPlayerData(client).businessOrderAmount > 0) {
|
if (getPlayerData(client).businessOrderAmount > 0) {
|
||||||
if (getBusinessData(getPlayerData(client).businessOrderBusiness).till < getPlayerData(client).businessOrderCost) {
|
if (getBusinessData(getPlayerData(client).businessOrderBusiness).till < getPlayerData(client).businessOrderCost) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Prompt] ${getPlayerDisplayForConsole(client)} failed to order ${getPlayerData(client).businessOrderAmount} ${getItemTypeData(getPlayerData(client).businessOrderItem).name} at ${getPlayerData(client).businessOrderCost / getPlayerData(client).businessOrderAmount} each for business ${getBusinessData(getPlayerData(client).businessOrderBusiness).name} (Reason: Not enough money in business till)`);
|
logToConsole(LOG_DEBUG, `[V.RP.Prompt] ${getPlayerDisplayForConsole(client)} failed to order ${getPlayerData(client).businessOrderAmount} ${getItemTypeData(getPlayerData(client).businessOrderItem).name} at ${getPlayerData(client).businessOrderCost / getPlayerData(client).businessOrderAmount} each for business ${getBusinessData(getPlayerData(client).businessOrderBusiness).name} (Reason: Not enough money in business till)`);
|
||||||
if (doesPlayerHaveGUIEnabled(client)) {
|
if (doesPlayerHaveGUIEnabled(client)) {
|
||||||
showPlayerErrorGUI(client, getLocaleString(client, "BusinessOrderNotEnoughMoney", `{ALTCOLOUR}/bizdeposit{MAINCOLOUR}`), getLocaleString(client, "BusinessOrderCanceled"));
|
showPlayerErrorGUI(client, getLocaleString(client, "BusinessOrderNotEnoughMoney", `{ALTCOLOUR}/bizdeposit{MAINCOLOUR}`), getLocaleString(client, "BusinessOrderCanceled"));
|
||||||
} else {
|
} else {
|
||||||
@@ -93,7 +93,7 @@ function playerPromptAnswerYes(client) {
|
|||||||
getPlayerData(client).businessOrderItem = -1;
|
getPlayerData(client).businessOrderItem = -1;
|
||||||
getPlayerData(client).businessOrderValue = -1;
|
getPlayerData(client).businessOrderValue = -1;
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Prompt] ${getPlayerDisplayForConsole(client)} successfully ordered ${getPlayerData(client).businessOrderAmount} ${getItemTypeData(getPlayerData(client).businessOrderItem).name} at ${getPlayerData(client).businessOrderCost / getPlayerData(client).businessOrderAmount} each for business ${getBusinessData(getPlayerData(client).businessOrderBusiness).name}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Prompt] ${getPlayerDisplayForConsole(client)} successfully ordered ${getPlayerData(client).businessOrderAmount} ${getItemTypeData(getPlayerData(client).businessOrderItem).name} at ${getPlayerData(client).businessOrderCost / getPlayerData(client).businessOrderAmount} each for business ${getBusinessData(getPlayerData(client).businessOrderBusiness).name}`);
|
||||||
|
|
||||||
showPlayerInfoGUI(client, getLocaleString(client, "BusinessOrderSuccessInfo", getPlayerData(client).businessOrderAmount, getItemTypeData(getPlayerData(client).businessOrderItem).name, getItemValueDisplay(getPlayerData(client).businessOrderItem, getPlayerData(client).businessOrderValue), getPlayerData(client).businessOrderCost), getLocaleString(client, "GUIInfoTitle"));
|
showPlayerInfoGUI(client, getLocaleString(client, "BusinessOrderSuccessInfo", getPlayerData(client).businessOrderAmount, getItemTypeData(getPlayerData(client).businessOrderItem).name, getItemValueDisplay(getPlayerData(client).businessOrderItem, getPlayerData(client).businessOrderValue), getPlayerData(client).businessOrderCost), getLocaleString(client, "GUIInfoTitle"));
|
||||||
createItem(getPlayerData(client).businessOrderItem, getPlayerData(client).businessOrderValue, V_ITEM_OWNER_BIZFLOOR, getBusinessData(getPlayerData(client).businessOrderBusiness).databaseId, getPlayerData(client).businessOrderAmount);
|
createItem(getPlayerData(client).businessOrderItem, getPlayerData(client).businessOrderValue, V_ITEM_OWNER_BIZFLOOR, getBusinessData(getPlayerData(client).businessOrderBusiness).databaseId, getPlayerData(client).businessOrderAmount);
|
||||||
|
|||||||
@@ -190,20 +190,20 @@ function loadPropertiesFromDatabase() {
|
|||||||
let tempPropertyData = new PropertyData(dbAssoc[i]);
|
let tempPropertyData = new PropertyData(dbAssoc[i]);
|
||||||
tempPropertyData.locations = loadPropertyLocationsFromDatabase(tempPropertyData.databaseId);
|
tempPropertyData.locations = loadPropertyLocationsFromDatabase(tempPropertyData.databaseId);
|
||||||
tempProperties.push(tempPropertyData);
|
tempProperties.push(tempPropertyData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Property]: Property '${tempPropertyData.name}' (ID ${tempPropertyData.databaseId}) loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Property]: Property '${tempPropertyData.name}' (ID ${tempPropertyData.databaseId}) loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_INFO, `[AGRP.Property]: ${tempProperties.length} properties loaded from database successfully!`);
|
logToConsole(LOG_INFO, `[V.RP.Property]: ${tempProperties.length} properties loaded from database successfully!`);
|
||||||
return tempProperties;
|
return tempProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadPropertyLocationsFromDatabase(propertyIndex) {
|
function loadPropertyLocationsFromDatabase(propertyIndex) {
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Property]: Loading property locations for property ${propertyIndex} from database ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Property]: Loading property locations for property ${propertyIndex} from database ...`);
|
||||||
|
|
||||||
let tempPropertyLocations = [];
|
let tempPropertyLocations = [];
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
@@ -219,7 +219,7 @@ function loadPropertyLocationsFromDatabase(propertyIndex) {
|
|||||||
for (let i in dbAssoc) {
|
for (let i in dbAssoc) {
|
||||||
let tempPropertyLocationData = new PropertyLocationData(dbAssoc[i]);
|
let tempPropertyLocationData = new PropertyLocationData(dbAssoc[i]);
|
||||||
tempPropertyLocations.push(tempPropertyLocationData);
|
tempPropertyLocations.push(tempPropertyLocationData);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Property]: Location '${tempPropertyLocationData.name}' loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Property]: Location '${tempPropertyLocationData.name}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
freeDatabaseQuery(dbQuery);
|
freeDatabaseQuery(dbQuery);
|
||||||
@@ -227,7 +227,7 @@ function loadPropertyLocationsFromDatabase(propertyIndex) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Property]: ${tempPropertyLocations.length} location for property ${propertyIndex} loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Property]: ${tempPropertyLocations.length} location for property ${propertyIndex} loaded from database successfully!`);
|
||||||
return tempPropertyLocations;
|
return tempPropertyLocations;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1208,7 +1208,7 @@ function orderItemForPropertyCommand(command, params, client) {
|
|||||||
let value = toInteger(splitParams.slice(-1)) || getItemTypeData(itemType).capacity;
|
let value = toInteger(splitParams.slice(-1)) || getItemTypeData(itemType).capacity;
|
||||||
let propertyIndex = getPlayerProperty(client);
|
let propertyIndex = getPlayerProperty(client);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Property] ${getPlayerDisplayForConsole(client)} is ordering ${amount} ${splitParams.slice(0, -2).join(" ")} (${value})`);
|
logToConsole(LOG_DEBUG, `[V.RP.Property] ${getPlayerDisplayForConsole(client)} is ordering ${amount} ${splitParams.slice(0, -2).join(" ")} (${value})`);
|
||||||
|
|
||||||
if (!getPropertyData(propertyIndex)) {
|
if (!getPropertyData(propertyIndex)) {
|
||||||
messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
|
messagePlayerError(client, getLocaleString(client, "InvalidProperty"));
|
||||||
@@ -1460,7 +1460,7 @@ function savePropertyToDatabase(propertyIndex) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Property]: Saving business '${tempPropertyData.name}' to database ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Property]: Saving business '${tempPropertyData.name}' to database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
let safePropertyName = escapeDatabaseString(dbConnection, tempPropertyData.name);
|
let safePropertyName = escapeDatabaseString(dbConnection, tempPropertyData.name);
|
||||||
@@ -1516,7 +1516,7 @@ function savePropertyToDatabase(propertyIndex) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Property]: Saved property '${tempPropertyData.name}' to database!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Property]: Saved property '${tempPropertyData.name}' to database!`);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1575,7 +1575,7 @@ function createPropertyEntrancePickup(propertyIndex) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating entrance pickup for property ${propertyData.name}`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Creating entrance pickup for property ${propertyData.name}`);
|
||||||
|
|
||||||
if (areServerElementsSupported() && getGame() != V_GAME_MAFIA_ONE) {
|
if (areServerElementsSupported() && getGame() != V_GAME_MAFIA_ONE) {
|
||||||
let entrancePickup = null;
|
let entrancePickup = null;
|
||||||
@@ -1652,7 +1652,7 @@ function createPropertyEntranceBlip(propertyIndex) {
|
|||||||
blipModelId = propertyData.entranceBlipModel;
|
blipModelId = propertyData.entranceBlipModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating entrance blip for business ${propertyData.name} (model ${blipModelId})`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Creating entrance blip for business ${propertyData.name} (model ${blipModelId})`);
|
||||||
|
|
||||||
if (areServerElementsSupported()) {
|
if (areServerElementsSupported()) {
|
||||||
let entranceBlip = createGameBlip(propertyData.entrancePosition, blipModelId, 1, getColourByType("propertyColour"));
|
let entranceBlip = createGameBlip(propertyData.entrancePosition, blipModelId, 1, getColourByType("propertyColour"));
|
||||||
@@ -1697,7 +1697,7 @@ function createPropertyExitPickup(propertyIndex) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating exit pickup for business ${propertyData.name}`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Creating exit pickup for business ${propertyData.name}`);
|
||||||
|
|
||||||
let exitPickup = null;
|
let exitPickup = null;
|
||||||
if (isGameFeatureSupported("pickup")) {
|
if (isGameFeatureSupported("pickup")) {
|
||||||
@@ -1764,7 +1764,7 @@ function createPropertyExitBlip(propertyIndex) {
|
|||||||
blipModelId = propertyData.exitBlipModel;
|
blipModelId = propertyData.exitBlipModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Job]: Creating exit blip for property ${propertyData.name} (model ${blipModelId})`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Job]: Creating exit blip for property ${propertyData.name} (model ${blipModelId})`);
|
||||||
|
|
||||||
let exitBlip = createGameBlip(propertyData.exitPosition, blipModelId, 1, getColourByName("propertyColour"));
|
let exitBlip = createGameBlip(propertyData.exitPosition, blipModelId, 1, getColourByName("propertyColour"));
|
||||||
if (exitBlip != null) {
|
if (exitBlip != null) {
|
||||||
@@ -2270,11 +2270,11 @@ function cachePropertyItems(propertyIndex) {
|
|||||||
clearArray(getPropertyData(propertyIndex).storageItemCache);
|
clearArray(getPropertyData(propertyIndex).storageItemCache);
|
||||||
|
|
||||||
//let propertyData = getPropertyData(propertyIndex);
|
//let propertyData = getPropertyData(propertyIndex);
|
||||||
//logToConsole(LOG_VERBOSE, `[AGRP.Property] Caching business items for business ${propertyIndex} (${propertyData.name}) ...`);
|
//logToConsole(LOG_VERBOSE, `[V.RP.Property] Caching business items for business ${propertyIndex} (${propertyData.name}) ...`);
|
||||||
//getPropertyData(propertyIndex).floorItemCache = getServerData().items.filter(item => item.ownerType == V_ITEM_OWNER_BIZFLOOR && item.ownerId == propertyData.databaseId).map(i => i.index);
|
//getPropertyData(propertyIndex).floorItemCache = getServerData().items.filter(item => item.ownerType == V_ITEM_OWNER_BIZFLOOR && item.ownerId == propertyData.databaseId).map(i => i.index);
|
||||||
//getPropertyData(propertyIndex).storageItemCache = getServerData().items.filter(item => item.ownerType == V_ITEM_OWNER_BIZSTORAGE && item.ownerId == propertyData.databaseId);
|
//getPropertyData(propertyIndex).storageItemCache = getServerData().items.filter(item => item.ownerType == V_ITEM_OWNER_BIZSTORAGE && item.ownerId == propertyData.databaseId);
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Property] Caching business items for business ${propertyIndex} (${getPropertyData(propertyIndex).name}) ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Property] Caching business items for business ${propertyIndex} (${getPropertyData(propertyIndex).name}) ...`);
|
||||||
for (let i in getServerData().items) {
|
for (let i in getServerData().items) {
|
||||||
if (getItemData(i).ownerType == V_ITEM_OWNER_BIZFLOOR && getItemData(i).ownerId == getPropertyData(propertyIndex).databaseId) {
|
if (getItemData(i).ownerType == V_ITEM_OWNER_BIZFLOOR && getItemData(i).ownerId == getPropertyData(propertyIndex).databaseId) {
|
||||||
getPropertyData(propertyIndex).floorItemCache.push(i);
|
getPropertyData(propertyIndex).floorItemCache.push(i);
|
||||||
@@ -2283,7 +2283,7 @@ function cachePropertyItems(propertyIndex) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Property] Successfully cached ${getPropertyData(propertyIndex).floorItemCache.length} floor items and ${getPropertyData(propertyIndex).storageItemCache} storage items for business ${propertyIndex} (${getPropertyData(propertyIndex).name})!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Property] Successfully cached ${getPropertyData(propertyIndex).floorItemCache.length} floor items and ${getPropertyData(propertyIndex).storageItemCache} storage items for business ${propertyIndex} (${getPropertyData(propertyIndex).name})!`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ function loadRadioStationsFromDatabase() {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_INFO, `[AGRP.Radio]: ${tempRadioStations.length} radio stations loaded from database successfully!`);
|
logToConsole(LOG_INFO, `[V.RP.Radio]: ${tempRadioStations.length} radio stations loaded from database successfully!`);
|
||||||
return tempRadioStations;
|
return tempRadioStations;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ function playStreamingRadioCommand(command, params, client) {
|
|||||||
|
|
||||||
let radioStationId = getRadioStationFromParams(params);
|
let radioStationId = getRadioStationFromParams(params);
|
||||||
|
|
||||||
if (radioStationId != 0 && typeof getServerData().radioStations[radioStationId - 1] == "undefined") {
|
if (getRadioStationData(radioStationId) == -1) {
|
||||||
messagePlayerError(client, getLocaleString(client, "InvalidRadioStation"));
|
messagePlayerError(client, getLocaleString(client, "InvalidRadioStation"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -90,7 +90,7 @@ function playStreamingRadioCommand(command, params, client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (radioStationId == 0) {
|
if (radioStationId == -1) {
|
||||||
getVehicleData(vehicle).streamingRadioStation = -1;
|
getVehicleData(vehicle).streamingRadioStation = -1;
|
||||||
getVehicleData(vehicle).needsSaved = true;
|
getVehicleData(vehicle).needsSaved = true;
|
||||||
getPlayerData(client).streamingRadioStation = -1;
|
getPlayerData(client).streamingRadioStation = -1;
|
||||||
@@ -105,20 +105,20 @@ function playStreamingRadioCommand(command, params, client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
getVehicleData(vehicle).streamingRadioStation = radioStationId - 1;
|
getVehicleData(vehicle).streamingRadioStation = radioStationId;
|
||||||
getPlayerData(client).streamingRadioStation = radioStationId - 1;
|
getPlayerData(client).streamingRadioStation = radioStationId;
|
||||||
meActionToNearbyPlayers(client, getLocaleString(client, "ActionVehicleRadioStationChange", getRadioStationData(radioStationId - 1).name, getRadioStationData(radioStationId - 1).genre));
|
meActionToNearbyPlayers(client, getLocaleString(client, "ActionVehicleRadioStationChange", getRadioStationData(radioStationId).name, getRadioStationData(radioStationId).genre));
|
||||||
|
|
||||||
let clients = getClients();
|
let clients = getClients();
|
||||||
for (let i in clients) {
|
for (let i in clients) {
|
||||||
if (vehicle == getPlayerVehicle(clients[i])) {
|
if (vehicle == getPlayerVehicle(clients[i])) {
|
||||||
playRadioStreamForPlayer(clients[i], getRadioStationData(radioStationId - 1).url, true, getPlayerStreamingRadioVolume(client));
|
playRadioStreamForPlayer(clients[i], getRadioStationData(radioStationId).url, true, getPlayerStreamingRadioVolume(client));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isPlayerInAnyHouse(client)) {
|
if (isPlayerInAnyHouse(client)) {
|
||||||
let houseId = getPlayerHouse(client);
|
let houseId = getPlayerHouse(client);
|
||||||
if (radioStationId == 0) {
|
if (radioStationId == -1) {
|
||||||
getHouseData(houseId).streamingRadioStationIndex = -1;
|
getHouseData(houseId).streamingRadioStationIndex = -1;
|
||||||
getHouseData(houseId).streamingRadioStationIndex = 0;
|
getHouseData(houseId).streamingRadioStationIndex = 0;
|
||||||
getHouseData(houseId).needsSaved = true;
|
getHouseData(houseId).needsSaved = true;
|
||||||
@@ -132,22 +132,22 @@ function playStreamingRadioCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
getHouseData(houseId).streamingRadioStationIndex = radioStationId - 1;
|
getHouseData(houseId).streamingRadioStationIndex = radioStationId;
|
||||||
getHouseData(houseId).streamingRadioStation = getRadioStationData(radioStationId - 1).databaseId;
|
getHouseData(houseId).streamingRadioStation = getRadioStationData(radioStationId).databaseId;
|
||||||
getHouseData(houseId).needsSaved = true;
|
getHouseData(houseId).needsSaved = true;
|
||||||
getPlayerData(client).streamingRadioStation = radioStationId - 1;
|
getPlayerData(client).streamingRadioStation = radioStationId;
|
||||||
meActionToNearbyPlayers(client, getLocaleString(client, "ActionHouseRadioStationChange", getRadioStationData(radioStationId - 1).name, getRadioStationData(radioStationId - 1).genre));
|
meActionToNearbyPlayers(client, getLocaleString(client, "ActionHouseRadioStationChange", getRadioStationData(radioStationId).name, getRadioStationData(radioStationId).genre));
|
||||||
|
|
||||||
let clients = getClients();
|
let clients = getClients();
|
||||||
for (let i in clients) {
|
for (let i in clients) {
|
||||||
if (getEntityData(clients[i], "v.rp.inHouse") == houseId) {
|
if (getEntityData(clients[i], "v.rp.inHouse") == houseId) {
|
||||||
playRadioStreamForPlayer(clients[i], getRadioStationData(radioStationId - 1).url, true, getPlayerStreamingRadioVolume(clients[i]));
|
playRadioStreamForPlayer(clients[i], getRadioStationData(radioStationId).url, true, getPlayerStreamingRadioVolume(clients[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (isPlayerInAnyBusiness(client)) {
|
} else if (isPlayerInAnyBusiness(client)) {
|
||||||
let businessId = getPlayerBusiness(client);
|
let businessId = getPlayerBusiness(client);
|
||||||
if (radioStationId == 0) {
|
if (radioStationId == -1) {
|
||||||
getBusinessData(businessId).streamingRadioStation = 0;
|
getBusinessData(businessId).streamingRadioStation = 0;
|
||||||
getBusinessData(businessId).streamingRadioStationIndex = -1;
|
getBusinessData(businessId).streamingRadioStationIndex = -1;
|
||||||
getBusinessData(businessId).needsSaved = true;
|
getBusinessData(businessId).needsSaved = true;
|
||||||
@@ -161,16 +161,16 @@ function playStreamingRadioCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
getBusinessData(businessId).streamingRadioStationIndex = radioStationId - 1;
|
getBusinessData(businessId).streamingRadioStationIndex = radioStationId;
|
||||||
getBusinessData(businessId).streamingRadioStation = getRadioStationData(radioStationId - 1).databaseId;
|
getBusinessData(businessId).streamingRadioStation = getRadioStationData(radioStationId).databaseId;
|
||||||
getBusinessData(businessId).needsSaved = true;
|
getBusinessData(businessId).needsSaved = true;
|
||||||
getPlayerData(client).streamingRadioStation = radioStationId - 1;
|
getPlayerData(client).streamingRadioStation = radioStationId;
|
||||||
meActionToNearbyPlayers(client, getLocaleString(client, "ActionBusinessRadioStationChange", getRadioStationData(radioStationId - 1).name, getRadioStationData(radioStationId - 1).genre));
|
meActionToNearbyPlayers(client, getLocaleString(client, "ActionBusinessRadioStationChange", getRadioStationData(radioStationId).name, getRadioStationData(radioStationId).genre));
|
||||||
|
|
||||||
let clients = getClients();
|
let clients = getClients();
|
||||||
for (let i in clients) {
|
for (let i in clients) {
|
||||||
if (getPlayerBusiness(clients[i]) == businessId) {
|
if (getPlayerBusiness(clients[i]) == businessId) {
|
||||||
playRadioStreamForPlayer(clients[i], getRadioStationData(radioStationId - 1).url, true, getPlayerStreamingRadioVolume(clients[i]));
|
playRadioStreamForPlayer(clients[i], getRadioStationData(radioStationId).url, true, getPlayerStreamingRadioVolume(clients[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -242,7 +242,7 @@ function getPlayerStreamingRadioVolume(client) {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function showRadioStationListCommand(command, params, client) {
|
function showRadioStationListCommand(command, params, client) {
|
||||||
let stationList = getServerData().radioStations.map(function (x) { return `{ALTCOLOUR}${toInteger(x.index) + 1}: {MAINCOLOUR}${x.name}`; });
|
let stationList = getServerData().radioStations.map(function (x) { return `{chatBoxListIndex}${toInteger(x.index) + 1}: {MAINCOLOUR}${x.name}`; });
|
||||||
|
|
||||||
let chunkedList = splitArrayIntoChunks(stationList, 4);
|
let chunkedList = splitArrayIntoChunks(stationList, 4);
|
||||||
|
|
||||||
@@ -263,16 +263,6 @@ 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.
|
* This is a command handler function.
|
||||||
*
|
*
|
||||||
@@ -301,12 +291,12 @@ function getRadioStationFromParams(params) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (typeof getServerData().radioStations[params] != "undefined") {
|
if (typeof getServerData().radioStations[params - 1] != "undefined") {
|
||||||
return toInteger(params);
|
return toInteger(params - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -1898,7 +1898,7 @@ function showAccountStaffNotesCommand(command, params, client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 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 chunkedList = splitArrayIntoChunks(staffNoteList, 1);
|
//let chunkedList = splitArrayIntoChunks(staffNoteList, 1);
|
||||||
|
|
||||||
|
|||||||
@@ -49,8 +49,9 @@ async function initServerScripts() {
|
|||||||
setAllServerDataIndexes();
|
setAllServerDataIndexes();
|
||||||
|
|
||||||
checkServerGameTime();
|
checkServerGameTime();
|
||||||
createAllServerElements();
|
spawnAllServerElements();
|
||||||
addAllNetworkEventHandlers();
|
addAllNetworkEventHandlers();
|
||||||
|
addAllCommandHandlers();
|
||||||
initAllClients();
|
initAllClients();
|
||||||
initTimers();
|
initTimers();
|
||||||
|
|
||||||
@@ -175,17 +176,16 @@ function setAllServerDataIndexes() {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function createAllServerElements() {
|
function spawnAllServerElements() {
|
||||||
createAllBusinessPickups();
|
spawnAllBusinessPickups();
|
||||||
createAllBusinessBlips();
|
spawnAllBusinessBlips();
|
||||||
createAllHousePickups();
|
spawnAllHousePickups();
|
||||||
createAllHouseBlips();
|
spawnAllHouseBlips();
|
||||||
createAllJobPickups();
|
spawnAllJobPickups();
|
||||||
createAllJobBlips();
|
spawnAllJobBlips();
|
||||||
createAllGroundItemObjects();
|
spawnAllGroundItemObjects();
|
||||||
spawnAllVehicles();
|
spawnAllVehicles();
|
||||||
spawnAllNPCs();
|
spawnAllNPCs();
|
||||||
addAllCommandHandlers();
|
|
||||||
|
|
||||||
// Using client-side spheres since server-side ones don't show on GTAC atm (bug)
|
// Using client-side spheres since server-side ones don't show on GTAC atm (bug)
|
||||||
//createAllJobRouteLocationMarkers();
|
//createAllJobRouteLocationMarkers();
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ function loadSubAccountsFromAccount(accountId) {
|
|||||||
let jobRankIndex = getJobRankIndexFromDatabaseId(jobIndex, tempSubAccount.jobRank);
|
let jobRankIndex = getJobRankIndexFromDatabaseId(jobIndex, tempSubAccount.jobRank);
|
||||||
if (!getJobRankData(jobIndex, jobRankIndex)) {
|
if (!getJobRankData(jobIndex, jobRankIndex)) {
|
||||||
let newJobRankIndex = getLowestJobRank(jobIndex);
|
let newJobRankIndex = getLowestJobRank(jobIndex);
|
||||||
console.log(`[AGRP.SubAccount]: Job ${jobIndex} has no rank ${tempSubAccount.jobRank}! Using lowest rank ${newJobRankIndex} instead.`);
|
console.log(`[V.RP.SubAccount]: Job ${jobIndex} has no rank ${tempSubAccount.jobRank}! Using lowest rank ${newJobRankIndex} instead.`);
|
||||||
tempSubAccount.jobRank = getJobRankData(jobIndex, newJobRankIndex).databaseId;
|
tempSubAccount.jobRank = getJobRankData(jobIndex, newJobRankIndex).databaseId;
|
||||||
tempSubAccount.jobRankIndex = newJobRankIndex;
|
tempSubAccount.jobRankIndex = newJobRankIndex;
|
||||||
} else {
|
} else {
|
||||||
@@ -339,7 +339,7 @@ function saveSubAccountToDatabase(subAccountData) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function createSubAccount(accountId, firstName, lastName) {
|
function createSubAccount(accountId, firstName, lastName) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Account] Attempting to create subaccount ${firstName} ${lastName} in database`);
|
logToConsole(LOG_DEBUG, `[V.RP.Account] Attempting to create subaccount ${firstName} ${lastName} in database`);
|
||||||
|
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
let dbQuery = false;
|
let dbQuery = false;
|
||||||
@@ -373,7 +373,7 @@ function showCharacterSelectToClient(client) {
|
|||||||
|
|
||||||
if (doesPlayerHaveAutoSelectLastCharacterEnabled(client)) {
|
if (doesPlayerHaveAutoSelectLastCharacterEnabled(client)) {
|
||||||
if (getPlayerData(client).subAccounts.length > 0) {
|
if (getPlayerData(client).subAccounts.length > 0) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.SubAccount] ${getPlayerDisplayForConsole(client)} is being auto-spawned as character ID ${getPlayerLastUsedSubAccount(client)}`);
|
logToConsole(LOG_DEBUG, `[V.RP.SubAccount] ${getPlayerDisplayForConsole(client)} is being auto-spawned as character ID ${getPlayerLastUsedSubAccount(client)}`);
|
||||||
selectCharacter(client, getPlayerLastUsedSubAccount(client));
|
selectCharacter(client, getPlayerLastUsedSubAccount(client));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -381,7 +381,7 @@ function showCharacterSelectToClient(client) {
|
|||||||
|
|
||||||
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
if (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client)) {
|
||||||
getPlayerData(client).currentSubAccount = 0;
|
getPlayerData(client).currentSubAccount = 0;
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.SubAccount] Setting ${getPlayerDisplayForConsole(client)}'s character to ID ${getPlayerData(client).currentSubAccount}`);
|
logToConsole(LOG_DEBUG, `[V.RP.SubAccount] Setting ${getPlayerDisplayForConsole(client)}'s character to ID ${getPlayerData(client).currentSubAccount}`);
|
||||||
let tempSubAccount = getPlayerData(client).subAccounts[0];
|
let tempSubAccount = getPlayerData(client).subAccounts[0];
|
||||||
let clanName = (tempSubAccount.clan != 0) ? getClanData(getClanIndexFromDatabaseId(tempSubAccount.clan)).name : "None";
|
let clanName = (tempSubAccount.clan != 0) ? getClanData(getClanIndexFromDatabaseId(tempSubAccount.clan)).name : "None";
|
||||||
let lastPlayedText = (tempSubAccount.lastLogin != 0) ? `${msToTime(getCurrentUnixTimestamp() - tempSubAccount.lastLogin)} ago` : "Never";
|
let lastPlayedText = (tempSubAccount.lastLogin != 0) ? `${msToTime(getCurrentUnixTimestamp() - tempSubAccount.lastLogin)} ago` : "Never";
|
||||||
@@ -391,16 +391,16 @@ function showCharacterSelectToClient(client) {
|
|||||||
//setTimeout(function() {
|
//setTimeout(function() {
|
||||||
// showCharacterSelectCameraToPlayer(client);
|
// showCharacterSelectCameraToPlayer(client);
|
||||||
//}, 500);
|
//}, 500);
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.SubAccount] ${getPlayerDisplayForConsole(client)} is being shown the character select GUI`);
|
logToConsole(LOG_DEBUG, `[V.RP.SubAccount] ${getPlayerDisplayForConsole(client)} is being shown the character select GUI`);
|
||||||
} else {
|
} else {
|
||||||
let charactersList = getPlayerData(client).subAccounts.map((sacct, index) => `{teal}${index + 1}: {ALTCOLOUR}${sacct.firstName} ${sacct.lastName}`);
|
let charactersList = getPlayerData(client).subAccounts.map((sacct, index) => `{chatBoxListIndex}${index + 1}: {ALTCOLOUR}${sacct.firstName} ${sacct.lastName}`);
|
||||||
let chunkedList = splitArrayIntoChunks(charactersList, 5);
|
let chunkedList = splitArrayIntoChunks(charactersList, 5);
|
||||||
messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderCharactersListSelf")));
|
messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderCharactersListSelf")));
|
||||||
for (let i in chunkedList) {
|
for (let i in chunkedList) {
|
||||||
messagePlayerNormal(client, chunkedList[i].join("{MAINCOLOUR} • "));
|
messagePlayerNormal(client, chunkedList[i].join("{MAINCOLOUR} • "));
|
||||||
}
|
}
|
||||||
messagePlayerInfo(client, getLocaleString(client, "CharacterSelectHelpText", `{ALTCOLOUR}/usechar{MAINCOLOUR}`, `{ALTCOLOUR}/newchar{MAINCOLOUR}`));
|
messagePlayerInfo(client, getLocaleString(client, "CharacterSelectHelpText", `{ALTCOLOUR}/usechar{MAINCOLOUR}`, `{ALTCOLOUR}/newchar{MAINCOLOUR}`));
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.SubAccount] ${getPlayerDisplayForConsole(client)} is being shown the character select/list message (GUI disabled)`);
|
logToConsole(LOG_DEBUG, `[V.RP.SubAccount] ${getPlayerDisplayForConsole(client)} is being shown the character select/list message (GUI disabled)`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -420,7 +420,7 @@ function checkNewCharacter(client, firstName, lastName) {
|
|||||||
lastName = lastName.trim();
|
lastName = lastName.trim();
|
||||||
|
|
||||||
if (doesNameContainInvalidCharacters(firstName) || doesNameContainInvalidCharacters(lastName)) {
|
if (doesNameContainInvalidCharacters(firstName) || doesNameContainInvalidCharacters(lastName)) {
|
||||||
logToConsole(LOG_INFO | LOG_WARN, `[AGRP.Account] Subaccount ${firstName} ${lastName} could not be created (invalid characters in name)`);
|
logToConsole(LOG_INFO | LOG_WARN, `[V.RP.Account] Subaccount ${firstName} ${lastName} could not be created (invalid characters in name)`);
|
||||||
showPlayerNewCharacterFailedGUI(client, "Invalid characters in name!");
|
showPlayerNewCharacterFailedGUI(client, "Invalid characters in name!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -467,7 +467,7 @@ function checkPreviousCharacter(client) {
|
|||||||
let lastPlayedText = (tempSubAccount.lastLogin != 0) ? `${msToTime(getCurrentUnixTimestamp() - tempSubAccount.lastLogin)} ago` : "Never";
|
let lastPlayedText = (tempSubAccount.lastLogin != 0) ? `${msToTime(getCurrentUnixTimestamp() - tempSubAccount.lastLogin)} ago` : "Never";
|
||||||
showPlayerCharacterSelectGUI(client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.cash, clanName, lastPlayedText, getGameConfig().skins[getGame()][tempSubAccount.skin][0]);
|
showPlayerCharacterSelectGUI(client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.cash, clanName, lastPlayedText, getGameConfig().skins[getGame()][tempSubAccount.skin][0]);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.SubAccount] Setting ${getPlayerDisplayForConsole(client)}'s character to ID ${getPlayerData(client).currentSubAccount}`);
|
logToConsole(LOG_DEBUG, `[V.RP.SubAccount] Setting ${getPlayerDisplayForConsole(client)}'s character to ID ${getPlayerData(client).currentSubAccount}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -488,16 +488,16 @@ function checkNextCharacter(client) {
|
|||||||
let lastPlayedText = (tempSubAccount.lastLogin != 0) ? `${msToTime(getCurrentUnixTimestamp() - tempSubAccount.lastLogin)} ago` : "Never";
|
let lastPlayedText = (tempSubAccount.lastLogin != 0) ? `${msToTime(getCurrentUnixTimestamp() - tempSubAccount.lastLogin)} ago` : "Never";
|
||||||
showPlayerCharacterSelectGUI(client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.cash, clanName, lastPlayedText, getGameConfig().skins[getGame()][tempSubAccount.skin][0]);
|
showPlayerCharacterSelectGUI(client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.cash, clanName, lastPlayedText, getGameConfig().skins[getGame()][tempSubAccount.skin][0]);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.SubAccount] Setting ${getPlayerDisplayForConsole(client)}'s character to ID ${getPlayerData(client).currentSubAccount}`);
|
logToConsole(LOG_DEBUG, `[V.RP.SubAccount] Setting ${getPlayerDisplayForConsole(client)}'s character to ID ${getPlayerData(client).currentSubAccount}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function selectCharacter(client, characterId = -1) {
|
function selectCharacter(client, characterId = -1) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.SubAccount] ${getPlayerDisplayForConsole(client)} character select called (Character ID ${characterId})`);
|
logToConsole(LOG_DEBUG, `[V.RP.SubAccount] ${getPlayerDisplayForConsole(client)} character select called (Character ID ${characterId})`);
|
||||||
if (characterId != -1) {
|
if (characterId != -1) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.SubAccount] ${getPlayerDisplayForConsole(client)} provided character ID (${characterId}) to spawn with`);
|
logToConsole(LOG_DEBUG, `[V.RP.SubAccount] ${getPlayerDisplayForConsole(client)} provided character ID (${characterId}) to spawn with`);
|
||||||
getPlayerData(client).currentSubAccount = characterId;
|
getPlayerData(client).currentSubAccount = characterId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -511,7 +511,7 @@ function selectCharacter(client, characterId = -1) {
|
|||||||
|
|
||||||
getPlayerData(client).switchingCharacter = false;
|
getPlayerData(client).switchingCharacter = false;
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.SubAccount] Spawning ${getPlayerDisplayForConsole(client)} as character ID ${getPlayerData(client).currentSubAccount} with skin ${skin} (${spawnPosition.x}, ${spawnPosition.y}, ${spawnPosition.z})`);
|
logToConsole(LOG_DEBUG, `[V.RP.SubAccount] Spawning ${getPlayerDisplayForConsole(client)} as character ID ${getPlayerData(client).currentSubAccount} with skin ${skin} (${spawnPosition.x}, ${spawnPosition.y}, ${spawnPosition.z})`);
|
||||||
//setPlayerCameraLookAt(client, getPosBehindPos(spawnPosition, spawnHeading, 5), spawnPosition);
|
//setPlayerCameraLookAt(client, getPosBehindPos(spawnPosition, spawnHeading, 5), spawnPosition);
|
||||||
getPlayerData(client).pedState = V_PEDSTATE_SPAWNING;
|
getPlayerData(client).pedState = V_PEDSTATE_SPAWNING;
|
||||||
|
|
||||||
@@ -520,14 +520,14 @@ function selectCharacter(client, characterId = -1) {
|
|||||||
onPlayerSpawn(client);
|
onPlayerSpawn(client);
|
||||||
} else if (getGame() == V_GAME_MAFIA_ONE) {
|
} else if (getGame() == V_GAME_MAFIA_ONE) {
|
||||||
//spawnPlayer(client, spawnPosition, spawnHeading, getGameConfig().skins[getGame()][skin][0]);
|
//spawnPlayer(client, spawnPosition, spawnHeading, getGameConfig().skins[getGame()][skin][0]);
|
||||||
//logToConsole(LOG_DEBUG, `[AGRP.SubAccount] Spawning ${getPlayerDisplayForConsole(client)} as ${getGameConfig().skins[getGame()][skin][1]} (${getGameConfig().skins[getGame()][skin][0]})`);
|
//logToConsole(LOG_DEBUG, `[V.RP.SubAccount] Spawning ${getPlayerDisplayForConsole(client)} as ${getGameConfig().skins[getGame()][skin][1]} (${getGameConfig().skins[getGame()][skin][0]})`);
|
||||||
spawnPlayer(client, spawnPosition, spawnHeading, getGameConfig().skins[getGame()][skin][0]);
|
spawnPlayer(client, spawnPosition, spawnHeading, getGameConfig().skins[getGame()][skin][0]);
|
||||||
onPlayerSpawn(client);
|
onPlayerSpawn(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
//removePlayerKeyBind(client, getKeyIdFromParams("insert"));
|
//removePlayerKeyBind(client, getKeyIdFromParams("insert"));
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.SubAccount] Spawned ${getPlayerDisplayForConsole(client)} as character ID ${getPlayerData(client).currentSubAccount} with skin ${skin} (${spawnPosition.x}, ${spawnPosition.y}, ${spawnPosition.z})`);
|
logToConsole(LOG_DEBUG, `[V.RP.SubAccount] Spawned ${getPlayerDisplayForConsole(client)} as character ID ${getPlayerData(client).currentSubAccount} with skin ${skin} (${spawnPosition.x}, ${spawnPosition.y}, ${spawnPosition.z})`);
|
||||||
|
|
||||||
getPlayerCurrentSubAccount(client).lastLogin = getCurrentUnixTimestamp();
|
getPlayerCurrentSubAccount(client).lastLogin = getCurrentUnixTimestamp();
|
||||||
}
|
}
|
||||||
@@ -535,14 +535,14 @@ function selectCharacter(client, characterId = -1) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function switchCharacterCommand(command, params, client) {
|
function switchCharacterCommand(command, params, client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.SubAccount] ${getPlayerDisplayForConsole(client)} is requesting to switch characters (current character: ${getCharacterFullName(client)} [${getPlayerData(client).currentSubAccount}/${getPlayerCurrentSubAccount(client).databaseId}])`);
|
logToConsole(LOG_DEBUG, `[V.RP.SubAccount] ${getPlayerDisplayForConsole(client)} is requesting to switch characters (current character: ${getCharacterFullName(client)} [${getPlayerData(client).currentSubAccount}/${getPlayerCurrentSubAccount(client).databaseId}])`);
|
||||||
if (!isPlayerSpawned(client)) {
|
if (!isPlayerSpawned(client)) {
|
||||||
logToConsole(LOG_WARN, `[AGRP.SubAccount] ${getPlayerDisplayForConsole(client)} is not allowed to switch characters (not spawned)`);
|
logToConsole(LOG_WARN, `[V.RP.SubAccount] ${getPlayerDisplayForConsole(client)} is not allowed to switch characters (not spawned)`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isPlayerSwitchingCharacter(client)) {
|
if (isPlayerSwitchingCharacter(client)) {
|
||||||
logToConsole(LOG_WARN, `[AGRP.SubAccount] ${getPlayerDisplayForConsole(client)} is not allowed to switch characters (already in switch char mode)`);
|
logToConsole(LOG_WARN, `[V.RP.SubAccount] ${getPlayerDisplayForConsole(client)} is not allowed to switch characters (already in switch char mode)`);
|
||||||
messagePlayerError(client, "You are already selecting/switching characters!");
|
messagePlayerError(client, "You are already selecting/switching characters!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,14 +103,14 @@ function initTimers() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function oneMinuteTimerFunction() {
|
function oneMinuteTimerFunction() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Checking server game time`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Checking server game time`);
|
||||||
checkServerGameTime();
|
checkServerGameTime();
|
||||||
|
|
||||||
if (getClients().length > 0) {
|
if (getClients().length > 0) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Checking rentable vehicles`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Checking rentable vehicles`);
|
||||||
checkVehicleRenting();
|
checkVehicleRenting();
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Event] Updating all player name tags`);
|
logToConsole(LOG_DEBUG, `[V.RP.Event] Updating all player name tags`);
|
||||||
updateAllPlayerNameTags();
|
updateAllPlayerNameTags();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,6 +121,7 @@ function tenMinuteTimerFunction() {
|
|||||||
//showRandomTipToAllPlayers();
|
//showRandomTipToAllPlayers();
|
||||||
//saveServerDataToDatabase();
|
//saveServerDataToDatabase();
|
||||||
//checkInactiveVehicleRespawns();
|
//checkInactiveVehicleRespawns();
|
||||||
|
updateVehicleSavedPositions();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -244,9 +245,15 @@ function checkServerGameTime() {
|
|||||||
removeAllPlayersFromProperties();
|
removeAllPlayersFromProperties();
|
||||||
removeAllPlayersFromVehicles();
|
removeAllPlayersFromVehicles();
|
||||||
saveServerDataToDatabase();
|
saveServerDataToDatabase();
|
||||||
logToConsole(LOG_INFO | LOG_WARN, `[AGRP.Timers] Changing server map to night`);
|
logToConsole(LOG_INFO | LOG_WARN, `[V.RP.Timers] Changing server map to night`);
|
||||||
messageDiscordEventChannel("🌙 Changing server map to night");
|
messageDiscordEventChannel("🌙 Changing server map to night");
|
||||||
|
despawnAllVehicles();
|
||||||
|
despawnAllNPCs();
|
||||||
|
despawnAllGroundItemObjects();
|
||||||
game.changeMap(getGameConfig().mainWorldScene[getGame()]);
|
game.changeMap(getGameConfig().mainWorldScene[getGame()]);
|
||||||
|
spawnAllVehicles();
|
||||||
|
spawnAllNPCs();
|
||||||
|
spawnAllGroundItemObjects();
|
||||||
}
|
}
|
||||||
} else if (getGameConfig().mainWorldScene[getGame()] == "FREERIDENOC") {
|
} else if (getGameConfig().mainWorldScene[getGame()] == "FREERIDENOC") {
|
||||||
if (isServerGoingToChangeMapsSoon(getServerConfig().hour, getServerConfig().minute)) {
|
if (isServerGoingToChangeMapsSoon(getServerConfig().hour, getServerConfig().minute)) {
|
||||||
@@ -258,9 +265,15 @@ function checkServerGameTime() {
|
|||||||
removeAllPlayersFromProperties();
|
removeAllPlayersFromProperties();
|
||||||
removeAllPlayersFromVehicles();
|
removeAllPlayersFromVehicles();
|
||||||
saveServerDataToDatabase();
|
saveServerDataToDatabase();
|
||||||
logToConsole(LOG_INFO | LOG_WARN, `[AGRP.Timers] Changing server map to day`);
|
logToConsole(LOG_INFO | LOG_WARN, `[V.RP.Timers] Changing server map to day`);
|
||||||
messageDiscordEventChannel("🌞 Changing server map to day");
|
messageDiscordEventChannel("🌞 Changing server map to day");
|
||||||
|
despawnAllVehicles();
|
||||||
|
despawnAllNPCs();
|
||||||
|
despawnAllGroundItemObjects();
|
||||||
game.changeMap(getGameConfig().mainWorldScene[getGame()]);
|
game.changeMap(getGameConfig().mainWorldScene[getGame()]);
|
||||||
|
spawnAllVehicles();
|
||||||
|
spawnAllNPCs();
|
||||||
|
spawnAllGroundItemObjects();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ function initAllClients() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function updateServerRules() {
|
function updateServerRules() {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities]: Updating all server rules ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities]: Updating all server rules ...`);
|
||||||
|
|
||||||
let timeWeatherRule = [];
|
let timeWeatherRule = [];
|
||||||
let tempText = "";
|
let tempText = "";
|
||||||
@@ -116,7 +116,7 @@ function updateServerRules() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setServerRule("Time & Weather", timeWeatherRule.join(", "));
|
setServerRule("Time & Weather", timeWeatherRule.join(", "));
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities]: All server rules updated successfully!`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities]: All server rules updated successfully!`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -272,7 +272,7 @@ function checkPlayerPedStates() {
|
|||||||
|
|
||||||
function showConnectCameraToPlayer(client) {
|
function showConnectCameraToPlayer(client) {
|
||||||
if (isFadeCameraSupported()) {
|
if (isFadeCameraSupported()) {
|
||||||
fadeCamera(client, true, 1);
|
fadePlayerCamera(client, true, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isCustomCameraSupported()) {
|
if (isCustomCameraSupported()) {
|
||||||
@@ -517,15 +517,15 @@ function removeAllPlayersFromVehicles() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function processPlayerEnteringExitingProperty(client) {
|
function processPlayerEnteringExitingProperty(client) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Utilities]: Processing property enter/exit for player ${getPlayerDisplayForConsole(client)} ...`);
|
logToConsole(LOG_DEBUG, `[V.RP.Utilities]: Processing property enter/exit for player ${getPlayerDisplayForConsole(client)} ...`);
|
||||||
if (getPlayerData(client).enteringExitingProperty == null) {
|
if (getPlayerData(client).enteringExitingProperty == null) {
|
||||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.Utilities]: Aborting property enter/exit for player ${getPlayerDisplayForConsole(client)}. Assigned property data is null.`);
|
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.Utilities]: Aborting property enter/exit for player ${getPlayerDisplayForConsole(client)}. Assigned property data is null.`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let pedState = getPlayerData(client).pedState;
|
let pedState = getPlayerData(client).pedState;
|
||||||
if (pedState != V_PEDSTATE_ENTERINGPROPERTY && pedState != V_PEDSTATE_EXITINGPROPERTY) {
|
if (pedState != V_PEDSTATE_ENTERINGPROPERTY && pedState != V_PEDSTATE_EXITINGPROPERTY) {
|
||||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.Utilities]: Aborting property enter/exit for player ${getPlayerDisplayForConsole(client)}. Ped state is not entering or exiting property.`);
|
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.Utilities]: Aborting property enter/exit for player ${getPlayerDisplayForConsole(client)}. Ped state is not entering or exiting property.`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -537,14 +537,14 @@ function processPlayerEnteringExitingProperty(client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (propertyData == null || propertyData == false) {
|
if (propertyData == null || propertyData == false) {
|
||||||
logToConsole(LOG_DEBUG | LOG_WARN, `[AGRP.Utilities]: Aborting property enter/exit for player ${getPlayerDisplayForConsole(client)}. Property is invalid.`);
|
logToConsole(LOG_DEBUG | LOG_WARN, `[V.RP.Utilities]: Aborting property enter/exit for player ${getPlayerDisplayForConsole(client)}. Property is invalid.`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pedState == V_PEDSTATE_ENTERINGPROPERTY) {
|
if (pedState == V_PEDSTATE_ENTERINGPROPERTY) {
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Utilities]: Processing property ENTER for player ${getPlayerDisplayForConsole(client)} ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Utilities]: Processing property ENTER for player ${getPlayerDisplayForConsole(client)} ...`);
|
||||||
if (isGameFeatureSupported("interiorScene") && propertyData.exitScene != "") {
|
if (isGameFeatureSupported("interiorScene") && propertyData.exitScene != "") {
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Utilities]: Player ${getPlayerDisplayForConsole(client)} is entering a property with interior scene (${propertyData.exitScene})`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Utilities]: Player ${getPlayerDisplayForConsole(client)} is entering a property with interior scene (${propertyData.exitScene})`);
|
||||||
spawnPlayer(client, propertyData.exitPosition, propertyData.exitRotation, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
spawnPlayer(client, propertyData.exitPosition, propertyData.exitRotation, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
||||||
onPlayerSpawn(client);
|
onPlayerSpawn(client);
|
||||||
} else {
|
} else {
|
||||||
@@ -552,12 +552,17 @@ function processPlayerEnteringExitingProperty(client) {
|
|||||||
setPlayerHeading(client, propertyData.exitRotation);
|
setPlayerHeading(client, propertyData.exitRotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
setPlayerDimension(client, propertyData.exitDimension);
|
if (isGameFeatureSupported("dimension")) {
|
||||||
setPlayerInterior(client, propertyData.exitInterior);
|
setPlayerDimension(client, propertyData.exitDimension);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isGameFeatureSupported("interior")) {
|
||||||
|
setPlayerInterior(client, propertyData.exitInterior);
|
||||||
|
}
|
||||||
|
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
if (isFadeCameraSupported()) {
|
if (isFadeCameraSupported()) {
|
||||||
fadeCamera(client, true, 1.0);
|
fadePlayerCamera(client, true, 1000);
|
||||||
}
|
}
|
||||||
updateInteriorLightsForPlayer(client, propertyData.interiorLights);
|
updateInteriorLightsForPlayer(client, propertyData.interiorLights);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
@@ -580,9 +585,9 @@ function processPlayerEnteringExitingProperty(client) {
|
|||||||
getPlayerData(client).enteringExitingProperty = null;
|
getPlayerData(client).enteringExitingProperty = null;
|
||||||
getPlayerData(client).pedState = V_PEDSTATE_READY;
|
getPlayerData(client).pedState = V_PEDSTATE_READY;
|
||||||
} else if (pedState == V_PEDSTATE_EXITINGPROPERTY) {
|
} else if (pedState == V_PEDSTATE_EXITINGPROPERTY) {
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Utilities]: Processing property EXIT for player ${getPlayerDisplayForConsole(client)} from property ID ${propertyData.index}/${propertyData.databaseId} ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Utilities]: Processing property EXIT for player ${getPlayerDisplayForConsole(client)} from property ID ${propertyData.index}/${propertyData.databaseId} ...`);
|
||||||
if (isGameFeatureSupported("interiorScene") && propertyData.entranceScene != "") {
|
if (isGameFeatureSupported("interiorScene") && propertyData.entranceScene != "") {
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Utilities]: Player ${getPlayerDisplayForConsole(client)} is exiting a property with external interior scene (${propertyData.entranceScene})`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Utilities]: Player ${getPlayerDisplayForConsole(client)} is exiting a property with external interior scene (${propertyData.entranceScene})`);
|
||||||
spawnPlayer(client, propertyData.entrancePosition, propertyData.entranceRotation, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
spawnPlayer(client, propertyData.entrancePosition, propertyData.entranceRotation, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
||||||
onPlayerSpawn(client);
|
onPlayerSpawn(client);
|
||||||
} else {
|
} else {
|
||||||
@@ -590,8 +595,13 @@ function processPlayerEnteringExitingProperty(client) {
|
|||||||
setPlayerHeading(client, propertyData.entranceRotation);
|
setPlayerHeading(client, propertyData.entranceRotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
setPlayerDimension(client, propertyData.entranceDimension);
|
if (isGameFeatureSupported("dimension")) {
|
||||||
setPlayerInterior(client, propertyData.entranceInterior);
|
setPlayerDimension(client, propertyData.entranceDimension);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isGameFeatureSupported("interior")) {
|
||||||
|
setPlayerInterior(client, propertyData.entranceInterior);
|
||||||
|
}
|
||||||
|
|
||||||
// Check if exiting property was into another house/business
|
// Check if exiting property was into another house/business
|
||||||
let inProperty = false;
|
let inProperty = false;
|
||||||
@@ -612,7 +622,7 @@ function processPlayerEnteringExitingProperty(client) {
|
|||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
if (getGame() != V_GAME_MAFIA_ONE && getGame() != V_GAME_GTA_IV) {
|
if (getGame() != V_GAME_MAFIA_ONE && getGame() != V_GAME_GTA_IV) {
|
||||||
if (isFadeCameraSupported()) {
|
if (isFadeCameraSupported()) {
|
||||||
fadeCamera(client, true, 1.0);
|
fadePlayerCamera(client, true, 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateInteriorLightsForPlayer(client, (inProperty != false) ? inProperty.interiorLights : true);
|
updateInteriorLightsForPlayer(client, (inProperty != false) ? inProperty.interiorLights : true);
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ class VehicleData {
|
|||||||
|
|
||||||
// Position and Rotation
|
// Position and Rotation
|
||||||
this.spawnPosition = toVector3(dbAssoc["veh_pos_x"], dbAssoc["veh_pos_y"], dbAssoc["veh_pos_z"]);
|
this.spawnPosition = toVector3(dbAssoc["veh_pos_x"], dbAssoc["veh_pos_y"], dbAssoc["veh_pos_z"]);
|
||||||
this.spawnRotation = toInteger(dbAssoc["veh_rot_z"]);
|
this.spawnRotation = toFloat(dbAssoc["veh_rot_z"]);
|
||||||
this.spawnLocked = intToBool(toInteger(dbAssoc["veh_spawn_lock"]));
|
this.spawnLocked = intToBool(toInteger(dbAssoc["veh_spawn_lock"]));
|
||||||
this.interior = toInteger(dbAssoc["veh_int"]);
|
this.interior = toInteger(dbAssoc["veh_int"]);
|
||||||
this.dimension = toInteger(dbAssoc["veh_vw"]);
|
this.dimension = toInteger(dbAssoc["veh_vw"]);
|
||||||
@@ -193,7 +193,7 @@ function loadVehiclesFromDatabase() {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_INFO, `[AGRP.Vehicle]: ${tempVehicles.length} vehicles loaded from database successfully!`);
|
logToConsole(LOG_INFO, `[V.RP.Vehicle]: ${tempVehicles.length} vehicles loaded from database successfully!`);
|
||||||
return tempVehicles;
|
return tempVehicles;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,7 +236,7 @@ function saveVehicleToDatabase(vehicleDataId) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Vehicle]: Saving vehicle ${tempVehicleData.databaseId} to database ...`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Vehicle]: Saving vehicle ${tempVehicleData.databaseId} to database ...`);
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
if (tempVehicleData.vehicle != false) {
|
if (tempVehicleData.vehicle != false) {
|
||||||
@@ -313,7 +313,7 @@ function saveVehicleToDatabase(vehicleDataId) {
|
|||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Vehicle]: Saved vehicle ${vehicleDataId} to database!`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Vehicle]: Saved vehicle ${vehicleDataId} to database!`);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -490,16 +490,10 @@ function vehicleLightsCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function deleteVehicleCommand(command, params, client) {
|
function deleteVehicleCommand(command, params, client) {
|
||||||
if (!getPlayerVehicle(client)) {
|
let vehicle = getClosestVehicle(getPlayerPosition(client));
|
||||||
messagePlayerError(client, getLocaleString(client, "MustBeInAVehicle"));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
let vehicle = getPlayerVehicle(client);
|
if (getPlayerVehicle(client)) {
|
||||||
|
vehicle = getPlayerVehicle(client);
|
||||||
if (!getVehicleData(vehicle)) {
|
|
||||||
messagePlayerError(client, getLocaleString(client, "RandomVehicleCommandsDisabled"));
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let dataIndex = getEntityData(vehicle, "v.rp.dataSlot");
|
let dataIndex = getEntityData(vehicle, "v.rp.dataSlot");
|
||||||
@@ -583,6 +577,11 @@ function vehicleSirenCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function vehicleAdminColourCommand(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)) {
|
if (areParamsEmpty(params) && areThereEnoughParams(params, 2)) {
|
||||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||||
return false;
|
return false;
|
||||||
@@ -776,6 +775,10 @@ function rentVehicleCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function enterVehicleAsPassengerCommand(command, params, client) {
|
function enterVehicleAsPassengerCommand(command, params, client) {
|
||||||
|
if (getGame() == V_GAME_MAFIA_ONE) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
sendNetworkEventToPlayer("v.rp.passenger", client);
|
sendNetworkEventToPlayer("v.rp.passenger", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1164,12 +1167,11 @@ function removeVehicleOwnerCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getVehicleInfoCommand(command, params, client) {
|
function getVehicleInfoCommand(command, params, client) {
|
||||||
if (!isPlayerInAnyVehicle(client)) {
|
let vehicle = getClosestVehicle(getPlayerPosition(client));
|
||||||
messagePlayerError(client, getLocaleString(client, "MustBeInAVehicle"));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
let vehicle = getPlayerVehicle(client);
|
if (getPlayerVehicle(client)) {
|
||||||
|
vehicle = getPlayerVehicle(client);
|
||||||
|
}
|
||||||
|
|
||||||
if (!getVehicleData(vehicle)) {
|
if (!getVehicleData(vehicle)) {
|
||||||
messagePlayerError(client, getLocaleString(client, "RandomVehicleCommandsDisabled"));
|
messagePlayerError(client, getLocaleString(client, "RandomVehicleCommandsDisabled"));
|
||||||
@@ -1227,7 +1229,7 @@ function getVehicleInfoCommand(command, params, client) {
|
|||||||
[`Last Driver`, `${vehicleData.lastDriverName}`],
|
[`Last Driver`, `${vehicleData.lastDriverName}`],
|
||||||
];
|
];
|
||||||
|
|
||||||
let stats = tempStats.map(stat => `{MAINCOLOUR}${stat[0]}: {ALTCOLOUR}${stat[1]}{MAINCOLOUR}`);
|
let stats = tempStats.map(stat => `{chatBoxListIndex}${stat[0]}: {ALTCOLOUR}${stat[1]}{MAINCOLOUR}`);
|
||||||
|
|
||||||
messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderVehicleInfo")));
|
messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderVehicleInfo")));
|
||||||
let chunkedList = splitArrayIntoChunks(stats, 6);
|
let chunkedList = splitArrayIntoChunks(stats, 6);
|
||||||
@@ -1488,7 +1490,7 @@ function respawnVehicle(vehicle) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function spawnVehicle(vehicleData) {
|
function spawnVehicle(vehicleData) {
|
||||||
logToConsole(LOG_DEBUG, `[AGRP.Vehicle]: Spawning ${getVehicleNameFromModel(vehicleData.model)} at ${vehicleData.spawnPosition.x}, ${vehicleData.spawnPosition.y}, ${vehicleData.spawnPosition.z} with heading ${vehicleData.spawnRotation}`);
|
logToConsole(LOG_DEBUG, `[V.RP.Vehicle]: Spawning ${getVehicleNameFromModel(vehicleData.model)} at ${vehicleData.spawnPosition.x}, ${vehicleData.spawnPosition.y}, ${vehicleData.spawnPosition.z} with heading ${vehicleData.spawnRotation}`);
|
||||||
let vehicle = createGameVehicle(vehicleData.model, vehicleData.spawnPosition, vehicleData.spawnRotation);
|
let vehicle = createGameVehicle(vehicleData.model, vehicleData.spawnPosition, vehicleData.spawnRotation);
|
||||||
|
|
||||||
if (!vehicle) {
|
if (!vehicle) {
|
||||||
@@ -1505,25 +1507,25 @@ function spawnVehicle(vehicleData) {
|
|||||||
vehicle.setRGBColours(vehicleData.colour1RGBA, vehicleData.colour2RGBA);
|
vehicle.setRGBColours(vehicleData.colour1RGBA, vehicleData.colour2RGBA);
|
||||||
let colour1 = rgbaArrayFromToColour(vehicleData.colour1RGBA);
|
let colour1 = rgbaArrayFromToColour(vehicleData.colour1RGBA);
|
||||||
let colour2 = rgbaArrayFromToColour(vehicleData.colour2RGBA);
|
let colour2 = rgbaArrayFromToColour(vehicleData.colour2RGBA);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Vehicle]: Setting vehicle ${vehicle.id}'s colours to RGBA [${colour1[0]}, ${colour1[1]}, ${colour1[2]}, ${colour1[3]}], [(]${colour2[0]}, ${colour2[1]}, ${colour2[2]}, ${colour2[3]}]`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Vehicle]: Setting vehicle ${vehicle.id}'s colours to RGBA [${colour1[0]}, ${colour1[1]}, ${colour1[2]}, ${colour1[3]}], [(]${colour2[0]}, ${colour2[1]}, ${colour2[2]}, ${colour2[3]}]`);
|
||||||
vehicle.setRGBColours(vehicleData.colour1RGBA, vehicleData.colour2RGBA);
|
vehicle.setRGBColours(vehicleData.colour1RGBA, vehicleData.colour2RGBA);
|
||||||
} else {
|
} else {
|
||||||
setVehicleColours(vehicle, vehicleData.colour1, vehicleData.colour2, vehicleData.colour3, vehicleData.colour4);
|
setVehicleColours(vehicle, vehicleData.colour1, vehicleData.colour2, vehicleData.colour3, vehicleData.colour4);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Vehicle]: Setting vehicle ${vehicle.id}'s colours to ${vehicleData.colour1}, ${vehicleData.colour2}, ${vehicleData.colour3}, ${vehicleData.colour4}`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Vehicle]: Setting vehicle ${vehicle.id}'s colours to ${vehicleData.colour1}, ${vehicleData.colour2}, ${vehicleData.colour3}, ${vehicleData.colour4}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vehicleData.spawnLocked == true) {
|
if (vehicleData.spawnLocked == true) {
|
||||||
setVehicleEngine(vehicle, false);
|
setVehicleEngine(vehicle, false);
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Vehicle]: Setting vehicle ${vehicle.id}'s engine to OFF`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Vehicle]: Setting vehicle ${vehicle.id}'s engine to OFF`);
|
||||||
} else {
|
} else {
|
||||||
setVehicleEngine(vehicle, intToBool(vehicleData.engine));
|
setVehicleEngine(vehicle, intToBool(vehicleData.engine));
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Vehicle]: Setting vehicle ${vehicle.id}'s engine to ${toUpperCase(getOnOffFromBool(getVehicleEngine(vehicle)))}`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Vehicle]: Setting vehicle ${vehicle.id}'s engine to ${toUpperCase(getOnOffFromBool(getVehicleEngine(vehicle)))}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof vehicle.locked != "undefined") {
|
if (typeof vehicle.locked != "undefined") {
|
||||||
setVehicleLocked(vehicle, intToBool(vehicleData.locked));
|
setVehicleLocked(vehicle, intToBool(vehicleData.locked));
|
||||||
logToConsole(LOG_VERBOSE, `[AGRP.Vehicle]: Setting vehicle ${vehicle.id}'s lock state to ${toUpperCase(getOnOffFromBool(getVehicleLocked(vehicle)))}`);
|
logToConsole(LOG_VERBOSE, `[V.RP.Vehicle]: Setting vehicle ${vehicle.id}'s lock state to ${toUpperCase(getOnOffFromBool(getVehicleLocked(vehicle)))}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
//setVehicleHealth(vehicle, 1000);
|
//setVehicleHealth(vehicle, 1000);
|
||||||
@@ -1588,17 +1590,6 @@ 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) {
|
function createNewDealershipVehicle(modelIndex, spawnPosition, spawnRotation, price, dealershipId, interior = 0, dimension = 0) {
|
||||||
let vehicle = createGameVehicle(modelIndex, spawnPosition, spawnRotation);
|
let vehicle = createGameVehicle(modelIndex, spawnPosition, spawnRotation);
|
||||||
if (!vehicle) {
|
if (!vehicle) {
|
||||||
@@ -1809,7 +1800,7 @@ function setAllVehicleIndexes() {
|
|||||||
getServerData().vehicles[i].index = i;
|
getServerData().vehicles[i].index = i;
|
||||||
|
|
||||||
if (getServerData().vehicles[i].streamingRadioStation != 0) {
|
if (getServerData().vehicles[i].streamingRadioStation != 0) {
|
||||||
getServerData().vehicles[i].streamingRadioStationIndex = getRadioStationIndexFromDatabase(getServerData().vehicles[i].streamingRadioStation);
|
getServerData().vehicles[i].streamingRadioStationIndex = getRadioStationIdFromDatabaseId(getServerData().vehicles[i].streamingRadioStation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1874,9 +1865,14 @@ function getVehicleTrunkPosition(vehicle) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function removeAllOccupantsFromVehicle(vehicle) {
|
function removeAllOccupantsFromVehicle(vehicle) {
|
||||||
for (let i = 0; i <= 16; i++) {
|
let clients = getClients();
|
||||||
if (vehicle.getOccupant(i) != null) {
|
for (let i in clients) {
|
||||||
removePlayerFromVehicle(vehicle.getOccupant(i));
|
if (clients[i].player != null) {
|
||||||
|
if (clients[i].player.vehicle != null) {
|
||||||
|
if (clients[i].player.vehicle == vehicle) {
|
||||||
|
removePlayerFromVehicle(clients[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1921,3 +1917,23 @@ function isPlayerInVehicleDriverSeat(client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
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",
|
businessBlue: "0099FF",
|
||||||
houseGreen: "11CC11",
|
houseGreen: "11CC11",
|
||||||
clanOrange: "FF9900",
|
clanOrange: "FF9900",
|
||||||
vehiclePurple: "960096",
|
vehiclePurple: "B19CD9",
|
||||||
jobYellow: "FFFF00",
|
jobYellow: "FFFF00",
|
||||||
adminOrange: "ED4337",
|
adminOrange: "ED4337",
|
||||||
chatBoxListIndex: "0099FF",
|
chatBoxListIndex: "0099FF",
|
||||||
@@ -206,7 +206,7 @@ let serverColours = {
|
|||||||
firefighterRed: toColour(205, 60, 60, 255),
|
firefighterRed: toColour(205, 60, 60, 255),
|
||||||
busDriverGreen: toColour(50, 160, 50, 255),
|
busDriverGreen: toColour(50, 160, 50, 255),
|
||||||
taxiDriverYellow: toColour(240, 230, 100, 255),
|
taxiDriverYellow: toColour(240, 230, 100, 255),
|
||||||
deliveryPurple: toColour(177, 156, 217, 255),
|
deliveryPurple: toColour(150, 0, 150, 255),
|
||||||
civilianWhite: toColour(200, 200, 200, 255),
|
civilianWhite: toColour(200, 200, 200, 255),
|
||||||
burntYellow: toColour(210, 210, 0, 255),
|
burntYellow: toColour(210, 210, 0, 255),
|
||||||
burntOrange: toColour(210, 120, 0, 255),
|
burntOrange: toColour(210, 120, 0, 255),
|
||||||
@@ -214,7 +214,7 @@ let serverColours = {
|
|||||||
softYellow: toColour(234, 198, 126, 255),
|
softYellow: toColour(234, 198, 126, 255),
|
||||||
businessBlue: toColour(0, 153, 255, 255),
|
businessBlue: toColour(0, 153, 255, 255),
|
||||||
houseGreen: toColour(17, 204, 17, 255),
|
houseGreen: toColour(17, 204, 17, 255),
|
||||||
vehiclePurple: toColour(177, 156, 217, 255),
|
vehiclePurple: toColour(150, 0, 150, 255),
|
||||||
chatBoxListIndex: toColour(0, 153, 255, 255),
|
chatBoxListIndex: toColour(0, 153, 255, 255),
|
||||||
npcPink: toColour(219, 112, 147, 255),
|
npcPink: toColour(219, 112, 147, 255),
|
||||||
adminOrange: toColour(205, 60, 60, 255),
|
adminOrange: toColour(205, 60, 60, 255),
|
||||||
@@ -1748,7 +1748,7 @@ function areWorldLabelsSupported() {
|
|||||||
|
|
||||||
function isGameFeatureSupported(featureName) {
|
function isGameFeatureSupported(featureName) {
|
||||||
if (typeof supportedFeatures[featureName] === "undefined") {
|
if (typeof supportedFeatures[featureName] === "undefined") {
|
||||||
logToConsole(LOG_WARN, `[AGRP.Utilities] Game feature support error. Unknown feature name: ${featureName}`);
|
logToConsole(LOG_WARN, `[V.RP.Utilities] Game feature support error. Unknown feature name: ${featureName}`);
|
||||||
if (isServerScript()) {
|
if (isServerScript()) {
|
||||||
submitBugReport(null, `[AUTOMATED REPORT] Game feature support error. Unknown feature name: ${featureName}`);
|
submitBugReport(null, `[AUTOMATED REPORT] Game feature support error. Unknown feature name: ${featureName}`);
|
||||||
return false;
|
return false;
|
||||||
@@ -2302,6 +2302,15 @@ function removeHexColoursFromString(str) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
function removeSlashesFromString(str) {
|
||||||
|
let matchRegex = /\//gi;
|
||||||
|
str.replace(matchRegex, ``);
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
async function waitUntil(condition) {
|
async function waitUntil(condition) {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
let interval = setInterval(() => {
|
let interval = setInterval(() => {
|
||||||
@@ -2648,11 +2657,11 @@ function fixCharacterName(name) {
|
|||||||
function getCurrentTimeStampWithTimeZone(timeZone) {
|
function getCurrentTimeStampWithTimeZone(timeZone) {
|
||||||
let date = new Date();
|
let date = new Date();
|
||||||
|
|
||||||
let utcDate = new Date(date.toLocaleString('en-US', { timeZone: "UTC" }));
|
//let utcDate = new Date(date.toLocaleString('en-US', { timeZone: "UTC" }));
|
||||||
let tzDate = new Date(date.toLocaleString('en-US', { timeZone: timeZone }));
|
//let tzDate = new Date(date.toLocaleString('en-US', { timeZone: timeZone }));
|
||||||
let offset = utcDate.getTime() - tzDate.getTime();
|
//let offset = utcDate.getTime() - tzDate.getTime();
|
||||||
|
|
||||||
date.setTime(date.getTime() + offset);
|
//date.setTime(date.getTime() + offset);
|
||||||
|
|
||||||
return date;
|
return date;
|
||||||
};
|
};
|
||||||
@@ -3175,7 +3184,15 @@ function getAnimationFromParams(params) {
|
|||||||
* @return {AnimationData} The animation's data (array)
|
* @return {AnimationData} The animation's data (array)
|
||||||
*/
|
*/
|
||||||
function getAnimationData(animationSlot, gameId = getGame()) {
|
function getAnimationData(animationSlot, gameId = getGame()) {
|
||||||
return getGameConfig().animations[gameId][animationSlot];
|
if (animationSlot == -1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof getGameConfig().animations[gameId][animationSlot] != "undefined") {
|
||||||
|
return getGameConfig().animations[gameId][animationSlot];
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user