Mass convert to tabs + fix veh buy ownership
This commit is contained in:
@@ -8,68 +8,68 @@
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function makePedPlayAnimation(pedId, animGroup, animId, animType, animSpeed, loop, loopNoControl, freezeLastFrame, returnToOriginalPosition, freezePlayer) {
|
function makePedPlayAnimation(pedId, animGroup, animId, animType, animSpeed, loop, loopNoControl, freezeLastFrame, returnToOriginalPosition, freezePlayer) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Animation] Playing animation ${animGroup}/${animId} for ped ${pedId}`);
|
logToConsole(LOG_DEBUG, `[VRR.Animation] Playing animation ${animGroup}/${animId} for ped ${pedId}`);
|
||||||
if(getGame() < VRR_GAME_GTA_IV) {
|
if(getGame() < VRR_GAME_GTA_IV) {
|
||||||
if(animType == VRR_ANIMTYPE_NORMAL || animType == VRR_ANIMTYPE_SURRENDER) {
|
if(animType == VRR_ANIMTYPE_NORMAL || animType == VRR_ANIMTYPE_SURRENDER) {
|
||||||
if(getGame() == VRR_GAME_GTA_VC || getGame() == VRR_GAME_GTA_SA) {
|
if(getGame() == VRR_GAME_GTA_VC || getGame() == VRR_GAME_GTA_SA) {
|
||||||
getElementFromId(pedId).clearAnimations();
|
getElementFromId(pedId).clearAnimations();
|
||||||
} else {
|
} else {
|
||||||
getElementFromId(pedId).clearObjective();
|
getElementFromId(pedId).clearObjective();
|
||||||
}
|
}
|
||||||
getElementFromId(pedId).addAnimation(animGroup, animId);
|
getElementFromId(pedId).addAnimation(animGroup, animId);
|
||||||
|
|
||||||
if(getElementFromId(pedId) == localPlayer && freezePlayer == true) {
|
if(getElementFromId(pedId) == localPlayer && freezePlayer == true) {
|
||||||
inAnimation = true;
|
inAnimation = true;
|
||||||
setLocalPlayerControlState(false, false);
|
setLocalPlayerControlState(false, false);
|
||||||
localPlayer.collisionsEnabled = false;
|
localPlayer.collisionsEnabled = false;
|
||||||
}
|
}
|
||||||
} else if(animType == VRR_ANIMTYPE_BLEND) {
|
} else if(animType == VRR_ANIMTYPE_BLEND) {
|
||||||
getElementFromId(pedId).position = getElementFromId(pedId).position;
|
getElementFromId(pedId).position = getElementFromId(pedId).position;
|
||||||
getElementFromId(pedId).blendAnimation(animGroup, animId, animSpeed);
|
getElementFromId(pedId).blendAnimation(animGroup, animId, animSpeed);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
natives.requestAnims(animGroup);
|
natives.requestAnims(animGroup);
|
||||||
natives.taskPlayAnimNonInterruptable(getElementFromId(pedId), animId, animGroup, animSpeed, loop, loopNoControl, freezeLastFrame, returnToOriginalPosition, -1);
|
natives.taskPlayAnimNonInterruptable(getElementFromId(pedId), animId, animGroup, animSpeed, loop, loopNoControl, freezeLastFrame, returnToOriginalPosition, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function forcePedAnimation(pedId, animGroup, animId, animType, animSpeed, loop, loopNoControl, freezeLastFrame, returnToOriginalPosition) {
|
function forcePedAnimation(pedId, animGroup, animId, animType, animSpeed, loop, loopNoControl, freezeLastFrame, returnToOriginalPosition) {
|
||||||
if(getGame() < VRR_GAME_GTA_IV) {
|
if(getGame() < VRR_GAME_GTA_IV) {
|
||||||
forcedAnimation = [animGroup, animId];
|
forcedAnimation = [animGroup, animId];
|
||||||
getElementFromId(pedId).position = getElementFromId(pedId).position;
|
getElementFromId(pedId).position = getElementFromId(pedId).position;
|
||||||
getElementFromId(pedId).addAnimation(animGroup, animId);
|
getElementFromId(pedId).addAnimation(animGroup, animId);
|
||||||
|
|
||||||
if(getElementFromId(pedId) == localPlayer) {
|
if(getElementFromId(pedId) == localPlayer) {
|
||||||
inAnimation = true;
|
inAnimation = true;
|
||||||
setLocalPlayerControlState(false, false);
|
setLocalPlayerControlState(false, false);
|
||||||
localPlayer.collisionsEnabled = false;
|
localPlayer.collisionsEnabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function makePedStopAnimation(pedId) {
|
function makePedStopAnimation(pedId) {
|
||||||
if(getElementFromId(pedId) == null) {
|
if(getElementFromId(pedId) == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getGame() != VRR_GAME_GTA_IV) {
|
if(getGame() != VRR_GAME_GTA_IV) {
|
||||||
if(getGame() == VRR_GAME_GTA_VC || getGame() == VRR_GAME_GTA_SA) {
|
if(getGame() == VRR_GAME_GTA_VC || getGame() == VRR_GAME_GTA_SA) {
|
||||||
getElementFromId(pedId).clearAnimations();
|
getElementFromId(pedId).clearAnimations();
|
||||||
} else {
|
} else {
|
||||||
getElementFromId(pedId).clearObjective();
|
getElementFromId(pedId).clearObjective();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getElementFromId(pedId) == localPlayer) {
|
if(getElementFromId(pedId) == localPlayer) {
|
||||||
if(getGame() != VRR_GAME_GTA_IV) {
|
if(getGame() != VRR_GAME_GTA_IV) {
|
||||||
localPlayer.collisionsEnabled = true;
|
localPlayer.collisionsEnabled = true;
|
||||||
}
|
}
|
||||||
setLocalPlayerControlState(true, false);
|
setLocalPlayerControlState(true, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -8,45 +8,45 @@
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
class BusinessData {
|
class BusinessData {
|
||||||
constructor(index, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems) {
|
constructor(index, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems) {
|
||||||
this.index = index;
|
this.index = index;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.entrancePosition = entrancePosition;
|
this.entrancePosition = entrancePosition;
|
||||||
this.blipModel = blipModel;
|
this.blipModel = blipModel;
|
||||||
this.pickupModel = pickupModel;
|
this.pickupModel = pickupModel;
|
||||||
this.hasInterior = hasInterior;
|
this.hasInterior = hasInterior;
|
||||||
this.hasItems = hasItems;
|
this.hasItems = hasItems;
|
||||||
this.blipId = -1;
|
this.blipId = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems) {
|
function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems) {
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if(getGame() == VRR_GAME_GTA_IV) {
|
||||||
if(getBusinessData(businessId) != false) {
|
if(getBusinessData(businessId) != false) {
|
||||||
if(blipModel == -1) {
|
if(blipModel == -1) {
|
||||||
natives.removeBlipAndClearIndex(getBusinessData(businessId).blipId);
|
natives.removeBlipAndClearIndex(getBusinessData(businessId).blipId);
|
||||||
businesses.splice(getBusinessData(businessId).index, 1);
|
businesses.splice(getBusinessData(businessId).index, 1);
|
||||||
} else {
|
} else {
|
||||||
natives.setBlipCoordinates(getBusinessData(businessId).blipId, getBusinessData(businessId).entrancePosition);
|
natives.setBlipCoordinates(getBusinessData(businessId).blipId, getBusinessData(businessId).entrancePosition);
|
||||||
natives.changeBlipSprite(getBusinessData(businessId).blipId, getBusinessData(businessId).blipModel);
|
natives.changeBlipSprite(getBusinessData(businessId).blipId, getBusinessData(businessId).blipModel);
|
||||||
natives.changeBlipNameFromAscii(getBusinessData(businessId).blipId, `${name.substr(0, 24)}${(name.length > 24) ? " ...": ""}`);
|
natives.changeBlipNameFromAscii(getBusinessData(businessId).blipId, `${name.substr(0, 24)}${(name.length > 24) ? " ...": ""}`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(blipModel != -1) {
|
if(blipModel != -1) {
|
||||||
let blipId = natives.addBlipForCoord(entrancePosition);
|
let blipId = natives.addBlipForCoord(entrancePosition);
|
||||||
if(blipId) {
|
if(blipId) {
|
||||||
let tempBusinessData = new BusinessData(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems);
|
let tempBusinessData = new BusinessData(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems);
|
||||||
tempBusinessData.blipId = blipId;
|
tempBusinessData.blipId = blipId;
|
||||||
natives.changeBlipSprite(blipId, blipModel);
|
natives.changeBlipSprite(blipId, blipModel);
|
||||||
natives.setBlipMarkerLongDistance(blipId, true);
|
natives.setBlipMarkerLongDistance(blipId, true);
|
||||||
natives.changeBlipNameFromAscii(blipId, `${name.substr(0, 24)}${(name.length > 24) ? " ...": ""}`);
|
natives.changeBlipNameFromAscii(blipId, `${name.substr(0, 24)}${(name.length > 24) ? " ...": ""}`);
|
||||||
businesses.push(tempBusinessData);
|
businesses.push(tempBusinessData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -22,88 +22,88 @@ let scrollDownKey = false;
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initChatBoxScript() {
|
function initChatBoxScript() {
|
||||||
logToConsole(LOG_DEBUG, "[VRR.ChatBox]: Initializing chatbox script ...");
|
logToConsole(LOG_DEBUG, "[VRR.ChatBox]: Initializing chatbox script ...");
|
||||||
scrollUpKey = getKeyIdFromParams("pageup");
|
scrollUpKey = getKeyIdFromParams("pageup");
|
||||||
scrollDownKey = getKeyIdFromParams("pagedown");
|
scrollDownKey = getKeyIdFromParams("pagedown");
|
||||||
bindChatBoxKeys();
|
bindChatBoxKeys();
|
||||||
logToConsole(LOG_DEBUG, "[VRR.ChatBox]: Chatbox script initialized!");
|
logToConsole(LOG_DEBUG, "[VRR.ChatBox]: Chatbox script initialized!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function bindChatBoxKeys() {
|
function bindChatBoxKeys() {
|
||||||
bindKey(toInteger(scrollUpKey), KEYSTATE_DOWN, chatBoxScrollUp);
|
bindKey(toInteger(scrollUpKey), KEYSTATE_DOWN, chatBoxScrollUp);
|
||||||
bindKey(toInteger(scrollDownKey), KEYSTATE_DOWN, chatBoxScrollDown);
|
bindKey(toInteger(scrollDownKey), KEYSTATE_DOWN, chatBoxScrollDown);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function unBindChatBoxKeys() {
|
function unBindChatBoxKeys() {
|
||||||
unbindKey(toInteger(scrollUpKey));
|
unbindKey(toInteger(scrollUpKey));
|
||||||
unbindKey(toInteger(scrollDownKey));
|
unbindKey(toInteger(scrollDownKey));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function receiveChatBoxMessageFromServer(messageString, colour) {
|
function receiveChatBoxMessageFromServer(messageString, colour) {
|
||||||
let colouredString = replaceColoursInMessage(messageString);
|
let colouredString = replaceColoursInMessage(messageString);
|
||||||
|
|
||||||
if(bottomMessageIndex >= chatBoxHistory.length-1) {
|
if(bottomMessageIndex >= chatBoxHistory.length-1) {
|
||||||
message(colouredString, colour);
|
message(colouredString, colour);
|
||||||
bottomMessageIndex = chatBoxHistory.length-1;
|
bottomMessageIndex = chatBoxHistory.length-1;
|
||||||
}
|
}
|
||||||
addToChatBoxHistory(colouredString, colour);
|
addToChatBoxHistory(colouredString, colour);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setChatScrollLines(amount) {
|
function setChatScrollLines(amount) {
|
||||||
scrollAmount = amount;
|
scrollAmount = amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function addToChatBoxHistory(messageString, colour) {
|
function addToChatBoxHistory(messageString, colour) {
|
||||||
chatBoxHistory.push([messageString, colour]);
|
chatBoxHistory.push([messageString, colour]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function chatBoxScrollUp() {
|
function chatBoxScrollUp() {
|
||||||
if(bottomMessageIndex > maxChatBoxLines) {
|
if(bottomMessageIndex > maxChatBoxLines) {
|
||||||
bottomMessageIndex = bottomMessageIndex-scrollAmount;
|
bottomMessageIndex = bottomMessageIndex-scrollAmount;
|
||||||
updateChatBox();
|
updateChatBox();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function chatBoxScrollDown() {
|
function chatBoxScrollDown() {
|
||||||
if(bottomMessageIndex < chatBoxHistory.length-1) {
|
if(bottomMessageIndex < chatBoxHistory.length-1) {
|
||||||
bottomMessageIndex = bottomMessageIndex+scrollAmount;
|
bottomMessageIndex = bottomMessageIndex+scrollAmount;
|
||||||
updateChatBox();
|
updateChatBox();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function clearChatBox() {
|
function clearChatBox() {
|
||||||
for(let i = 0 ; i <= maxChatBoxLines ; i++) {
|
for(let i = 0 ; i <= maxChatBoxLines ; i++) {
|
||||||
message("", COLOUR_WHITE);
|
message("", COLOUR_WHITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function updateChatBox() {
|
function updateChatBox() {
|
||||||
clearChatBox();
|
clearChatBox();
|
||||||
for(let i = bottomMessageIndex-maxChatBoxLines ; i <= bottomMessageIndex ; i++) {
|
for(let i = bottomMessageIndex-maxChatBoxLines ; i <= bottomMessageIndex ; i++) {
|
||||||
if(typeof chatBoxHistory[i] != "undefined") {
|
if(typeof chatBoxHistory[i] != "undefined") {
|
||||||
message(chatBoxHistory[i][0], chatBoxHistory[i][1]);
|
message(chatBoxHistory[i][0], chatBoxHistory[i][1]);
|
||||||
} else {
|
} else {
|
||||||
message("", COLOUR_WHITE);
|
message("", COLOUR_WHITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -8,58 +8,58 @@
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getCustomImage(imageName) {
|
function getCustomImage(imageName) {
|
||||||
let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
|
let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
|
||||||
if(contentResource != null) {
|
if(contentResource != null) {
|
||||||
if(contentResource.isStarted) {
|
if(contentResource.isStarted) {
|
||||||
let image = contentResource.exports.getCustomImage(imageName);
|
let image = contentResource.exports.getCustomImage(imageName);
|
||||||
if(image != null) {
|
if(image != null) {
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getCustomFont(fontName) {
|
function getCustomFont(fontName) {
|
||||||
let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
|
let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
|
||||||
if(contentResource != null) {
|
if(contentResource != null) {
|
||||||
if(contentResource.isStarted) {
|
if(contentResource.isStarted) {
|
||||||
let font = contentResource.exports.getCustomFont(fontName);
|
let font = contentResource.exports.getCustomFont(fontName);
|
||||||
if(font != null) {
|
if(font != null) {
|
||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getCustomAudio(audioName) {
|
function getCustomAudio(audioName) {
|
||||||
let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
|
let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
|
||||||
if(contentResource != null) {
|
if(contentResource != null) {
|
||||||
if(contentResource.isStarted) {
|
if(contentResource.isStarted) {
|
||||||
let audioFile = contentResource.exports.getCustomAudio(audioName);
|
let audioFile = contentResource.exports.getCustomAudio(audioName);
|
||||||
if(audioFile != null) {
|
if(audioFile != null) {
|
||||||
return audioFile;
|
return audioFile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function playCustomAudio(audioName, volume = 0.5, loop = false) {
|
function playCustomAudio(audioName, volume = 0.5, loop = false) {
|
||||||
let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
|
let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
|
||||||
if(contentResource != null) {
|
if(contentResource != null) {
|
||||||
if(contentResource.isStarted) {
|
if(contentResource.isStarted) {
|
||||||
contentResource.exports.playCustomAudio(audioName, volume, loop);
|
contentResource.exports.playCustomAudio(audioName, volume, loop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -8,216 +8,216 @@
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initEventScript() {
|
function initEventScript() {
|
||||||
logToConsole(LOG_DEBUG, "[VRR.Event]: Initializing event script ...");
|
logToConsole(LOG_DEBUG, "[VRR.Event]: Initializing event script ...");
|
||||||
addCustomEvents();
|
addCustomEvents();
|
||||||
addAllEventHandlers();
|
addAllEventHandlers();
|
||||||
logToConsole(LOG_DEBUG, "[VRR.Event]: Event script initialized!");
|
logToConsole(LOG_DEBUG, "[VRR.Event]: Event script initialized!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function addCustomEvents() {
|
function addCustomEvents() {
|
||||||
addEvent("OnLocalPlayerEnterSphere", 1);
|
addEvent("OnLocalPlayerEnterSphere", 1);
|
||||||
addEvent("OnLocalPlayerExitSphere", 1);
|
addEvent("OnLocalPlayerExitSphere", 1);
|
||||||
addEvent("OnLocalPlayerEnteredVehicle", 1);
|
addEvent("OnLocalPlayerEnteredVehicle", 1);
|
||||||
addEvent("OnLocalPlayerExitedVehicle", 1);
|
addEvent("OnLocalPlayerExitedVehicle", 1);
|
||||||
addEvent("OnLocalPlayerSwitchWeapon", 2);
|
addEvent("OnLocalPlayerSwitchWeapon", 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function addAllEventHandlers() {
|
function addAllEventHandlers() {
|
||||||
bindEventHandler("OnResourceStart", thisResource, onResourceStart);
|
bindEventHandler("OnResourceStart", thisResource, onResourceStart);
|
||||||
bindEventHandler("OnResourceReady", thisResource, onResourceReady);
|
bindEventHandler("OnResourceReady", thisResource, onResourceReady);
|
||||||
bindEventHandler("OnResourceStop", thisResource, onResourceStop);
|
bindEventHandler("OnResourceStop", thisResource, onResourceStop);
|
||||||
|
|
||||||
addEventHandler("OnProcess", onProcess);
|
addEventHandler("OnProcess", onProcess);
|
||||||
addEventHandler("OnKeyUp", onKeyUp);
|
addEventHandler("OnKeyUp", onKeyUp);
|
||||||
addEventHandler("OnDrawnHUD", onDrawnHUD);
|
addEventHandler("OnDrawnHUD", onDrawnHUD);
|
||||||
|
|
||||||
addEventHandler("OnPedWasted", onPedWasted);
|
addEventHandler("OnPedWasted", onPedWasted);
|
||||||
|
|
||||||
addEventHandler("OnElementStreamIn", onElementStreamIn);
|
addEventHandler("OnElementStreamIn", onElementStreamIn);
|
||||||
|
|
||||||
addEventHandler("OnLocalPlayerEnteredVehicle", onLocalPlayerEnteredVehicle);
|
addEventHandler("OnLocalPlayerEnteredVehicle", onLocalPlayerEnteredVehicle);
|
||||||
addEventHandler("OnLocalPlayerExitedVehicle", onLocalPlayerExitedVehicle);
|
addEventHandler("OnLocalPlayerExitedVehicle", onLocalPlayerExitedVehicle);
|
||||||
addEventHandler("OnLocalPlayerEnterSphere", onLocalPlayerEnterSphere);
|
addEventHandler("OnLocalPlayerEnterSphere", onLocalPlayerEnterSphere);
|
||||||
addEventHandler("OnLocalPlayerExitSphere", onLocalPlayerExitSphere);
|
addEventHandler("OnLocalPlayerExitSphere", onLocalPlayerExitSphere);
|
||||||
addEventHandler("OnLocalPlayerSwitchWeapon", onLocalPlayerSwitchWeapon);
|
addEventHandler("OnLocalPlayerSwitchWeapon", onLocalPlayerSwitchWeapon);
|
||||||
|
|
||||||
addEventHandler("OnPedInflictDamage", onPedInflictDamage);
|
addEventHandler("OnPedInflictDamage", onPedInflictDamage);
|
||||||
|
|
||||||
addEventHandler("OnLostFocus", onLostFocus);
|
addEventHandler("OnLostFocus", onLostFocus);
|
||||||
addEventHandler("OnFocus", onFocus);
|
addEventHandler("OnFocus", onFocus);
|
||||||
|
|
||||||
addEventHandler("OnCameraProcess", onCameraProcess);
|
addEventHandler("OnCameraProcess", onCameraProcess);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onResourceStart(event, resource) {
|
function onResourceStart(event, resource) {
|
||||||
sendResourceStartedSignalToServer();
|
sendResourceStartedSignalToServer();
|
||||||
setUpInitialGame();
|
setUpInitialGame();
|
||||||
garbageCollectorInterval = setInterval(collectAllGarbage, 1000*60);
|
garbageCollectorInterval = setInterval(collectAllGarbage, 1000*60);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onResourceStop(event, resource) {
|
function onResourceStop(event, resource) {
|
||||||
sendResourceStoppedSignalToServer();
|
sendResourceStoppedSignalToServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onResourceReady(event, resource) {
|
function onResourceReady(event, resource) {
|
||||||
sendResourceReadySignalToServer();
|
sendResourceReadySignalToServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onProcess(event, deltaTime) {
|
function onProcess(event, deltaTime) {
|
||||||
if(localPlayer == null) {
|
if(localPlayer == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isSpawned) {
|
if(!isSpawned) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
processSync();
|
processSync();
|
||||||
processLocalPlayerControlState();
|
processLocalPlayerControlState();
|
||||||
processLocalPlayerVehicleControlState();
|
processLocalPlayerVehicleControlState();
|
||||||
processLocalPlayerSphereEntryExitHandling();
|
processLocalPlayerSphereEntryExitHandling();
|
||||||
processLocalPlayerVehicleEntryExitHandling();
|
processLocalPlayerVehicleEntryExitHandling();
|
||||||
processJobRouteSphere();
|
processJobRouteSphere();
|
||||||
forceLocalPlayerEquippedWeaponItem();
|
forceLocalPlayerEquippedWeaponItem();
|
||||||
processWantedLevelReset();
|
processWantedLevelReset();
|
||||||
processGameSpecifics();
|
processGameSpecifics();
|
||||||
processNearbyPickups();
|
processNearbyPickups();
|
||||||
processVehiclePurchasing();
|
processVehiclePurchasing();
|
||||||
processVehicleFires();
|
processVehicleFires();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onKeyUp(event, keyCode, scanCode, keyModifiers) {
|
function onKeyUp(event, keyCode, scanCode, keyModifiers) {
|
||||||
processSkinSelectKeyPress(keyCode);
|
processSkinSelectKeyPress(keyCode);
|
||||||
//processKeyDuringAnimation();
|
//processKeyDuringAnimation();
|
||||||
processGUIKeyPress(keyCode);
|
processGUIKeyPress(keyCode);
|
||||||
processToggleGUIKeyPress(keyCode);
|
processToggleGUIKeyPress(keyCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onDrawnHUD(event) {
|
function onDrawnHUD(event) {
|
||||||
if(!renderHUD) {
|
if(!renderHUD) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(localPlayer == null) {
|
if(localPlayer == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
processSmallGameMessageRendering();
|
processSmallGameMessageRendering();
|
||||||
processScoreBoardRendering();
|
processScoreBoardRendering();
|
||||||
processLabelRendering();
|
processLabelRendering();
|
||||||
processLogoRendering();
|
processLogoRendering();
|
||||||
processItemActionRendering();
|
processItemActionRendering();
|
||||||
processSkinSelectRendering();
|
processSkinSelectRendering();
|
||||||
processNameTagRendering();
|
processNameTagRendering();
|
||||||
processInteriorLightsRendering();
|
processInteriorLightsRendering();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPedWasted(event, wastedPed, killerPed, weapon, pedPiece) {
|
function onPedWasted(event, wastedPed, killerPed, weapon, pedPiece) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Ped ${wastedPed.name} died`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Ped ${wastedPed.name} died`);
|
||||||
wastedPed.clearWeapons();
|
wastedPed.clearWeapons();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onElementStreamIn(event, element) {
|
function onElementStreamIn(event, element) {
|
||||||
syncElementProperties(element);
|
syncElementProperties(element);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onLocalPlayerExitedVehicle(event, vehicle, seat) {
|
function onLocalPlayerExitedVehicle(event, vehicle, seat) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Local player exited vehicle`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Local player exited vehicle`);
|
||||||
if(areServerElementsSupported()) {
|
if(areServerElementsSupported()) {
|
||||||
sendNetworkEventToServer("vrr.onPlayerExitVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
sendNetworkEventToServer("vrr.onPlayerExitVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(inVehicleSeat) {
|
if(inVehicleSeat) {
|
||||||
parkedVehiclePosition = false;
|
parkedVehiclePosition = false;
|
||||||
parkedVehicleHeading = false;
|
parkedVehicleHeading = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onLocalPlayerEnteredVehicle(event, vehicle, seat) {
|
function onLocalPlayerEnteredVehicle(event, vehicle, seat) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Local player entered vehicle`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Local player entered vehicle`);
|
||||||
|
|
||||||
if(areServerElementsSupported()) {
|
if(areServerElementsSupported()) {
|
||||||
sendNetworkEventToServer("vrr.onPlayerEnterVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
sendNetworkEventToServer("vrr.onPlayerEnterVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
||||||
|
|
||||||
if(inVehicleSeat == 0) {
|
if(inVehicleSeat == 0) {
|
||||||
if(inVehicle.owner != -1) {
|
if(inVehicle.owner != -1) {
|
||||||
inVehicle.engine = false;
|
inVehicle.engine = false;
|
||||||
if(!inVehicle.engine) {
|
if(!inVehicle.engine) {
|
||||||
parkedVehiclePosition = inVehicle.position;
|
parkedVehiclePosition = inVehicle.position;
|
||||||
parkedVehicleHeading = inVehicle.heading;
|
parkedVehicleHeading = inVehicle.heading;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
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, `[VRR.Event] ${damagerEntityString} damaged ${damagedEntityString}'s '${pedPiece} with weapon ${weaponId}`);
|
//logToConsole(LOG_DEBUG, `[VRR.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) {
|
||||||
//if(!weaponDamageEnabled[damagerEntity.name]) {
|
//if(!weaponDamageEnabled[damagerEntity.name]) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
sendNetworkEventToServer("vrr.weaponDamage", damagerEntity.name, weaponId, pedPiece, healthLoss);
|
sendNetworkEventToServer("vrr.weaponDamage", damagerEntity.name, weaponId, pedPiece, healthLoss);
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onLocalPlayerEnterSphere(event, sphere) {
|
function onLocalPlayerEnterSphere(event, sphere) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Local player entered sphere`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Local player entered sphere`);
|
||||||
if(sphere == jobRouteLocationSphere) {
|
if(sphere == jobRouteLocationSphere) {
|
||||||
enteredJobRouteSphere();
|
enteredJobRouteSphere();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onLocalPlayerExitSphere(event, sphere) {
|
function onLocalPlayerExitSphere(event, sphere) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Local player exited sphere`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Local player exited sphere`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onLostFocus(event) {
|
function onLostFocus(event) {
|
||||||
processLostFocusAFK();
|
processLostFocusAFK();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onFocus(event) {
|
function onFocus(event) {
|
||||||
processFocusAFK();
|
processFocusAFK();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -8,13 +8,13 @@
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
let clanManager = {
|
let clanManager = {
|
||||||
window: null,
|
window: null,
|
||||||
generalTab: null,
|
generalTab: null,
|
||||||
ranksTab: null,
|
ranksTab: null,
|
||||||
membersTab: null,
|
membersTab: null,
|
||||||
vehiclesTab: null,
|
vehiclesTab: null,
|
||||||
businessesTab: null,
|
businessesTab: null,
|
||||||
housesTab: null,
|
housesTab: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -16,49 +16,49 @@ let errorDialog = {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initErrorDialogGUI() {
|
function initErrorDialogGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating error GUI ...`);
|
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating error GUI ...`);
|
||||||
errorDialog.window = mexui.window(game.width/2-200, game.height/2-70, 500, 140, 'ERROR', {
|
errorDialog.window = mexui.window(game.width/2-200, game.height/2-70, 500, 140, 'ERROR', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||||
transitionTime: 500,
|
transitionTime: 500,
|
||||||
},
|
},
|
||||||
title: {
|
title: {
|
||||||
textSize: 11.0,
|
textSize: 11.0,
|
||||||
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 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: 0.0,
|
textSize: 0.0,
|
||||||
textColour: toColour(0, 0, 0, 0),
|
textColour: toColour(0, 0, 0, 0),
|
||||||
backgroundColour: toColour(0, 0, 0, 0),
|
backgroundColour: toColour(0, 0, 0, 0),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
errorDialog.messageLabel = errorDialog.window.text(15, 50, 470, 75, 'Error Message', {
|
errorDialog.messageLabel = errorDialog.window.text(15, 50, 470, 75, 'Error Message', {
|
||||||
main: {
|
main: {
|
||||||
textSize: 10.0,
|
textSize: 10.0,
|
||||||
textAlign: 0.5,
|
textAlign: 0.5,
|
||||||
textColour: toColour(255, 255, 255, 255),
|
textColour: toColour(255, 255, 255, 255),
|
||||||
textFont: mainFont,
|
textFont: mainFont,
|
||||||
},
|
},
|
||||||
focused: {
|
focused: {
|
||||||
borderColour: toColour(0, 0, 0, 0),
|
borderColour: toColour(0, 0, 0, 0),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
errorDialog.okayButton = errorDialog.window.button(5, 105, 390, 30, 'OK', {
|
errorDialog.okayButton = errorDialog.window.button(5, 105, 390, 30, 'OK', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||||
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
|
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
|
||||||
textSize: 10.0,
|
textSize: 10.0,
|
||||||
textFont: mainFont,
|
textFont: mainFont,
|
||||||
textAlign: 0.5,
|
textAlign: 0.5,
|
||||||
},
|
},
|
||||||
focused: {
|
focused: {
|
||||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
|
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
|
||||||
},
|
},
|
||||||
}, closeErrorDialog);
|
}, closeErrorDialog);
|
||||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Created error GUI ...`);
|
logToConsole(LOG_DEBUG, `[VRR.GUI] Created error GUI ...`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -14,101 +14,101 @@ let newCharacter = {
|
|||||||
skinDropDown: null,
|
skinDropDown: null,
|
||||||
spawnAreaDropDown: null,
|
spawnAreaDropDown: null,
|
||||||
createButton: null,
|
createButton: null,
|
||||||
mainLogoImage: null,
|
mainLogoImage: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initNewCharacterGUI() {
|
function initNewCharacterGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating new character GUI ...`);
|
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating new character GUI ...`);
|
||||||
newCharacter.window = mexui.window(game.width/2-130, game.height/2-115, 300, 230, 'New Character', {
|
newCharacter.window = mexui.window(game.width/2-130, game.height/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),
|
||||||
transitionTime: 500,
|
transitionTime: 500,
|
||||||
},
|
},
|
||||||
title: {
|
title: {
|
||||||
textSize: 0.0,
|
textSize: 0.0,
|
||||||
textColour: toColour(0, 0, 0, 0),
|
textColour: toColour(0, 0, 0, 0),
|
||||||
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
|
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
|
||||||
},
|
},
|
||||||
icon: {
|
icon: {
|
||||||
textSize: 0.0,
|
textSize: 0.0,
|
||||||
textColour: toColour(0, 0, 0, 0),
|
textColour: toColour(0, 0, 0, 0),
|
||||||
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
|
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
newCharacter.window.titleBarIconSize = toVector2(0,0);
|
newCharacter.window.titleBarIconSize = toVector2(0,0);
|
||||||
newCharacter.window.titleBarHeight = 0;
|
newCharacter.window.titleBarHeight = 0;
|
||||||
|
|
||||||
newCharacter.mainLogoImage = newCharacter.window.image(5, 20, 290, 80, mainLogoPath, {
|
newCharacter.mainLogoImage = newCharacter.window.image(5, 20, 290, 80, mainLogoPath, {
|
||||||
focused: {
|
focused: {
|
||||||
borderColour: toColour(0, 0, 0, 0),
|
borderColour: toColour(0, 0, 0, 0),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
newCharacter.messageLabel = newCharacter.window.text(20, 100, 260, 20, 'Name your character', {
|
newCharacter.messageLabel = newCharacter.window.text(20, 100, 260, 20, 'Name your character', {
|
||||||
main: {
|
main: {
|
||||||
textSize: 10.0,
|
textSize: 10.0,
|
||||||
textAlign: 0.5,
|
textAlign: 0.5,
|
||||||
textColour: toColour(200, 200, 200, 255),
|
textColour: toColour(200, 200, 200, 255),
|
||||||
textFont: mainFont,
|
textFont: mainFont,
|
||||||
},
|
},
|
||||||
focused: {
|
focused: {
|
||||||
borderColour: toColour(0, 0, 0, 0),
|
borderColour: toColour(0, 0, 0, 0),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
newCharacter.firstNameInput = newCharacter.window.textInput(20, 125, 260, 25, '', {
|
newCharacter.firstNameInput = newCharacter.window.textInput(20, 125, 260, 25, '', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(0, 0, 0, 120),
|
backgroundColour: toColour(0, 0, 0, 120),
|
||||||
textColour: toColour(200, 200, 200, 255),
|
textColour: toColour(200, 200, 200, 255),
|
||||||
textSize: 10.0,
|
textSize: 10.0,
|
||||||
textFont: mainFont,
|
textFont: mainFont,
|
||||||
},
|
},
|
||||||
caret: {
|
caret: {
|
||||||
lineColour: toColour(255, 255, 255, 255),
|
lineColour: toColour(255, 255, 255, 255),
|
||||||
},
|
},
|
||||||
placeholder: {
|
placeholder: {
|
||||||
backgroundColour: toColour(0, 0, 0, 120),
|
backgroundColour: toColour(0, 0, 0, 120),
|
||||||
textColour: toColour(200, 200, 200, 200),
|
textColour: toColour(200, 200, 200, 200),
|
||||||
textSize: 10.0,
|
textSize: 10.0,
|
||||||
textFont: mainFont,
|
textFont: mainFont,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
newCharacter.firstNameInput.placeholder = "First Name";
|
newCharacter.firstNameInput.placeholder = "First Name";
|
||||||
|
|
||||||
newCharacter.lastNameInput = newCharacter.window.textInput(20, 155, 260, 25, '', {
|
newCharacter.lastNameInput = newCharacter.window.textInput(20, 155, 260, 25, '', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(0, 0, 0, 120),
|
backgroundColour: toColour(0, 0, 0, 120),
|
||||||
textColour: toColour(200, 200, 200, 255),
|
textColour: toColour(200, 200, 200, 255),
|
||||||
textSize: 10.0,
|
textSize: 10.0,
|
||||||
textFont: mainFont,
|
textFont: mainFont,
|
||||||
},
|
},
|
||||||
caret: {
|
caret: {
|
||||||
lineColour: toColour(255, 255, 255, 255),
|
lineColour: toColour(255, 255, 255, 255),
|
||||||
},
|
},
|
||||||
placeholder: {
|
placeholder: {
|
||||||
backgroundColour: toColour(0, 0, 0, 120),
|
backgroundColour: toColour(0, 0, 0, 120),
|
||||||
textColour: toColour(150, 150, 150, 200),
|
textColour: toColour(150, 150, 150, 200),
|
||||||
textSize: 10.0,
|
textSize: 10.0,
|
||||||
textFont: mainFont,
|
textFont: mainFont,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
newCharacter.lastNameInput.placeholder = "Last Name";
|
newCharacter.lastNameInput.placeholder = "Last Name";
|
||||||
|
|
||||||
newCharacter.createCharacterButton = newCharacter.window.button(20, 185, 260, 25, 'CREATE CHARACTER', {
|
newCharacter.createCharacterButton = newCharacter.window.button(20, 185, 260, 25, 'CREATE CHARACTER', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||||
textColour: toColour(255, 255, 255, 255),
|
textColour: toColour(255, 255, 255, 255),
|
||||||
textSize: 10.0,
|
textSize: 10.0,
|
||||||
textFont: mainFont,
|
textFont: mainFont,
|
||||||
textAlign: 0.5,
|
textAlign: 0.5,
|
||||||
},
|
},
|
||||||
focused: {
|
focused: {
|
||||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||||
},
|
},
|
||||||
}, checkNewCharacter);
|
}, checkNewCharacter);
|
||||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Created new character GUI`);
|
logToConsole(LOG_DEBUG, `[VRR.GUI] Created new character GUI`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -157,8 +157,8 @@ function showNewCharacterGUI() {
|
|||||||
setChatWindowEnabled(false);
|
setChatWindowEnabled(false);
|
||||||
mexui.setInput(true);
|
mexui.setInput(true);
|
||||||
newCharacter.window.shown = true;
|
newCharacter.window.shown = true;
|
||||||
mexui.focusedInput = newCharacter.firstNameInput;
|
mexui.focusedInput = newCharacter.firstNameInput;
|
||||||
guiSubmitButton = checkNewCharacter;
|
guiSubmitButton = checkNewCharacter;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -18,62 +18,62 @@ let yesNoDialog = {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initYesNoDialogGUI() {
|
function initYesNoDialogGUI() {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Created prompt GUI ...`);
|
logToConsole(LOG_DEBUG, `[VRR.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),
|
||||||
transitionTime: 500,
|
transitionTime: 500,
|
||||||
},
|
},
|
||||||
title: {
|
title: {
|
||||||
textSize: 11.0,
|
textSize: 11.0,
|
||||||
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 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: 0.0,
|
textSize: 0.0,
|
||||||
textColour: toColour(0, 0, 0, 0),
|
textColour: toColour(0, 0, 0, 0),
|
||||||
backgroundColour: toColour(0, 0, 0, 0),
|
backgroundColour: toColour(0, 0, 0, 0),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
yesNoDialog.messageLabel = yesNoDialog.window.text(15, 50, 370, 20, 'Would you like to answer this question?', {
|
yesNoDialog.messageLabel = yesNoDialog.window.text(15, 50, 370, 20, 'Would you like to answer this question?', {
|
||||||
main: {
|
main: {
|
||||||
textSize: 10.0,
|
textSize: 10.0,
|
||||||
textAlign: 0.5,
|
textAlign: 0.5,
|
||||||
textColour: toColour(255, 255, 255, 255),
|
textColour: toColour(255, 255, 255, 255),
|
||||||
textFont: mainFont,
|
textFont: mainFont,
|
||||||
},
|
},
|
||||||
focused: {
|
focused: {
|
||||||
borderColour: toColour(0, 0, 0, 0),
|
borderColour: toColour(0, 0, 0, 0),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
yesNoDialog.yesButton = yesNoDialog.window.button(5, 100, 197, 25, 'YES', {
|
yesNoDialog.yesButton = yesNoDialog.window.button(5, 100, 197, 25, 'YES', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||||
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
|
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
|
||||||
textSize: 10.0,
|
textSize: 10.0,
|
||||||
textFont: mainFont,
|
textFont: mainFont,
|
||||||
textAlign: 0.5,
|
textAlign: 0.5,
|
||||||
},
|
},
|
||||||
focused: {
|
focused: {
|
||||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
|
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
|
||||||
},
|
},
|
||||||
}, yesNoDialogAnswerYes);
|
}, yesNoDialogAnswerYes);
|
||||||
|
|
||||||
yesNoDialog.noButton = yesNoDialog.window.button(202, 105, 197, 25, 'NO', {
|
yesNoDialog.noButton = yesNoDialog.window.button(202, 105, 197, 25, 'NO', {
|
||||||
main: {
|
main: {
|
||||||
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||||
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
|
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
|
||||||
textSize: 10.0,
|
textSize: 10.0,
|
||||||
textFont: mainFont,
|
textFont: mainFont,
|
||||||
textAlign: 0.5,
|
textAlign: 0.5,
|
||||||
},
|
},
|
||||||
focused: {
|
focused: {
|
||||||
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
|
borderColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], 255),
|
||||||
},
|
},
|
||||||
}, yesNoDialogAnswerNo);
|
}, yesNoDialogAnswerNo);
|
||||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Created prompt GUI`);
|
logToConsole(LOG_DEBUG, `[VRR.GUI] Created prompt GUI`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -22,74 +22,74 @@ function initJobScript() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocalPlayerJobType(tempJobType) {
|
function setLocalPlayerJobType(tempJobType) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Main] Set local player job type to ${tempJobType}`);
|
logToConsole(LOG_DEBUG, `[VRR.Main] Set local player job type to ${tempJobType}`);
|
||||||
localPlayerJobType = tempJobType;
|
localPlayerJobType = tempJobType;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocalPlayerWorkingState(tempWorking) {
|
function setLocalPlayerWorkingState(tempWorking) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Main] Setting working state to ${tempWorking}`);
|
logToConsole(LOG_DEBUG, `[VRR.Main] Setting working state to ${tempWorking}`);
|
||||||
localPlayerWorking = tempWorking;
|
localPlayerWorking = tempWorking;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showJobRouteLocation(position, colour) {
|
function showJobRouteLocation(position, colour) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Job] Showing job route location`);
|
logToConsole(LOG_DEBUG, `[VRR.Job] Showing job route location`);
|
||||||
if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
|
if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
|
||||||
if(game.game == VRR_GAME_GTA_SA) {
|
if(game.game == VRR_GAME_GTA_SA) {
|
||||||
jobRouteLocationSphere = game.createPickup(1318, position, 1);
|
jobRouteLocationSphere = game.createPickup(1318, position, 1);
|
||||||
} else {
|
} else {
|
||||||
jobRouteLocationSphere = game.createSphere(position, 3);
|
jobRouteLocationSphere = game.createSphere(position, 3);
|
||||||
jobRouteLocationSphere.colour = colour;
|
jobRouteLocationSphere.colour = colour;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(jobRouteLocationBlip != null) {
|
if(jobRouteLocationBlip != null) {
|
||||||
destroyElement(jobRouteLocationBlip);
|
destroyElement(jobRouteLocationBlip);
|
||||||
}
|
}
|
||||||
|
|
||||||
blinkJobRouteLocationBlip(10, position, colour);
|
blinkJobRouteLocationBlip(10, position, colour);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function enteredJobRouteSphere() {
|
function enteredJobRouteSphere() {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Job] Entered job route sphere`);
|
logToConsole(LOG_DEBUG, `[VRR.Job] Entered job route sphere`);
|
||||||
tellServerPlayerArrivedAtJobRouteLocation();
|
tellServerPlayerArrivedAtJobRouteLocation();
|
||||||
destroyElement(jobRouteLocationSphere);
|
destroyElement(jobRouteLocationSphere);
|
||||||
destroyElement(jobRouteLocationBlip);
|
destroyElement(jobRouteLocationBlip);
|
||||||
jobRouteLocationSphere = null;
|
jobRouteLocationSphere = null;
|
||||||
jobRouteLocationBlip = null;
|
jobRouteLocationBlip = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function blinkJobRouteLocationBlip(times, position, colour) {
|
function blinkJobRouteLocationBlip(times, position, colour) {
|
||||||
for(let i = 1 ; i <= times ; i++) {
|
for(let i = 1 ; i <= times ; i++) {
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
if(jobRouteLocationBlip != null) {
|
if(jobRouteLocationBlip != null) {
|
||||||
destroyElement(jobRouteLocationBlip);
|
destroyElement(jobRouteLocationBlip);
|
||||||
jobRouteLocationBlip = null;
|
jobRouteLocationBlip = null;
|
||||||
} else {
|
} else {
|
||||||
jobRouteLocationBlip = game.createBlip(position, 0, 2, colour);
|
jobRouteLocationBlip = game.createBlip(position, 0, 2, colour);
|
||||||
}
|
}
|
||||||
}, 500*i);
|
}, 500*i);
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
jobRouteLocationBlip = game.createBlip(position, 0, 2, colour);
|
jobRouteLocationBlip = game.createBlip(position, 0, 2, colour);
|
||||||
}, 500*times+1);
|
}, 500*times+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function hideJobRouteLocation() {
|
function hideJobRouteLocation() {
|
||||||
destroyElement(jobRouteLocationSphere);
|
destroyElement(jobRouteLocationSphere);
|
||||||
destroyElement(jobRouteLocationBlip);
|
destroyElement(jobRouteLocationBlip);
|
||||||
jobRouteLocationSphere = null;
|
jobRouteLocationSphere = null;
|
||||||
jobRouteLocationBlip = null;
|
jobRouteLocationBlip = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"target": "es6",
|
"target": "es6",
|
||||||
"moduleResolution": "classic"
|
"moduleResolution": "classic"
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"*.js",
|
"*.js",
|
||||||
"gui/*.js",
|
"gui/*.js",
|
||||||
"native/*.js",
|
"native/*.js",
|
||||||
"../shared/*.js",
|
"../shared/*.js",
|
||||||
"../third-party/mexui/*"
|
"../third-party/mexui/*"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -23,71 +23,71 @@ function initKeyBindScript() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function bindAccountKey(key, keyState) {
|
function bindAccountKey(key, keyState) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Binded key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
logToConsole(LOG_DEBUG, `[VRR.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()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hasKeyBindDelayElapsed()) {
|
if(hasKeyBindDelayElapsed()) {
|
||||||
if(canLocalPlayerUseKeyBinds()) {
|
if(canLocalPlayerUseKeyBinds()) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Using keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Using keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
||||||
lastKeyBindUse = sdl.ticks;
|
lastKeyBindUse = sdl.ticks;
|
||||||
tellServerPlayerUsedKeyBind(key);
|
tellServerPlayerUsedKeyBind(key);
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Failed to use keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key}) - Not allowed to use keybinds!`);
|
logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Failed to use keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key}) - Not allowed to use keybinds!`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Failed to use keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key}) - Not enough time has passed since last keybind use!`);
|
logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Failed to use keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key}) - Not enough time has passed since last keybind use!`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function unBindAccountKey(key) {
|
function unBindAccountKey(key) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Unbinded key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
logToConsole(LOG_DEBUG, `[VRR.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;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function hasKeyBindDelayElapsed() {
|
function hasKeyBindDelayElapsed() {
|
||||||
if(sdl.ticks-lastKeyBindUse >= keyBindDelayTime) {
|
if(sdl.ticks-lastKeyBindUse >= keyBindDelayTime) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function canLocalPlayerUseKeyBinds() {
|
function canLocalPlayerUseKeyBinds() {
|
||||||
if(isAnyGUIActive()) {
|
if(isAnyGUIActive()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isSpawned) {
|
if(!isSpawned) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(itemActionDelayEnabled) {
|
if(itemActionDelayEnabled) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function clearKeyBinds() {
|
function clearKeyBinds() {
|
||||||
for(let i in keyBinds) {
|
for(let i in keyBinds) {
|
||||||
unbindKey(keyBinds[i]);
|
unbindKey(keyBinds[i]);
|
||||||
}
|
}
|
||||||
keyBinds = [];
|
keyBinds = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -42,266 +42,266 @@ function initLabelScript() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initLabelPropertyNameFont() {
|
function initLabelPropertyNameFont() {
|
||||||
return lucasFont.createDefaultFont(16.0, "Roboto", "Regular");
|
return lucasFont.createDefaultFont(16.0, "Roboto", "Regular");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initLabelPropertyLockedFont() {
|
function initLabelPropertyLockedFont() {
|
||||||
return lucasFont.createDefaultFont(12.0, "Roboto", "Light");
|
return lucasFont.createDefaultFont(12.0, "Roboto", "Light");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initLabelJobNameFont() {
|
function initLabelJobNameFont() {
|
||||||
return lucasFont.createDefaultFont(16.0, "Roboto", "Regular");
|
return lucasFont.createDefaultFont(16.0, "Roboto", "Regular");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initLabelJobHelpFont() {
|
function initLabelJobHelpFont() {
|
||||||
return lucasFont.createDefaultFont(10.0, "Roboto", "Light");
|
return lucasFont.createDefaultFont(10.0, "Roboto", "Light");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function renderPropertyEntranceLabel(name, position, locked, isBusiness, price, rentPrice, labelInfoType) {
|
function renderPropertyEntranceLabel(name, position, locked, isBusiness, price, rentPrice, labelInfoType) {
|
||||||
if(localPlayer == null) {
|
if(localPlayer == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(propertyLabelNameFont == null) {
|
if(propertyLabelNameFont == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(propertyLabelLockedFont == null) {
|
if(propertyLabelLockedFont == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let tempPosition = position;
|
let tempPosition = position;
|
||||||
tempPosition.z = tempPosition.z + propertyLabelHeight;
|
tempPosition.z = tempPosition.z + propertyLabelHeight;
|
||||||
let screenPosition = getScreenFromWorldPosition(tempPosition);
|
let screenPosition = getScreenFromWorldPosition(tempPosition);
|
||||||
|
|
||||||
if(screenPosition.x < 0 || screenPosition.x > game.width) {
|
if(screenPosition.x < 0 || screenPosition.x > game.width) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let text = "";
|
let text = "";
|
||||||
if(price > "0") {
|
if(price > "0") {
|
||||||
text = `For sale: $${price}`;
|
text = `For sale: $${price}`;
|
||||||
let size = propertyLabelLockedFont.measure(text, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
|
let size = propertyLabelLockedFont.measure(text, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
|
||||||
propertyLabelLockedFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, toColour(200, 200, 200, 255), false, true, false, true);
|
propertyLabelLockedFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, toColour(200, 200, 200, 255), false, true, false, true);
|
||||||
|
|
||||||
screenPosition.y -= propertyLabelPriceOffset;
|
screenPosition.y -= propertyLabelPriceOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
text = "";
|
text = "";
|
||||||
if(rentPrice != "0") {
|
if(rentPrice != "0") {
|
||||||
text = `For rent: $${rentPrice} every payday`;
|
text = `For rent: $${rentPrice} every payday`;
|
||||||
let size = propertyLabelLockedFont.measure(text, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
|
let size = propertyLabelLockedFont.measure(text, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
|
||||||
propertyLabelLockedFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, toColour(200, 200, 200, 255), false, true, false, true);
|
propertyLabelLockedFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, toColour(200, 200, 200, 255), false, true, false, true);
|
||||||
|
|
||||||
screenPosition.y -= propertyLabelPriceOffset;
|
screenPosition.y -= propertyLabelPriceOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(isBusiness) {
|
if(isBusiness) {
|
||||||
text = (locked) ? "CLOSED" : "OPEN";
|
text = (locked) ? "CLOSED" : "OPEN";
|
||||||
} else {
|
} else {
|
||||||
text = (locked) ? "LOCKED" : "UNLOCKED";
|
text = (locked) ? "LOCKED" : "UNLOCKED";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!locked && labelInfoType != VRR_PROPLABEL_INFO_NONE) {
|
if(!locked && labelInfoType != VRR_PROPLABEL_INFO_NONE) {
|
||||||
let infoText = "";
|
let infoText = "";
|
||||||
switch(labelInfoType) {
|
switch(labelInfoType) {
|
||||||
case VRR_PROPLABEL_INFO_ENTER:
|
case VRR_PROPLABEL_INFO_ENTER:
|
||||||
if(enterPropertyKey) {
|
if(enterPropertyKey) {
|
||||||
infoText = `Press ${toUpperCase(getKeyNameFromId(enterPropertyKey))} to enter`;
|
infoText = `Press ${toUpperCase(getKeyNameFromId(enterPropertyKey))} to enter`;
|
||||||
} else {
|
} else {
|
||||||
infoText = `Use /enter to enter`;
|
infoText = `Use /enter to enter`;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VRR_PROPLABEL_INFO_BUY:
|
case VRR_PROPLABEL_INFO_BUY:
|
||||||
infoText = `Use /buy to purchase items`;
|
infoText = `Use /buy to purchase items`;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VRR_PROPLABEL_INFO_BUYBIZ:
|
case VRR_PROPLABEL_INFO_BUYBIZ:
|
||||||
infoText = `Use /buy to purchase items`;
|
infoText = `Use /buy to purchase items`;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//case VRR_PROPLABEL_INFO_RENTBIZ:
|
//case VRR_PROPLABEL_INFO_RENTBIZ:
|
||||||
// infoText = `Use /bizrent to buy this business`;
|
// infoText = `Use /bizrent to buy this business`;
|
||||||
// break;
|
// break;
|
||||||
|
|
||||||
case VRR_PROPLABEL_INFO_BUYHOUSE:
|
case VRR_PROPLABEL_INFO_BUYHOUSE:
|
||||||
infoText = `Use /housebuy to buy this house`;
|
infoText = `Use /housebuy to buy this house`;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VRR_PROPLABEL_INFO_RENTHOUSE:
|
case VRR_PROPLABEL_INFO_RENTHOUSE:
|
||||||
infoText = `Use /houserent to rent this house`;
|
infoText = `Use /houserent to rent this house`;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VRR_PROPLABEL_INFO_ENTERVEH:
|
case VRR_PROPLABEL_INFO_ENTERVEH:
|
||||||
infoText = "Enter a vehicle in the parking lot to buy it";
|
infoText = "Enter a vehicle in the parking lot to buy it";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VRR_PROPLABEL_INFO_NONE:
|
case VRR_PROPLABEL_INFO_NONE:
|
||||||
default:
|
default:
|
||||||
infoText = "";
|
infoText = "";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(getDistance(localPlayer.position, position) <= renderLabelDistance-2) {
|
if(getDistance(localPlayer.position, position) <= renderLabelDistance-2) {
|
||||||
let size = propertyLabelLockedFont.measure(infoText, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
|
let size = propertyLabelLockedFont.measure(infoText, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
|
||||||
propertyLabelLockedFont.render(infoText, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, toColour(234, 198, 126, 255), false, true, false, true);
|
propertyLabelLockedFont.render(infoText, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, toColour(234, 198, 126, 255), false, true, false, true);
|
||||||
screenPosition.y -= propertyLabelLockedOffset;
|
screenPosition.y -= propertyLabelLockedOffset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let size = propertyLabelLockedFont.measure(text, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
|
let size = propertyLabelLockedFont.measure(text, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
|
||||||
propertyLabelLockedFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, (locked) ? lockedColour : unlockedColour, false, true, false, true);
|
propertyLabelLockedFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, (locked) ? lockedColour : unlockedColour, false, true, false, true);
|
||||||
|
|
||||||
screenPosition.y -= propertyLabelNameOffset;
|
screenPosition.y -= propertyLabelNameOffset;
|
||||||
|
|
||||||
text = name || " ";
|
text = name || " ";
|
||||||
size = propertyLabelNameFont.measure(text, game.width, 0.0, 0.0, propertyLabelNameFont.size, true, true);
|
size = propertyLabelNameFont.measure(text, game.width, 0.0, 0.0, propertyLabelNameFont.size, true, true);
|
||||||
propertyLabelNameFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelNameFont.size, (isBusiness) ? toColour(0, 153, 255, 255) : toColour(17, 204, 17, 255), false, true, false, true);
|
propertyLabelNameFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelNameFont.size, (isBusiness) ? toColour(0, 153, 255, 255) : toColour(17, 204, 17, 255), false, true, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
function renderPropertyExitLabel(position) {
|
function renderPropertyExitLabel(position) {
|
||||||
if(localPlayer == null) {
|
if(localPlayer == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(propertyLabelNameFont == null) {
|
if(propertyLabelNameFont == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(propertyLabelLockedFont == null) {
|
if(propertyLabelLockedFont == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let tempPosition = position;
|
let tempPosition = position;
|
||||||
tempPosition.z = tempPosition.z + propertyLabelHeight;
|
tempPosition.z = tempPosition.z + propertyLabelHeight;
|
||||||
let screenPosition = getScreenFromWorldPosition(tempPosition);
|
let screenPosition = getScreenFromWorldPosition(tempPosition);
|
||||||
|
|
||||||
if(screenPosition.x < 0 || screenPosition.x > game.width) {
|
if(screenPosition.x < 0 || screenPosition.x > game.width) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let text = "EXIT";
|
let text = "EXIT";
|
||||||
let size = propertyLabelNameFont.measure(text, game.width, 0.0, 0.0, propertyLabelNameFont.size, true, true);
|
let size = propertyLabelNameFont.measure(text, game.width, 0.0, 0.0, propertyLabelNameFont.size, true, true);
|
||||||
propertyLabelNameFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelNameFont.size, COLOUR_WHITE, false, true, false, true);
|
propertyLabelNameFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelNameFont.size, COLOUR_WHITE, false, true, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
function renderJobLabel(name, position, jobType) {
|
function renderJobLabel(name, position, jobType) {
|
||||||
if(localPlayer == null) {
|
if(localPlayer == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(jobNameLabelFont == null) {
|
if(jobNameLabelFont == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(jobHelpLabelFont == null) {
|
if(jobHelpLabelFont == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let tempPosition = position;
|
let tempPosition = position;
|
||||||
tempPosition.z = tempPosition.z + propertyLabelHeight;
|
tempPosition.z = tempPosition.z + propertyLabelHeight;
|
||||||
let screenPosition = getScreenFromWorldPosition(tempPosition);
|
let screenPosition = getScreenFromWorldPosition(tempPosition);
|
||||||
|
|
||||||
if(screenPosition.x < 0 || screenPosition.x > game.width) {
|
if(screenPosition.x < 0 || screenPosition.x > game.width) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let text = "";
|
let text = "";
|
||||||
if(jobType == localPlayerJobType) {
|
if(jobType == localPlayerJobType) {
|
||||||
if(localPlayerWorking) {
|
if(localPlayerWorking) {
|
||||||
text = "Use /uniform and /equip for job stuff, or /stopwork to go off duty";
|
text = "Use /uniform and /equip for job stuff, or /stopwork to go off duty";
|
||||||
} else {
|
} else {
|
||||||
text = "Use /startwork to go on duty";
|
text = "Use /startwork to go on duty";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(localPlayerJobType == 0) {
|
if(localPlayerJobType == 0) {
|
||||||
text = "Use /takejob to work here";
|
text = "Use /takejob to work here";
|
||||||
} else {
|
} else {
|
||||||
text = "You already have a job. Use /quitjob if you want this one";
|
text = "You already have a job. Use /quitjob if you want this one";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let size = jobHelpLabelFont.measure(text, game.width, 0.0, 0.0, jobHelpLabelFont.size, true, true);
|
let size = jobHelpLabelFont.measure(text, game.width, 0.0, 0.0, jobHelpLabelFont.size, true, true);
|
||||||
jobHelpLabelFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, jobHelpLabelFont.size, COLOUR_YELLOW, false, true, false, true);
|
jobHelpLabelFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, jobHelpLabelFont.size, COLOUR_YELLOW, false, true, false, true);
|
||||||
|
|
||||||
screenPosition.y -= 18;
|
screenPosition.y -= 18;
|
||||||
|
|
||||||
text = name + " Job";
|
text = name + " Job";
|
||||||
size = jobNameLabelFont.measure(text, game.width, 0.0, 0.0, jobNameLabelFont.size, true, true);
|
size = jobNameLabelFont.measure(text, game.width, 0.0, 0.0, jobNameLabelFont.size, true, true);
|
||||||
jobNameLabelFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, jobNameLabelFont.size, COLOUR_WHITE, false, true, false, true);
|
jobNameLabelFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, jobNameLabelFont.size, COLOUR_WHITE, false, true, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
function processLabelRendering() {
|
function processLabelRendering() {
|
||||||
if(renderLabels && areWorldLabelsSupported()) {
|
if(renderLabels && areWorldLabelsSupported()) {
|
||||||
if(localPlayer != null) {
|
if(localPlayer != null) {
|
||||||
if(!areServerElementsSupported()) {
|
if(!areServerElementsSupported()) {
|
||||||
//for(let i in businesses) {
|
//for(let i in businesses) {
|
||||||
// if(pickups[i].getData("vrr.label.type") != null) {
|
// if(pickups[i].getData("vrr.label.type") != null) {
|
||||||
// if(getDistance(localPlayer.position, pickups[i].position) <= renderLabelDistance) {
|
// if(getDistance(localPlayer.position, pickups[i].position) <= renderLabelDistance) {
|
||||||
|
|
||||||
// natives.getScreenViewportId
|
// natives.getScreenViewportId
|
||||||
// natives.getGameViewportId
|
// natives.getGameViewportId
|
||||||
// natives.getViewportPositionOfCoord
|
// natives.getViewportPositionOfCoord
|
||||||
} else {
|
} else {
|
||||||
let pickups = getElementsByType(ELEMENT_PICKUP);
|
let pickups = getElementsByType(ELEMENT_PICKUP);
|
||||||
for(let i in pickups) {
|
for(let i in pickups) {
|
||||||
if(pickups[i].getData("vrr.label.type") != null) {
|
if(pickups[i].getData("vrr.label.type") != null) {
|
||||||
if(getDistance(localPlayer.position, pickups[i].position) <= renderLabelDistance) {
|
if(getDistance(localPlayer.position, pickups[i].position) <= renderLabelDistance) {
|
||||||
if(!pickups[i].isOnScreen) {
|
if(!pickups[i].isOnScreen) {
|
||||||
let price = "0";
|
let price = "0";
|
||||||
let rentPrice = "0";
|
let rentPrice = "0";
|
||||||
let labelInfoType = VRR_PROPLABEL_INFO_NONE;
|
let labelInfoType = VRR_PROPLABEL_INFO_NONE;
|
||||||
if(pickups[i].getData("vrr.label.price") != null) {
|
if(pickups[i].getData("vrr.label.price") != null) {
|
||||||
price = makeLargeNumberReadable(pickups[i].getData("vrr.label.price"));
|
price = makeLargeNumberReadable(pickups[i].getData("vrr.label.price"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pickups[i].getData("vrr.label.rentprice") != null) {
|
if(pickups[i].getData("vrr.label.rentprice") != null) {
|
||||||
rentPrice = makeLargeNumberReadable(pickups[i].getData("vrr.label.rentprice"));
|
rentPrice = makeLargeNumberReadable(pickups[i].getData("vrr.label.rentprice"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pickups[i].getData("vrr.label.help") != null) {
|
if(pickups[i].getData("vrr.label.help") != null) {
|
||||||
labelInfoType = pickups[i].getData("vrr.label.help");
|
labelInfoType = pickups[i].getData("vrr.label.help");
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(pickups[i].getData("vrr.label.type")) {
|
switch(pickups[i].getData("vrr.label.type")) {
|
||||||
case VRR_LABEL_BUSINESS:
|
case VRR_LABEL_BUSINESS:
|
||||||
renderPropertyEntranceLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.locked"), true, price, rentPrice, labelInfoType);
|
renderPropertyEntranceLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.locked"), true, price, rentPrice, labelInfoType);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VRR_LABEL_HOUSE:
|
case VRR_LABEL_HOUSE:
|
||||||
renderPropertyEntranceLabel("House", pickups[i].position, pickups[i].getData("vrr.label.locked"), false, price, rentPrice, labelInfoType);
|
renderPropertyEntranceLabel("House", pickups[i].position, pickups[i].getData("vrr.label.locked"), false, price, rentPrice, labelInfoType);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VRR_LABEL_JOB:
|
case VRR_LABEL_JOB:
|
||||||
renderJobLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.jobType"));
|
renderJobLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.jobType"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VRR_LABEL_EXIT:
|
case VRR_LABEL_EXIT:
|
||||||
renderPropertyExitLabel(pickups[i].position);
|
renderPropertyExitLabel(pickups[i].position);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
@@ -15,38 +15,38 @@ let logoSize = toVector2(128, 128);
|
|||||||
|
|
||||||
function initLogoScript() {
|
function initLogoScript() {
|
||||||
logToConsole(LOG_DEBUG, "[VRR.Logo]: Initializing logo script ...");
|
logToConsole(LOG_DEBUG, "[VRR.Logo]: Initializing logo script ...");
|
||||||
//logoImage = loadLogoImage();
|
//logoImage = loadLogoImage();
|
||||||
logToConsole(LOG_DEBUG, "[VRR.Logo]: Logo script initialized!");
|
logToConsole(LOG_DEBUG, "[VRR.Logo]: Logo script initialized!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadLogoImage() {
|
function loadLogoImage() {
|
||||||
let logoStream = openFile(mainLogoPath);
|
let logoStream = openFile(mainLogoPath);
|
||||||
let tempLogoImage = null;
|
let tempLogoImage = null;
|
||||||
if(logoStream != null) {
|
if(logoStream != null) {
|
||||||
tempLogoImage = graphics.loadPNG(logoStream);
|
tempLogoImage = graphics.loadPNG(logoStream);
|
||||||
logoStream.close();
|
logoStream.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
return tempLogoImage;
|
return tempLogoImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function processLogoRendering() {
|
function processLogoRendering() {
|
||||||
if(renderLogo) {
|
if(renderLogo) {
|
||||||
if(logoImage != null) {
|
if(logoImage != null) {
|
||||||
graphics.drawRectangle(logoImage, logoPos, logoSize);
|
graphics.drawRectangle(logoImage, logoPos, logoSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setServerLogoRenderState(state) {
|
function setServerLogoRenderState(state) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Main] Server logo ${(state) ? "enabled" : "disabled"}`);
|
logToConsole(LOG_DEBUG, `[VRR.Main] Server logo ${(state) ? "enabled" : "disabled"}`);
|
||||||
renderLogo = state;
|
renderLogo = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -16,64 +16,64 @@ let smallGameMessageTimer = null;
|
|||||||
|
|
||||||
function initMessagingScript() {
|
function initMessagingScript() {
|
||||||
logToConsole(LOG_DEBUG, "[VRR.Messaging]: Initializing messaging script ...");
|
logToConsole(LOG_DEBUG, "[VRR.Messaging]: Initializing messaging script ...");
|
||||||
smallGameMessageFont = loadSmallGameMessageFont();
|
smallGameMessageFont = loadSmallGameMessageFont();
|
||||||
logToConsole(LOG_DEBUG, "[VRR.Messaging]: Messaging script initialized!");
|
logToConsole(LOG_DEBUG, "[VRR.Messaging]: Messaging script initialized!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadSmallGameMessageFont() {
|
function loadSmallGameMessageFont() {
|
||||||
let tempSmallGameMessageFont = null;
|
let tempSmallGameMessageFont = null;
|
||||||
let fontStream = openFile("files/fonts/pricedown.ttf");
|
let fontStream = openFile("files/fonts/pricedown.ttf");
|
||||||
if(fontStream != null) {
|
if(fontStream != null) {
|
||||||
tempSmallGameMessageFont = lucasFont.createFont(fontStream, 20.0);
|
tempSmallGameMessageFont = lucasFont.createFont(fontStream, 20.0);
|
||||||
fontStream.close();
|
fontStream.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
return tempSmallGameMessageFont;
|
return tempSmallGameMessageFont;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadBigGameMessageFont() {
|
function loadBigGameMessageFont() {
|
||||||
let tempBigGameMessageFont = null;
|
let tempBigGameMessageFont = null;
|
||||||
let fontStream = openFile("files/fonts/pricedown.ttf");
|
let fontStream = openFile("files/fonts/pricedown.ttf");
|
||||||
if(fontStream != null) {
|
if(fontStream != null) {
|
||||||
tempBigGameMessageFont = lucasFont.createFont(fontStream, 28.0);
|
tempBigGameMessageFont = lucasFont.createFont(fontStream, 28.0);
|
||||||
fontStream.close();
|
fontStream.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
return tempBigGameMessageFont;
|
return tempBigGameMessageFont;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function processSmallGameMessageRendering() {
|
function processSmallGameMessageRendering() {
|
||||||
if(renderSmallGameMessage) {
|
if(renderSmallGameMessage) {
|
||||||
if(smallGameMessageFont != null) {
|
if(smallGameMessageFont != null) {
|
||||||
if(smallGameMessageFont != "") {
|
if(smallGameMessageFont != "") {
|
||||||
smallGameMessageFont.render(smallGameMessageText, [0, game.height-90], game.width, 0.5, 0.0, smallGameMessageFont.size, smallGameMessageColour, true, true, false, true);
|
smallGameMessageFont.render(smallGameMessageText, [0, game.height-90], game.width, 0.5, 0.0, smallGameMessageFont.size, smallGameMessageColour, true, true, false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showSmallGameMessage(text, colour, duration) {
|
function showSmallGameMessage(text, colour, duration) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Messaging] Showing small game message '${text}' for ${duration}ms`);
|
logToConsole(LOG_DEBUG, `[VRR.Messaging] Showing small game message '${text}' for ${duration}ms`);
|
||||||
if(smallGameMessageText != "") {
|
if(smallGameMessageText != "") {
|
||||||
clearTimeout(smallGameMessageTimer);
|
clearTimeout(smallGameMessageTimer);
|
||||||
}
|
}
|
||||||
|
|
||||||
smallGameMessageColour = colour;
|
smallGameMessageColour = colour;
|
||||||
smallGameMessageText = text;
|
smallGameMessageText = text;
|
||||||
|
|
||||||
smallGameMessageTimer = setTimeout(function() {
|
smallGameMessageTimer = setTimeout(function() {
|
||||||
smallGameMessageText = "";
|
smallGameMessageText = "";
|
||||||
smallGameMessageColour = COLOUR_WHITE;
|
smallGameMessageColour = COLOUR_WHITE;
|
||||||
smallGameMessageTimer = null;
|
smallGameMessageTimer = null;
|
||||||
}, duration);
|
}, duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -8,39 +8,39 @@
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function playStreamingRadio(url, loop, volume, element = false) {
|
function playStreamingRadio(url, loop, volume, element = false) {
|
||||||
if(streamingRadio != null) {
|
if(streamingRadio != null) {
|
||||||
streamingRadio.stop();
|
streamingRadio.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
streamingRadioVolume = volume;
|
streamingRadioVolume = volume;
|
||||||
|
|
||||||
streamingRadio = audio.createSoundFromURL(url, loop);
|
streamingRadio = audio.createSoundFromURL(url, loop);
|
||||||
streamingRadio.volume = volume/100;
|
streamingRadio.volume = volume/100;
|
||||||
streamingRadio.play();
|
streamingRadio.play();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function stopStreamingRadio() {
|
function stopStreamingRadio() {
|
||||||
if(streamingRadio != null) {
|
if(streamingRadio != null) {
|
||||||
streamingRadio.stop();
|
streamingRadio.stop();
|
||||||
}
|
}
|
||||||
streamingRadio = null;
|
streamingRadio = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setStreamingRadioVolume(volume) {
|
function setStreamingRadioVolume(volume) {
|
||||||
if(streamingRadio != null) {
|
if(streamingRadio != null) {
|
||||||
streamingRadioVolume = volume;
|
streamingRadioVolume = volume;
|
||||||
streamingRadio.volume = volume/100;
|
streamingRadio.volume = volume/100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function playAudioFile(audioName, loop, volume) {
|
function playAudioFile(audioName, loop, volume) {
|
||||||
playCustomAudio(audioName, volume/100, loop);
|
playCustomAudio(audioName, volume/100, loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -8,193 +8,193 @@
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initServerScript() {
|
function initServerScript() {
|
||||||
logToConsole(LOG_DEBUG, "[VRR.Server]: Initializing server script ...");
|
logToConsole(LOG_DEBUG, "[VRR.Server]: Initializing server script ...");
|
||||||
addAllNetworkHandlers();
|
addAllNetworkHandlers();
|
||||||
logToConsole(LOG_DEBUG, "[VRR.Server]: Server script initialized!");
|
logToConsole(LOG_DEBUG, "[VRR.Server]: Server script initialized!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function addAllNetworkHandlers() {
|
function addAllNetworkHandlers() {
|
||||||
logToConsole(LOG_DEBUG, "[VRR.Server]: Adding network handlers ...");
|
logToConsole(LOG_DEBUG, "[VRR.Server]: Adding network handlers ...");
|
||||||
|
|
||||||
addNetworkEventHandler("vrr.smallGameMessage", showSmallGameMessage);
|
addNetworkEventHandler("vrr.smallGameMessage", showSmallGameMessage);
|
||||||
addNetworkEventHandler("vrr.working", setLocalPlayerWorkingState);
|
addNetworkEventHandler("vrr.working", setLocalPlayerWorkingState);
|
||||||
addNetworkEventHandler("vrr.jobType", setLocalPlayerJobType);
|
addNetworkEventHandler("vrr.jobType", setLocalPlayerJobType);
|
||||||
addNetworkEventHandler("vrr.passenger", enterVehicleAsPassenger);
|
addNetworkEventHandler("vrr.passenger", enterVehicleAsPassenger);
|
||||||
|
|
||||||
addNetworkEventHandler("vrr.freeze", setLocalPlayerFrozenState);
|
addNetworkEventHandler("vrr.freeze", setLocalPlayerFrozenState);
|
||||||
addNetworkEventHandler("vrr.control", setLocalPlayerControlState);
|
addNetworkEventHandler("vrr.control", setLocalPlayerControlState);
|
||||||
addNetworkEventHandler("vrr.fadeCamera", fadeLocalCamera);
|
addNetworkEventHandler("vrr.fadeCamera", fadeLocalCamera);
|
||||||
addNetworkEventHandler("vrr.removeFromVehicle", removeLocalPlayerFromVehicle);
|
addNetworkEventHandler("vrr.removeFromVehicle", removeLocalPlayerFromVehicle);
|
||||||
addNetworkEventHandler("vrr.clearPeds", clearLocalPlayerOwnedPeds);
|
addNetworkEventHandler("vrr.clearPeds", clearLocalPlayerOwnedPeds);
|
||||||
addNetworkEventHandler("vrr.restoreCamera", restoreLocalCamera);
|
addNetworkEventHandler("vrr.restoreCamera", restoreLocalCamera);
|
||||||
addNetworkEventHandler("vrr.cameraLookAt", setLocalCameraLookAt);
|
addNetworkEventHandler("vrr.cameraLookAt", setLocalCameraLookAt);
|
||||||
addNetworkEventHandler("vrr.logo", setServerLogoRenderState);
|
addNetworkEventHandler("vrr.logo", setServerLogoRenderState);
|
||||||
addNetworkEventHandler("vrr.ambience", setCityAmbienceState);
|
addNetworkEventHandler("vrr.ambience", setCityAmbienceState);
|
||||||
addNetworkEventHandler("vrr.runCode", runClientCode);
|
addNetworkEventHandler("vrr.runCode", runClientCode);
|
||||||
addNetworkEventHandler("vrr.clearWeapons", clearLocalPlayerWeapons);
|
addNetworkEventHandler("vrr.clearWeapons", clearLocalPlayerWeapons);
|
||||||
addNetworkEventHandler("vrr.giveWeapon", giveLocalPlayerWeapon);
|
addNetworkEventHandler("vrr.giveWeapon", giveLocalPlayerWeapon);
|
||||||
addNetworkEventHandler("vrr.position", setLocalPlayerPosition);
|
addNetworkEventHandler("vrr.position", setLocalPlayerPosition);
|
||||||
addNetworkEventHandler("vrr.heading", setLocalPlayerHeading);
|
addNetworkEventHandler("vrr.heading", setLocalPlayerHeading);
|
||||||
addNetworkEventHandler("vrr.interior", setLocalPlayerInterior);
|
addNetworkEventHandler("vrr.interior", setLocalPlayerInterior);
|
||||||
addNetworkEventHandler("vrr.minuteDuration", setMinuteDuration);
|
addNetworkEventHandler("vrr.minuteDuration", setMinuteDuration);
|
||||||
addNetworkEventHandler("vrr.showJobRouteLocation", showJobRouteLocation);
|
addNetworkEventHandler("vrr.showJobRouteLocation", showJobRouteLocation);
|
||||||
addNetworkEventHandler("vrr.hideJobRouteLocation", hideJobRouteLocation);
|
addNetworkEventHandler("vrr.hideJobRouteLocation", hideJobRouteLocation);
|
||||||
addNetworkEventHandler("vrr.snow", setSnowState);
|
addNetworkEventHandler("vrr.snow", setSnowState);
|
||||||
addNetworkEventHandler("vrr.health", setLocalPlayerHealth);
|
addNetworkEventHandler("vrr.health", setLocalPlayerHealth);
|
||||||
addNetworkEventHandler("vrr.enterPropertyKey", setEnterPropertyKey);
|
addNetworkEventHandler("vrr.enterPropertyKey", setEnterPropertyKey);
|
||||||
addNetworkEventHandler("vrr.skinSelect", toggleSkinSelect);
|
addNetworkEventHandler("vrr.skinSelect", toggleSkinSelect);
|
||||||
addNetworkEventHandler("vrr.hotbar", updatePlayerHotBar);
|
addNetworkEventHandler("vrr.hotbar", updatePlayerHotBar);
|
||||||
addNetworkEventHandler("vrr.pedSpeech", playPedSpeech);
|
addNetworkEventHandler("vrr.pedSpeech", playPedSpeech);
|
||||||
addNetworkEventHandler("vrr.clearPedState", clearLocalPedState);
|
addNetworkEventHandler("vrr.clearPedState", clearLocalPedState);
|
||||||
addNetworkEventHandler("vrr.drunkEffect", setLocalPlayerDrunkEffect);
|
addNetworkEventHandler("vrr.drunkEffect", setLocalPlayerDrunkEffect);
|
||||||
addNetworkEventHandler("vrr.showItemActionDelay", showItemActionDelay);
|
addNetworkEventHandler("vrr.showItemActionDelay", showItemActionDelay);
|
||||||
addNetworkEventHandler("vrr.set2DRendering", setPlayer2DRendering);
|
addNetworkEventHandler("vrr.set2DRendering", setPlayer2DRendering);
|
||||||
addNetworkEventHandler("vrr.mouseCursor", toggleMouseCursor);
|
addNetworkEventHandler("vrr.mouseCursor", toggleMouseCursor);
|
||||||
addNetworkEventHandler("vrr.mouseCamera", toggleMouseCamera);
|
addNetworkEventHandler("vrr.mouseCamera", toggleMouseCamera);
|
||||||
addNetworkEventHandler("vrr.mouseCameraForce", setMouseCameraState);
|
addNetworkEventHandler("vrr.mouseCameraForce", setMouseCameraState);
|
||||||
addNetworkEventHandler("vrr.weaponDamageEnabled", setPlayerWeaponDamageEnabled);
|
addNetworkEventHandler("vrr.weaponDamageEnabled", setPlayerWeaponDamageEnabled);
|
||||||
addNetworkEventHandler("vrr.weaponDamageEvent", setPlayerWeaponDamageEvent);
|
addNetworkEventHandler("vrr.weaponDamageEvent", setPlayerWeaponDamageEvent);
|
||||||
addNetworkEventHandler("vrr.spawned", onServerSpawnedPlayer);
|
addNetworkEventHandler("vrr.spawned", onServerSpawnedPlayer);
|
||||||
addNetworkEventHandler("vrr.money", setLocalPlayerCash);
|
addNetworkEventHandler("vrr.money", setLocalPlayerCash);
|
||||||
addNetworkEventHandler("vrr.armour", setLocalPlayerArmour);
|
addNetworkEventHandler("vrr.armour", setLocalPlayerArmour);
|
||||||
addNetworkEventHandler("vrr.wantedLevel", forceLocalPlayerWantedLevel);
|
addNetworkEventHandler("vrr.wantedLevel", forceLocalPlayerWantedLevel);
|
||||||
|
|
||||||
addNetworkEventHandler("vrr.delKeyBind", unBindAccountKey);
|
addNetworkEventHandler("vrr.delKeyBind", unBindAccountKey);
|
||||||
addNetworkEventHandler("vrr.addKeyBind", bindAccountKey);
|
addNetworkEventHandler("vrr.addKeyBind", bindAccountKey);
|
||||||
addNetworkEventHandler("vrr.clearKeyBinds", clearKeyBinds);
|
addNetworkEventHandler("vrr.clearKeyBinds", clearKeyBinds);
|
||||||
|
|
||||||
addNetworkEventHandler("vrr.nametag", updatePlayerNameTag);
|
addNetworkEventHandler("vrr.nametag", updatePlayerNameTag);
|
||||||
addNetworkEventHandler("vrr.ping", updatePlayerPing);
|
addNetworkEventHandler("vrr.ping", updatePlayerPing);
|
||||||
|
|
||||||
addNetworkEventHandler("vrr.m", receiveChatBoxMessageFromServer);
|
addNetworkEventHandler("vrr.m", receiveChatBoxMessageFromServer);
|
||||||
addNetworkEventHandler("vrr.chatScrollLines", setChatScrollLines);
|
addNetworkEventHandler("vrr.chatScrollLines", setChatScrollLines);
|
||||||
|
|
||||||
addNetworkEventHandler("vrr.radioStream", playStreamingRadio);
|
addNetworkEventHandler("vrr.radioStream", playStreamingRadio);
|
||||||
addNetworkEventHandler("vrr.audioFileStream", playAudioFile);
|
addNetworkEventHandler("vrr.audioFileStream", playAudioFile);
|
||||||
addNetworkEventHandler("vrr.stopRadioStream", stopStreamingRadio);
|
addNetworkEventHandler("vrr.stopRadioStream", stopStreamingRadio);
|
||||||
addNetworkEventHandler("vrr.radioVolume", setStreamingRadioVolume);
|
addNetworkEventHandler("vrr.radioVolume", setStreamingRadioVolume);
|
||||||
|
|
||||||
addNetworkEventHandler("vrr.veh.lights", setVehicleLights);
|
addNetworkEventHandler("vrr.veh.lights", setVehicleLights);
|
||||||
addNetworkEventHandler("vrr.veh.engine", setVehicleEngine);
|
addNetworkEventHandler("vrr.veh.engine", setVehicleEngine);
|
||||||
addNetworkEventHandler("vrr.veh.repair", repairVehicle);
|
addNetworkEventHandler("vrr.veh.repair", repairVehicle);
|
||||||
|
|
||||||
addNetworkEventHandler("vrr.pedAnim", makePedPlayAnimation);
|
addNetworkEventHandler("vrr.pedAnim", makePedPlayAnimation);
|
||||||
addNetworkEventHandler("vrr.pedStopAnim", makePedStopAnimation);
|
addNetworkEventHandler("vrr.pedStopAnim", makePedStopAnimation);
|
||||||
addNetworkEventHandler("vrr.localPlayerSkin", setLocalPlayerSkin);
|
addNetworkEventHandler("vrr.localPlayerSkin", setLocalPlayerSkin);
|
||||||
addNetworkEventHandler("vrr.forcePedAnim", forcePedAnimation);
|
addNetworkEventHandler("vrr.forcePedAnim", forcePedAnimation);
|
||||||
addNetworkEventHandler("vrr.hideAllGUI", hideAllGUI);
|
addNetworkEventHandler("vrr.hideAllGUI", hideAllGUI);
|
||||||
addNetworkEventHandler("vrr.clientInfo", serverRequestedClientInfo);
|
addNetworkEventHandler("vrr.clientInfo", serverRequestedClientInfo);
|
||||||
addNetworkEventHandler("vrr.interiorLights", updateInteriorLightsState);
|
addNetworkEventHandler("vrr.interiorLights", updateInteriorLightsState);
|
||||||
|
|
||||||
addNetworkEventHandler("vrr.syncElement", forceSyncElementProperties);
|
addNetworkEventHandler("vrr.syncElement", forceSyncElementProperties);
|
||||||
addNetworkEventHandler("vrr.elementPosition", setElementPosition);
|
addNetworkEventHandler("vrr.elementPosition", setElementPosition);
|
||||||
addNetworkEventHandler("vrr.elementCollisions", setElementCollisionsEnabled);
|
addNetworkEventHandler("vrr.elementCollisions", setElementCollisionsEnabled);
|
||||||
|
|
||||||
addNetworkEventHandler("vrr.vehBuyState", setVehiclePurchaseState);
|
addNetworkEventHandler("vrr.vehBuyState", setVehiclePurchaseState);
|
||||||
|
|
||||||
addNetworkEventHandler("vrr.showRegistration", showRegistrationGUI);
|
addNetworkEventHandler("vrr.showRegistration", showRegistrationGUI);
|
||||||
addNetworkEventHandler("vrr.showNewCharacter", showNewCharacterGUI);
|
addNetworkEventHandler("vrr.showNewCharacter", showNewCharacterGUI);
|
||||||
addNetworkEventHandler("vrr.showLogin", showLoginGUI);
|
addNetworkEventHandler("vrr.showLogin", showLoginGUI);
|
||||||
|
|
||||||
addNetworkEventHandler("vrr.logLevel", setLogLevel);
|
addNetworkEventHandler("vrr.logLevel", setLogLevel);
|
||||||
addNetworkEventHandler("vrr.infiniteRun", setLocalPlayerInfiniteRun);
|
addNetworkEventHandler("vrr.infiniteRun", setLocalPlayerInfiniteRun);
|
||||||
|
|
||||||
addNetworkEventHandler("vrr.business", receiveBusinessFromServer);
|
addNetworkEventHandler("vrr.business", receiveBusinessFromServer);
|
||||||
addNetworkEventHandler("vrr.house", receiveHouseFromServer);
|
addNetworkEventHandler("vrr.house", receiveHouseFromServer);
|
||||||
|
|
||||||
addNetworkEventHandler("vrr.holdObject", makePedHoldObject);
|
addNetworkEventHandler("vrr.holdObject", makePedHoldObject);
|
||||||
|
|
||||||
addNetworkEventHandler("vrr.playerPedId", sendLocalPlayerNetworkIdToServer);
|
addNetworkEventHandler("vrr.playerPedId", sendLocalPlayerNetworkIdToServer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendResourceReadySignalToServer() {
|
function sendResourceReadySignalToServer() {
|
||||||
sendNetworkEventToServer("vrr.clientReady");
|
sendNetworkEventToServer("vrr.clientReady");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendResourceStartedSignalToServer() {
|
function sendResourceStartedSignalToServer() {
|
||||||
sendNetworkEventToServer("vrr.clientStarted");
|
sendNetworkEventToServer("vrr.clientStarted");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendResourceStoppedSignalToServer() {
|
function sendResourceStoppedSignalToServer() {
|
||||||
if(isConnected) {
|
if(isConnected) {
|
||||||
sendNetworkEventToServer("vrr.clientStopped");
|
sendNetworkEventToServer("vrr.clientStopped");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setPlayer2DRendering(hudState, labelState, smallGameMessageState, scoreboardState, hotBarState, itemActionDelayState) {
|
function setPlayer2DRendering(hudState, labelState, smallGameMessageState, scoreboardState, hotBarState, itemActionDelayState) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Main] Updating render states (HUD: ${hudState}, Labels: ${labelState}, Bottom Text: ${smallGameMessageState}, Scoreboard: ${scoreboardState}, HotBar: ${hotBarState}, Item Action Delay: ${itemActionDelayState})`);
|
logToConsole(LOG_DEBUG, `[VRR.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() == VRR_GAME_GTA_IV) {
|
if(getGame() == VRR_GAME_GTA_IV) {
|
||||||
natives.displayCash(hudState);
|
natives.displayCash(hudState);
|
||||||
natives.displayAmmo(hudState);
|
natives.displayAmmo(hudState);
|
||||||
natives.displayHud(hudState);
|
natives.displayHud(hudState);
|
||||||
} else {
|
} else {
|
||||||
if(typeof setHUDEnabled != "undefined") {
|
if(typeof setHUDEnabled != "undefined") {
|
||||||
setHUDEnabled(hudState);
|
setHUDEnabled(hudState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
renderLabels = labelState;
|
renderLabels = labelState;
|
||||||
renderSmallGameMessage = smallGameMessageState;
|
renderSmallGameMessage = smallGameMessageState;
|
||||||
renderScoreBoard = scoreboardState;
|
renderScoreBoard = scoreboardState;
|
||||||
renderHotBar = hotBarState;
|
renderHotBar = hotBarState;
|
||||||
renderItemActionDelay = itemActionDelayState;
|
renderItemActionDelay = itemActionDelayState;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onServerSpawnedPlayer(state) {
|
function onServerSpawnedPlayer(state) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Main] Setting spawned state to ${state}`);
|
logToConsole(LOG_DEBUG, `[VRR.Main] Setting spawned state to ${state}`);
|
||||||
isSpawned = state;
|
isSpawned = state;
|
||||||
if(state) {
|
if(state) {
|
||||||
setUpInitialGame();
|
setUpInitialGame();
|
||||||
calledDeathEvent = false;
|
calledDeathEvent = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function tellServerPlayerUsedKeyBind(key) {
|
function tellServerPlayerUsedKeyBind(key) {
|
||||||
sendNetworkEventToServer("vrr.useKeyBind", key);
|
sendNetworkEventToServer("vrr.useKeyBind", key);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function tellServerPlayerArrivedAtJobRouteLocation() {
|
function tellServerPlayerArrivedAtJobRouteLocation() {
|
||||||
sendNetworkEventToServer("vrr.arrivedAtJobRouteLocation");
|
sendNetworkEventToServer("vrr.arrivedAtJobRouteLocation");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function tellServerItemActionDelayComplete() {
|
function tellServerItemActionDelayComplete() {
|
||||||
sendNetworkEventToServer("vrr.itemActionDelayComplete");
|
sendNetworkEventToServer("vrr.itemActionDelayComplete");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendServerClientInfo() {
|
function sendServerClientInfo() {
|
||||||
let clientVersion = "0.0.0.0";
|
let clientVersion = "0.0.0.0";
|
||||||
if(typeof CLIENT_VERSION_MAJOR != "undefined") {
|
if(typeof CLIENT_VERSION_MAJOR != "undefined") {
|
||||||
clientVersion = `${CLIENT_VERSION_MAJOR}.${CLIENT_VERSION_MINOR}.${CLIENT_VERSION_PATCH}.${CLIENT_VERSION_BUILD}`;
|
clientVersion = `${CLIENT_VERSION_MAJOR}.${CLIENT_VERSION_MINOR}.${CLIENT_VERSION_PATCH}.${CLIENT_VERSION_BUILD}`;
|
||||||
}
|
}
|
||||||
sendNetworkEventToServer("vrr.clientInfo", clientVersion, game.width, game.height);
|
sendNetworkEventToServer("vrr.clientInfo", clientVersion, game.width, game.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendServerNewAFKStatus(state) {
|
function sendServerNewAFKStatus(state) {
|
||||||
sendNetworkEventToServer("vrr.afk", state);
|
sendNetworkEventToServer("vrr.afk", state);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -206,120 +206,120 @@ function anchorBoat(vehicleId) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setEnterPropertyKey(key) {
|
function setEnterPropertyKey(key) {
|
||||||
enterPropertyKey = key;
|
enterPropertyKey = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function serverRequestedClientInfo() {
|
function serverRequestedClientInfo() {
|
||||||
sendServerClientInfo();
|
sendServerClientInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function updateInteriorLightsState(state) {
|
function updateInteriorLightsState(state) {
|
||||||
interiorLightsEnabled = state;
|
interiorLightsEnabled = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function forceSyncElementProperties(elementId) {
|
function forceSyncElementProperties(elementId) {
|
||||||
if(getElementFromId(elementId) == null) {
|
if(getElementFromId(elementId) == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
syncElementProperties(getElementFromId(elementId));
|
syncElementProperties(getElementFromId(elementId));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setElementPosition(elementId, position) {
|
function setElementPosition(elementId, position) {
|
||||||
if(getElementFromId(elementId) == null) {
|
if(getElementFromId(elementId) == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!getElementFromId(elementId).isSyncer) {
|
if(!getElementFromId(elementId).isSyncer) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
getElementFromId(elementId).position = position;
|
getElementFromId(elementId).position = position;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setElementCollisionsEnabled(elementId, state) {
|
function setElementCollisionsEnabled(elementId, state) {
|
||||||
if(getElementFromId(elementId) == null) {
|
if(getElementFromId(elementId) == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
getElementFromId(elementId).collisionsEnabled = state;
|
getElementFromId(elementId).collisionsEnabled = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocalPlayerPedPartsAndProps(parts, props) {
|
function setLocalPlayerPedPartsAndProps(parts, props) {
|
||||||
for(let i in parts) {
|
for(let i in parts) {
|
||||||
localPlayer.changeBodyPart(parts[0], parts[1], parts[2]);
|
localPlayer.changeBodyPart(parts[0], parts[1], parts[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(let i in props) {
|
for(let i in props) {
|
||||||
localPlayer.changeBodyProp(props[0], props[1]);
|
localPlayer.changeBodyProp(props[0], props[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocalPlayerArmour(armour) {
|
function setLocalPlayerArmour(armour) {
|
||||||
if(typeof localPlayer.armour != "undefined") {
|
if(typeof localPlayer.armour != "undefined") {
|
||||||
localPlayer.armour = armour;
|
localPlayer.armour = armour;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function forceLocalPlayerWantedLevel(wantedLevel) {
|
function forceLocalPlayerWantedLevel(wantedLevel) {
|
||||||
forceWantedLevel = toInteger(wantedLevel);
|
forceWantedLevel = toInteger(wantedLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLogLevel(level) {
|
function setLogLevel(level) {
|
||||||
logLevel = level;
|
logLevel = level;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocalPlayerInfiniteRun(state) {
|
function setLocalPlayerInfiniteRun(state) {
|
||||||
if(localPlayer != null) {
|
if(localPlayer != null) {
|
||||||
if(getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
|
if(getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
|
||||||
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), boolToInt(state));
|
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), boolToInt(state));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocalPlayerSkin(skinId) {
|
function setLocalPlayerSkin(skinId) {
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if(getGame() == VRR_GAME_GTA_IV) {
|
||||||
//natives.changePlayerModel(natives.getPlayerId(), skinId);
|
//natives.changePlayerModel(natives.getPlayerId(), skinId);
|
||||||
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
|
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
|
||||||
} else {
|
} else {
|
||||||
localPlayer.skin = skinId;
|
localPlayer.skin = skinId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function makePedHoldObject(pedId, modelIndex) {
|
function makePedHoldObject(pedId, modelIndex) {
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if(getGame() == VRR_GAME_GTA_IV) {
|
||||||
natives.givePedAmbientObject(natives.getPedFromNetworkId(pedId), getGameConfig().objects[getGame()][modelIndex][1])
|
natives.givePedAmbientObject(natives.getPedFromNetworkId(pedId), getGameConfig().objects[getGame()][modelIndex][1])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendLocalPlayerNetworkIdToServer() {
|
function sendLocalPlayerNetworkIdToServer() {
|
||||||
sendNetworkEventToServer("vrr.playerPedId", natives.getNetworkIdFromPed(localPlayer));
|
sendNetworkEventToServer("vrr.playerPedId", natives.getNetworkIdFromPed(localPlayer));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -45,93 +45,93 @@ function loadSkinSelectMessageFontBottom() {
|
|||||||
|
|
||||||
function processSkinSelectKeyPress(keyCode) {
|
function processSkinSelectKeyPress(keyCode) {
|
||||||
if(usingSkinSelector) {
|
if(usingSkinSelector) {
|
||||||
if(keyCode == SDLK_PAGEUP) {
|
if(keyCode == SDLK_PAGEUP) {
|
||||||
if(skinSelectorIndex >= allowedSkins.length-1) {
|
if(skinSelectorIndex >= allowedSkins.length-1) {
|
||||||
skinSelectorIndex = 1;
|
skinSelectorIndex = 1;
|
||||||
} else {
|
} else {
|
||||||
skinSelectorIndex = skinSelectorIndex + 1;
|
skinSelectorIndex = skinSelectorIndex + 1;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `Switching to skin ${allowedSkins[skinSelectorIndex][1]} (Index: ${skinSelectorIndex}, Skin: ${allowedSkins[skinSelectorIndex][0]})`);
|
logToConsole(LOG_DEBUG, `Switching to skin ${allowedSkins[skinSelectorIndex][1]} (Index: ${skinSelectorIndex}, Skin: ${allowedSkins[skinSelectorIndex][0]})`);
|
||||||
skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
|
skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if(getGame() == VRR_GAME_GTA_IV) {
|
||||||
//natives.changePlayerModel(natives.getPlayerId(), allowedSkins[skinSelectorIndex][0]);
|
//natives.changePlayerModel(natives.getPlayerId(), allowedSkins[skinSelectorIndex][0]);
|
||||||
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
|
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
|
||||||
} else {
|
} else {
|
||||||
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
|
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
|
||||||
}
|
}
|
||||||
} else if(keyCode == SDLK_PAGEDOWN) {
|
} else if(keyCode == SDLK_PAGEDOWN) {
|
||||||
if(skinSelectorIndex <= 0) {
|
if(skinSelectorIndex <= 0) {
|
||||||
skinSelectorIndex = allowedSkins.length-1;
|
skinSelectorIndex = allowedSkins.length-1;
|
||||||
} else {
|
} else {
|
||||||
skinSelectorIndex = skinSelectorIndex - 1;
|
skinSelectorIndex = skinSelectorIndex - 1;
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `Switching to skin ${allowedSkins[skinSelectorIndex][1]} (Index: ${skinSelectorIndex}, Skin: ${allowedSkins[skinSelectorIndex][0]})`);
|
logToConsole(LOG_DEBUG, `Switching to skin ${allowedSkins[skinSelectorIndex][1]} (Index: ${skinSelectorIndex}, Skin: ${allowedSkins[skinSelectorIndex][0]})`);
|
||||||
skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
|
skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if(getGame() == VRR_GAME_GTA_IV) {
|
||||||
//natives.changePlayerModel(natives.getPlayerId(), allowedSkins[skinSelectorIndex][0]);
|
//natives.changePlayerModel(natives.getPlayerId(), allowedSkins[skinSelectorIndex][0]);
|
||||||
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
|
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
|
||||||
} else {
|
} else {
|
||||||
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
|
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
|
||||||
}
|
}
|
||||||
} else if(keyCode == SDLK_RETURN) {
|
} else if(keyCode == SDLK_RETURN) {
|
||||||
sendNetworkEventToServer("vrr.skinSelected", skinSelectorIndex);
|
sendNetworkEventToServer("vrr.skinSelected", skinSelectorIndex);
|
||||||
toggleSkinSelect(false);
|
toggleSkinSelect(false);
|
||||||
return true;
|
return true;
|
||||||
} else if(keyCode == SDLK_BACKSPACE) {
|
} else if(keyCode == SDLK_BACKSPACE) {
|
||||||
sendNetworkEventToServer("vrr.skinSelected", -1);
|
sendNetworkEventToServer("vrr.skinSelected", -1);
|
||||||
toggleSkinSelect(false);
|
toggleSkinSelect(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
localPlayer.heading = skinSelectHeading;
|
localPlayer.heading = skinSelectHeading;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function processSkinSelectRendering() {
|
function processSkinSelectRendering() {
|
||||||
if(usingSkinSelector) {
|
if(usingSkinSelector) {
|
||||||
if(skinSelectMessageFontTop != null && skinSelectMessageFontBottom != null) {
|
if(skinSelectMessageFontTop != null && skinSelectMessageFontBottom != null) {
|
||||||
if(skinSelectMessageTextTop != "" && skinSelectMessageTextBottom != "") {
|
if(skinSelectMessageTextTop != "" && skinSelectMessageTextBottom != "") {
|
||||||
skinSelectMessageFontTop.render(skinSelectMessageTextTop, [0, game.height-100], game.width, 0.5, 0.0, skinSelectMessageFontTop.size, skinSelectMessageColourTop, true, true, false, true);
|
skinSelectMessageFontTop.render(skinSelectMessageTextTop, [0, game.height-100], game.width, 0.5, 0.0, skinSelectMessageFontTop.size, skinSelectMessageColourTop, true, true, false, true);
|
||||||
skinSelectMessageFontBottom.render(skinSelectMessageTextBottom, [0, game.height-65], game.width, 0.5, 0.0, skinSelectMessageFontBottom.size, skinSelectMessageColourBottom, true, true, false, true);
|
skinSelectMessageFontBottom.render(skinSelectMessageTextBottom, [0, game.height-65], game.width, 0.5, 0.0, skinSelectMessageFontBottom.size, skinSelectMessageColourBottom, true, true, false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function toggleSkinSelect(state) {
|
function toggleSkinSelect(state) {
|
||||||
if(state) {
|
if(state) {
|
||||||
skinSelectorIndex = getAllowedSkinIndexFromSkin(localPlayer.skin);
|
skinSelectorIndex = getAllowedSkinIndexFromSkin(localPlayer.skin);
|
||||||
if(!skinSelectorIndex) {
|
if(!skinSelectorIndex) {
|
||||||
skinSelectorIndex = 0;
|
skinSelectorIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
usingSkinSelector = true;
|
usingSkinSelector = true;
|
||||||
skinSelectPosition = localPlayer.position;
|
skinSelectPosition = localPlayer.position;
|
||||||
skinSelectHeading = localPlayer.heading;
|
skinSelectHeading = localPlayer.heading;
|
||||||
|
|
||||||
if(isCustomCameraSupported()) {
|
if(isCustomCameraSupported()) {
|
||||||
let tempPosition = localPlayer.position;
|
let tempPosition = localPlayer.position;
|
||||||
tempPosition.z += 0.5;
|
tempPosition.z += 0.5;
|
||||||
let frontCameraPosition = getPosInFrontOfPos(tempPosition, localPlayer.heading, 3);
|
let frontCameraPosition = getPosInFrontOfPos(tempPosition, localPlayer.heading, 3);
|
||||||
game.setCameraLookAt(frontCameraPosition, localPlayer.position, true);
|
game.setCameraLookAt(frontCameraPosition, localPlayer.position, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if(getGame() == VRR_GAME_GTA_IV) {
|
||||||
//natives.changePlayerModel(natives.getPlayerId(), allowedSkins[skinSelectorIndex][0]);
|
//natives.changePlayerModel(natives.getPlayerId(), allowedSkins[skinSelectorIndex][0]);
|
||||||
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
|
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
|
||||||
} else {
|
} else {
|
||||||
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
|
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
|
skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
|
||||||
setLocalPlayerControlState(false, false);
|
setLocalPlayerControlState(false, false);
|
||||||
} else {
|
} else {
|
||||||
usingSkinSelector = false;
|
usingSkinSelector = false;
|
||||||
setLocalPlayerControlState(false, false);
|
setLocalPlayerControlState(false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -8,158 +8,158 @@
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initClientScripts() {
|
function initClientScripts() {
|
||||||
initGUIScript();
|
initGUIScript();
|
||||||
initNameTagScript();
|
initNameTagScript();
|
||||||
initScoreBoardScript();
|
initScoreBoardScript();
|
||||||
initMessagingScript();
|
initMessagingScript();
|
||||||
initServerScript();
|
initServerScript();
|
||||||
initLogoScript();
|
initLogoScript();
|
||||||
initLabelScript();
|
initLabelScript();
|
||||||
initChatBoxScript();
|
initChatBoxScript();
|
||||||
initAFKScript();
|
initAFKScript();
|
||||||
initKeyBindScript();
|
initKeyBindScript();
|
||||||
initEventScript();
|
initEventScript();
|
||||||
initSkinSelectScript();
|
initSkinSelectScript();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setUpInitialGame() {
|
function setUpInitialGame() {
|
||||||
if(getGame() == VRR_GAME_GTA_III) {
|
if(getGame() == VRR_GAME_GTA_III) {
|
||||||
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0);
|
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0);
|
||||||
game.setGameStat(STAT_PROGRESSMADE, 9999);
|
game.setGameStat(STAT_PROGRESSMADE, 9999);
|
||||||
game.setGameStat(STAT_TOTALPROGRESSINGAME, 9999);
|
game.setGameStat(STAT_TOTALPROGRESSINGAME, 9999);
|
||||||
game.SET_CAR_DENSITY_MULTIPLIER(3.0);
|
game.SET_CAR_DENSITY_MULTIPLIER(3.0);
|
||||||
game.SET_PED_DENSITY_MULTIPLIER(3.0);
|
game.SET_PED_DENSITY_MULTIPLIER(3.0);
|
||||||
game.onMission = true;
|
game.onMission = true;
|
||||||
SetStandardControlsEnabled(true);
|
SetStandardControlsEnabled(true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getGame() == VRR_GAME_GTA_VC) {
|
if(getGame() == VRR_GAME_GTA_VC) {
|
||||||
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0);
|
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0);
|
||||||
game.setGameStat(STAT_PROGRESSMADE, 9999);
|
game.setGameStat(STAT_PROGRESSMADE, 9999);
|
||||||
game.setGameStat(STAT_TOTALPROGRESSINGAME, 9999);
|
game.setGameStat(STAT_TOTALPROGRESSINGAME, 9999);
|
||||||
game.SET_CAR_DENSITY_MULTIPLIER(3.0);
|
game.SET_CAR_DENSITY_MULTIPLIER(3.0);
|
||||||
game.SET_PED_DENSITY_MULTIPLIER(3.0);
|
game.SET_PED_DENSITY_MULTIPLIER(3.0);
|
||||||
|
|
||||||
game.REQUEST_ANIMATION("bikev");
|
game.REQUEST_ANIMATION("bikev");
|
||||||
game.REQUEST_ANIMATION("bikeh");
|
game.REQUEST_ANIMATION("bikeh");
|
||||||
game.REQUEST_ANIMATION("biked");
|
game.REQUEST_ANIMATION("biked");
|
||||||
game.REQUEST_ANIMATION("knife");
|
game.REQUEST_ANIMATION("knife");
|
||||||
game.REQUEST_ANIMATION("python");
|
game.REQUEST_ANIMATION("python");
|
||||||
game.REQUEST_ANIMATION("shotgun");
|
game.REQUEST_ANIMATION("shotgun");
|
||||||
game.REQUEST_ANIMATION("buddy");
|
game.REQUEST_ANIMATION("buddy");
|
||||||
game.REQUEST_ANIMATION("tec");
|
game.REQUEST_ANIMATION("tec");
|
||||||
game.REQUEST_ANIMATION("uzi");
|
game.REQUEST_ANIMATION("uzi");
|
||||||
game.REQUEST_ANIMATION("rifle");
|
game.REQUEST_ANIMATION("rifle");
|
||||||
game.REQUEST_ANIMATION("m60");
|
game.REQUEST_ANIMATION("m60");
|
||||||
game.REQUEST_ANIMATION("sniper");
|
game.REQUEST_ANIMATION("sniper");
|
||||||
game.REQUEST_ANIMATION("grenade");
|
game.REQUEST_ANIMATION("grenade");
|
||||||
game.REQUEST_ANIMATION("flame");
|
game.REQUEST_ANIMATION("flame");
|
||||||
game.REQUEST_ANIMATION("medic");
|
game.REQUEST_ANIMATION("medic");
|
||||||
game.REQUEST_ANIMATION("sunbathe");
|
game.REQUEST_ANIMATION("sunbathe");
|
||||||
//game.REQUEST_ANIMATION("playidles");
|
//game.REQUEST_ANIMATION("playidles");
|
||||||
game.REQUEST_ANIMATION("riot");
|
game.REQUEST_ANIMATION("riot");
|
||||||
game.REQUEST_ANIMATION("strip");
|
game.REQUEST_ANIMATION("strip");
|
||||||
game.REQUEST_ANIMATION("lance");
|
game.REQUEST_ANIMATION("lance");
|
||||||
game.REQUEST_ANIMATION("skate");
|
game.REQUEST_ANIMATION("skate");
|
||||||
|
|
||||||
game.LOAD_ALL_MODELS_NOW();
|
game.LOAD_ALL_MODELS_NOW();
|
||||||
game.onMission = true;
|
game.onMission = true;
|
||||||
SetStandardControlsEnabled(true);
|
SetStandardControlsEnabled(true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getGame() == VRR_GAME_GTA_SA) {
|
if(getGame() == VRR_GAME_GTA_SA) {
|
||||||
game.setGameStat(STAT_WEAPONTYPE_PISTOL_SKILL, 400);
|
game.setGameStat(STAT_WEAPONTYPE_PISTOL_SKILL, 400);
|
||||||
game.setGameStat(STAT_WEAPONTYPE_PISTOL_SILENCED_SKILL, 400);
|
game.setGameStat(STAT_WEAPONTYPE_PISTOL_SILENCED_SKILL, 400);
|
||||||
game.setGameStat(STAT_WEAPONTYPE_DESERT_EAGLE_SKILL, 400);
|
game.setGameStat(STAT_WEAPONTYPE_DESERT_EAGLE_SKILL, 400);
|
||||||
game.setGameStat(STAT_WEAPONTYPE_SHOTGUN_SKILL, 400);
|
game.setGameStat(STAT_WEAPONTYPE_SHOTGUN_SKILL, 400);
|
||||||
game.setGameStat(STAT_WEAPONTYPE_SAWNOFF_SHOTGUN_SKILL, 400);
|
game.setGameStat(STAT_WEAPONTYPE_SAWNOFF_SHOTGUN_SKILL, 400);
|
||||||
game.setGameStat(STAT_WEAPONTYPE_SPAS12_SHOTGUN_SKILL, 400);
|
game.setGameStat(STAT_WEAPONTYPE_SPAS12_SHOTGUN_SKILL, 400);
|
||||||
game.setGameStat(STAT_WEAPONTYPE_MICRO_UZI_SKILL, 400);
|
game.setGameStat(STAT_WEAPONTYPE_MICRO_UZI_SKILL, 400);
|
||||||
game.setGameStat(STAT_WEAPONTYPE_MP5_SKILL, 400);
|
game.setGameStat(STAT_WEAPONTYPE_MP5_SKILL, 400);
|
||||||
game.setGameStat(STAT_WEAPONTYPE_AK47_SKILL, 400);
|
game.setGameStat(STAT_WEAPONTYPE_AK47_SKILL, 400);
|
||||||
game.setGameStat(STAT_WEAPONTYPE_M4_SKILL, 400);
|
game.setGameStat(STAT_WEAPONTYPE_M4_SKILL, 400);
|
||||||
game.setGameStat(STAT_DRIVING_SKILL, 9999);
|
game.setGameStat(STAT_DRIVING_SKILL, 9999);
|
||||||
game.setGameStat(STAT_FAT, 9999);
|
game.setGameStat(STAT_FAT, 9999);
|
||||||
game.setGameStat(STAT_ENERGY, 9999);
|
game.setGameStat(STAT_ENERGY, 9999);
|
||||||
game.setGameStat(STAT_CYCLE_SKILL, 9999);
|
game.setGameStat(STAT_CYCLE_SKILL, 9999);
|
||||||
game.setGameStat(STAT_BIKE_SKILL, 9999);
|
game.setGameStat(STAT_BIKE_SKILL, 9999);
|
||||||
game.setGameStat(STAT_GAMBLING, 9999);
|
game.setGameStat(STAT_GAMBLING, 9999);
|
||||||
game.setGameStat(STAT_PROGRESS_MADE, 9999);
|
game.setGameStat(STAT_PROGRESS_MADE, 9999);
|
||||||
game.setGameStat(STAT_RESPECT, 0);
|
game.setGameStat(STAT_RESPECT, 0);
|
||||||
game.setGameStat(STAT_RESPECT_TOTAL, 0);
|
game.setGameStat(STAT_RESPECT_TOTAL, 0);
|
||||||
game.setGameStat(STAT_SEX_APPEAL, 0);
|
game.setGameStat(STAT_SEX_APPEAL, 0);
|
||||||
game.setGameStat(STAT_STAMINA, 9999);
|
game.setGameStat(STAT_STAMINA, 9999);
|
||||||
game.setGameStat(STAT_TOTAL_PROGRESS, 9999);
|
game.setGameStat(STAT_TOTAL_PROGRESS, 9999);
|
||||||
game.setGameStat(STAT_UNDERWATER_STAMINA, 9999);
|
game.setGameStat(STAT_UNDERWATER_STAMINA, 9999);
|
||||||
game.setGameStat(STAT_BODY_MUSCLE, 9999);
|
game.setGameStat(STAT_BODY_MUSCLE, 9999);
|
||||||
|
|
||||||
game.setDefaultInteriors(false);
|
game.setDefaultInteriors(false);
|
||||||
game.onMission = true;
|
game.onMission = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if(getGame() == VRR_GAME_GTA_IV) {
|
||||||
natives.allowEmergencyServices(false);
|
natives.allowEmergencyServices(false);
|
||||||
natives.setCreateRandomCops(true);
|
natives.setCreateRandomCops(true);
|
||||||
natives.setMaxWantedLevel(0);
|
natives.setMaxWantedLevel(0);
|
||||||
natives.setWantedMultiplier(0.0);
|
natives.setWantedMultiplier(0.0);
|
||||||
natives.allowPlayerToCarryNonMissionObjects(natives.getPlayerId(), true);
|
natives.allowPlayerToCarryNonMissionObjects(natives.getPlayerId(), true);
|
||||||
natives.setPlayerTeam(natives.getPlayerId(), 0);
|
natives.setPlayerTeam(natives.getPlayerId(), 0);
|
||||||
natives.loadAllObjectsNow();
|
natives.loadAllObjectsNow();
|
||||||
natives.setCellphoneRanked(false);
|
natives.setCellphoneRanked(false);
|
||||||
natives.setOverrideNoSprintingOnPhoneInMultiplayer(false);
|
natives.setOverrideNoSprintingOnPhoneInMultiplayer(false);
|
||||||
natives.setSyncWeatherAndGameTime(false);
|
natives.setSyncWeatherAndGameTime(false);
|
||||||
natives.usePlayerColourInsteadOfTeamColour(true);
|
natives.usePlayerColourInsteadOfTeamColour(true);
|
||||||
natives.disablePauseMenu(true);
|
natives.disablePauseMenu(true);
|
||||||
natives.allowReactionAnims(localPlayer, true);
|
natives.allowReactionAnims(localPlayer, true);
|
||||||
natives.allowGameToPauseForStreaming(false);
|
natives.allowGameToPauseForStreaming(false);
|
||||||
natives.allowStuntJumpsToTrigger(false);
|
natives.allowStuntJumpsToTrigger(false);
|
||||||
natives.setPickupsFixCars(false);
|
natives.setPickupsFixCars(false);
|
||||||
|
|
||||||
// HUD and Display
|
// HUD and Display
|
||||||
natives.displayCash(false);
|
natives.displayCash(false);
|
||||||
natives.displayAmmo(false);
|
natives.displayAmmo(false);
|
||||||
natives.displayHud(false);
|
natives.displayHud(false);
|
||||||
natives.displayRadar(false);
|
natives.displayRadar(false);
|
||||||
natives.displayAreaName(false);
|
natives.displayAreaName(false);
|
||||||
natives.displayPlayerNames(false);
|
natives.displayPlayerNames(false);
|
||||||
natives.setPoliceRadarBlips(false);
|
natives.setPoliceRadarBlips(false);
|
||||||
natives.removeTemporaryRadarBlipsForPickups();
|
natives.removeTemporaryRadarBlipsForPickups();
|
||||||
natives.displayNonMinigameHelpMessages(false);
|
natives.displayNonMinigameHelpMessages(false);
|
||||||
natives.setDisplayPlayerNameAndIcon(natives.getPlayerId(), false);
|
natives.setDisplayPlayerNameAndIcon(natives.getPlayerId(), false);
|
||||||
|
|
||||||
// Item/Money Dropping
|
// Item/Money Dropping
|
||||||
natives.setMoneyCarriedByAllNewPeds(0);
|
natives.setMoneyCarriedByAllNewPeds(0);
|
||||||
natives.setDeadPedsDropWeapons(false);
|
natives.setDeadPedsDropWeapons(false);
|
||||||
natives.setPlayersDropMoneyInNetworkGame(false);
|
natives.setPlayersDropMoneyInNetworkGame(false);
|
||||||
|
|
||||||
// Population
|
// Population
|
||||||
natives.dontSuppressAnyCarModels(5.0);
|
natives.dontSuppressAnyCarModels(5.0);
|
||||||
natives.dontSuppressAnyPedModels(5.0);
|
natives.dontSuppressAnyPedModels(5.0);
|
||||||
natives.forceGenerateParkedCarsTooCloseToOthers(5.0);
|
natives.forceGenerateParkedCarsTooCloseToOthers(5.0);
|
||||||
natives.setParkedCarDensityMultiplier(5.0);
|
natives.setParkedCarDensityMultiplier(5.0);
|
||||||
natives.setRandomCarDensityMultiplier(5.0);
|
natives.setRandomCarDensityMultiplier(5.0);
|
||||||
natives.setPedDensityMultiplier(5.0);
|
natives.setPedDensityMultiplier(5.0);
|
||||||
natives.setCarDensityMultiplier(5.0);
|
natives.setCarDensityMultiplier(5.0);
|
||||||
natives.setScenarioPedDensityMultiplier(5.0, 5.0);
|
natives.setScenarioPedDensityMultiplier(5.0, 5.0);
|
||||||
natives.switchRandomTrains(true);
|
natives.switchRandomTrains(true);
|
||||||
natives.switchRandomBoats(true);
|
natives.switchRandomBoats(true);
|
||||||
natives.switchAmbientPlanes(true);
|
natives.switchAmbientPlanes(true);
|
||||||
natives.switchMadDrivers(false);
|
natives.switchMadDrivers(false);
|
||||||
|
|
||||||
natives.requestAnims("DANCING");
|
natives.requestAnims("DANCING");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getGame() == VRR_GAME_MAFIA_ONE) {
|
if(getGame() == VRR_GAME_MAFIA_ONE) {
|
||||||
game.mapEnabled = false;
|
game.mapEnabled = false;
|
||||||
game.setTrafficEnabled(false);
|
game.setTrafficEnabled(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -8,375 +8,375 @@
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function processSync(event, deltaTime) {
|
function processSync(event, deltaTime) {
|
||||||
if(localPlayer != null) {
|
if(localPlayer != null) {
|
||||||
if(!areServerElementsSupported()) {
|
if(!areServerElementsSupported()) {
|
||||||
sendNetworkEventToServer("vrr.player.position", localPlayer.position);
|
sendNetworkEventToServer("vrr.player.position", localPlayer.position);
|
||||||
sendNetworkEventToServer("vrr.player.heading", localPlayer.heading);
|
sendNetworkEventToServer("vrr.player.heading", localPlayer.heading);
|
||||||
}
|
}
|
||||||
|
|
||||||
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("vrr.playerDeath");
|
sendNetworkEventToServer("vrr.playerDeath");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(streamingRadioElement) {
|
if(streamingRadioElement) {
|
||||||
streamingRadio.position = getElementPosition(streamingRadioElement);
|
streamingRadio.position = getElementPosition(streamingRadioElement);
|
||||||
//streamingRadio.volume = getStreamingRadioVolumeForPosition(streamingRadio.position);
|
//streamingRadio.volume = getStreamingRadioVolumeForPosition(streamingRadio.position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setVehicleEngine(vehicleId, state) {
|
function setVehicleEngine(vehicleId, state) {
|
||||||
getElementFromId(vehicleId).engine = state;
|
getElementFromId(vehicleId).engine = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setVehicleLights(vehicleId, state) {
|
function setVehicleLights(vehicleId, state) {
|
||||||
if(getGame() != VRR_GAME_MAFIA_ONE) {
|
if(getGame() != VRR_GAME_MAFIA_ONE) {
|
||||||
if(!state) {
|
if(!state) {
|
||||||
getElementFromId(vehicleId).lightStatus = 2;
|
getElementFromId(vehicleId).lightStatus = 2;
|
||||||
} else {
|
} else {
|
||||||
getElementFromId(vehicleId).lightStatus = 1;
|
getElementFromId(vehicleId).lightStatus = 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(!state) {
|
if(!state) {
|
||||||
getElementFromId(vehicleId).lights = false;
|
getElementFromId(vehicleId).lights = false;
|
||||||
} else {
|
} else {
|
||||||
getElementFromId(vehicleId).lights = true;
|
getElementFromId(vehicleId).lights = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function repairVehicle(syncId) {
|
function repairVehicle(syncId) {
|
||||||
getVehicleFromSyncId(syncId).fix();
|
getVehicleFromSyncId(syncId).fix();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function syncVehicleProperties(vehicle) {
|
function syncVehicleProperties(vehicle) {
|
||||||
if(doesEntityDataExist(vehicle, "vrr.lights")) {
|
if(doesEntityDataExist(vehicle, "vrr.lights")) {
|
||||||
let lightStatus = getEntityData(vehicle, "vrr.lights");
|
let lightStatus = getEntityData(vehicle, "vrr.lights");
|
||||||
if(!lightStatus) {
|
if(!lightStatus) {
|
||||||
vehicle.lightStatus = 2;
|
vehicle.lightStatus = 2;
|
||||||
} else {
|
} else {
|
||||||
vehicle.lightStatus = 1;
|
vehicle.lightStatus = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(vehicle, "vrr.invincible")) {
|
if(doesEntityDataExist(vehicle, "vrr.invincible")) {
|
||||||
let invincible = getEntityData(vehicle, "vrr.invincible");
|
let invincible = getEntityData(vehicle, "vrr.invincible");
|
||||||
element.setProofs(invincible, invincible, invincible, invincible, invincible);
|
element.setProofs(invincible, invincible, invincible, invincible, invincible);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(vehicle, "vrr.panelStatus")) {
|
if(doesEntityDataExist(vehicle, "vrr.panelStatus")) {
|
||||||
let panelsStatus = getEntityData(vehicle, "vrr.panelStatus");
|
let panelsStatus = getEntityData(vehicle, "vrr.panelStatus");
|
||||||
for(let i in panelsStatus) {
|
for(let i in panelsStatus) {
|
||||||
vehicle.setPanelStatus(i, panelsStatus[i]);
|
vehicle.setPanelStatus(i, panelsStatus[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(vehicle, "vrr.wheelStatus")) {
|
if(doesEntityDataExist(vehicle, "vrr.wheelStatus")) {
|
||||||
let wheelsStatus = getEntityData(vehicle, "vrr.wheelStatus");
|
let wheelsStatus = getEntityData(vehicle, "vrr.wheelStatus");
|
||||||
for(let i in wheelsStatus) {
|
for(let i in wheelsStatus) {
|
||||||
vehicle.setWheelStatus(i, wheelsStatus[i]);
|
vehicle.setWheelStatus(i, wheelsStatus[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(vehicle, "vrr.lightStatus")) {
|
if(doesEntityDataExist(vehicle, "vrr.lightStatus")) {
|
||||||
let lightStatus = getEntityData(vehicle, "vrr.lightStatus");
|
let lightStatus = getEntityData(vehicle, "vrr.lightStatus");
|
||||||
for(let i in lightStatus) {
|
for(let i in lightStatus) {
|
||||||
vehicle.setLightStatus(i, lightStatus[i]);
|
vehicle.setLightStatus(i, lightStatus[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(vehicle, "vrr.suspensionHeight")) {
|
if(doesEntityDataExist(vehicle, "vrr.suspensionHeight")) {
|
||||||
let suspensionHeight = getEntityData(vehicle, "vrr.suspensionHeight");
|
let suspensionHeight = getEntityData(vehicle, "vrr.suspensionHeight");
|
||||||
vehicle.setSuspensionHeight(suspensionHeight);
|
vehicle.setSuspensionHeight(suspensionHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getGame() == VRR_GAME_GTA_SA) {
|
if(getGame() == VRR_GAME_GTA_SA) {
|
||||||
let allUpgrades = getGameConfig().vehicleUpgrades[getGame()];
|
let allUpgrades = getGameConfig().vehicleUpgrades[getGame()];
|
||||||
for(let i in allUpgrades) {
|
for(let i in allUpgrades) {
|
||||||
vehicle.removeUpgrade(i);
|
vehicle.removeUpgrade(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(vehicle, "vrr.upgrades")) {
|
if(doesEntityDataExist(vehicle, "vrr.upgrades")) {
|
||||||
let upgrades = getEntityData(vehicle, "vrr.upgrades");
|
let upgrades = getEntityData(vehicle, "vrr.upgrades");
|
||||||
for(let i in upgrades) {
|
for(let i in upgrades) {
|
||||||
if(upgrades[i] != 0) {
|
if(upgrades[i] != 0) {
|
||||||
vehicle.addUpgrade(upgrades[i]);
|
vehicle.addUpgrade(upgrades[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getGame() == VRR_GAME_GTA_SA || getGame() == VRR_GAME_GTA_IV) {
|
if(getGame() == VRR_GAME_GTA_SA || getGame() == VRR_GAME_GTA_IV) {
|
||||||
if(doesEntityDataExist(vehicle, "vrr.livery")) {
|
if(doesEntityDataExist(vehicle, "vrr.livery")) {
|
||||||
let livery = getEntityData(vehicle, "vrr.livery");
|
let livery = getEntityData(vehicle, "vrr.livery");
|
||||||
if(getGame() == VRR_GAME_GTA_SA) {
|
if(getGame() == VRR_GAME_GTA_SA) {
|
||||||
vehicle.setPaintJob(livery);
|
vehicle.setPaintJob(livery);
|
||||||
} else if(getGame() == VRR_GAME_GTA_IV) {
|
} else if(getGame() == VRR_GAME_GTA_IV) {
|
||||||
vehicle.livery = livery;
|
vehicle.livery = livery;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function syncCivilianProperties(civilian) {
|
function syncCivilianProperties(civilian) {
|
||||||
if(getGame() == VRR_GAME_GTA_III) {
|
if(getGame() == VRR_GAME_GTA_III) {
|
||||||
if(doesEntityDataExist(civilian, "vrr.scale")) {
|
if(doesEntityDataExist(civilian, "vrr.scale")) {
|
||||||
let scaleFactor = getEntityData(civilian, "vrr.scale");
|
let scaleFactor = getEntityData(civilian, "vrr.scale");
|
||||||
let tempMatrix = civilian.matrix;
|
let tempMatrix = civilian.matrix;
|
||||||
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
|
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
|
||||||
let tempPosition = civilian.position;
|
let tempPosition = civilian.position;
|
||||||
civilian.matrix = tempMatrix;
|
civilian.matrix = tempMatrix;
|
||||||
tempPosition.z += scaleFactor.z;
|
tempPosition.z += scaleFactor.z;
|
||||||
civilian.position = tempPosition;
|
civilian.position = tempPosition;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getGame() == VRR_GAME_GTA_SA) {
|
if(getGame() == VRR_GAME_GTA_SA) {
|
||||||
if(doesEntityDataExist(civilian, "vrr.fightStyle")) {
|
if(doesEntityDataExist(civilian, "vrr.fightStyle")) {
|
||||||
let fightStyle = getEntityData(civilian, "vrr.fightStyle");
|
let fightStyle = getEntityData(civilian, "vrr.fightStyle");
|
||||||
civilian.setFightStyle(fightStyle[0], fightStyle[1]);
|
civilian.setFightStyle(fightStyle[0], fightStyle[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getGame() == VRR_GAME_GTA_III) {
|
if(getGame() == VRR_GAME_GTA_III) {
|
||||||
if(doesEntityDataExist(civilian, "vrr.walkStyle")) {
|
if(doesEntityDataExist(civilian, "vrr.walkStyle")) {
|
||||||
let walkStyle = getEntityData(civilian, "vrr.walkStyle");
|
let walkStyle = getEntityData(civilian, "vrr.walkStyle");
|
||||||
civilian.walkStyle = walkStyle;
|
civilian.walkStyle = walkStyle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if(getGame() == VRR_GAME_GTA_IV) {
|
||||||
if(doesEntityDataExist(civilian, "vrr.bodyPropHair")) {
|
if(doesEntityDataExist(civilian, "vrr.bodyPropHair")) {
|
||||||
let bodyPropHair = getEntityData(civilian, "vrr.bodyPropHair");
|
let bodyPropHair = getEntityData(civilian, "vrr.bodyPropHair");
|
||||||
civilian.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
|
civilian.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(civilian, "vrr.bodyPropHead")) {
|
if(doesEntityDataExist(civilian, "vrr.bodyPropHead")) {
|
||||||
let bodyPropHead = getEntityData(civilian, "vrr.bodyPropHead");
|
let bodyPropHead = getEntityData(civilian, "vrr.bodyPropHead");
|
||||||
civilian.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
|
civilian.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(civilian, "vrr.bodyPropEyes")) {
|
if(doesEntityDataExist(civilian, "vrr.bodyPropEyes")) {
|
||||||
let bodyPropEyes = getEntityData(civilian, "vrr.bodyPropEyes");
|
let bodyPropEyes = getEntityData(civilian, "vrr.bodyPropEyes");
|
||||||
civilian.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
|
civilian.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(civilian, "vrr.bodyPropLeftHand")) {
|
if(doesEntityDataExist(civilian, "vrr.bodyPropLeftHand")) {
|
||||||
let bodyPropLeftHand = getEntityData(civilian, "vrr.bodyPropLeftHand");
|
let bodyPropLeftHand = getEntityData(civilian, "vrr.bodyPropLeftHand");
|
||||||
civilian.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
|
civilian.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(civilian, "vrr.bodyPropRightHand")) {
|
if(doesEntityDataExist(civilian, "vrr.bodyPropRightHand")) {
|
||||||
let bodyPropRightHand = getEntityData(civilian, "vrr.bodyPropRightHand");
|
let bodyPropRightHand = getEntityData(civilian, "vrr.bodyPropRightHand");
|
||||||
civilian.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
|
civilian.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(civilian, "vrr.bodyPropLeftWrist")) {
|
if(doesEntityDataExist(civilian, "vrr.bodyPropLeftWrist")) {
|
||||||
let bodyPropLeftWrist = getEntityData(civilian, "vrr.bodyPropLeftWrist");
|
let bodyPropLeftWrist = getEntityData(civilian, "vrr.bodyPropLeftWrist");
|
||||||
civilian.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
|
civilian.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(civilian, "vrr.bodyPropRightWrist")) {
|
if(doesEntityDataExist(civilian, "vrr.bodyPropRightWrist")) {
|
||||||
let bodyPropRightWrist = getEntityData(civilian, "vrr.bodyPropRightWrist");
|
let bodyPropRightWrist = getEntityData(civilian, "vrr.bodyPropRightWrist");
|
||||||
civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(civilian, "vrr.bodyPropRightWrist")) {
|
if(doesEntityDataExist(civilian, "vrr.bodyPropRightWrist")) {
|
||||||
let bodyPropRightWrist = getEntityData(civilian, "vrr.bodyPropRightWrist");
|
let bodyPropRightWrist = getEntityData(civilian, "vrr.bodyPropRightWrist");
|
||||||
civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(civilian, "vrr.bodyPropHip")) {
|
if(doesEntityDataExist(civilian, "vrr.bodyPropHip")) {
|
||||||
let bodyPropHip = getEntityData(civilian, "vrr.bodyPropHip");
|
let bodyPropHip = getEntityData(civilian, "vrr.bodyPropHip");
|
||||||
civilian.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
|
civilian.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(civilian, "vrr.bodyPropLeftFoot")) {
|
if(doesEntityDataExist(civilian, "vrr.bodyPropLeftFoot")) {
|
||||||
let bodyPropLeftFoot = getEntityData(civilian, "vrr.bodyPropLeftFoot");
|
let bodyPropLeftFoot = getEntityData(civilian, "vrr.bodyPropLeftFoot");
|
||||||
civilian.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
|
civilian.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(civilian, "vrr.bodyPropRightFoot")) {
|
if(doesEntityDataExist(civilian, "vrr.bodyPropRightFoot")) {
|
||||||
let bodyPropRightFoot = getEntityData(civilian, "vrr.bodyPropRightFoot");
|
let bodyPropRightFoot = getEntityData(civilian, "vrr.bodyPropRightFoot");
|
||||||
civilian.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
|
civilian.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(civilian, "vrr.anim")) {
|
if(doesEntityDataExist(civilian, "vrr.anim")) {
|
||||||
let animData = getEntityData(vehicle, "vrr.anim");
|
let animData = getEntityData(vehicle, "vrr.anim");
|
||||||
civilian.addAnimation(animData[0], animData[1]);
|
civilian.addAnimation(animData[0], animData[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function syncPlayerProperties(player) {
|
function syncPlayerProperties(player) {
|
||||||
if(getGame() == VRR_GAME_GTA_III) {
|
if(getGame() == VRR_GAME_GTA_III) {
|
||||||
if(doesEntityDataExist(player, "vrr.scale")) {
|
if(doesEntityDataExist(player, "vrr.scale")) {
|
||||||
let scaleFactor = getEntityData(player, "vrr.scale");
|
let scaleFactor = getEntityData(player, "vrr.scale");
|
||||||
let tempMatrix = player.matrix;
|
let tempMatrix = player.matrix;
|
||||||
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
|
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
|
||||||
let tempPosition = player.position;
|
let tempPosition = player.position;
|
||||||
player.matrix = tempMatrix;
|
player.matrix = tempMatrix;
|
||||||
tempPosition.z += scaleFactor.z;
|
tempPosition.z += scaleFactor.z;
|
||||||
player.position = tempPosition;
|
player.position = tempPosition;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getGame() == VRR_GAME_GTA_SA) {
|
if(getGame() == VRR_GAME_GTA_SA) {
|
||||||
if(doesEntityDataExist(player, "vrr.fightStyle")) {
|
if(doesEntityDataExist(player, "vrr.fightStyle")) {
|
||||||
let fightStyle = getEntityData(player, "vrr.fightStyle");
|
let fightStyle = getEntityData(player, "vrr.fightStyle");
|
||||||
player.setFightStyle(fightStyle[0], fightStyle[1]);
|
player.setFightStyle(fightStyle[0], fightStyle[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//if(getGame() == VRR_GAME_GTA_SA) {
|
//if(getGame() == VRR_GAME_GTA_SA) {
|
||||||
// if(doesEntityDataExist(player, "vrr.walkStyle")) {
|
// if(doesEntityDataExist(player, "vrr.walkStyle")) {
|
||||||
// let walkStyle = getEntityData(player, "vrr.walkStyle");
|
// let walkStyle = getEntityData(player, "vrr.walkStyle");
|
||||||
// player.walkStyle = walkStyle;
|
// player.walkStyle = walkStyle;
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if(getGame() == VRR_GAME_GTA_IV) {
|
||||||
if(doesEntityDataExist(player, "vrr.bodyPartHair")) {
|
if(doesEntityDataExist(player, "vrr.bodyPartHair")) {
|
||||||
let bodyPartHead = getEntityData(player, "vrr.bodyPartHair");
|
let bodyPartHead = getEntityData(player, "vrr.bodyPartHair");
|
||||||
player.changeBodyPart(0, bodyPartHead[0], bodyPartHair[1]);
|
player.changeBodyPart(0, bodyPartHead[0], bodyPartHair[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(player, "vrr.bodyPartHead")) {
|
if(doesEntityDataExist(player, "vrr.bodyPartHead")) {
|
||||||
let bodyPartHead = getEntityData(player, "vrr.bodyPartHead");
|
let bodyPartHead = getEntityData(player, "vrr.bodyPartHead");
|
||||||
player.changeBodyPart(1, bodyPartHead[0], bodyPartHead[1]);
|
player.changeBodyPart(1, bodyPartHead[0], bodyPartHead[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(player, "vrr.bodyPartUpper")) {
|
if(doesEntityDataExist(player, "vrr.bodyPartUpper")) {
|
||||||
let bodyPartUpper = getEntityData(player, "vrr.bodyPartUpper");
|
let bodyPartUpper = getEntityData(player, "vrr.bodyPartUpper");
|
||||||
player.changeBodyPart(1, bodyPartUpper[0], bodyPartUpper[1]);
|
player.changeBodyPart(1, bodyPartUpper[0], bodyPartUpper[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(player, "vrr.bodyPartLower")) {
|
if(doesEntityDataExist(player, "vrr.bodyPartLower")) {
|
||||||
let bodyPartLower = getEntityData(player, "vrr.bodyPartLower");
|
let bodyPartLower = getEntityData(player, "vrr.bodyPartLower");
|
||||||
player.changeBodyPart(1, bodyPartLower[0], bodyPartLower[1]);
|
player.changeBodyPart(1, bodyPartLower[0], bodyPartLower[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if(getGame() == VRR_GAME_GTA_IV) {
|
||||||
if(doesEntityDataExist(player, "vrr.bodyPropHair")) {
|
if(doesEntityDataExist(player, "vrr.bodyPropHair")) {
|
||||||
let bodyPropHair = getEntityData(player, "vrr.bodyPropHair");
|
let bodyPropHair = getEntityData(player, "vrr.bodyPropHair");
|
||||||
player.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
|
player.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(player, "vrr.bodyPropHead")) {
|
if(doesEntityDataExist(player, "vrr.bodyPropHead")) {
|
||||||
let bodyPropHead = getEntityData(player, "vrr.bodyPropHead");
|
let bodyPropHead = getEntityData(player, "vrr.bodyPropHead");
|
||||||
player.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
|
player.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(player, "vrr.bodyPropEyes")) {
|
if(doesEntityDataExist(player, "vrr.bodyPropEyes")) {
|
||||||
let bodyPropEyes = getEntityData(player, "vrr.bodyPropEyes");
|
let bodyPropEyes = getEntityData(player, "vrr.bodyPropEyes");
|
||||||
player.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
|
player.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(player, "vrr.bodyPropLeftHand")) {
|
if(doesEntityDataExist(player, "vrr.bodyPropLeftHand")) {
|
||||||
let bodyPropLeftHand = getEntityData(player, "vrr.bodyPropLeftHand");
|
let bodyPropLeftHand = getEntityData(player, "vrr.bodyPropLeftHand");
|
||||||
player.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
|
player.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(player, "vrr.bodyPropRightHand")) {
|
if(doesEntityDataExist(player, "vrr.bodyPropRightHand")) {
|
||||||
let bodyPropRightHand = getEntityData(player, "vrr.bodyPropRightHand");
|
let bodyPropRightHand = getEntityData(player, "vrr.bodyPropRightHand");
|
||||||
player.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
|
player.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(player, "vrr.bodyPropLeftWrist")) {
|
if(doesEntityDataExist(player, "vrr.bodyPropLeftWrist")) {
|
||||||
let bodyPropLeftWrist = getEntityData(player, "vrr.bodyPropLeftWrist");
|
let bodyPropLeftWrist = getEntityData(player, "vrr.bodyPropLeftWrist");
|
||||||
player.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
|
player.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(player, "vrr.bodyPropRightWrist")) {
|
if(doesEntityDataExist(player, "vrr.bodyPropRightWrist")) {
|
||||||
let bodyPropRightWrist = getEntityData(player, "vrr.bodyPropRightWrist");
|
let bodyPropRightWrist = getEntityData(player, "vrr.bodyPropRightWrist");
|
||||||
player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(player, "vrr.bodyPropRightWrist")) {
|
if(doesEntityDataExist(player, "vrr.bodyPropRightWrist")) {
|
||||||
let bodyPropRightWrist = getEntityData(player, "vrr.bodyPropRightWrist");
|
let bodyPropRightWrist = getEntityData(player, "vrr.bodyPropRightWrist");
|
||||||
player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(player, "vrr.bodyPropHip")) {
|
if(doesEntityDataExist(player, "vrr.bodyPropHip")) {
|
||||||
let bodyPropHip = getEntityData(player, "vrr.bodyPropHip");
|
let bodyPropHip = getEntityData(player, "vrr.bodyPropHip");
|
||||||
player.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
|
player.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(player, "vrr.bodyPropLeftFoot")) {
|
if(doesEntityDataExist(player, "vrr.bodyPropLeftFoot")) {
|
||||||
let bodyPropLeftFoot = getEntityData(player, "vrr.bodyPropLeftFoot");
|
let bodyPropLeftFoot = getEntityData(player, "vrr.bodyPropLeftFoot");
|
||||||
player.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
|
player.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(player, "vrr.bodyPropRightFoot")) {
|
if(doesEntityDataExist(player, "vrr.bodyPropRightFoot")) {
|
||||||
let bodyPropRightFoot = getEntityData(player, "vrr.bodyPropRightFoot");
|
let bodyPropRightFoot = getEntityData(player, "vrr.bodyPropRightFoot");
|
||||||
player.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
|
player.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function syncObjectProperties(object) {
|
function syncObjectProperties(object) {
|
||||||
if(getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
|
if(getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
|
||||||
if(doesEntityDataExist(object, "vrr.scale")) {
|
if(doesEntityDataExist(object, "vrr.scale")) {
|
||||||
let scaleFactor = getEntityData(object, "vrr.scale");
|
let scaleFactor = getEntityData(object, "vrr.scale");
|
||||||
let tempMatrix = object.matrix;
|
let tempMatrix = object.matrix;
|
||||||
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
|
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
|
||||||
let tempPosition = object.position;
|
let tempPosition = object.position;
|
||||||
object.matrix = tempMatrix;
|
object.matrix = tempMatrix;
|
||||||
tempPosition.z += scaleFactor.z;
|
tempPosition.z += scaleFactor.z;
|
||||||
object.position = tempPosition;
|
object.position = tempPosition;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function syncElementProperties(element) {
|
function syncElementProperties(element) {
|
||||||
if(doesEntityDataExist(element, "vrr.interior")) {
|
if(doesEntityDataExist(element, "vrr.interior")) {
|
||||||
if(typeof element.interior != "undefined") {
|
if(typeof element.interior != "undefined") {
|
||||||
element.interior = getEntityData(element, "vrr.interior");
|
element.interior = getEntityData(element, "vrr.interior");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(element.type) {
|
switch(element.type) {
|
||||||
case ELEMENT_VEHICLE:
|
case ELEMENT_VEHICLE:
|
||||||
syncVehicleProperties(element);
|
syncVehicleProperties(element);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ELEMENT_PED:
|
case ELEMENT_PED:
|
||||||
syncCivilianProperties(element);
|
syncCivilianProperties(element);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ELEMENT_PLAYER:
|
case ELEMENT_PLAYER:
|
||||||
syncPlayerProperties(element);
|
syncPlayerProperties(element);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ELEMENT_OBJECT:
|
case ELEMENT_OBJECT:
|
||||||
syncObjectProperties(element);
|
syncObjectProperties(element);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -384,9 +384,9 @@ function syncElementProperties(element) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function receiveHouseFromServer(houseId, entrancePosition, blipModel, pickupModel, hasInterior) {
|
function receiveHouseFromServer(houseId, entrancePosition, blipModel, pickupModel, hasInterior) {
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if(getGame() == VRR_GAME_GTA_IV) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -10,8 +10,8 @@
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initBanScript() {
|
function initBanScript() {
|
||||||
logToConsole(LOG_INFO, "[VRR.Ban]: Initializing ban script ...");
|
logToConsole(LOG_INFO, "[VRR.Ban]: Initializing ban script ...");
|
||||||
logToConsole(LOG_INFO, "[VRR.Ban]: Ban script initialized!");
|
logToConsole(LOG_INFO, "[VRR.Ban]: Ban script initialized!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -22,22 +22,22 @@ function accountBanCommand(command, params, client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let splitParams = params.split(" ");
|
let splitParams = params.split(" ");
|
||||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||||
let reason = splitParams.slice(1).join(" ");
|
let reason = splitParams.slice(1).join(" ");
|
||||||
|
|
||||||
if(!targetClient) {
|
if(!targetClient) {
|
||||||
messagePlayerError(client, "That player is not connected!")
|
messagePlayerError(client, "That player is not connected!")
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
// Prevent banning admins with really high permissions
|
|
||||||
if(doesPlayerHaveStaffPermission(targetClient, "ManageServer") || doesPlayerHaveStaffPermission(targetClient, "Developer")) {
|
|
||||||
messagePlayerError(client, getLocaleString(client, "CantBanPlayer"));
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_WARN, `[VRR.Ban]: ${getPlayerDisplayForConsole(targetClient)} (${getPlayerData(targetClient).accountData.name}) account was banned by ${getPlayerDisplayForConsole(client)}. Reason: ${reason}`);
|
// Prevent banning admins with really high permissions
|
||||||
|
if(doesPlayerHaveStaffPermission(targetClient, "ManageServer") || doesPlayerHaveStaffPermission(targetClient, "Developer")) {
|
||||||
|
messagePlayerError(client, getLocaleString(client, "CantBanPlayer"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
logToConsole(LOG_WARN, `[VRR.Ban]: ${getPlayerDisplayForConsole(targetClient)} (${getPlayerData(targetClient).accountData.name}) account was banned by ${getPlayerDisplayForConsole(client)}. Reason: ${reason}`);
|
||||||
|
|
||||||
messageAdminAction(`{ALTCOLOUR}${getPlayerData(targetClient).currentSubAccountData.name} {MAINCOLOUR}has been account banned.`);
|
messageAdminAction(`{ALTCOLOUR}${getPlayerData(targetClient).currentSubAccountData.name} {MAINCOLOUR}has been account banned.`);
|
||||||
banAccount(getPlayerData(targetClient).accountData.databaseId, getPlayerData(client).accountData.databaseId, reason);
|
banAccount(getPlayerData(targetClient).accountData.databaseId, getPlayerData(client).accountData.databaseId, reason);
|
||||||
@@ -52,27 +52,27 @@ function subAccountBanCommand(command, params, client, fromDiscord) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let splitParams = params.split(" ");
|
let splitParams = params.split(" ");
|
||||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||||
let reason = splitParams.slice(1).join(" ");
|
let reason = splitParams.slice(1).join(" ");
|
||||||
|
|
||||||
if(!targetClient) {
|
if(!targetClient) {
|
||||||
messagePlayerError(client, "That player is not connected!")
|
messagePlayerError(client, "That player is not connected!")
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent banning admins with really high permissions
|
// Prevent banning admins with really high permissions
|
||||||
if(doesPlayerHaveStaffPermission(targetClient, "ManageServer") || doesPlayerHaveStaffPermission(targetClient, "Developer")) {
|
if(doesPlayerHaveStaffPermission(targetClient, "ManageServer") || doesPlayerHaveStaffPermission(targetClient, "Developer")) {
|
||||||
messagePlayerError(client, getLocaleString(client, "CantBanPlayer"));
|
messagePlayerError(client, getLocaleString(client, "CantBanPlayer"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_WARN, `[VRR.Ban]: ${getPlayerDisplayForConsole(targetClient)} (${getPlayerData(targetClient).accountData.name})'s subaccount was banned by ${getPlayerDisplayForConsole(client)}. Reason: ${reason}`);
|
logToConsole(LOG_WARN, `[VRR.Ban]: ${getPlayerDisplayForConsole(targetClient)} (${getPlayerData(targetClient).accountData.name})'s subaccount was banned by ${getPlayerDisplayForConsole(client)}. Reason: ${reason}`);
|
||||||
|
|
||||||
messageAdminAction(`{ALTCOLOUR}${getPlayerData(targetClient).currentSubAccountData.name} {MAINCOLOUR}has been character banned.`);
|
messageAdminAction(`{ALTCOLOUR}${getPlayerData(targetClient).currentSubAccountData.name} {MAINCOLOUR}has been character banned.`);
|
||||||
banSubAccount(getPlayerData(targetClient).currentSubAccountData.databaseId, getPlayerData(client).accountData.databaseId, reason);
|
banSubAccount(getPlayerData(targetClient).currentSubAccountData.databaseId, getPlayerData(client).accountData.databaseId, reason);
|
||||||
|
|
||||||
disconnectPlayer(client);
|
disconnectPlayer(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -81,28 +81,28 @@ function ipBanCommand(command, params, client, fromDiscord) {
|
|||||||
if(areParamsEmpty(params)) {
|
if(areParamsEmpty(params)) {
|
||||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let splitParams = params.split(" ");
|
let splitParams = params.split(" ");
|
||||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||||
let reason = splitParams.slice(1).join(" ");
|
let reason = splitParams.slice(1).join(" ");
|
||||||
|
|
||||||
if(!targetClient) {
|
if(!targetClient) {
|
||||||
messagePlayerError(client, "That player is not connected!")
|
messagePlayerError(client, "That player is not connected!")
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent banning admins with really high permissions
|
// Prevent banning admins with really high permissions
|
||||||
if(doesPlayerHaveStaffPermission(targetClient, "ManageServer") || doesPlayerHaveStaffPermission(targetClient, "Developer")) {
|
if(doesPlayerHaveStaffPermission(targetClient, "ManageServer") || doesPlayerHaveStaffPermission(targetClient, "Developer")) {
|
||||||
messagePlayerError(client, getLocaleString(client, "CantBanPlayer"));
|
messagePlayerError(client, getLocaleString(client, "CantBanPlayer"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
messageAdminAction(`{ALTCOLOUR}${getPlayerData(targetClient).currentSubAccountData.name} {MAINCOLOUR}has been IP banned.`);
|
messageAdminAction(`{ALTCOLOUR}${getPlayerData(targetClient).currentSubAccountData.name} {MAINCOLOUR}has been IP banned.`);
|
||||||
banIPAddress(targetClient.ip, getPlayerData(client).accountData.databaseId, reason);
|
banIPAddress(targetClient.ip, getPlayerData(client).accountData.databaseId, reason);
|
||||||
|
|
||||||
server.banIP(targetClient.ip);
|
server.banIP(targetClient.ip);
|
||||||
targetClient.disconnect();
|
targetClient.disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -111,190 +111,189 @@ function subNetBanCommand(command, params, client, fromDiscord) {
|
|||||||
if(areParamsEmpty(params)) {
|
if(areParamsEmpty(params)) {
|
||||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let splitParams = params.split(" ");
|
let splitParams = params.split(" ");
|
||||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||||
let octetAmount = Number(getParam(params, " ", 2));
|
let octetAmount = Number(getParam(params, " ", 2));
|
||||||
let reason = splitParams.slice(2).join(" ");
|
let reason = splitParams.slice(2).join(" ");
|
||||||
|
|
||||||
if(!targetClient) {
|
if(!targetClient) {
|
||||||
messagePlayerError(client, "That player is not connected!")
|
messagePlayerError(client, "That player is not connected!")
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent banning admins with really high permissions
|
// Prevent banning admins with really high permissions
|
||||||
if(doesPlayerHaveStaffPermission(targetClient, "ManageServer") || doesPlayerHaveStaffPermission(targetClient, "Developer")) {
|
if(doesPlayerHaveStaffPermission(targetClient, "ManageServer") || doesPlayerHaveStaffPermission(targetClient, "Developer")) {
|
||||||
messagePlayerError(client, getLocaleString(client, "CantBanPlayer"));
|
messagePlayerError(client, getLocaleString(client, "CantBanPlayer"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
messageAdminAction(`{ALTCOLOUR}${getPlayerData(targetClient).currentSubAccountData.name} {MAINCOLOUR}has been subnet banned`);
|
messageAdminAction(`{ALTCOLOUR}${getPlayerData(targetClient).currentSubAccountData.name} {MAINCOLOUR}has been subnet banned`);
|
||||||
banSubNet(targetClient.ip, getSubNet(targetClient.ip, octetAmount), getPlayerData(client).accountData.databaseId, reason);
|
banSubNet(targetClient.ip, getSubNet(targetClient.ip, octetAmount), getPlayerData(client).accountData.databaseId, reason);
|
||||||
|
|
||||||
server.banIP(targetClient.ip);
|
server.banIP(targetClient.ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function banAccount(accountId, adminAccountId, reason) {
|
function banAccount(accountId, adminAccountId, reason) {
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if(dbConnection) {
|
if(dbConnection) {
|
||||||
let safeReason = dbConnection.escapetoString(reason);
|
let safeReason = dbConnection.escapetoString(reason);
|
||||||
let dbQuery = queryDatabase(dbConnection, `INSERT INTO ban_main (ban_type, ban_detail, ban_who_banned, ban_reason) VALUES (${VRR_BANTYPE_ACCOUNT}, ${accountId}, ${adminAccountId}, '${safeReason}');`);
|
let dbQuery = queryDatabase(dbConnection, `INSERT INTO ban_main (ban_type, ban_detail, ban_who_banned, ban_reason) VALUES (${VRR_BANTYPE_ACCOUNT}, ${accountId}, ${adminAccountId}, '${safeReason}');`);
|
||||||
freeDatabaseQuery(dbQuery);
|
freeDatabaseQuery(dbQuery);
|
||||||
dbConnection.close();
|
dbConnection.close();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function banSubAccount(subAccountId, adminAccountId, reason) {
|
function banSubAccount(subAccountId, adminAccountId, reason) {
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if(dbConnection) {
|
if(dbConnection) {
|
||||||
let safeReason = dbConnection.escapetoString(reason);
|
let safeReason = dbConnection.escapetoString(reason);
|
||||||
let dbQuery = queryDatabase(dbConnection, `INSERT INTO ban_main (ban_type, ban_detail, ban_who_banned, ban_reason) VALUES (${VRR_BANTYPE_SUBACCOUNT}, ${subAccountId}, ${adminAccountId}, '${safeReason}');`);
|
let dbQuery = queryDatabase(dbConnection, `INSERT INTO ban_main (ban_type, ban_detail, ban_who_banned, ban_reason) VALUES (${VRR_BANTYPE_SUBACCOUNT}, ${subAccountId}, ${adminAccountId}, '${safeReason}');`);
|
||||||
freeDatabaseQuery(dbQuery);
|
freeDatabaseQuery(dbQuery);
|
||||||
dbConnection.close();
|
dbConnection.close();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function banIPAddress(ipAddress, adminAccountId, reason) {
|
function banIPAddress(ipAddress, adminAccountId, reason) {
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if(dbConnection) {
|
if(dbConnection) {
|
||||||
let safeReason = dbConnection.escapetoString(reason);
|
let safeReason = dbConnection.escapetoString(reason);
|
||||||
let dbQuery = queryDatabase(dbConnection, `INSERT INTO ban_main (ban_type, ban_detail, ban_who_banned, ban_reason) VALUES (${VRR_BANTYPE_IPADDRESS}, INET_ATON(${ipAddress}), ${adminAccountId}, '${safeReason}');`);
|
let dbQuery = queryDatabase(dbConnection, `INSERT INTO ban_main (ban_type, ban_detail, ban_who_banned, ban_reason) VALUES (${VRR_BANTYPE_IPADDRESS}, INET_ATON(${ipAddress}), ${adminAccountId}, '${safeReason}');`);
|
||||||
freeDatabaseQuery(dbQuery);
|
freeDatabaseQuery(dbQuery);
|
||||||
dbConnection.close();
|
dbConnection.close();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function banSubNet(ipAddressStart, ipAddressEnd, adminAccountId, reason) {
|
function banSubNet(ipAddressStart, ipAddressEnd, adminAccountId, reason) {
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if(dbConnection) {
|
if(dbConnection) {
|
||||||
let safeReason = dbConnection.escapetoString(reason);
|
let safeReason = dbConnection.escapetoString(reason);
|
||||||
let dbQuery = queryDatabase(dbConnection, `INSERT INTO ban_main (ban_type, ban_ip_start, ban_ip_end, ban_who_banned, ban_reason) VALUES (${VRR_BANTYPE_SUBNET}, INET_ATON(${ipAddressStart}), INET_ATON(${ipAddressEnd}), ${adminAccountId}, '${safeReason}');`);
|
let dbQuery = queryDatabase(dbConnection, `INSERT INTO ban_main (ban_type, ban_ip_start, ban_ip_end, ban_who_banned, ban_reason) VALUES (${VRR_BANTYPE_SUBNET}, INET_ATON(${ipAddressStart}), INET_ATON(${ipAddressEnd}), ${adminAccountId}, '${safeReason}');`);
|
||||||
freeDatabaseQuery(dbQuery);
|
freeDatabaseQuery(dbQuery);
|
||||||
dbConnection.close();
|
dbConnection.close();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function unbanAccount(accountId, adminAccountId) {
|
function unbanAccount(accountId, adminAccountId) {
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if(dbConnection) {
|
if(dbConnection) {
|
||||||
let dbQuery = queryDatabase(dbConnection, `UPDATE ban_main SET ban_who_removed=${adminAccountId}, ban_removed=1 WHERE ban_type=${VRR_BANTYPE_ACCOUNT} AND ban_detail=${accountId}`);
|
let dbQuery = queryDatabase(dbConnection, `UPDATE ban_main SET ban_who_removed=${adminAccountId}, ban_removed=1 WHERE ban_type=${VRR_BANTYPE_ACCOUNT} AND ban_detail=${accountId}`);
|
||||||
freeDatabaseQuery(dbQuery);
|
freeDatabaseQuery(dbQuery);
|
||||||
dbConnection.close();
|
dbConnection.close();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function unbanSubAccount(subAccountId, adminAccountId) {
|
function unbanSubAccount(subAccountId, adminAccountId) {
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if(dbConnection) {
|
if(dbConnection) {
|
||||||
let dbQuery = queryDatabase(dbConnection, `UPDATE ban_main SET ban_who_removed=${adminAccountId}, ban_removed=1 WHERE ban_type=${VRR_BANTYPE_SUBACCOUNT} AND ban_detail=${subAccountId}`);
|
let dbQuery = queryDatabase(dbConnection, `UPDATE ban_main SET ban_who_removed=${adminAccountId}, ban_removed=1 WHERE ban_type=${VRR_BANTYPE_SUBACCOUNT} AND ban_detail=${subAccountId}`);
|
||||||
freeDatabaseQuery(dbQuery);
|
freeDatabaseQuery(dbQuery);
|
||||||
dbConnection.close();
|
dbConnection.close();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function unbanIPAddress(ipAddress, adminAccountId) {
|
function unbanIPAddress(ipAddress, adminAccountId) {
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if(dbConnection) {
|
if(dbConnection) {
|
||||||
let dbQuery = queryDatabase(dbConnection, `UPDATE ban_main SET ban_who_removed=${adminAccountId}, ban_removed=1 WHERE ban_type=${VRR_BANTYPE_IPADDRESS} AND ban_detail=INET_ATON(${ipAddress})`);
|
let dbQuery = queryDatabase(dbConnection, `UPDATE ban_main SET ban_who_removed=${adminAccountId}, ban_removed=1 WHERE ban_type=${VRR_BANTYPE_IPADDRESS} AND ban_detail=INET_ATON(${ipAddress})`);
|
||||||
freeDatabaseQuery(dbQuery);
|
freeDatabaseQuery(dbQuery);
|
||||||
dbConnection.close();
|
dbConnection.close();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function unbanSubNet(ipAddressStart, ipAddressEnd, adminAccountId) {
|
function unbanSubNet(ipAddressStart, ipAddressEnd, adminAccountId) {
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if(dbConnection) {
|
if(dbConnection) {
|
||||||
let dbQuery = queryDatabase(dbConnection, `UPDATE ban_main SET ban_who_removed=${adminAccountId}, ban_removed=1 WHERE ban_type=${VRR_BANTYPE_SUBNET} AND ban_ip_start=INET_ATON(${ipAddressStart}) AND ban_ip_end=INET_ATON(${ipAddressEnd})`);
|
let dbQuery = queryDatabase(dbConnection, `UPDATE ban_main SET ban_who_removed=${adminAccountId}, ban_removed=1 WHERE ban_type=${VRR_BANTYPE_SUBNET} AND ban_ip_start=INET_ATON(${ipAddressStart}) AND ban_ip_end=INET_ATON(${ipAddressEnd})`);
|
||||||
freeDatabaseQuery(dbQuery);
|
freeDatabaseQuery(dbQuery);
|
||||||
dbConnection.close();
|
dbConnection.close();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function isAccountBanned(accountId) {
|
function isAccountBanned(accountId) {
|
||||||
let bans = getServerData().bans;
|
let bans = getServerData().bans;
|
||||||
for(let i in bans) {
|
for(let i in bans) {
|
||||||
if(bans[i].type == VRR_BANTYPE_ACCOUNT) {
|
if(bans[i].type == VRR_BANTYPE_ACCOUNT) {
|
||||||
if(bans[i].detail == accountId) {
|
if(bans[i].detail == accountId) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function isSubAccountBanned(subAccountId) {
|
function isSubAccountBanned(subAccountId) {
|
||||||
let bans = getServerData().bans;
|
let bans = getServerData().bans;
|
||||||
for(let i in bans) {
|
for(let i in bans) {
|
||||||
if(bans[i].type == VRR_BANTYPE_SUBACCOUNT) {
|
if(bans[i].type == VRR_BANTYPE_SUBACCOUNT) {
|
||||||
if(bans[i].detail == subAccountId) {
|
if(bans[i].detail == subAccountId) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function isIpAddressBanned(ipAddress) {
|
function isIpAddressBanned(ipAddress) {
|
||||||
let bans = getServerData().bans;
|
let bans = getServerData().bans;
|
||||||
for(let i in bans) {
|
for(let i in bans) {
|
||||||
if(bans[i].type == VRR_BANTYPE_IPADDRESS) {
|
if(bans[i].type == VRR_BANTYPE_IPADDRESS) {
|
||||||
if(bans[i].detail == ipAddress) {
|
if(bans[i].detail == ipAddress) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -16,31 +16,31 @@ function initDiscordScript() {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
addEventHandler("OnDiscordCommand", function(command, params, discordUser) {
|
addEventHandler("OnDiscordCommand", function(command, params, discordUser) {
|
||||||
let commandData = getCommand(command);
|
let commandData = getCommand(command);
|
||||||
|
|
||||||
if(!commandData) {
|
if(!commandData) {
|
||||||
messagePlayerError(discordUser, "That command does not exist!");
|
messagePlayerError(discordUser, "That command does not exist!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isCommandAllowedOnDiscord(command)) {
|
if(isCommandAllowedOnDiscord(command)) {
|
||||||
messagePlayerError(discordUser, "That command can not be used on Discord!");
|
messagePlayerError(discordUser, "That command can not be used on Discord!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesClientHavePermission(discordUser, getCommandRequiredPermissions(command))) {
|
if(doesClientHavePermission(discordUser, getCommandRequiredPermissions(command))) {
|
||||||
messagePlayerError(discordUser, "You do not have permission to use that command!");
|
messagePlayerError(discordUser, "You do not have permission to use that command!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
commandData.handlerFunction(command, params, discordUser);
|
commandData.handlerFunction(command, params, discordUser);
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function messageDiscordUser(discordUser, messageText) {
|
function messageDiscordUser(discordUser, messageText) {
|
||||||
let socketData = JSON.stringify({
|
let socketData = JSON.stringify({
|
||||||
type: "chat.message.text",
|
type: "chat.message.text",
|
||||||
payload: {
|
payload: {
|
||||||
author: discordUser.name,
|
author: discordUser.name,
|
||||||
@@ -53,88 +53,88 @@ function messageDiscordUser(discordUser, messageText) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendDiscordSocketData(socketData) {
|
function sendDiscordSocketData(socketData) {
|
||||||
if(!getDiscordSocket()) {
|
if(!getDiscordSocket()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
getDiscordSocket().send(module.hash.encodeBase64(socketData) + "\r\n");
|
getDiscordSocket().send(module.hash.encodeBase64(socketData) + "\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function isClientFromDiscord(client) {
|
function isClientFromDiscord(client) {
|
||||||
if(client == null) {
|
if(client == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(client instanceof Client) {
|
if(client instanceof Client) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getDiscordSocket() {
|
function getDiscordSocket() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getDiscordUserData(discordUserId) {
|
function getDiscordUserData(discordUserId) {
|
||||||
return loadAccountFromDiscordUserId(discordUserId);
|
return loadAccountFromDiscordUserId(discordUserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function messageDiscordChatChannel(message) {
|
function messageDiscordChatChannel(message) {
|
||||||
if(!getServerConfig().discordConfig.sendChat) {
|
if(!getServerConfig().discordConfig.sendChat) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
message = removeColoursInMessage(message);
|
message = removeColoursInMessage(message);
|
||||||
console.warn(message);
|
console.warn(message);
|
||||||
let payloadData = {
|
let payloadData = {
|
||||||
"username": "Chat",
|
"username": "Chat",
|
||||||
"content": message,
|
"content": message,
|
||||||
};
|
};
|
||||||
|
|
||||||
triggerWebHook(getServerConfig().discordConfig.chatChannelWebHookURL, JSON.stringify(payloadData));
|
triggerWebHook(getServerConfig().discordConfig.chatChannelWebHookURL, JSON.stringify(payloadData));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function messageDiscordAdminChannel(message) {
|
function messageDiscordAdminChannel(message) {
|
||||||
if(!getServerConfig().discordConfig.sendAdminEvents) {
|
if(!getServerConfig().discordConfig.sendAdminEvents) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
message = removeColoursInMessage(message);
|
message = removeColoursInMessage(message);
|
||||||
console.warn(message);
|
console.warn(message);
|
||||||
let payloadData = {
|
let payloadData = {
|
||||||
"username": "Admin Event",
|
"username": "Admin Event",
|
||||||
"content": message,
|
"content": message,
|
||||||
};
|
};
|
||||||
|
|
||||||
triggerWebHook(getServerConfig().discordConfig.adminChannelWebHookURL, JSON.stringify(payloadData));
|
triggerWebHook(getServerConfig().discordConfig.adminChannelWebHookURL, JSON.stringify(payloadData));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function messageDiscordEventChannel(message) {
|
function messageDiscordEventChannel(message) {
|
||||||
if(!getServerConfig().discordConfig.sendEvents) {
|
if(!getServerConfig().discordConfig.sendEvents) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
message = removeColoursInMessage(message);
|
message = removeColoursInMessage(message);
|
||||||
console.warn(message);
|
console.warn(message);
|
||||||
let payloadData = {
|
let payloadData = {
|
||||||
"username": "Event",
|
"username": "Event",
|
||||||
"content": message,
|
"content": message,
|
||||||
};
|
};
|
||||||
|
|
||||||
triggerWebHook(getServerConfig().discordConfig.eventChannelWebHookURL, JSON.stringify(payloadData));
|
triggerWebHook(getServerConfig().discordConfig.eventChannelWebHookURL, JSON.stringify(payloadData));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -8,47 +8,47 @@
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initEmailScript() {
|
function initEmailScript() {
|
||||||
if(!checkForSMTPModule()) {
|
if(!checkForSMTPModule()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_INFO, "[VRR.Email]: Initializing email script ...");
|
logToConsole(LOG_INFO, "[VRR.Email]: Initializing email script ...");
|
||||||
emailConfig = loadEmailConfiguration();
|
emailConfig = loadEmailConfiguration();
|
||||||
logToConsole(LOG_INFO, "[VRR.Email]: Email script initialized successfully!");
|
logToConsole(LOG_INFO, "[VRR.Email]: Email script initialized successfully!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendEmail(toEmail, toName, subject, body) {
|
function sendEmail(toEmail, toName, subject, body) {
|
||||||
if(!checkForSMTPModule()) {
|
if(!checkForSMTPModule()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.smtp.send(
|
module.smtp.send(
|
||||||
getEmailConfig().smtp.host,
|
getEmailConfig().smtp.host,
|
||||||
getEmailConfig().smtp.port,
|
getEmailConfig().smtp.port,
|
||||||
intToBool(getEmailConfig().smtp.useTLS),
|
intToBool(getEmailConfig().smtp.useTLS),
|
||||||
getEmailConfig().smtp.username,
|
getEmailConfig().smtp.username,
|
||||||
getEmailConfig().smtp.password,
|
getEmailConfig().smtp.password,
|
||||||
toEmail,
|
toEmail,
|
||||||
toName,
|
toName,
|
||||||
subject,
|
subject,
|
||||||
body,
|
body,
|
||||||
getEmailConfig().smtp.from,
|
getEmailConfig().smtp.from,
|
||||||
getEmailConfig().smtp.fromName);
|
getEmailConfig().smtp.fromName);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadEmailConfiguration() {
|
function loadEmailConfiguration() {
|
||||||
let emailConfigFile = loadTextFile("config/email.json");
|
let emailConfigFile = loadTextFile("config/email.json");
|
||||||
return JSON.parse(emailConfigFile);
|
return JSON.parse(emailConfigFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getEmailConfig() {
|
function getEmailConfig() {
|
||||||
return emailConfig;
|
return emailConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -8,59 +8,59 @@
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initEventScript() {
|
function initEventScript() {
|
||||||
logToConsole(LOG_INFO, "[VRR.Event]: Initializing event script ...");
|
logToConsole(LOG_INFO, "[VRR.Event]: Initializing event script ...");
|
||||||
addAllEventHandlers();
|
addAllEventHandlers();
|
||||||
logToConsole(LOG_INFO, "[VRR.Event]: Event script initialized!");
|
logToConsole(LOG_INFO, "[VRR.Event]: Event script initialized!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function addAllEventHandlers() {
|
function addAllEventHandlers() {
|
||||||
addEventHandler("onResourceStart", onResourceStart);
|
addEventHandler("onResourceStart", onResourceStart);
|
||||||
addEventHandler("onResourceStop", onResourceStop);
|
addEventHandler("onResourceStop", onResourceStop);
|
||||||
addEventHandler("onServerStop", onResourceStop);
|
addEventHandler("onServerStop", onResourceStop);
|
||||||
|
|
||||||
addEventHandler("onProcess", onProcess);
|
addEventHandler("onProcess", onProcess);
|
||||||
addEventHandler("onEntityProcess", onEntityProcess);
|
addEventHandler("onEntityProcess", onEntityProcess);
|
||||||
|
|
||||||
addEventHandler("onPlayerConnect", onPlayerConnect);
|
addEventHandler("onPlayerConnect", onPlayerConnect);
|
||||||
addEventHandler("onPlayerJoin", onPlayerJoin);
|
addEventHandler("onPlayerJoin", onPlayerJoin);
|
||||||
addEventHandler("onPlayerJoined", onPlayerJoined);
|
addEventHandler("onPlayerJoined", onPlayerJoined);
|
||||||
addEventHandler("onPlayerChat", onPlayerChat);
|
addEventHandler("onPlayerChat", onPlayerChat);
|
||||||
addEventHandler("onPlayerQuit", onPlayerQuit);
|
addEventHandler("onPlayerQuit", onPlayerQuit);
|
||||||
addEventHandler("onElementStreamIn", onElementStreamIn);
|
addEventHandler("onElementStreamIn", onElementStreamIn);
|
||||||
addEventHandler("onElementStreamOut", onElementStreamOut);
|
addEventHandler("onElementStreamOut", onElementStreamOut);
|
||||||
|
|
||||||
addEventHandler("onPedSpawn", onPedSpawn);
|
addEventHandler("onPedSpawn", onPedSpawn);
|
||||||
addEventHandler("onPedEnterVehicle", onPedEnteringVehicle);
|
addEventHandler("onPedEnterVehicle", onPedEnteringVehicle);
|
||||||
addEventHandler("onPedExitVehicle", onPedExitingVehicle);
|
addEventHandler("onPedExitVehicle", onPedExitingVehicle);
|
||||||
|
|
||||||
addEventHandler("onPedEnteringVehicle", onPedEnteringVehicle);
|
addEventHandler("onPedEnteringVehicle", onPedEnteringVehicle);
|
||||||
addEventHandler("onPedExitingVehicle", onPedExitingVehicle);
|
addEventHandler("onPedExitingVehicle", onPedExitingVehicle);
|
||||||
|
|
||||||
addEventHandler("OnPlayerCommand", onPlayerCommand);
|
addEventHandler("OnPlayerCommand", onPlayerCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPlayerConnect(event, ipAddress, port) {
|
function onPlayerConnect(event, ipAddress, port) {
|
||||||
logToConsole(LOG_INFO, `[VRR.Event] Client connecting (IP: ${ipAddress})`);
|
logToConsole(LOG_INFO, `[VRR.Event] 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;
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPlayerJoin(event, client) {
|
function onPlayerJoin(event, client) {
|
||||||
logToConsole(LOG_INFO, `[VRR.Event] Client ${client.name}[${client.index}] joining from ${client.ip}`);
|
logToConsole(LOG_INFO, `[VRR.Event] Client ${client.name}[${client.index}] joining from ${client.ip}`);
|
||||||
|
|
||||||
if(isFadeCameraSupported()) {
|
if(isFadeCameraSupported()) {
|
||||||
fadeCamera(client, true, 1.0);
|
fadeCamera(client, true, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
messageDiscordEventChannel(`👋 ${getPlayerDisplayForConsole(client)} has joined the server.`);
|
messageDiscordEventChannel(`👋 ${getPlayerDisplayForConsole(client)} has joined the server.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -72,16 +72,16 @@ function onPlayerJoined(event, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onElementStreamIn(event, element, client) {
|
function onElementStreamIn(event, element, client) {
|
||||||
//if(getPlayerDimension(client) != getElementDimension(element)) {
|
//if(getPlayerDimension(client) != getElementDimension(element)) {
|
||||||
// event.preventDefault();
|
// event.preventDefault();
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if(getPlayerData(getClientFromIndex(element.owner)) != false ) {
|
if(getPlayerData(getClientFromIndex(element.owner)) != false ) {
|
||||||
if(hasBitFlag(getPlayerData(getClientFromIndex(element.owner)).accountData.flags.moderation, getModerationFlagValue("DontSyncClientElements"))) {
|
if(hasBitFlag(getPlayerData(getClientFromIndex(element.owner)).accountData.flags.moderation, getModerationFlagValue("DontSyncClientElements"))) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
destroyGameElement(element);
|
destroyGameElement(element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -93,39 +93,39 @@ function onElementStreamOut(event, element, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPlayerQuit(event, client, quitReasonId) {
|
function onPlayerQuit(event, client, quitReasonId) {
|
||||||
logToConsole(LOG_INFO, `👋 Client ${getPlayerDisplayForConsole(client)} disconnected (${disconnectReasons[quitReasonId]}[${quitReasonId}])`);
|
logToConsole(LOG_INFO, `👋 Client ${getPlayerDisplayForConsole(client)} disconnected (${disconnectReasons[quitReasonId]}[${quitReasonId}])`);
|
||||||
updateConnectionLogOnQuit(client, quitReasonId);
|
updateConnectionLogOnQuit(client, quitReasonId);
|
||||||
|
|
||||||
if(isPlayerLoggedIn(client)) {
|
if(isPlayerLoggedIn(client)) {
|
||||||
messagePlayerNormal(null, `👋 ${getPlayerName(client)} has left the server (${disconnectReasons[quitReasonId]})`, getColourByName("softYellow"));
|
messagePlayerNormal(null, `👋 ${getPlayerName(client)} has left the server (${disconnectReasons[quitReasonId]})`, getColourByName("softYellow"));
|
||||||
savePlayerToDatabase(client);
|
savePlayerToDatabase(client);
|
||||||
resetClientStuff(client);
|
resetClientStuff(client);
|
||||||
getServerData().clients[client.index] = null;
|
getServerData().clients[client.index] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
messageDiscordEventChannel(`👋 ${getPlayerDisplayForConsole(client)} has left the server.`);
|
messageDiscordEventChannel(`👋 ${getPlayerDisplayForConsole(client)} has left the server.`);
|
||||||
|
|
||||||
clearTemporaryVehicles();
|
clearTemporaryVehicles();
|
||||||
clearTemporaryPeds();
|
clearTemporaryPeds();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
async function onPlayerChat(event, client, messageText) {
|
async function onPlayerChat(event, client, messageText) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
processPlayerChat(client, messageText);
|
processPlayerChat(client, messageText);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onProcess(event, deltaTime) {
|
function onProcess(event, deltaTime) {
|
||||||
updateServerGameTime();
|
updateServerGameTime();
|
||||||
//checkPlayerSpawning();
|
//checkPlayerSpawning();
|
||||||
//checkPlayerPedState();
|
//checkPlayerPedState();
|
||||||
//checkVehicleBurning();
|
//checkVehicleBurning();
|
||||||
|
|
||||||
processVehiclePurchasing();
|
processVehiclePurchasing();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -136,89 +136,89 @@ function onEntityProcess(event, entity) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPedEnteringVehicle(event, ped, vehicle, seat) {
|
function onPedEnteringVehicle(event, ped, vehicle, seat) {
|
||||||
if(ped.isType(ELEMENT_PLAYER)) {
|
if(ped.isType(ELEMENT_PLAYER)) {
|
||||||
let client = getClientFromPlayerElement(ped);
|
let client = getClientFromPlayerElement(ped);
|
||||||
getPlayerData(client).pedState = VRR_PEDSTATE_ENTERINGVEHICLE;
|
getPlayerData(client).pedState = VRR_PEDSTATE_ENTERINGVEHICLE;
|
||||||
|
|
||||||
if(!getVehicleData(vehicle)) {
|
if(!getVehicleData(vehicle)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getVehicleData(vehicle).locked) {
|
if(getVehicleData(vehicle).locked) {
|
||||||
if(doesPlayerHaveVehicleKeys(client, vehicle)) {
|
if(doesPlayerHaveVehicleKeys(client, vehicle)) {
|
||||||
if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "lock")) {
|
if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "lock")) {
|
||||||
messagePlayerTip(client, `🔒 This ${getVehicleName(vehicle)} is locked. Press {ALTCOLOUR}${toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "lock").key))} {MAINCOLOUR}to unlock it.`);
|
messagePlayerTip(client, `🔒 This ${getVehicleName(vehicle)} is locked. Press {ALTCOLOUR}${toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "lock").key))} {MAINCOLOUR}to unlock it.`);
|
||||||
} else {
|
} else {
|
||||||
messagePlayerNormal(client, `🔒 This ${getVehicleName(vehicle)} is locked. Use /lock to unlock it`);
|
messagePlayerNormal(client, `🔒 This ${getVehicleName(vehicle)} is locked. Use /lock to unlock it`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
messagePlayerNormal(client, `🔒 This ${getVehicleName(vehicle)} is locked and you don't have the keys to unlock it`);
|
messagePlayerNormal(client, `🔒 This ${getVehicleName(vehicle)} is locked and you don't have the keys to unlock it`);
|
||||||
}
|
}
|
||||||
|
|
||||||
getPlayerData(client).enteringVehicle = null;
|
getPlayerData(client).enteringVehicle = null;
|
||||||
makePlayerStopAnimation(client);
|
makePlayerStopAnimation(client);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
getPlayerData(client).enteringVehicle = vehicle;
|
getPlayerData(client).enteringVehicle = vehicle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPedExitingVehicle(event, ped, vehicle) {
|
function onPedExitingVehicle(event, ped, vehicle) {
|
||||||
if(!getVehicleData(vehicle)) {
|
if(!getVehicleData(vehicle)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ped.isType(ELEMENT_PLAYER)) {
|
if(ped.isType(ELEMENT_PLAYER)) {
|
||||||
let client = getClientFromPlayerElement(ped);
|
let client = getClientFromPlayerElement(ped);
|
||||||
getPlayerData(client).pedState = VRR_PEDSTATE_EXITINGVEHICLE;
|
getPlayerData(client).pedState = VRR_PEDSTATE_EXITINGVEHICLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!getVehicleData(vehicle).spawnLocked) {
|
if(!getVehicleData(vehicle).spawnLocked) {
|
||||||
getVehicleData(vehicle).spawnPosition = getVehiclePosition(vehicle);
|
getVehicleData(vehicle).spawnPosition = getVehiclePosition(vehicle);
|
||||||
getVehicleData(vehicle).spawnRotation = getVehicleHeading(vehicle);
|
getVehicleData(vehicle).spawnRotation = getVehicleHeading(vehicle);
|
||||||
getVehicleData(vehicle).needsSaved = true;
|
getVehicleData(vehicle).needsSaved = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onResourceStart(event, resource) {
|
function onResourceStart(event, resource) {
|
||||||
logToConsole(LOG_WARN, `[VRR.Event] ${resource.name} started!`);
|
logToConsole(LOG_WARN, `[VRR.Event] ${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!`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onResourceStop(event, resource) {
|
function onResourceStop(event, resource) {
|
||||||
logToConsole(LOG_WARN, `[VRR.Event] ${resource.name} stopped!`);
|
logToConsole(LOG_WARN, `[VRR.Event] ${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!`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(resource == thisResource) {
|
if(resource == thisResource) {
|
||||||
saveAllServerDataToDatabase();
|
saveAllServerDataToDatabase();
|
||||||
clearArray(getServerData().vehicles);
|
clearArray(getServerData().vehicles);
|
||||||
clearArray(getServerData().clients);
|
clearArray(getServerData().clients);
|
||||||
clearArray(getServerData().businesses);
|
clearArray(getServerData().businesses);
|
||||||
clearArray(getServerData().houses);
|
clearArray(getServerData().houses);
|
||||||
clearArray(getServerData().factions);
|
clearArray(getServerData().factions);
|
||||||
clearArray(getServerData().jobs);
|
clearArray(getServerData().jobs);
|
||||||
clearArray(getServerData().clans);
|
clearArray(getServerData().clans);
|
||||||
clearArray(getServerData().items);
|
clearArray(getServerData().items);
|
||||||
clearArray(getServerData().itemTypes);
|
clearArray(getServerData().itemTypes);
|
||||||
clearArray(getServerData().groundItemCache);
|
clearArray(getServerData().groundItemCache);
|
||||||
clearArray(getServerData().groundPlantCache);
|
clearArray(getServerData().groundPlantCache);
|
||||||
kickAllClients();
|
kickAllClients();
|
||||||
}
|
}
|
||||||
|
|
||||||
collectAllGarbage();
|
collectAllGarbage();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -236,199 +236,199 @@ function onPlayerExitedSphere(client, sphere) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
async function onPlayerEnteredVehicle(client, clientVehicle, seat) {
|
async function onPlayerEnteredVehicle(client, clientVehicle, seat) {
|
||||||
if(client == null) {
|
if(client == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(client.player == null) {
|
if(client.player == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
await waitUntil(() => client != null && client.player != null && client.player.vehicle != null);
|
await waitUntil(() => client != null && client.player != null && client.player.vehicle != null);
|
||||||
//setTimeout(function() {
|
//setTimeout(function() {
|
||||||
//if(client.player.vehicle == null) {
|
//if(client.player.vehicle == null) {
|
||||||
// onPlayerEnteredVehicle(client, clientVehicle, seat);
|
// onPlayerEnteredVehicle(client, clientVehicle, seat);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
let vehicle = client.player.vehicle;
|
let vehicle = client.player.vehicle;
|
||||||
|
|
||||||
//if(vehicle.syncer != client.index) {
|
//if(vehicle.syncer != client.index) {
|
||||||
// if(getPlayerVehicleSeat(client) == VRR_VEHSEAT_DRIVER) {
|
// if(getPlayerVehicleSeat(client) == VRR_VEHSEAT_DRIVER) {
|
||||||
// vehicle.setSyncer(client, true);
|
// vehicle.setSyncer(client, true);
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if(vehicle.owner != -1) {
|
if(vehicle.owner != -1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!getVehicleData(vehicle)) {
|
if(!getVehicleData(vehicle)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//if(getPlayerData(client).enteringVehicle == null || getPlayerData(client).enteringVehicle != vehicle) {
|
//if(getPlayerData(client).enteringVehicle == null || getPlayerData(client).enteringVehicle != vehicle) {
|
||||||
// messagePlayerError(client, "You can't enter this vehicle!");
|
// messagePlayerError(client, "You can't enter this vehicle!");
|
||||||
// removePlayerFromVehicle(client);
|
// removePlayerFromVehicle(client);
|
||||||
// messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}tried to warp into a locked vehicle`);
|
// messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}tried to warp into a locked vehicle`);
|
||||||
// return false;
|
// return false;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} entered a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("vrr.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} entered a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("vrr.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
|
||||||
|
|
||||||
getPlayerData(client).lastVehicle = vehicle;
|
getPlayerData(client).lastVehicle = vehicle;
|
||||||
getVehicleData(vehicle).lastActiveTime = getCurrentUnixTimestamp();
|
getVehicleData(vehicle).lastActiveTime = getCurrentUnixTimestamp();
|
||||||
|
|
||||||
if(getPlayerVehicleSeat(client) == VRR_VEHSEAT_DRIVER) {
|
if(getPlayerVehicleSeat(client) == VRR_VEHSEAT_DRIVER) {
|
||||||
vehicle.engine = getVehicleData(vehicle).engine;
|
vehicle.engine = getVehicleData(vehicle).engine;
|
||||||
|
|
||||||
if(getVehicleData(vehicle).buyPrice > 0) {
|
if(getVehicleData(vehicle).buyPrice > 0) {
|
||||||
messagePlayerAlert(client, getLocaleString(client, "VehicleForSale", getVehicleName(vehicle), `{ALTCOLOUR}$${makeLargeNumberReadable(getVehicleData(vehicle).buyPrice)}{MAINCOLOUR}`, `{ALTCOLOUR}/vehbuy{MAINCOLOUR}`));
|
messagePlayerAlert(client, getLocaleString(client, "VehicleForSale", getVehicleName(vehicle), `{ALTCOLOUR}$${makeLargeNumberReadable(getVehicleData(vehicle).buyPrice)}{MAINCOLOUR}`, `{ALTCOLOUR}/vehbuy{MAINCOLOUR}`));
|
||||||
resetVehiclePosition(vehicle);
|
resetVehiclePosition(vehicle);
|
||||||
} else if(getVehicleData(vehicle).rentPrice > 0) {
|
} else if(getVehicleData(vehicle).rentPrice > 0) {
|
||||||
if(getVehicleData(vehicle).rentedBy != client) {
|
if(getVehicleData(vehicle).rentedBy != client) {
|
||||||
messagePlayerAlert(client, getLocaleString(client, "VehicleForRent", getVehicleName(vehicle), `{ALTCOLOUR}$${makeLargeNumberReadable(getVehicleData(vehicle).rentPrice)}{MAINCOLOUR}`, `{ALTCOLOUR}/vehrent{MAINCOLOUR}`));
|
messagePlayerAlert(client, getLocaleString(client, "VehicleForRent", getVehicleName(vehicle), `{ALTCOLOUR}$${makeLargeNumberReadable(getVehicleData(vehicle).rentPrice)}{MAINCOLOUR}`, `{ALTCOLOUR}/vehrent{MAINCOLOUR}`));
|
||||||
resetVehiclePosition(vehicle);
|
resetVehiclePosition(vehicle);
|
||||||
} else {
|
} else {
|
||||||
messagePlayerAlert(client, `You are renting this ${getVehicleName(vehicle)} for {ALTCOLOUR}$${makeLargeNumberReadable(getVehicleData(vehicle).rentPrice)} per minute. {MAINCOLOUR}Use {ALTCOLOUR}/stoprent {MAINCOLOUR}if you want to stop renting it.`);
|
messagePlayerAlert(client, `You are renting this ${getVehicleName(vehicle)} for {ALTCOLOUR}$${makeLargeNumberReadable(getVehicleData(vehicle).rentPrice)} per minute. {MAINCOLOUR}Use {ALTCOLOUR}/stoprent {MAINCOLOUR}if you want to stop renting it.`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let ownerName = "Nobody";
|
let ownerName = "Nobody";
|
||||||
let ownerType = "None";
|
let ownerType = "None";
|
||||||
ownerType = toLowerCase(getVehicleOwnerTypeText(getVehicleData(vehicle).ownerType));
|
ownerType = toLowerCase(getVehicleOwnerTypeText(getVehicleData(vehicle).ownerType));
|
||||||
switch(getVehicleData(vehicle).ownerType) {
|
switch(getVehicleData(vehicle).ownerType) {
|
||||||
case VRR_VEHOWNER_CLAN:
|
case VRR_VEHOWNER_CLAN:
|
||||||
ownerName = getClanData(getClanIdFromDatabaseId(getVehicleData(vehicle).ownerId)).name;
|
ownerName = getClanData(getClanIdFromDatabaseId(getVehicleData(vehicle).ownerId)).name;
|
||||||
ownerType = "clan";
|
ownerType = "clan";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VRR_VEHOWNER_JOB:
|
case VRR_VEHOWNER_JOB:
|
||||||
ownerName = getJobData(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)).name;
|
ownerName = getJobData(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)).name;
|
||||||
ownerType = "job";
|
ownerType = "job";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VRR_VEHOWNER_PLAYER:
|
case VRR_VEHOWNER_PLAYER:
|
||||||
let subAccountData = loadSubAccountFromId(getVehicleData(vehicle).ownerId);
|
let subAccountData = loadSubAccountFromId(getVehicleData(vehicle).ownerId);
|
||||||
ownerName = `${subAccountData.firstName} ${subAccountData.lastName}`;
|
ownerName = `${subAccountData.firstName} ${subAccountData.lastName}`;
|
||||||
ownerType = "player";
|
ownerType = "player";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VRR_VEHOWNER_BIZ:
|
case VRR_VEHOWNER_BIZ:
|
||||||
ownerName = getBusinessData(getVehicleData(vehicle).ownerId).name;
|
ownerName = getBusinessData(getVehicleData(vehicle).ownerId).name;
|
||||||
ownerType = "business";
|
ownerType = "business";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
messagePlayerAlert(client, `This ${getVehicleName(vehicle)} belongs to {ALTCOLOUR}${ownerName} (${ownerType})`);
|
messagePlayerAlert(client, `This ${getVehicleName(vehicle)} belongs to {ALTCOLOUR}${ownerName} (${ownerType})`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!getVehicleData(vehicle).engine) {
|
if(!getVehicleData(vehicle).engine) {
|
||||||
if(getVehicleData(vehicle).buyPrice == 0 && getVehicleData(vehicle).rentPrice == 0) {
|
if(getVehicleData(vehicle).buyPrice == 0 && getVehicleData(vehicle).rentPrice == 0) {
|
||||||
if(doesPlayerHaveVehicleKeys(client, vehicle)) {
|
if(doesPlayerHaveVehicleKeys(client, vehicle)) {
|
||||||
if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "engine")) {
|
if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "engine")) {
|
||||||
messagePlayerTip(client, `This ${getVehicleName(vehicle)}'s engine is off. Press {ALTCOLOUR}${toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "engine").key))} {MAINCOLOUR}to start it.`);
|
messagePlayerTip(client, `This ${getVehicleName(vehicle)}'s engine is off. Press {ALTCOLOUR}${toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "engine").key))} {MAINCOLOUR}to start it.`);
|
||||||
} else {
|
} else {
|
||||||
messagePlayerAlert(client, `This ${getVehicleName(vehicle)}'s engine is off. Use /engine to start it`);
|
messagePlayerAlert(client, `This ${getVehicleName(vehicle)}'s engine is off. Use /engine to start it`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
messagePlayerAlert(client, `This ${getVehicleName(vehicle)}'s engine is off and you don't have the keys to start it`);
|
messagePlayerAlert(client, `This ${getVehicleName(vehicle)}'s engine is off and you don't have the keys to start it`);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resetVehiclePosition(vehicle);
|
resetVehiclePosition(vehicle);
|
||||||
}
|
}
|
||||||
|
|
||||||
let currentSubAccount = getPlayerCurrentSubAccount(client);
|
let currentSubAccount = getPlayerCurrentSubAccount(client);
|
||||||
|
|
||||||
if(isPlayerWorking(client)) {
|
if(isPlayerWorking(client)) {
|
||||||
if(getVehicleData(vehicle).ownerType == VRR_VEHOWNER_JOB) {
|
if(getVehicleData(vehicle).ownerType == VRR_VEHOWNER_JOB) {
|
||||||
if(getVehicleData(vehicle).ownerId == getPlayerCurrentSubAccount(client).job) {
|
if(getVehicleData(vehicle).ownerId == getPlayerCurrentSubAccount(client).job) {
|
||||||
getPlayerCurrentSubAccount(client).lastJobVehicle = vehicle;
|
getPlayerCurrentSubAccount(client).lastJobVehicle = vehicle;
|
||||||
messagePlayerInfo(client, `Use /startroute to start working in this vehicle`);
|
messagePlayerInfo(client, `Use /startroute to start working in this vehicle`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isPlayerWorking(client)) {
|
if(isPlayerWorking(client)) {
|
||||||
if(isPlayerOnJobRoute(client)) {
|
if(isPlayerOnJobRoute(client)) {
|
||||||
if(vehicle == getPlayerJobRouteVehicle(client)) {
|
if(vehicle == getPlayerJobRouteVehicle(client)) {
|
||||||
stopReturnToJobVehicleCountdown(client);
|
stopReturnToJobVehicleCountdown(client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getVehicleData(vehicle).streamingRadioStation != -1) {
|
if(getVehicleData(vehicle).streamingRadioStation != -1) {
|
||||||
if(getPlayerData(client).streamingRadioStation != getVehicleData(vehicle).streamingRadioStation) {
|
if(getPlayerData(client).streamingRadioStation != getVehicleData(vehicle).streamingRadioStation) {
|
||||||
playRadioStreamForPlayer(client, radioStations[getVehicleData(vehicle).streamingRadioStation].url, true, getPlayerStreamingRadioVolume(client));
|
playRadioStreamForPlayer(client, radioStations[getVehicleData(vehicle).streamingRadioStation].url, true, getPlayerStreamingRadioVolume(client));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//}, client.ping+500);
|
//}, client.ping+500);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPlayerExitedVehicle(client, vehicle) {
|
function onPlayerExitedVehicle(client, vehicle) {
|
||||||
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
||||||
|
|
||||||
stopRadioStreamForPlayer(client);
|
stopRadioStreamForPlayer(client);
|
||||||
|
|
||||||
if(!getVehicleData(vehicle)) {
|
if(!getVehicleData(vehicle)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isPlayerWorking(client)) {
|
if(isPlayerWorking(client)) {
|
||||||
if(isPlayerOnJobRoute(client)) {
|
if(isPlayerOnJobRoute(client)) {
|
||||||
if(vehicle == getPlayerJobRouteVehicle(client)) {
|
if(vehicle == getPlayerJobRouteVehicle(client)) {
|
||||||
startReturnToJobVehicleCountdown(client);
|
startReturnToJobVehicleCountdown(client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getVehicleData(vehicle).lastActiveTime = getCurrentUnixTimestamp();
|
getVehicleData(vehicle).lastActiveTime = getCurrentUnixTimestamp();
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} exited a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("vrr.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} exited a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("vrr.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPlayerDeath(client, position) {
|
function onPlayerDeath(client, position) {
|
||||||
logToConsole(LOG_INFO, `${getPlayerDisplayForConsole(client)} died.`);
|
logToConsole(LOG_INFO, `${getPlayerDisplayForConsole(client)} died.`);
|
||||||
getPlayerData(client).pedState = VRR_PEDSTATE_DEAD;
|
getPlayerData(client).pedState = VRR_PEDSTATE_DEAD;
|
||||||
updatePlayerSpawnedState(client, false);
|
updatePlayerSpawnedState(client, false);
|
||||||
setPlayerControlState(client, false);
|
setPlayerControlState(client, false);
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
if(isFadeCameraSupported()) {
|
if(isFadeCameraSupported()) {
|
||||||
fadeCamera(client, false, 1.0);
|
fadeCamera(client, false, 1.0);
|
||||||
}
|
}
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
if(getPlayerCurrentSubAccount(client).inJail) {
|
if(getPlayerCurrentSubAccount(client).inJail) {
|
||||||
let closestJail = getClosestPoliceStation(getPlayerPosition(client));
|
let closestJail = getClosestPoliceStation(getPlayerPosition(client));
|
||||||
client.despawnPlayer();
|
client.despawnPlayer();
|
||||||
getPlayerCurrentSubAccount(client).interior = closestJail.interior;
|
getPlayerCurrentSubAccount(client).interior = closestJail.interior;
|
||||||
getPlayerCurrentSubAccount(client).dimension = closestJail.dimension;
|
getPlayerCurrentSubAccount(client).dimension = closestJail.dimension;
|
||||||
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);
|
fadeCamera(client, true, 1.0);
|
||||||
}
|
}
|
||||||
updatePlayerSpawnedState(client, true);
|
updatePlayerSpawnedState(client, true);
|
||||||
makePlayerStopAnimation(client);
|
makePlayerStopAnimation(client);
|
||||||
setPlayerControlState(client, true);
|
setPlayerControlState(client, true);
|
||||||
} else {
|
} else {
|
||||||
let closestHospital = getClosestHospital(getPlayerPosition(client));
|
let closestHospital = getClosestHospital(getPlayerPosition(client));
|
||||||
client.despawnPlayer();
|
client.despawnPlayer();
|
||||||
getPlayerCurrentSubAccount(client).interior = closestHospital.interior;
|
getPlayerCurrentSubAccount(client).interior = closestHospital.interior;
|
||||||
getPlayerCurrentSubAccount(client).dimension = closestHospital.dimension;
|
getPlayerCurrentSubAccount(client).dimension = closestHospital.dimension;
|
||||||
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);
|
fadeCamera(client, true, 1.0);
|
||||||
}
|
}
|
||||||
updatePlayerSpawnedState(client, true);
|
updatePlayerSpawnedState(client, true);
|
||||||
makePlayerStopAnimation(client);
|
makePlayerStopAnimation(client);
|
||||||
setPlayerControlState(client, true);
|
setPlayerControlState(client, true);
|
||||||
}
|
}
|
||||||
}, 2000);
|
}, 2000);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
@@ -437,175 +437,175 @@ function onPlayerDeath(client, position) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPedSpawn(ped) {
|
function onPedSpawn(ped) {
|
||||||
if(ped.type == ELEMENT_PLAYER) {
|
if(ped.type == ELEMENT_PLAYER) {
|
||||||
//setTimeout(onPlayerSpawn, 250, ped);
|
//setTimeout(onPlayerSpawn, 250, ped);
|
||||||
onPlayerSpawn();
|
onPlayerSpawn();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function onPlayerSpawn(client) {
|
function onPlayerSpawn(client) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Checking for ${getPlayerDisplayForConsole(client)}'s player ped`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Checking for ${getPlayerDisplayForConsole(client)}'s player ped`);
|
||||||
//if(client.player == null) {
|
//if(client.player == null) {
|
||||||
// logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player element not set yet. Rechecking ...`);
|
// logToConsole(LOG_DEBUG, `[VRR.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, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player ped is valid. Continuing spawn processing ...`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player ped is valid. Continuing spawn processing ...`);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s player data`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s player data`);
|
||||||
if(!getPlayerData(client)) {
|
if(!getPlayerData(client)) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player data is invalid. Kicking them from server.`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player data is invalid. Kicking them from server.`);
|
||||||
client.disconnect();
|
client.disconnect();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s login status`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s login status`);
|
||||||
if(!getPlayerData(client).loggedIn) {
|
if(!getPlayerData(client).loggedIn) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} is NOT logged in. Despawning their player.`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} is NOT logged in. Despawning their player.`);
|
||||||
client.disconnect();
|
client.disconnect();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s selected character status`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s selected character status`);
|
||||||
if(getPlayerData(client).currentSubAccount == -1) {
|
if(getPlayerData(client).currentSubAccount == -1) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} has NOT selected a character. Despawning their player.`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} has NOT selected a character. Despawning their player.`);
|
||||||
client.disconnect();
|
client.disconnect();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player data is valid. Continuing spawn processing ...`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player data is valid. Continuing spawn processing ...`);
|
||||||
|
|
||||||
if(getServerGame() == VRR_GAME_GTA_IV) {
|
if(getServerGame() == VRR_GAME_GTA_IV) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped body parts and props`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped body parts and props`);
|
||||||
setEntityData(client.player, "vrr.bodyParts", getPlayerCurrentSubAccount(client).bodyParts, true);
|
setEntityData(client.player, "vrr.bodyParts", getPlayerCurrentSubAccount(client).bodyParts, true);
|
||||||
setEntityData(client.player, "vrr.bodyProps", getPlayerCurrentSubAccount(client).bodyProps, true);
|
setEntityData(client.player, "vrr.bodyProps", getPlayerCurrentSubAccount(client).bodyProps, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped scale (${getPlayerCurrentSubAccount(client).pedScale})`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped scale (${getPlayerCurrentSubAccount(client).pedScale})`);
|
||||||
setEntityData(client.player, "vrr.scale", getPlayerCurrentSubAccount(client).pedScale, true);
|
setEntityData(client.player, "vrr.scale", getPlayerCurrentSubAccount(client).pedScale, true);
|
||||||
|
|
||||||
if(isPlayerSwitchingCharacter(client) || isPlayerCreatingCharacter(client)) {
|
if(isPlayerSwitchingCharacter(client) || isPlayerCreatingCharacter(client)) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s ped is being used for character selection/creation. No further spawn processing needed'`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s ped is being used for character selection/creation. No further spawn processing needed'`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//logToConsole(LOG_DEBUG, `[VRR.Event] Setting player skin for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).skin}`);
|
//logToConsole(LOG_DEBUG, `[VRR.Event] Setting player skin for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).skin}`);
|
||||||
//setPlayerSkin(client, getPlayerCurrentSubAccount(client).skin);
|
//setPlayerSkin(client, getPlayerCurrentSubAccount(client).skin);
|
||||||
|
|
||||||
//if(getPlayerData(client).pedState != VRR_PEDSTATE_READY) {
|
//if(getPlayerData(client).pedState != VRR_PEDSTATE_READY) {
|
||||||
restorePlayerCamera(client);
|
restorePlayerCamera(client);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Storing ${getPlayerDisplayForConsole(client)} ped in client data `);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Storing ${getPlayerDisplayForConsole(client)} ped in client data `);
|
||||||
getPlayerData(client).ped = client.player;
|
getPlayerData(client).ped = client.player;
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Sending ${getPlayerDisplayForConsole(client)} the 'now playing as' message`);
|
logToConsole(LOG_DEBUG, `[VRR.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"));
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Updating spawned state for ${getPlayerDisplayForConsole(client)} to true`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Updating spawned state for ${getPlayerDisplayForConsole(client)} to true`);
|
||||||
updatePlayerSpawnedState(client, true);
|
updatePlayerSpawnedState(client, true);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting player interior for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).interior}`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Setting player interior for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).interior}`);
|
||||||
setPlayerInterior(client, getPlayerCurrentSubAccount(client).interior);
|
setPlayerInterior(client, getPlayerCurrentSubAccount(client).interior);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting player dimension for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).dimension}`);
|
logToConsole(LOG_DEBUG, `[VRR.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, `[VRR.Event] Setting player health for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).health}`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Setting player health for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).health}`);
|
||||||
setPlayerHealth(client, getPlayerCurrentSubAccount(client).health);
|
setPlayerHealth(client, getPlayerCurrentSubAccount(client).health);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting player armour for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).armour}`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Setting player armour for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).armour}`);
|
||||||
setPlayerArmour(client, getPlayerCurrentSubAccount(client).armour);
|
setPlayerArmour(client, getPlayerCurrentSubAccount(client).armour);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Sending ${getPlayerDisplayForConsole(client)}'s job type to their client (${getJobIndexFromDatabaseId(getPlayerCurrentSubAccount(client))})`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Sending ${getPlayerDisplayForConsole(client)}'s job type to their client (${getJobIndexFromDatabaseId(getPlayerCurrentSubAccount(client))})`);
|
||||||
sendPlayerJobType(client, getPlayerCurrentSubAccount(client).job);
|
sendPlayerJobType(client, getPlayerCurrentSubAccount(client).job);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Enabling all rendering states for ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Enabling all rendering states for ${getPlayerDisplayForConsole(client)}`);
|
||||||
setPlayer2DRendering(client, true, true, true, true, true, true);
|
setPlayer2DRendering(client, true, true, true, true, true, true);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Sending snow states to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Sending snow states to ${getPlayerDisplayForConsole(client)}`);
|
||||||
updatePlayerSnowState(client);
|
updatePlayerSnowState(client);
|
||||||
|
|
||||||
if(getServerGame() == VRR_GAME_GTA_SA) {
|
if(getServerGame() == VRR_GAME_GTA_SA) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting player walk and fightstyle for ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Setting player walk and fightstyle for ${getPlayerDisplayForConsole(client)}`);
|
||||||
setEntityData(client.player, "vrr.walkStyle", getPlayerCurrentSubAccount(client).walkStyle, true);
|
setEntityData(client.player, "vrr.walkStyle", getPlayerCurrentSubAccount(client).walkStyle, true);
|
||||||
|
|
||||||
setPlayerFightStyle(client, getPlayerCurrentSubAccount(client).fightStyle);
|
setPlayerFightStyle(client, getPlayerCurrentSubAccount(client).fightStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Updating logo state for ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Updating logo state for ${getPlayerDisplayForConsole(client)}`);
|
||||||
if(getServerConfig().showLogo && doesPlayerHaveLogoEnabled(client)) {
|
if(getServerConfig().showLogo && doesPlayerHaveLogoEnabled(client)) {
|
||||||
updatePlayerShowLogoState(client, true);
|
updatePlayerShowLogoState(client, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Caching ${getPlayerDisplayForConsole(client)}'s hotbar items`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Caching ${getPlayerDisplayForConsole(client)}'s hotbar items`);
|
||||||
cachePlayerHotBarItems(client);
|
cachePlayerHotBarItems(client);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Syncing ${getPlayerDisplayForConsole(client)}'s hotbar`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Syncing ${getPlayerDisplayForConsole(client)}'s hotbar`);
|
||||||
updatePlayerHotBar(client);
|
updatePlayerHotBar(client);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s switchchar state to false`);
|
logToConsole(LOG_DEBUG, `[VRR.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, `[VRR.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
|
||||||
sendPlayerEnterPropertyKey(client, keyId.key);
|
sendPlayerEnterPropertyKey(client, keyId.key);
|
||||||
}
|
}
|
||||||
|
|
||||||
//if(isGTAIV()) {
|
//if(isGTAIV()) {
|
||||||
// setEntityData(client.player, "vrr.bodyPartHair", getPlayerCurrentSubAccount(client).bodyParts.hair, true);
|
// setEntityData(client.player, "vrr.bodyPartHair", getPlayerCurrentSubAccount(client).bodyParts.hair, true);
|
||||||
// setEntityData(client.player, "vrr.bodyPartHead", getPlayerCurrentSubAccount(client).bodyParts.head, true);
|
// setEntityData(client.player, "vrr.bodyPartHead", getPlayerCurrentSubAccount(client).bodyParts.head, true);
|
||||||
// setEntityData(client.player, "vrr.bodyPartUpper", getPlayerCurrentSubAccount(client).bodyParts.upper, true);
|
// setEntityData(client.player, "vrr.bodyPartUpper", getPlayerCurrentSubAccount(client).bodyParts.upper, true);
|
||||||
// setEntityData(client.player, "vrr.bodyPartLower", getPlayerCurrentSubAccount(client).bodyParts.lower, true);
|
// setEntityData(client.player, "vrr.bodyPartLower", getPlayerCurrentSubAccount(client).bodyParts.lower, true);
|
||||||
// setEntityData(client.player, "vrr.bodyPropHair", getPlayerCurrentSubAccount(client).bodyProps.hair, true);
|
// setEntityData(client.player, "vrr.bodyPropHair", getPlayerCurrentSubAccount(client).bodyProps.hair, true);
|
||||||
// setEntityData(client.player, "vrr.bodyPropEyes", getPlayerCurrentSubAccount(client).bodyProps.eyes, true);
|
// setEntityData(client.player, "vrr.bodyPropEyes", getPlayerCurrentSubAccount(client).bodyProps.eyes, true);
|
||||||
// setEntityData(client.player, "vrr.bodyPartHead", getPlayerCurrentSubAccount(client).bodyProps.head, true);
|
// setEntityData(client.player, "vrr.bodyPartHead", getPlayerCurrentSubAccount(client).bodyProps.head, true);
|
||||||
// setEntityData(client.player, "vrr.bodyPartLeftHand", getPlayerCurrentSubAccount(client).bodyProps.leftHand, true);
|
// setEntityData(client.player, "vrr.bodyPartLeftHand", getPlayerCurrentSubAccount(client).bodyProps.leftHand, true);
|
||||||
// setEntityData(client.player, "vrr.bodyPartRightHand", getPlayerCurrentSubAccount(client).bodyProps.rightHand, true);
|
// setEntityData(client.player, "vrr.bodyPartRightHand", getPlayerCurrentSubAccount(client).bodyProps.rightHand, true);
|
||||||
// setEntityData(client.player, "vrr.bodyPartLeftWrist", getPlayerCurrentSubAccount(client).bodyProps.leftWrist, true);
|
// setEntityData(client.player, "vrr.bodyPartLeftWrist", getPlayerCurrentSubAccount(client).bodyProps.leftWrist, true);
|
||||||
// setEntityData(client.player, "vrr.bodyPartRightWrist", getPlayerCurrentSubAccount(client).bodyProps.rightWrist, true);
|
// setEntityData(client.player, "vrr.bodyPartRightWrist", getPlayerCurrentSubAccount(client).bodyProps.rightWrist, true);
|
||||||
// setEntityData(client.player, "vrr.bodyPartHip", getPlayerCurrentSubAccount(client).bodyProps.hip, true);
|
// setEntityData(client.player, "vrr.bodyPartHip", getPlayerCurrentSubAccount(client).bodyProps.hip, true);
|
||||||
// setEntityData(client.player, "vrr.bodyPartLeftFoot", getPlayerCurrentSubAccount(client).bodyProps.leftFoot, true);
|
// setEntityData(client.player, "vrr.bodyPartLeftFoot", getPlayerCurrentSubAccount(client).bodyProps.leftFoot, true);
|
||||||
// setEntityData(client.player, "vrr.bodyPartRightFoot", getPlayerCurrentSubAccount(client).bodyProps.rightFoot, true);
|
// setEntityData(client.player, "vrr.bodyPartRightFoot", getPlayerCurrentSubAccount(client).bodyProps.rightFoot, true);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if(isGTAIV()) {
|
if(isGTAIV()) {
|
||||||
sendPlayerPedPartsAndProps(client);
|
sendPlayerPedPartsAndProps(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped state to ready`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped state to ready`);
|
||||||
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
||||||
|
|
||||||
syncPlayerProperties(client);
|
syncPlayerProperties(client);
|
||||||
//setTimeout(function() {
|
//setTimeout(function() {
|
||||||
// syncPlayerProperties(client);
|
// syncPlayerProperties(client);
|
||||||
//}, 1000);
|
//}, 1000);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Syncing ${getPlayerDisplayForConsole(client)}'s cash ${getPlayerCurrentSubAccount(client).cash}`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Syncing ${getPlayerDisplayForConsole(client)}'s cash ${getPlayerCurrentSubAccount(client).cash}`);
|
||||||
updatePlayerCash(client);
|
updatePlayerCash(client);
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Updating all player name tags`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Updating all player name tags`);
|
||||||
updateAllPlayerNameTags();
|
updateAllPlayerNameTags();
|
||||||
|
|
||||||
if(!areServerElementsSupported()) {
|
if(!areServerElementsSupported()) {
|
||||||
sendAllBusinessEntrancesToPlayer(client);
|
sendAllBusinessEntrancesToPlayer(client);
|
||||||
sendAllHouseEntrancesToPlayer(client);
|
sendAllHouseEntrancesToPlayer(client);
|
||||||
//sendAllJobLocationsToPlayer(client);
|
//sendAllJobLocationsToPlayer(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
requestPlayerPedNetworkId(client);
|
requestPlayerPedNetworkId(client);
|
||||||
|
|
||||||
getPlayerData(client).payDayTickStart = sdl.ticks;
|
getPlayerData(client).payDayTickStart = sdl.ticks;
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -15,121 +15,121 @@ function initGUIScript() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function playerPromptAnswerNo(client) {
|
function playerPromptAnswerNo(client) {
|
||||||
if(getPlayerData(client).promptType == VRR_PROMPT_NONE) {
|
if(getPlayerData(client).promptType == VRR_PROMPT_NONE) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.GUI] ${getPlayerDisplayForConsole(client)} answered NO to their prompt (${getPlayerData(client).promptType})`);
|
logToConsole(LOG_DEBUG, `[VRR.GUI] ${getPlayerDisplayForConsole(client)} answered NO to their prompt (${getPlayerData(client).promptType})`);
|
||||||
|
|
||||||
switch(getPlayerData(client).promptType) {
|
switch(getPlayerData(client).promptType) {
|
||||||
case VRR_PROMPT_CREATEFIRSTCHAR:
|
case VRR_PROMPT_CREATEFIRSTCHAR:
|
||||||
logToConsole(LOG_DEBUG, `${getPlayerDisplayForConsole(client)} chose not to create a first character. Kicking them from the server ...`);
|
logToConsole(LOG_DEBUG, `${getPlayerDisplayForConsole(client)} chose not to create a first character. Kicking them from the server ...`);
|
||||||
showPlayerErrorGUI(client, "You don't have a character to play. Goodbye!", "No Characters");
|
showPlayerErrorGUI(client, "You don't have a character to play. Goodbye!", "No Characters");
|
||||||
setTimeout(function() { client.disconnect(); }, 5000);
|
setTimeout(function() { client.disconnect(); }, 5000);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VRR_PROMPT_BIZORDER:
|
case VRR_PROMPT_BIZORDER:
|
||||||
if(getPlayerData(client).businessOrderAmount > 0) {
|
if(getPlayerData(client).businessOrderAmount > 0) {
|
||||||
if(canPlayerUseGUI(client)) {
|
if(canPlayerUseGUI(client)) {
|
||||||
showPlayerErrorGUI(client, "You canceled the order.", "Business Order Canceled");
|
showPlayerErrorGUI(client, "You canceled the order.", "Business Order Canceled");
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `${getPlayerDisplayForConsole(client)} canceled the order of ${getPlayerData(client).businessOrderAmount} ${getPlayerData(client).businessOrderItem} at ${getPlayerData(client).businessOrderCost/getPlayerData(client).businessOrderAmount} each for business ${getBusinessData(getPlayerData(client).businessOrderBusiness)}`);
|
logToConsole(LOG_DEBUG, `${getPlayerDisplayForConsole(client)} canceled the order of ${getPlayerData(client).businessOrderAmount} ${getPlayerData(client).businessOrderItem} at ${getPlayerData(client).businessOrderCost/getPlayerData(client).businessOrderAmount} each for business ${getBusinessData(getPlayerData(client).businessOrderBusiness)}`);
|
||||||
messagePlayerError(client, "You canceled the order!");
|
messagePlayerError(client, "You canceled the order!");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
showPlayerErrorGUI(client, "You aren't ordering anything for a business!", "Business Order Canceled");
|
showPlayerErrorGUI(client, "You aren't ordering anything for a business!", "Business Order Canceled");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
getPlayerData(client).promptType = VRR_PROMPT_NONE;
|
getPlayerData(client).promptType = VRR_PROMPT_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function playerPromptAnswerYes(client) {
|
function playerPromptAnswerYes(client) {
|
||||||
if(getPlayerData(client).promptType == VRR_PROMPT_NONE) {
|
if(getPlayerData(client).promptType == VRR_PROMPT_NONE) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.GUI] ${getPlayerDisplayForConsole(client)} answered YES to their prompt (${getPlayerData(client).promptType})`);
|
logToConsole(LOG_DEBUG, `[VRR.GUI] ${getPlayerDisplayForConsole(client)} answered YES to their prompt (${getPlayerData(client).promptType})`);
|
||||||
|
|
||||||
switch(getPlayerData(client).promptType) {
|
switch(getPlayerData(client).promptType) {
|
||||||
case VRR_PROMPT_CREATEFIRSTCHAR:
|
case VRR_PROMPT_CREATEFIRSTCHAR:
|
||||||
showPlayerNewCharacterGUI(client);
|
showPlayerNewCharacterGUI(client);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VRR_PROMPT_BIZORDER:
|
case VRR_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, `[VRR.GUI] ${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, `[VRR.GUI] ${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)`);
|
||||||
showPlayerErrorGUI(client, "This business doesn't have enough money! Deposit some using /bizdeposit", "Business Order Canceled");
|
showPlayerErrorGUI(client, "This business doesn't have enough money! Deposit some using /bizdeposit", "Business Order Canceled");
|
||||||
getPlayerData(client).businessOrderAmount = 0;
|
getPlayerData(client).businessOrderAmount = 0;
|
||||||
getPlayerData(client).businessOrderBusiness = false;
|
getPlayerData(client).businessOrderBusiness = false;
|
||||||
getPlayerData(client).businessOrderItem = -1;
|
getPlayerData(client).businessOrderItem = -1;
|
||||||
getPlayerData(client).businessOrderValue = -1;
|
getPlayerData(client).businessOrderValue = -1;
|
||||||
} else {
|
} else {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.GUI] ${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, `[VRR.GUI] ${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, `You ordered ${getPlayerData(client).businessOrderAmount} ${getItemTypeData(getPlayerData(client).businessOrderItem).name} (${getItemValueDisplay(getPlayerData(client).businessOrderItem, getPlayerData(client).businessOrderValue)}) for ${getPlayerData(client).businessOrderCost}!`, "Business Order Successful");
|
showPlayerInfoGUI(client, `You ordered ${getPlayerData(client).businessOrderAmount} ${getItemTypeData(getPlayerData(client).businessOrderItem).name} (${getItemValueDisplay(getPlayerData(client).businessOrderItem, getPlayerData(client).businessOrderValue)}) for ${getPlayerData(client).businessOrderCost}!`, "Business Order Successful");
|
||||||
createItem(getPlayerData(client).businessOrderItem, getPlayerData(client).businessOrderValue, VRR_ITEM_OWNER_BIZFLOOR, getBusinessData(getPlayerData(client).businessOrderBusiness).databaseId, getPlayerData(client).businessOrderAmount);
|
createItem(getPlayerData(client).businessOrderItem, getPlayerData(client).businessOrderValue, VRR_ITEM_OWNER_BIZFLOOR, getBusinessData(getPlayerData(client).businessOrderBusiness).databaseId, getPlayerData(client).businessOrderAmount);
|
||||||
cacheBusinessItems(getPlayerData(client).businessOrderBusiness);
|
cacheBusinessItems(getPlayerData(client).businessOrderBusiness);
|
||||||
getBusinessData(getPlayerData(client).businessOrderBusiness).till -= getPlayerData(client).businessOrderCost;
|
getBusinessData(getPlayerData(client).businessOrderBusiness).till -= getPlayerData(client).businessOrderCost;
|
||||||
updateBusinessPickupLabelData(getPlayerData(client).businessOrderBusiness);
|
updateBusinessPickupLabelData(getPlayerData(client).businessOrderBusiness);
|
||||||
getPlayerData(client).businessOrderAmount = 0;
|
getPlayerData(client).businessOrderAmount = 0;
|
||||||
getPlayerData(client).businessOrderBusiness = false;
|
getPlayerData(client).businessOrderBusiness = false;
|
||||||
getPlayerData(client).businessOrderItem = -1;
|
getPlayerData(client).businessOrderItem = -1;
|
||||||
getPlayerData(client).businessOrderValue = -1;
|
getPlayerData(client).businessOrderValue = -1;
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
showPlayerErrorGUI(client, `You aren't ordering anything for a business!`, `Business Order Canceled`);
|
showPlayerErrorGUI(client, `You aren't ordering anything for a business!`, `Business Order Canceled`);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
getPlayerData(client).promptType = VRR_PROMPT_NONE;
|
getPlayerData(client).promptType = VRR_PROMPT_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function canPlayerUseGUI(client) {
|
function canPlayerUseGUI(client) {
|
||||||
return (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client));
|
return (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function playerPromptAnswerYesCommand(command, params, client) {
|
function playerPromptAnswerYesCommand(command, params, client) {
|
||||||
playerPromptAnswerYes(client);
|
playerPromptAnswerYes(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function playerPromptAnswerNoCommand(command, params, client) {
|
function playerPromptAnswerNoCommand(command, params, client) {
|
||||||
playerPromptAnswerNo(client);
|
playerPromptAnswerNo(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function playerToggledGUI(client) {
|
function playerToggledGUI(client) {
|
||||||
toggleAccountGUICommand("gui", "", client);
|
toggleAccountGUICommand("gui", "", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerChangePasswordGUI(client) {
|
function showPlayerChangePasswordGUI(client) {
|
||||||
sendNetworkEventToPlayer("vrr.changePassword", client);
|
sendNetworkEventToPlayer("vrr.changePassword", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showPlayerTwoFactorAuthenticationGUI(client) {
|
function showPlayerTwoFactorAuthenticationGUI(client) {
|
||||||
sendNetworkEventToPlayer("vrr.2fa", client);
|
sendNetworkEventToPlayer("vrr.2fa", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -15,144 +15,144 @@ function initHelpScript() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
let randomTips = [
|
let randomTips = [
|
||||||
`{MAINCOLOUR}Look for yellow dots on your map for job locations.`,
|
`{MAINCOLOUR}Look for yellow dots on your map for job locations.`,
|
||||||
`{MAINCOLOUR}You can set custom key binds. Use {ALTCOLOUR}/help keys {MAINCOLOUR} for details.`,
|
`{MAINCOLOUR}You can set custom key binds. Use {ALTCOLOUR}/help keys {MAINCOLOUR} for details.`,
|
||||||
`{MAINCOLOUR}Use /notips if you don't want to see tips and extra information`,
|
`{MAINCOLOUR}Use /notips if you don't want to see tips and extra information`,
|
||||||
`{MAINCOLOUR}You can edit your keybinds using {ALTCOLOUR}/bindkey and /unbindkey`,
|
`{MAINCOLOUR}You can edit your keybinds using {ALTCOLOUR}/bindkey and /unbindkey`,
|
||||||
`{MAINCOLOUR}Press ℹ️ to see your inventory, and use number keys to select an item`,
|
`{MAINCOLOUR}Press ℹ️ to see your inventory, and use number keys to select an item`,
|
||||||
`{MAINCOLOUR}Use /buy at a business to purchase items.`,
|
`{MAINCOLOUR}Use /buy at a business to purchase items.`,
|
||||||
`{MAINCOLOUR}Found a bug? Report it with {ALTCOLOUR}/bug`,
|
`{MAINCOLOUR}Found a bug? Report it with {ALTCOLOUR}/bug`,
|
||||||
`{MAINCOLOUR}Have an idea or suggestion for the server? Let the devs know using {ALTCOLOUR}/idea`,
|
`{MAINCOLOUR}Have an idea or suggestion for the server? Let the devs know using {ALTCOLOUR}/idea`,
|
||||||
`{MAINCOLOUR}Want to buy a business? Use /bizbuy at one for sale`,
|
`{MAINCOLOUR}Want to buy a business? Use /bizbuy at one for sale`,
|
||||||
`{MAINCOLOUR}Want to buy a house? Use /housebuy at one for sale`,
|
`{MAINCOLOUR}Want to buy a house? Use /housebuy at one for sale`,
|
||||||
`{MAINCOLOUR}Want to buy a vehicle? Visit a dealership and enter one for info on how to buy it!`,
|
`{MAINCOLOUR}Want to buy a vehicle? Visit a dealership and enter one for info on how to buy it!`,
|
||||||
`{MAINCOLOUR}Switch to any of your characters with {ALTCOLOUR}/switchchar`,
|
`{MAINCOLOUR}Switch to any of your characters with {ALTCOLOUR}/switchchar`,
|
||||||
`{MAINCOLOUR}Use {ALTCOLOUR}/iplogin {MAINCOLOUR}to automatically login when connecting with the same IP`,
|
`{MAINCOLOUR}Use {ALTCOLOUR}/iplogin {MAINCOLOUR}to automatically login when connecting with the same IP`,
|
||||||
`{MAINCOLOUR}Use {ALTCOLOUR}/houselights or /bizlights {MAINCOLOUR}to turn on/off the lights in your house or business`,
|
`{MAINCOLOUR}Use {ALTCOLOUR}/houselights or /bizlights {MAINCOLOUR}to turn on/off the lights in your house or business`,
|
||||||
`{MAINCOLOUR}Use {ALTCOLOUR}/radiostation {MAINCOLOUR}to play an internet radio station in your car, house, or business`,
|
`{MAINCOLOUR}Use {ALTCOLOUR}/radiostation {MAINCOLOUR}to play an internet radio station in your car, house, or business`,
|
||||||
//`{MAINCOLOUR}Lower your car windows with /windows {ALTCOLOUR} to play the vehicle's internet radio station {ALTCOLOUR}(/radiostation) {MAINCOLOUR}to nearby players`,
|
//`{MAINCOLOUR}Lower your car windows with /windows {ALTCOLOUR} to play the vehicle's internet radio station {ALTCOLOUR}(/radiostation) {MAINCOLOUR}to nearby players`,
|
||||||
//`{MAINCOLOUR}Lower your car windows with /windows {ALTCOLOUR} to play the vehicle's internet radio station {ALTCOLOUR}(/radiostation) {MAINCOLOUR}to nearby players`,
|
//`{MAINCOLOUR}Lower your car windows with /windows {ALTCOLOUR} to play the vehicle's internet radio station {ALTCOLOUR}(/radiostation) {MAINCOLOUR}to nearby players`,
|
||||||
//`{MAINCOLOUR}Tax is based on your total wealth. This includes money, vehicles, businesses and more.`,
|
//`{MAINCOLOUR}Tax is based on your total wealth. This includes money, vehicles, businesses and more.`,
|
||||||
//`{MAINCOLOUR}Don't go broke because of a hospital bill! Get insured today by visiting an insurance agency!`,
|
//`{MAINCOLOUR}Don't go broke because of a hospital bill! Get insured today by visiting an insurance agency!`,
|
||||||
//`{MAINCOLOUR}Don't go broke because your car was destroyed. Visit an insurance agency today!`,
|
//`{MAINCOLOUR}Don't go broke because your car was destroyed. Visit an insurance agency today!`,
|
||||||
//`{MAINCOLOUR}You can find most locations by using {ALTCOLOUR}/gps`,
|
//`{MAINCOLOUR}You can find most locations by using {ALTCOLOUR}/gps`,
|
||||||
//`{MAINCOLOUR}Want to advertise your business? Visit the news station and place an /ad today!`,
|
//`{MAINCOLOUR}Want to advertise your business? Visit the news station and place an /ad today!`,
|
||||||
//`{MAINCOLOUR}You can change your quick item display. Choices are GTAV-style pie menu or Minecraft-style hotbar`,
|
//`{MAINCOLOUR}You can change your quick item display. Choices are GTAV-style pie menu or Minecraft-style hotbar`,
|
||||||
//`{MAINCOLOUR}Hold [#0066FF]E {MAINCOLOUR}to hail a nearby taxi if you need a ride.`,
|
//`{MAINCOLOUR}Hold [#0066FF]E {MAINCOLOUR}to hail a nearby taxi if you need a ride.`,
|
||||||
//`{MAINCOLOUR}Press [#0066FF]G {MAINCOLOUR}to enter a vehicle as passenger.`,
|
//`{MAINCOLOUR}Press [#0066FF]G {MAINCOLOUR}to enter a vehicle as passenger.`,
|
||||||
//`{MAINCOLOUR}Banks can provide loans. Use {ALTCOLOUR}/help loans {MAINCOLOUR} for more details.`,
|
//`{MAINCOLOUR}Banks can provide loans. Use {ALTCOLOUR}/help loans {MAINCOLOUR} for more details.`,
|
||||||
`{MAINCOLOUR}Want to make a clan? Use {ALTCOLOUR}/help clans {MAINCOLOUR} for details.`,
|
`{MAINCOLOUR}Want to make a clan? Use {ALTCOLOUR}/help clans {MAINCOLOUR} for details.`,
|
||||||
`{MAINCOLOUR}Legal weapons can be purchased at any ammunation.`,
|
`{MAINCOLOUR}Legal weapons can be purchased at any ammunation.`,
|
||||||
];
|
];
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function helpCommand(command, params, client) {
|
function helpCommand(command, params, client) {
|
||||||
if(areParamsEmpty(params)) {
|
if(areParamsEmpty(params)) {
|
||||||
showMainHelpMessage(client);
|
showMainHelpMessage(client);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let splitParams = params.split(" ");
|
let splitParams = params.split(" ");
|
||||||
|
|
||||||
switch(toLowerCase(getParam(params, " ", 1))) {
|
switch(toLowerCase(getParam(params, " ", 1))) {
|
||||||
case "account":
|
case "account":
|
||||||
showAccountHelpMessage(client);
|
showAccountHelpMessage(client);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "vehicle":
|
case "vehicle":
|
||||||
case "veh":
|
case "veh":
|
||||||
case "vehs":
|
case "vehs":
|
||||||
case "vehicles":
|
case "vehicles":
|
||||||
case "car":
|
case "car":
|
||||||
case "cars":
|
case "cars":
|
||||||
showVehicleHelpMessage(client);
|
showVehicleHelpMessage(client);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "dealership":
|
case "dealership":
|
||||||
showVehicleDealershipHelpMessage(client);
|
showVehicleDealershipHelpMessage(client);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "business":
|
case "business":
|
||||||
showBusinessHelpMessage(client);
|
showBusinessHelpMessage(client);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "job":
|
case "job":
|
||||||
showJobHelpMessage(client);
|
showJobHelpMessage(client);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "chat":
|
case "chat":
|
||||||
showChatHelpMessage(client);
|
showChatHelpMessage(client);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "rules":
|
case "rules":
|
||||||
showRulesHelpMessage(client);
|
showRulesHelpMessage(client);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "website":
|
case "website":
|
||||||
showWebsiteHelpMessage(client);
|
showWebsiteHelpMessage(client);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "discord":
|
case "discord":
|
||||||
showDiscordHelpMessage(client);
|
showDiscordHelpMessage(client);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "anim":
|
case "anim":
|
||||||
case "anims":
|
case "anims":
|
||||||
case "animation":
|
case "animation":
|
||||||
case "animations":
|
case "animations":
|
||||||
showAnimationHelpMessage(client);
|
showAnimationHelpMessage(client);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "skin":
|
case "skin":
|
||||||
case "skins":
|
case "skins":
|
||||||
case "clothes":
|
case "clothes":
|
||||||
showClothesHelpMessage(client);
|
showClothesHelpMessage(client);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "key":
|
case "key":
|
||||||
case "keys":
|
case "keys":
|
||||||
case "keybinds":
|
case "keybinds":
|
||||||
case "keybind":
|
case "keybind":
|
||||||
case "bindkey":
|
case "bindkey":
|
||||||
case "bindkeys":
|
case "bindkeys":
|
||||||
showBindKeysHelpMessage(client);
|
showBindKeysHelpMessage(client);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "command":
|
case "command":
|
||||||
case "cmd":
|
case "cmd":
|
||||||
showCommandHelpMessage(client, getParam(params, " ", 2));
|
showCommandHelpMessage(client, getParam(params, " ", 2));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "clan":
|
case "clan":
|
||||||
case "clans":
|
case "clans":
|
||||||
case "group":
|
case "group":
|
||||||
case "groups":
|
case "groups":
|
||||||
case "faction":
|
case "faction":
|
||||||
case "factions":
|
case "factions":
|
||||||
case "family":
|
case "family":
|
||||||
case "families":
|
case "families":
|
||||||
showClanHelpMessage(client);
|
showClanHelpMessage(client);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "radio":
|
case "radio":
|
||||||
case "radiostations":
|
case "radiostations":
|
||||||
case "music":
|
case "music":
|
||||||
showRadioHelpMessage(client);
|
showRadioHelpMessage(client);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "economy":
|
case "economy":
|
||||||
case "wealth":
|
case "wealth":
|
||||||
case "tax":
|
case "tax":
|
||||||
case "taxes":
|
case "taxes":
|
||||||
case "payday":
|
case "payday":
|
||||||
showWealthAndTaxHelpMessage(client);
|
showWealthAndTaxHelpMessage(client);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
showMainHelpMessage(client);
|
showMainHelpMessage(client);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// == Account Help =============================
|
// == Account Help =============================
|
||||||
@@ -184,152 +184,152 @@ function helpCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showMainHelpMessage(client) {
|
function showMainHelpMessage(client) {
|
||||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderHelpMainList")));
|
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderHelpMainList")));
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Use /help <category> for commands and info. Example: {ALTCOLOUR}/help vehicle`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Use /help <category> for commands and info. Example: {ALTCOLOUR}/help vehicle`);
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Help Categories: [#A9A9A9]account, command, vehicle, job, chat, rules, website, animation`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Help Categories: [#A9A9A9]account, command, vehicle, job, chat, rules, website, animation`);
|
||||||
messagePlayerNormal(client, `{clanOrange}• [#A9A9A9]skin, mechanic, dealership, discord, colour, keybind`);
|
messagePlayerNormal(client, `{clanOrange}• [#A9A9A9]skin, mechanic, dealership, discord, colour, keybind`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showAccountHelpMessage(client) {
|
function showAccountHelpMessage(client) {
|
||||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderAccountHelp")));
|
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderAccountHelp")));
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Do not share your password with anybody else.`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Do not share your password with anybody else.`);
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Use {ALTCOLOUR}/changepass{MAINCOLOUR} to change your password.`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Use {ALTCOLOUR}/changepass{MAINCOLOUR} to change your password.`);
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Some settings you can use: {ALTCOLOUR}/gui, /logo, /iplogin, /autolastchar, /2fa, /loginalert`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Some settings you can use: {ALTCOLOUR}/gui, /logo, /iplogin, /autolastchar, /2fa, /loginalert`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showVehicleHelpMessage(client) {
|
function showVehicleHelpMessage(client) {
|
||||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderVehicleHelp")));
|
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderVehicleHelp")));
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Visit dealerships to buy new vehicles (Use {ALTCOLOUR}/help dealership {MAINCOLOUR}for more info.)`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Visit dealerships to buy new vehicles (Use {ALTCOLOUR}/help dealership {MAINCOLOUR}for more info.)`);
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Some commands: {ALTCOLOUR}/lock, /engine, /lights, /trunk, /rentveh, /buyveh, /rentprice, /buyprice`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Some commands: {ALTCOLOUR}/lock, /engine, /lights, /trunk, /rentveh, /buyveh, /rentprice, /buyprice`);
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Your personal vehicles will save wherever you or somebody else leaves them!`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Your personal vehicles will save wherever you or somebody else leaves them!`);
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Visit a mechanic garage to repair, colour, and tune up your car! {ALTCOLOUR}/help mechanic {MAINCOLOUR} for info`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Visit a mechanic garage to repair, colour, and tune up your car! {ALTCOLOUR}/help mechanic {MAINCOLOUR} for info`);
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Don't forget to register and insure your vehicle! Use {ALTCOLOUR}/gps {MAINCOLOUR}to find a DMV for this.`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Don't forget to register and insure your vehicle! Use {ALTCOLOUR}/gps {MAINCOLOUR}to find a DMV for this.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showVehicleDealershipHelpMessage(client) {
|
function showVehicleDealershipHelpMessage(client) {
|
||||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderVehicleDealershipHelp")));
|
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderVehicleDealershipHelp")));
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Visit a vehicle dealer to buy new vehicles. Use {ALTCOLOUR}/gps {MAINCOLOUR}to find one.`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Visit a vehicle dealer to buy new vehicles. Use {ALTCOLOUR}/gps {MAINCOLOUR}to find one.`);
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}At the dealer, simply enter a car you want to buy, and the price will be shown to you`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}At the dealer, simply enter a car you want to buy, and the price will be shown to you`);
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}If you want to buy the vehicle and have enough money, use {ALTCOLOUR}/buyveh {MAINCOLOUR}and you will be given keys`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}If you want to buy the vehicle and have enough money, use {ALTCOLOUR}/buyveh {MAINCOLOUR}and you will be given keys`);
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}A new car for sale will appear when you drive away from the dealer.`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}A new car for sale will appear when you drive away from the dealer.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showJobHelpMessage(client) {
|
function showJobHelpMessage(client) {
|
||||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderJobHelp")));
|
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderJobHelp")));
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Visit job locations get a job and earn money. Look for yellow spots on the map`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Visit job locations get a job and earn money. Look for yellow spots on the map`);
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}At a job location, use {ALTCOLOUR}/takejob {MAINCOLOUR}to get the job. Use {ALTCOLOUR}/quitjob {MAINCOLOUR}to quit your job`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}At a job location, use {ALTCOLOUR}/takejob {MAINCOLOUR}to get the job. Use {ALTCOLOUR}/quitjob {MAINCOLOUR}to quit your job`);
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Use {ALTCOLOUR}/startwork {MAINCOLOUR}to begin working. You can also get a job {ALTCOLOUR}/uniform and {ALTCOLOUR}/equipment`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Use {ALTCOLOUR}/startwork {MAINCOLOUR}to begin working. You can also get a job {ALTCOLOUR}/uniform and {ALTCOLOUR}/equipment`);
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Most job vehicles are locked. Use {ALTCOLOUR}/lock {MAINCOLOUR}near one to enter it.`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Most job vehicles are locked. Use {ALTCOLOUR}/lock {MAINCOLOUR}near one to enter it.`);
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}When entering a job vehicle, information on how to do the job will be shown to you.`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}When entering a job vehicle, information on how to do the job will be shown to you.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showChatHelpMessage(client) {
|
function showChatHelpMessage(client) {
|
||||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderChatHelp")));
|
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderChatHelp")));
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}There are two main types of chat: out-of-character (OOC) and in-character (IC)`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}There are two main types of chat: out-of-character (OOC) and in-character (IC)`);
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Mixing these two types is not proper roleplay. See {ALTCOLOUR}/rules {MAINCOLOUR}for info.`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Mixing these two types is not proper roleplay. See {ALTCOLOUR}/rules {MAINCOLOUR}for info.`);
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Some chat commands: {ALTCOLOUR}/dm /whisper /talk /shout /me.`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Some chat commands: {ALTCOLOUR}/dm /whisper /talk /shout /me.`);
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Some have shorter names available ({ALTCOLOUR}/t {MAINCOLOUR}for talk, {ALTCOLOUR}/s {MAINCOLOUR}for shout, etc)`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Some have shorter names available ({ALTCOLOUR}/t {MAINCOLOUR}for talk, {ALTCOLOUR}/s {MAINCOLOUR}for shout, etc)`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showRulesHelpMessage(client) {
|
function showRulesHelpMessage(client) {
|
||||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderServerRulesList")));
|
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderServerRulesList")));
|
||||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RulesHelp", 0));
|
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RulesHelp", 0));
|
||||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RulesHelp", 1));
|
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RulesHelp", 1));
|
||||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RulesHelp", 2));
|
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RulesHelp", 2));
|
||||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RulesHelp", 3));
|
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RulesHelp", 3));
|
||||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RulesHelp", 4), `{ALTCOLOUR}/help language {MAINCOLOUR}`);
|
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RulesHelp", 4), `{ALTCOLOUR}/help language {MAINCOLOUR}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showWebsiteHelpMessage(client) {
|
function showWebsiteHelpMessage(client) {
|
||||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderWebsiteInfo")));
|
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderWebsiteInfo")));
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}${server.getRule("Website")}`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}${server.getRule("Website")}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showDiscordHelpMessage(client) {
|
function showDiscordHelpMessage(client) {
|
||||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderDiscordInfo")));
|
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderDiscordInfo")));
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}${server.getRule("Website")}`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}${server.getRule("Website")}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showAnimationHelpMessage(client) {
|
function showAnimationHelpMessage(client) {
|
||||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderAnimationHelp")));
|
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderAnimationHelp")));
|
||||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "AnimationHelp", 0, `{ALTCOLOUR}/buy {MAINCOLOUR}`));
|
messagePlayerHelpContent(client, getGroupedLocaleString(client, "AnimationHelp", 0, `{ALTCOLOUR}/buy {MAINCOLOUR}`));
|
||||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "AnimationHelp", 1, `{ALTCOLOUR}/an {MAINCOLOUR}`, `{ALTCOLOUR}/anim {MAINCOLOUR}`));
|
messagePlayerHelpContent(client, getGroupedLocaleString(client, "AnimationHelp", 1, `{ALTCOLOUR}/an {MAINCOLOUR}`, `{ALTCOLOUR}/anim {MAINCOLOUR}`));
|
||||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "AnimationHelp", 2, `{ALTCOLOUR}/animlist {MAINCOLOUR}`));
|
messagePlayerHelpContent(client, getGroupedLocaleString(client, "AnimationHelp", 2, `{ALTCOLOUR}/animlist {MAINCOLOUR}`));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showClothesHelpMessage(client) {
|
function showClothesHelpMessage(client) {
|
||||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderSkinHelp")));
|
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderSkinHelp")));
|
||||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "SkinHelp", 0, `{ALTCOLOUR}/buy {MAINCOLOUR}`));
|
messagePlayerHelpContent(client, getGroupedLocaleString(client, "SkinHelp", 0, `{ALTCOLOUR}/buy {MAINCOLOUR}`));
|
||||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "SkinHelp", 1, `{ALTCOLOUR}/help items {MAINCOLOUR}`));
|
messagePlayerHelpContent(client, getGroupedLocaleString(client, "SkinHelp", 1, `{ALTCOLOUR}/help items {MAINCOLOUR}`));
|
||||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "SkinHelp", 2));
|
messagePlayerHelpContent(client, getGroupedLocaleString(client, "SkinHelp", 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showBindKeysHelpMessage(client) {
|
function showBindKeysHelpMessage(client) {
|
||||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderBindableKeysHelp")));
|
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderBindableKeysHelp")));
|
||||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "KeyBindHelp", 0, `{ALTCOLOUR}/keybinds {MAINCOLOUR}`));
|
messagePlayerHelpContent(client, getGroupedLocaleString(client, "KeyBindHelp", 0, `{ALTCOLOUR}/keybinds {MAINCOLOUR}`));
|
||||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "KeyBindHelp", 1, `{ALTCOLOUR}/bindkey {MAINCOLOUR}`, `{ALTCOLOUR}/unbindkey {MAINCOLOUR}`));
|
messagePlayerHelpContent(client, getGroupedLocaleString(client, "KeyBindHelp", 1, `{ALTCOLOUR}/bindkey {MAINCOLOUR}`, `{ALTCOLOUR}/unbindkey {MAINCOLOUR}`));
|
||||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "KeyBindHelp", 2, `{ALTCOLOUR}K {MAINCOLOUR}`, `{ALTCOLOUR}L {MAINCOLOUR}`, `{ALTCOLOUR}J {MAINCOLOUR}`));
|
messagePlayerHelpContent(client, getGroupedLocaleString(client, "KeyBindHelp", 2, `{ALTCOLOUR}K {MAINCOLOUR}`, `{ALTCOLOUR}L {MAINCOLOUR}`, `{ALTCOLOUR}J {MAINCOLOUR}`));
|
||||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "KeyBindHelp", 3, `{ALTCOLOUR}I {MAINCOLOUR}`, `{ALTCOLOUR}1-9 {MAINCOLOUR}`, `{ALTCOLOUR}0 {MAINCOLOUR}`));
|
messagePlayerHelpContent(client, getGroupedLocaleString(client, "KeyBindHelp", 3, `{ALTCOLOUR}I {MAINCOLOUR}`, `{ALTCOLOUR}1-9 {MAINCOLOUR}`, `{ALTCOLOUR}0 {MAINCOLOUR}`));
|
||||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "KeyBindHelp", 4, `{ALTCOLOUR}U {MAINCOLOUR}`, `{ALTCOLOUR}O {MAINCOLOUR}`, `{ALTCOLOUR}P {MAINCOLOUR}`));
|
messagePlayerHelpContent(client, getGroupedLocaleString(client, "KeyBindHelp", 4, `{ALTCOLOUR}U {MAINCOLOUR}`, `{ALTCOLOUR}O {MAINCOLOUR}`, `{ALTCOLOUR}P {MAINCOLOUR}`));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showBusinessHelpMessage(client) {
|
function showBusinessHelpMessage(client) {
|
||||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderBusinessHelp")));
|
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderBusinessHelp")));
|
||||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "BusinessHelp", 0));
|
messagePlayerHelpContent(client, getGroupedLocaleString(client, "BusinessHelp", 0));
|
||||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "BusinessHelp", 1));
|
messagePlayerHelpContent(client, getGroupedLocaleString(client, "BusinessHelp", 1));
|
||||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "BusinessHelp", 2, `{ALTCOLOUR}/bizorder, /bizlock, /bizlights, /radiostation, /bizitemprice, /bizbuyprice, /bizfee, /biztill, /bizwithdraw, /bizdeposit`));
|
messagePlayerHelpContent(client, getGroupedLocaleString(client, "BusinessHelp", 2, `{ALTCOLOUR}/bizorder, /bizlock, /bizlights, /radiostation, /bizitemprice, /bizbuyprice, /bizfee, /biztill, /bizwithdraw, /bizdeposit`));
|
||||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "BusinessHelp", 3));
|
messagePlayerHelpContent(client, getGroupedLocaleString(client, "BusinessHelp", 3));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showClanHelpMessage(client) {
|
function showClanHelpMessage(client) {
|
||||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderClanHelp")));
|
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderClanHelp")));
|
||||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "ClanHelp", 0));
|
messagePlayerHelpContent(client, getGroupedLocaleString(client, "ClanHelp", 0));
|
||||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "ClanHelp", 1));
|
messagePlayerHelpContent(client, getGroupedLocaleString(client, "ClanHelp", 1));
|
||||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "ClanHelp", 2, `{ALTCOLOUR}/clan, /clanmotd, /clanname, /clanowner, /clanhouse, /clanbiz, /claninvite, /clanuninvite, /clansetrank`));
|
messagePlayerHelpContent(client, getGroupedLocaleString(client, "ClanHelp", 2, `{ALTCOLOUR}/clan, /clanmotd, /clanname, /clanowner, /clanhouse, /clanbiz, /claninvite, /clanuninvite, /clansetrank`));
|
||||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "ClanHelp", 3, `{ALTCOLOUR}/clanranks, /clanflags, /clanaddrank, /clandelrank, /clanaddrankflag, /clandelrankflag, /clanaddmemberflag, /clandelmemberflag`));
|
messagePlayerHelpContent(client, getGroupedLocaleString(client, "ClanHelp", 3, `{ALTCOLOUR}/clanranks, /clanflags, /clanaddrank, /clandelrank, /clanaddrankflag, /clandelrankflag, /clanaddmemberflag, /clandelmemberflag`));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showRadioHelpMessage(client) {
|
function showRadioHelpMessage(client) {
|
||||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderRadioHelp")));
|
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderRadioHelp")));
|
||||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RadioHelp", 0, `{ALTCOLOUR}/radiostation {MAINCOLOUR}`));
|
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RadioHelp", 0, `{ALTCOLOUR}/radiostation {MAINCOLOUR}`));
|
||||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RadioHelp", 1, `{ALTCOLOUR}/radiostations {MAINCOLOUR}`));
|
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RadioHelp", 1, `{ALTCOLOUR}/radiostations {MAINCOLOUR}`));
|
||||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RadioHelp", 2, `{ALTCOLOUR}/radiovolume {MAINCOLOUR}`));
|
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RadioHelp", 2, `{ALTCOLOUR}/radiovolume {MAINCOLOUR}`));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showWealthAndTaxHelpMessage(client) {
|
function showWealthAndTaxHelpMessage(client) {
|
||||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderWealthandTaxHelp")));
|
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderWealthandTaxHelp")));
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Your taxes on payday are ${100*getGlobalConfig().economy.incomeTaxRate}% of your calculated wealth.`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Your taxes on payday are ${100*getGlobalConfig().economy.incomeTaxRate}% of your calculated wealth.`);
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Your calculated wealth is a total sum based on how many vehicles, houses, and businesses you have.`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Your calculated wealth is a total sum based on how many vehicles, houses, and businesses you have.`);
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Each vehicle is {ALTCOLOUR}${getGlobalConfig().economy.upKeepCosts.upKeepPerVehicle}, {MAINCOLOUR}each house is {ALTCOLOUR}${getGlobalConfig().economy.upKeepCosts.upKeepPerHouse}, {MAINCOLOUR}and each business is {ALTCOLOUR}${getGlobalConfig().economy.upKeepCosts.upKeepPerBusiness}`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Each vehicle is {ALTCOLOUR}${getGlobalConfig().economy.upKeepCosts.upKeepPerVehicle}, {MAINCOLOUR}each house is {ALTCOLOUR}${getGlobalConfig().economy.upKeepCosts.upKeepPerHouse}, {MAINCOLOUR}and each business is {ALTCOLOUR}${getGlobalConfig().economy.upKeepCosts.upKeepPerBusiness}`);
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Use {ALTCOLOUR}/wealth {MAINCOLOUR}to see your current wealth, and {ALTCOLOUR}/tax {MAINCOLOUR}to see how much you'll pay in tax each payday`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Use {ALTCOLOUR}/wealth {MAINCOLOUR}to see your current wealth, and {ALTCOLOUR}/tax {MAINCOLOUR}to see how much you'll pay in tax each payday`);
|
||||||
}
|
}
|
||||||
@@ -337,35 +337,35 @@ function showWealthAndTaxHelpMessage(client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showCommandHelpMessage(client, commandName) {
|
function showCommandHelpMessage(client, commandName) {
|
||||||
if(!commandName) {
|
if(!commandName) {
|
||||||
messagePlayerSyntax(client, `${getCommandSyntaxText("help")}command <command name>`);
|
messagePlayerSyntax(client, `${getCommandSyntaxText("help")}command <command name>`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
commandName = toLowerCase(commandName);
|
commandName = toLowerCase(commandName);
|
||||||
commandName = commandName.trim();
|
commandName = commandName.trim();
|
||||||
|
|
||||||
if(commandName.slice(0, 1) == "/") {
|
if(commandName.slice(0, 1) == "/") {
|
||||||
commandName = commandName.slice(1);
|
commandName = commandName.slice(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
let command = getCommandData(commandName);
|
let command = getCommandData(commandName);
|
||||||
let aliases = getCommandAliasesNames(command);
|
let aliases = getCommandAliasesNames(command);
|
||||||
|
|
||||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderCommandInfo", commandName)));
|
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderCommandInfo", commandName)));
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Description: ${command.description}`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Description: ${command.description}`);
|
||||||
|
|
||||||
if(aliases.length > 0) {
|
if(aliases.length > 0) {
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Aliases: ${aliases.join(", ")}`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Aliases: ${aliases.join(", ")}`);
|
||||||
} else {
|
} else {
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Aliases: (None)`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Aliases: (None)`);
|
||||||
}
|
}
|
||||||
|
|
||||||
//messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Usable on Discord: ${getYesNoFromBool(command.allowOnDiscord)}`);
|
//messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Usable on Discord: ${getYesNoFromBool(command.allowOnDiscord)}`);
|
||||||
|
|
||||||
//if(doesPlayerHaveStaffPermission(client, getStaffFlagValue("BasicModeration"))) {
|
//if(doesPlayerHaveStaffPermission(client, getStaffFlagValue("BasicModeration"))) {
|
||||||
// messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Usable on Discord: ${getYesNoFromBool(command.allowOnDiscord)}`);
|
// messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Usable on Discord: ${getYesNoFromBool(command.allowOnDiscord)}`);
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -10,27 +10,27 @@
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function isPlayerHandCuffed(client) {
|
function isPlayerHandCuffed(client) {
|
||||||
return (getPlayerData(client).pedState == VRR_PEDSTATE_BINDED);
|
return (getPlayerData(client).pedState == VRR_PEDSTATE_BINDED);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function handCuffPlayer(client) {
|
function handCuffPlayer(client) {
|
||||||
getPlayerData(client).pedState = VRR_PEDSTATE_BINDED;
|
getPlayerData(client).pedState = VRR_PEDSTATE_BINDED;
|
||||||
setPlayerControlState(client, false);
|
setPlayerControlState(client, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function unHandCuffPlayer(client) {
|
function unHandCuffPlayer(client) {
|
||||||
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
||||||
setPlayerControlState(client, true);
|
setPlayerControlState(client, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function isPlayerSurrendered(client) {
|
function isPlayerSurrendered(client) {
|
||||||
return true; //(getPlayerData(client).pedState == VRR_PEDSTATE_TAZED || getPlayerData(client).pedState == VRR_PEDSTATE_HANDSUP);
|
return true; //(getPlayerData(client).pedState == VRR_PEDSTATE_TAZED || getPlayerData(client).pedState == VRR_PEDSTATE_HANDSUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -8,48 +8,48 @@
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getItemWithPhoneNumber(phoneNumber) {
|
function getItemWithPhoneNumber(phoneNumber) {
|
||||||
for(let i in getServerData().items) {
|
for(let i in getServerData().items) {
|
||||||
if(getItemTypeData(getItemData(i).itemTypeIndex).useType == VRR_ITEM_USETYPE_PHONE) {
|
if(getItemTypeData(getItemData(i).itemTypeIndex).useType == VRR_ITEM_USETYPE_PHONE) {
|
||||||
if(getItemData(i).value == phoneNumber) {
|
if(getItemData(i).value == phoneNumber) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function isPhoneItemEnabled(itemIndex) {
|
function isPhoneItemEnabled(itemIndex) {
|
||||||
return getItemData(itemIndex).enabled;
|
return getItemData(itemIndex).enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function ringPhoneForNearbyPlayers(itemIndex) {
|
function ringPhoneForNearbyPlayers(itemIndex) {
|
||||||
/*
|
/*
|
||||||
if(isPhoneItemEnabled(itemIndex)) {
|
if(isPhoneItemEnabled(itemIndex)) {
|
||||||
switch(getItemData(itemIndex).ownerType) {
|
switch(getItemData(itemIndex).ownerType) {
|
||||||
case VRR_ITEM_OWNER_GROUND:
|
case VRR_ITEM_OWNER_GROUND:
|
||||||
playRingtoneForPlayersInRange(getItemData(itemIndex).position, getItemData(i).extra);
|
playRingtoneForPlayersInRange(getItemData(itemIndex).position, getItemData(i).extra);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VRR_ITEM_OWNER_VEHTRUNK:
|
case VRR_ITEM_OWNER_VEHTRUNK:
|
||||||
playRingtoneForPlayersInRange(getVehiclePosition(getItemData(itemIndex).ownerId), getItemData(i).extra);
|
playRingtoneForPlayersInRange(getVehiclePosition(getItemData(itemIndex).ownerId), getItemData(i).extra);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VRR_ITEM_OWNER_VEHDASH:
|
case VRR_ITEM_OWNER_VEHDASH:
|
||||||
playRingtoneForPlayersInRange(getVehiclePosition(getItemData(itemIndex).ownerId), getItemData(i).extra);
|
playRingtoneForPlayersInRange(getVehiclePosition(getItemData(itemIndex).ownerId), getItemData(i).extra);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function phoneTransmit(radioFrequency, messageText, transmittingPlayer) {
|
function phoneTransmit(radioFrequency, messageText, transmittingPlayer) {
|
||||||
phoneOutgoingToNearbyPlayers(transmittingPlayer, messageText);
|
phoneOutgoingToNearbyPlayers(transmittingPlayer, messageText);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -10,21 +10,21 @@
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function isPlayerTied(client) {
|
function isPlayerTied(client) {
|
||||||
return (getPlayerData(client).pedState == VRR_PEDSTATE_BINDED);
|
return (getPlayerData(client).pedState == VRR_PEDSTATE_BINDED);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function ropeTiePlayer(client) {
|
function ropeTiePlayer(client) {
|
||||||
getPlayerData(client).pedState = VRR_PEDSTATE_BINDED;
|
getPlayerData(client).pedState = VRR_PEDSTATE_BINDED;
|
||||||
setPlayerControlState(client, false);
|
setPlayerControlState(client, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function ropeUnTiePlayer(client) {
|
function ropeUnTiePlayer(client) {
|
||||||
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
||||||
setPlayerControlState(client, true);
|
setPlayerControlState(client, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -10,34 +10,34 @@
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function isPlayerTazed(client) {
|
function isPlayerTazed(client) {
|
||||||
return (getPlayerData(client).pedState == VRR_PEDSTATE_TAZED);
|
return (getPlayerData(client).pedState == VRR_PEDSTATE_TAZED);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function tazePlayer(client) {
|
function tazePlayer(client) {
|
||||||
getPlayerData(client).pedState = VRR_PEDSTATE_TAZED;
|
getPlayerData(client).pedState = VRR_PEDSTATE_TAZED;
|
||||||
setPlayerControlState(client, false);
|
setPlayerControlState(client, false);
|
||||||
|
|
||||||
let animationId = getAnimationFromParams("tazed");
|
let animationId = getAnimationFromParams("tazed");
|
||||||
if(animationId != false) {
|
if(animationId != false) {
|
||||||
forcePlayerPlayAnimation(client, animationId);
|
forcePlayerPlayAnimation(client, animationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
unTazePlayer(client);
|
unTazePlayer(client);
|
||||||
doActionToNearbyPlayers(client, `The tazer effect wears off`);
|
doActionToNearbyPlayers(client, `The tazer effect wears off`);
|
||||||
}, getGlobalConfig().tazerEffectDuration);
|
}, getGlobalConfig().tazerEffectDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function unTazePlayer(client) {
|
function unTazePlayer(client) {
|
||||||
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
||||||
|
|
||||||
setPlayerControlState(client, true);
|
setPlayerControlState(client, true);
|
||||||
setPlayerPosition(client, getPlayerData(client).currentAnimationPositionReturnTo);
|
setPlayerPosition(client, getPlayerData(client).currentAnimationPositionReturnTo);
|
||||||
makePedStopAnimation(getPlayerData(client).ped);
|
makePedStopAnimation(getPlayerData(client).ped);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,13 +9,6 @@
|
|||||||
|
|
||||||
function initJobScript() {
|
function initJobScript() {
|
||||||
logToConsole(LOG_INFO, "[VRR.Job]: Initializing job script ...");
|
logToConsole(LOG_INFO, "[VRR.Job]: Initializing job script ...");
|
||||||
getServerData().jobs = loadJobsFromDatabase();
|
|
||||||
|
|
||||||
createAllJobPickups();
|
|
||||||
createAllJobBlips();
|
|
||||||
|
|
||||||
setAllJobDataIndexes();
|
|
||||||
|
|
||||||
logToConsole(LOG_INFO, "[VRR.Job]: Job script initialized successfully!");
|
logToConsole(LOG_INFO, "[VRR.Job]: Job script initialized successfully!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -39,7 +32,7 @@ function loadJobsFromDatabase() {
|
|||||||
tempJobData.locations = loadJobLocationsFromDatabase(tempJobData.databaseId);
|
tempJobData.locations = loadJobLocationsFromDatabase(tempJobData.databaseId);
|
||||||
tempJobData.equipment = loadJobEquipmentsFromDatabase(tempJobData.databaseId);
|
tempJobData.equipment = loadJobEquipmentsFromDatabase(tempJobData.databaseId);
|
||||||
tempJobData.uniforms = loadJobUniformsFromDatabase(tempJobData.databaseId);
|
tempJobData.uniforms = loadJobUniformsFromDatabase(tempJobData.databaseId);
|
||||||
tempJobData.routes = loadJobRoutesFromDatabase(tempJobData.databaseId);
|
//tempJobData.routes = loadJobRoutesFromDatabase(tempJobData.databaseId);
|
||||||
tempJobs.push(tempJobData);
|
tempJobs.push(tempJobData);
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Job]: Job '${tempJobData.name}' loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[VRR.Job]: Job '${tempJobData.name}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
@@ -617,9 +610,9 @@ function stopWorking(client) {
|
|||||||
|
|
||||||
let jobVehicle = getPlayerData(client).lastJobVehicle;
|
let jobVehicle = getPlayerData(client).lastJobVehicle;
|
||||||
if(jobVehicle) {
|
if(jobVehicle) {
|
||||||
if(client.player.vehicle) {
|
if(getPlayerVehicle(client) == jobVehicle) {
|
||||||
removePlayerFromVehicle(client);
|
removePlayerFromVehicle(client);
|
||||||
//client.player.removeFromVehicle();
|
//getPlayerPed(client).removeFromVehicle();
|
||||||
}
|
}
|
||||||
|
|
||||||
respawnVehicle(jobVehicle);
|
respawnVehicle(jobVehicle);
|
||||||
@@ -631,7 +624,7 @@ function stopWorking(client) {
|
|||||||
deleteJobItems(client);
|
deleteJobItems(client);
|
||||||
restorePlayerJobLockerItems(client);
|
restorePlayerJobLockerItems(client);
|
||||||
respawnJobVehicle(client);
|
respawnJobVehicle(client);
|
||||||
sendPlayerStopJobRoute(client);
|
sendPlayerStopJobRoute(client);
|
||||||
|
|
||||||
let jobId = getPlayerJob(client);
|
let jobId = getPlayerJob(client);
|
||||||
switch(getJobType(jobId)) {
|
switch(getJobType(jobId)) {
|
||||||
@@ -665,9 +658,9 @@ function stopWorking(client) {
|
|||||||
case VRR_JOB_DRUG:
|
case VRR_JOB_DRUG:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VRR_JOB_GENERIC:
|
case VRR_JOB_GENERIC:
|
||||||
messagePlayerInfo(client, "Your vehicle has been respawned at your job location");
|
messagePlayerInfo(client, "Your vehicle has been respawned at your job location");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -753,13 +746,13 @@ function jobUniformCommand(command, params, client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(uniformId == 0) {
|
if(uniformId == 0) {
|
||||||
setPlayerSkin(client, getPlayerCurrentSubAccount(client).skin);
|
setPlayerSkin(client, getPlayerCurrentSubAccount(client).skin);
|
||||||
meActionToNearbyPlayers(client, `takes off their uniform`);
|
meActionToNearbyPlayers(client, `takes off their uniform`);
|
||||||
} else {
|
} else {
|
||||||
setPlayerSkin(client, jobData.uniforms[uniformId-1].skin);
|
setPlayerSkin(client, jobData.uniforms[uniformId-1].skin);
|
||||||
meActionToNearbyPlayers(client, `puts on ${getProperDeterminerForName(jobData.uniforms[uniformId-1].name)} ${jobData.uniforms[uniformId-1].name} uniform`);
|
meActionToNearbyPlayers(client, `puts on ${getProperDeterminerForName(jobData.uniforms[uniformId-1].name)} ${jobData.uniforms[uniformId-1].name} uniform`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -942,7 +935,7 @@ function reloadAllJobsCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
messageAdminAction(`All server jobs have been reloaded by an admin!`);
|
announceAdminAction("AllJobsReloaded");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -966,8 +959,8 @@ function createJob(name) {
|
|||||||
tempJobData.pickupModel = getGameConfig().pickupModels[getGame()].job;
|
tempJobData.pickupModel = getGameConfig().pickupModels[getGame()].job;
|
||||||
|
|
||||||
getServerData().jobs.push(tempJobData);
|
getServerData().jobs.push(tempJobData);
|
||||||
saveJobToDatabase(tempJobData);
|
saveJobToDatabase(tempJobData);
|
||||||
setAllJobDataIndexes();
|
setAllJobDataIndexes();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -986,7 +979,7 @@ function createJobLocationCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
createJobLocation(jobId, getPlayerPosition(client), getPlayerInterior(client), getPlayerDimension(client));
|
createJobLocation(jobId, getPlayerPosition(client), getPlayerInterior(client), getPlayerDimension(client));
|
||||||
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}created a location for the {jobYellow}${getJobData(jobId).name} {MAINCOLOUR}job`);
|
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} created a location for the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -995,7 +988,7 @@ function createJobLocationCommand(command, params, client) {
|
|||||||
function deleteJobLocationCommand(command, params, client) {
|
function deleteJobLocationCommand(command, params, client) {
|
||||||
let closestJobLocation = getClosestJobLocation(getPlayerPosition(client));
|
let closestJobLocation = getClosestJobLocation(getPlayerPosition(client));
|
||||||
|
|
||||||
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}deleted location {ALTCOLOUR}${closestJobLocation.index} (DB ID ${closestJobLocation.databaseId}) {MAINCOLOUR}for the {jobYellow}${getJobData(closestJobLocation.jobIndex).name} {MAINCOLOUR}job`);
|
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} deleted location {ALTCOLOUR}${closestJobLocation.index} (DB ID ${closestJobLocation.databaseId}){MAINCOLOUR} for the {jobYellow}${getJobData(closestJobLocation.jobIndex).name}{MAINCOLOUR} job`);
|
||||||
|
|
||||||
|
|
||||||
deleteJobLocation(closestJobLocation);
|
deleteJobLocation(closestJobLocation);
|
||||||
@@ -1012,7 +1005,7 @@ function toggleJobLocationEnabledCommand(command, params, client) {
|
|||||||
let closestJobLocation = getClosestJobLocation(getPlayerPosition(client));
|
let closestJobLocation = getClosestJobLocation(getPlayerPosition(client));
|
||||||
|
|
||||||
closestJobLocation.enabled = !closestJobLocation.enabled;
|
closestJobLocation.enabled = !closestJobLocation.enabled;
|
||||||
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(closestJobLocation.enabled)} location {ALTCOLOUR}${closestJobLocation.databaseId} {MAINCOLOUR}for the {jobYellow}${getJobData(closestJobLocation.jobIndex).name} {MAINCOLOUR}job`);
|
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} ${getEnabledDisabledFromBool(closestJobLocation.enabled)} location {ALTCOLOUR}${closestJobLocation.databaseId} {MAINCOLOUR}for the {jobYellow}${getJobData(closestJobLocation.jobIndex).name}{MAINCOLOUR} job`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1026,7 +1019,7 @@ function toggleJobEnabledCommand(command, params, client) {
|
|||||||
let jobId = getJobFromParams(params) || getClosestJobLocation(getPlayerPosition(client)).jobIndex;
|
let jobId = getJobFromParams(params) || getClosestJobLocation(getPlayerPosition(client)).jobIndex;
|
||||||
|
|
||||||
getJobData(jobId).enabled = !getJobData(jobId).enabled;
|
getJobData(jobId).enabled = !getJobData(jobId).enabled;
|
||||||
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} the {jobYellow}${getJobData(jobId).name} {MAINCOLOUR}job`);
|
messageAdmins(`{adminRed}${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} the {jobYellow}${getJobData(jobId).name} {MAINCOLOUR}job`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1049,7 +1042,7 @@ function setJobColourCommand(command, params, client) {
|
|||||||
|
|
||||||
getJobData(jobId).colour = toColour(toInteger(red), toInteger(green), toInteger(blue), 255);
|
getJobData(jobId).colour = toColour(toInteger(red), toInteger(green), toInteger(blue), 255);
|
||||||
getJobData(jobId).needsSaved = true;
|
getJobData(jobId).needsSaved = true;
|
||||||
messageAdmins(`${getPlayerName(client)}{MAINCOLOUR} set job {jobYellow}${getJobData(jobId).name}'s{MAINCOLOUR} colour to ${red}, ${green}, ${blue}`);
|
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} set job {jobYellow}${getJobData(jobId).name}'s{MAINCOLOUR} colour to ${red}, ${green}, ${blue}`);
|
||||||
|
|
||||||
// Force nametag update in case somebody is using this job
|
// Force nametag update in case somebody is using this job
|
||||||
updateAllPlayerNameTags();
|
updateAllPlayerNameTags();
|
||||||
@@ -1096,7 +1089,7 @@ function setJobBlipCommand(command, params, client) {
|
|||||||
|
|
||||||
getJobData(jobId).blipModel = blipId;
|
getJobData(jobId).blipModel = blipId;
|
||||||
getJobData(jobId).needsSaved = true;
|
getJobData(jobId).needsSaved = true;
|
||||||
messageAdmins(`${getPlayerName(client)}{MAINCOLOUR} set job {jobYellow}${getJobData(jobId).name}'s{MAINCOLOUR} blip model to ${blipString}`);
|
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} set job {jobYellow}${getJobData(jobId).name}'s{MAINCOLOUR} blip model to ${blipString}`);
|
||||||
resetAllJobBlips();
|
resetAllJobBlips();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1141,7 +1134,7 @@ function setJobPickupCommand(command, params, client) {
|
|||||||
|
|
||||||
getJobData(jobId).pickupModel = pickupId;
|
getJobData(jobId).pickupModel = pickupId;
|
||||||
getJobData(jobId).needsSaved = true;
|
getJobData(jobId).needsSaved = true;
|
||||||
messageAdmins(`${getPlayerName(client)}{MAINCOLOUR} set job {jobYellow}${getJobData(jobId).name}'s{MAINCOLOUR} pickup to ${pickupString}`);
|
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} set job {jobYellow}${getJobData(jobId).name}'s{MAINCOLOUR} pickup to ${pickupString}`);
|
||||||
resetAllJobPickups();
|
resetAllJobPickups();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1164,7 +1157,7 @@ function toggleJobRouteEnabledCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getJobData(jobId).routes[jobRoute].enabled = !getJobData(jobId).routes[jobRoute].enabled;
|
getJobData(jobId).routes[jobRoute].enabled = !getJobData(jobId).routes[jobRoute].enabled;
|
||||||
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} for the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} ${getEnabledDisabledFromBool(getJobRouteData(jobId, jobRoute).enabled)} route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} for the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1190,7 +1183,7 @@ function setJobRouteNameCommand(command, params, client) {
|
|||||||
|
|
||||||
let oldName = getJobData(jobId).routes[jobRoute].name;
|
let oldName = getJobData(jobId).routes[jobRoute].name;
|
||||||
getJobData(jobId).routes[jobRoute].name = params;
|
getJobData(jobId).routes[jobRoute].name = params;
|
||||||
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} set route {ALTCOLOUR}${oldName}{MAINCOLOUR} to {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} for the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} set route {ALTCOLOUR}${oldName}{MAINCOLOUR} to {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} for the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1213,19 +1206,19 @@ function setJobRouteAllLocationDelaysCommand(command, params, client) {
|
|||||||
|
|
||||||
let jobId = getPlayerJob(client);
|
let jobId = getPlayerJob(client);
|
||||||
let jobRoute = getPlayerJobRoute(client);
|
let jobRoute = getPlayerJobRoute(client);
|
||||||
let delay = getParam(params, " ", 1);
|
let delay = getParam(params, " ", 1);
|
||||||
|
|
||||||
if(isNaN(delay)) {
|
if(isNaN(delay)) {
|
||||||
messagePlayerError(client, getLocaleString(client, "TimeNotNumber"))
|
messagePlayerError(client, getLocaleString(client, "TimeNotNumber"))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(let i in getJobData(jobId).routes[jobRoute].locations) {
|
for(let i in getJobData(jobId).routes[jobRoute].locations) {
|
||||||
getJobData(jobId).routes[jobRoute].locations[i].stopDelay = delay;
|
getJobData(jobId).routes[jobRoute].locations[i].stopDelay = delay;
|
||||||
getJobData(jobId).routes[jobRoute].locations[i].needsSaved = true;
|
getJobData(jobId).routes[jobRoute].locations[i].needsSaved = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} set route {ALTCOLOUR}${oldName}{MAINCOLOUR} location's stop delays to {ALTCOLOUR}${delay/1000}{MAINCOLOUR} seconds for the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} set route {ALTCOLOUR}${oldName}{MAINCOLOUR} location's stop delays to {ALTCOLOUR}${delay/1000}{MAINCOLOUR} seconds for the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1269,7 +1262,7 @@ function setJobRouteVehicleColoursCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} set the vehicle colours to {ALTCOLOUR}${colour1}, ${colour2}{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} set the vehicle colours to {ALTCOLOUR}${colour1}, ${colour2}{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1295,7 +1288,7 @@ function setJobRouteFinishMessageCommand(command, params, client) {
|
|||||||
|
|
||||||
getJobData(jobId).routes[jobRoute].finishMessage = params;
|
getJobData(jobId).routes[jobRoute].finishMessage = params;
|
||||||
getJobData(jobId).routes[jobRoute].needsSaved = true;
|
getJobData(jobId).routes[jobRoute].needsSaved = true;
|
||||||
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} set the finish message to {ALTCOLOUR}"${params}"{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} set the finish message to {ALTCOLOUR}"${params}"{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1321,7 +1314,7 @@ function setJobRouteStartMessageCommand(command, params, client) {
|
|||||||
|
|
||||||
getJobData(jobId).routes[jobRoute].startMessage = params;
|
getJobData(jobId).routes[jobRoute].startMessage = params;
|
||||||
getJobData(jobId).routes[jobRoute].needsSaved = true;
|
getJobData(jobId).routes[jobRoute].needsSaved = true;
|
||||||
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} set the start message to {ALTCOLOUR}"${params}"{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} set the start message to {ALTCOLOUR}"${params}"{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1347,7 +1340,7 @@ function setJobRouteLocationArriveMessageCommand(command, params, client) {
|
|||||||
|
|
||||||
getJobData(jobId).routes[jobRoute].locationArriveMessage = params;
|
getJobData(jobId).routes[jobRoute].locationArriveMessage = params;
|
||||||
getJobData(jobId).routes[jobRoute].needsSaved = true;
|
getJobData(jobId).routes[jobRoute].needsSaved = true;
|
||||||
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} set the location arrival message to {ALTCOLOUR}"${params}"{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} ${getEnabledDisabledFromBool(getJobData(jobId).enabled)} set the location arrival message to {ALTCOLOUR}"${params}"{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1373,7 +1366,7 @@ function setJobRouteLocationNextMessageCommand(command, params, client) {
|
|||||||
|
|
||||||
getJobData(jobId).routes[jobRoute].locationNextMessage = params;
|
getJobData(jobId).routes[jobRoute].locationNextMessage = params;
|
||||||
getJobData(jobId).routes[jobRoute].needsSaved = true;
|
getJobData(jobId).routes[jobRoute].needsSaved = true;
|
||||||
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} set the location next message to {ALTCOLOUR}"${params}"{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} ${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} set the location next message to {ALTCOLOUR}"${params}"{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1405,7 +1398,7 @@ function setJobRoutePayCommand(command, params, client) {
|
|||||||
|
|
||||||
getJobData(jobId).routes[jobRoute].pay = amount;
|
getJobData(jobId).routes[jobRoute].pay = amount;
|
||||||
getJobData(jobId).routes[jobRoute].needsSaved = true;
|
getJobData(jobId).routes[jobRoute].needsSaved = true;
|
||||||
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} set the start message to {ALTCOLOUR}"${params}"{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} set the start message to {ALTCOLOUR}"${params}"{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1419,7 +1412,7 @@ function toggleJobWhiteListCommand(command, params, client) {
|
|||||||
let jobId = getJobFromParams(params) || getClosestJobLocation(getPlayerPosition(client)).jobIndex;
|
let jobId = getJobFromParams(params) || getClosestJobLocation(getPlayerPosition(client)).jobIndex;
|
||||||
|
|
||||||
getJobData(jobId).whiteListEnabled = !getJobData(jobId).whiteListEnabled;
|
getJobData(jobId).whiteListEnabled = !getJobData(jobId).whiteListEnabled;
|
||||||
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).whiteListEnabled)} {MAINCOLOUR}the whitelist for the {ALTCOLOUR}${getJobData(jobId).name} {MAINCOLOUR}job`);
|
messageAdmins(`{adminRed}${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).whiteListEnabled)} {MAINCOLOUR}the whitelist for the {ALTCOLOUR}${getJobData(jobId).name} {MAINCOLOUR}job`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1433,7 +1426,7 @@ function toggleJobBlackListCommand(command, params, client) {
|
|||||||
let jobId = getJobFromParams(params) || getClosestJobLocation(getPlayerPosition(client)).jobIndex;
|
let jobId = getJobFromParams(params) || getClosestJobLocation(getPlayerPosition(client)).jobIndex;
|
||||||
|
|
||||||
getJobData(jobId).blackListEnabled = !getJobData(jobId).blackListEnabled;
|
getJobData(jobId).blackListEnabled = !getJobData(jobId).blackListEnabled;
|
||||||
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).blackListEnabled)} {MAINCOLOUR}the blacklist for the {ALTCOLOUR}${getJobData(jobId).name} {MAINCOLOUR}job`);
|
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} ${getEnabledDisabledFromBool(getJobData(jobId).blackListEnabled)} the blacklist for the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1463,7 +1456,7 @@ function addPlayerToJobBlackListCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addPlayerToJobBlackList(targetClient, jobId);
|
addPlayerToJobBlackList(targetClient, jobId);
|
||||||
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}added ${getCharacterFullName(targetClient)} {MAINCOLOUR}to the blacklist for the {ALTCOLOUR}${jobData.name} {MAINCOLOUR}job`);
|
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} added {ALTCOLOUR}${getCharacterFullName(targetClient)}{MAINCOLOUR} to the blacklist for the {jobYellow}${jobData.name}{MAINCOLOUR} job`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1493,7 +1486,7 @@ function removePlayerFromJobBlackListCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
removePlayerFromJobBlackList(targetClient, jobId);
|
removePlayerFromJobBlackList(targetClient, jobId);
|
||||||
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}removed ${getCharacterFullName(targetClient)} {MAINCOLOUR}from the blacklist for the {ALTCOLOUR}${jobData.name} {MAINCOLOUR}job`);
|
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} removed {ALTCOLOUR}${getCharacterFullName(targetClient)}{MAINCOLOUR} from the blacklist for the {jobYellow}${jobData.name}{MAINCOLOUR} job`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1523,7 +1516,7 @@ function addPlayerToJobWhiteListCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addPlayerToJobWhiteList(targetClient, jobId);
|
addPlayerToJobWhiteList(targetClient, jobId);
|
||||||
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}added ${getCharacterFullName(targetClient)} {MAINCOLOUR}to the whitelist for the {ALTCOLOUR}${jobData.name} {MAINCOLOUR}job`);
|
messageAdmins(`{adminRed}${getPlayerName(client)} {MAINCOLOUR}added {ALTCOLOUR}${getCharacterFullName(targetClient)}{MAINCOLOUR} to the whitelist for the {jobYellow}${jobData.name}{MAINCOLOUR} job`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1553,7 +1546,7 @@ function removePlayerFromJobWhiteListCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
removePlayerFromJobWhiteList(targetClient, jobId);
|
removePlayerFromJobWhiteList(targetClient, jobId);
|
||||||
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}removed ${getCharacterFullName(targetClient)} {MAINCOLOUR}from the whitelist for the {ALTCOLOUR}${jobData.name} {MAINCOLOUR}job`);
|
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} removed {ALTCOLOUR}${getCharacterFullName(targetClient)}{MAINCOLOUR} from the whitelist for the {jobYellow}${jobData.name}{MAINCOLOUR} job`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1569,40 +1562,40 @@ function forceAllPlayersToStopWorking() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function jobStartRouteCommand(command, params, client) {
|
function jobStartRouteCommand(command, params, client) {
|
||||||
if(!canPlayerUseJobs(client)) {
|
if(!canPlayerUseJobs(client)) {
|
||||||
messagePlayerError(client, "You are not allowed to use jobs.");
|
messagePlayerError(client, "You are not allowed to use jobs.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isPlayerWorking(client)) {
|
if(!isPlayerWorking(client)) {
|
||||||
messagePlayerError(client, "You aren't working yet! Use /startwork first.");
|
messagePlayerError(client, "You aren't working yet! Use /startwork first.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getJobData(getPlayerJob(client)).routes.length == 0) {
|
if(getJobData(getPlayerJob(client)).routes.length == 0) {
|
||||||
messagePlayerError(client, "Your job doesn't have any routes for this location!");
|
messagePlayerError(client, "Your job doesn't have any routes for this location!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isPlayerInJobVehicle(client)) {
|
if(!isPlayerInJobVehicle(client)) {
|
||||||
messagePlayerError(client, "You need to be in a vehicle that belongs to your job!");
|
messagePlayerError(client, "You need to be in a vehicle that belongs to your job!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isPlayerOnJobRoute(client)) {
|
if(isPlayerOnJobRoute(client)) {
|
||||||
messagePlayerError(client, "You're already on a job route! Finish the route or use /stoproute");
|
messagePlayerError(client, "You're already on a job route! Finish the route or use /stoproute");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let forceRoute = -1;
|
let forceRoute = -1;
|
||||||
if(doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageJobs"))) {
|
if(doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageJobs"))) {
|
||||||
if(!areParamsEmpty(params)) {
|
if(!areParamsEmpty(params)) {
|
||||||
let tempRoute = getJobRouteFromParams(params, getPlayerJob(client));
|
let tempRoute = getJobRouteFromParams(params, getPlayerJob(client));
|
||||||
if(tempRoute != false) {
|
if(tempRoute != false) {
|
||||||
forceRoute = tempRoute;
|
forceRoute = tempRoute;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
startJobRoute(client, forceRoute);
|
startJobRoute(client, forceRoute);
|
||||||
return true;
|
return true;
|
||||||
@@ -1611,24 +1604,24 @@ function jobStartRouteCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function jobStopRouteCommand(command, params, client) {
|
function jobStopRouteCommand(command, params, client) {
|
||||||
if(!canPlayerUseJobs(client)) {
|
if(!canPlayerUseJobs(client)) {
|
||||||
messagePlayerError(client, "You are not allowed to use jobs.");
|
messagePlayerError(client, "You are not allowed to use jobs.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isPlayerWorking(client)) {
|
if(!isPlayerWorking(client)) {
|
||||||
messagePlayerError(client, "You aren't working yet! Use /startwork first.");
|
messagePlayerError(client, "You aren't working yet! Use /startwork first.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//if(!doesPlayerHaveJobType(client, VRR_JOB_BUS) && !doesPlayerHaveJobType(client, VRR_JOB_GARBAGE)) {
|
//if(!doesPlayerHaveJobType(client, VRR_JOB_BUS) && !doesPlayerHaveJobType(client, VRR_JOB_GARBAGE)) {
|
||||||
// messagePlayerError(client, "Your job doesn't use a route!");
|
// messagePlayerError(client, "Your job doesn't use a route!");
|
||||||
// return false;
|
// return false;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if(!isPlayerOnJobRoute(client)) {
|
if(!isPlayerOnJobRoute(client)) {
|
||||||
messagePlayerError(client, "You aren't on a job route!");
|
messagePlayerError(client, "You aren't on a job route!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
stopJobRoute(client, false, false);
|
stopJobRoute(client, false, false);
|
||||||
@@ -1660,21 +1653,21 @@ function isPlayerWorking(client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function startJobRoute(client, forceRoute = -1) {
|
function startJobRoute(client, forceRoute = -1) {
|
||||||
let jobId = getPlayerJob(client);
|
let jobId = getPlayerJob(client);
|
||||||
let jobRoute = 0;
|
let jobRoute = 0;
|
||||||
|
|
||||||
if(forceRoute == -1) {
|
if(forceRoute == -1) {
|
||||||
jobRoute = getRandomJobRouteForLocation(getClosestJobLocationForJob(getPlayerPosition(client), jobId));
|
jobRoute = getRandomJobRouteForLocation(getClosestJobLocationForJob(getPlayerPosition(client), jobId));
|
||||||
} else {
|
} else {
|
||||||
jobRoute = forceRoute;
|
jobRoute = forceRoute;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(jobRoute == -1) {
|
if(jobRoute == -1) {
|
||||||
messagePlayerError(client, `There are no routes for this location.`);
|
messagePlayerError(client, `There are no routes for this location.`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `${getPlayerDisplayForConsole(client)} is starting job route ${jobRoute} for job ${jobId}`);
|
logToConsole(LOG_DEBUG, `${getPlayerDisplayForConsole(client)} is starting job route ${jobRoute} for job ${jobId}`);
|
||||||
|
|
||||||
getPlayerData(client).jobRoute = jobRoute;
|
getPlayerData(client).jobRoute = jobRoute;
|
||||||
getPlayerData(client).jobRouteLocation = 0;
|
getPlayerData(client).jobRouteLocation = 0;
|
||||||
@@ -1684,26 +1677,26 @@ function startJobRoute(client, forceRoute = -1) {
|
|||||||
getPlayerVehicle(client).colour2 = getJobRouteData(jobId, jobRoute).vehicleColour2;
|
getPlayerVehicle(client).colour2 = getJobRouteData(jobId, jobRoute).vehicleColour2;
|
||||||
|
|
||||||
messagePlayerNormal(client, replaceJobRouteStringsInMessage(getJobRouteData(jobId, jobRoute).startMessage, jobId, jobRoute));
|
messagePlayerNormal(client, replaceJobRouteStringsInMessage(getJobRouteData(jobId, jobRoute).startMessage, jobId, jobRoute));
|
||||||
if(getJobRouteData(jobId, jobRoute).locations.length > 0) {
|
if(getJobRouteData(jobId, jobRoute).locations.length > 0) {
|
||||||
showCurrentJobLocation(client);
|
showCurrentJobLocation(client);
|
||||||
} else {
|
} else {
|
||||||
messagePlayerError(client, `There are no locations for this route.`);
|
messagePlayerError(client, `There are no locations for this route.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function stopJobRoute(client, successful = false, alertPlayer = true) {
|
function stopJobRoute(client, successful = false, alertPlayer = true) {
|
||||||
let jobId = getPlayerJob(client);
|
let jobId = getPlayerJob(client);
|
||||||
|
|
||||||
if(alertPlayer) {
|
if(alertPlayer) {
|
||||||
messagePlayerAlert(client, replaceJobRouteStringsInMessage(getJobRouteData(jobId, getPlayerJobRoute(client)).finishMessage), jobId, getPlayerJobRoute(client));
|
messagePlayerAlert(client, replaceJobRouteStringsInMessage(getJobRouteData(jobId, getPlayerJobRoute(client)).finishMessage), jobId, getPlayerJobRoute(client));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(successful == true) {
|
if(successful == true) {
|
||||||
finishSuccessfulJobRoute(client);
|
finishSuccessfulJobRoute(client);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
stopReturnToJobVehicleCountdown(client);
|
stopReturnToJobVehicleCountdown(client);
|
||||||
sendPlayerStopJobRoute(client);
|
sendPlayerStopJobRoute(client);
|
||||||
@@ -1797,26 +1790,26 @@ function deleteJobLocation(jobLocationData) {
|
|||||||
quickDatabaseQuery(`DELETE FROM job_loc WHERE job_loc_id = ${jobLocationData.databaseId}`);
|
quickDatabaseQuery(`DELETE FROM job_loc WHERE job_loc_id = ${jobLocationData.databaseId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteJobLocationBlip(tempJob, tempLocation);
|
deleteJobLocationBlip(tempJob, tempLocation);
|
||||||
deleteJobLocationPickup(tempJob, tempLocation);
|
deleteJobLocationPickup(tempJob, tempLocation);
|
||||||
getJobData(getJobIdFromDatabaseId(tempJob)).locations.splice(tempLocation, 1);
|
getJobData(getJobIdFromDatabaseId(tempJob)).locations.splice(tempLocation, 1);
|
||||||
setAllJobDataIndexes();
|
setAllJobDataIndexes();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function freezePlayerJobVehicleForRouteLocation(client) {
|
function freezePlayerJobVehicleForRouteLocation(client) {
|
||||||
getVehicleData(getPlayerVehicle(client)).engine = false;
|
getVehicleData(getPlayerVehicle(client)).engine = false;
|
||||||
setVehicleEngine(getPlayerVehicle(client), getVehicleData(getPlayerVehicle(client)).engine);
|
setVehicleEngine(getPlayerVehicle(client), getVehicleData(getPlayerVehicle(client)).engine);
|
||||||
//setPlayerControlState(client, false);
|
//setPlayerControlState(client, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function unFreezePlayerJobVehicleForRouteLocation(client) {
|
function unFreezePlayerJobVehicleForRouteLocation(client) {
|
||||||
getVehicleData(getPlayerVehicle(client)).engine = true;
|
getVehicleData(getPlayerVehicle(client)).engine = true;
|
||||||
setVehicleEngine(getPlayerVehicle(client), getVehicleData(getPlayerVehicle(client)).engine);
|
setVehicleEngine(getPlayerVehicle(client), getVehicleData(getPlayerVehicle(client)).engine);
|
||||||
//setPlayerControlState(client, true);
|
//setPlayerControlState(client, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -2291,24 +2284,33 @@ function createJobLocationPickup(jobId, locationId) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getJobData(jobId).pickupModel != -1) {
|
let tempJobData = getJobData(jobId);
|
||||||
|
|
||||||
|
if(tempJobData.pickupModel != -1) {
|
||||||
let pickupModelId = getGameConfig().pickupModels[getServerGame()].Job;
|
let pickupModelId = getGameConfig().pickupModels[getServerGame()].Job;
|
||||||
|
|
||||||
if(getJobData(jobId).pickupModel != 0) {
|
if(tempJobData.pickupModel != 0) {
|
||||||
pickupModelId = getJobData(jobId).pickupModel;
|
pickupModelId = tempJobData.pickupModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating pickup for location ${locationId} of the ${getServerData().jobs[jobId].name} job`);
|
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating pickup for location ${locationId} of the ${tempJobData.name} job`);
|
||||||
|
|
||||||
getJobData(jobId).locations[locationId].pickup = createGamePickup(pickupModelId, getJobData(jobId).locations[locationId].position, getGameConfig().pickupTypes[getServerGame()].job);
|
if(areServerElementsSupported()) {
|
||||||
setElementDimension(getJobData(jobId).locations[locationId].pickup, getJobData(jobId).locations[locationId].dimension);
|
let pickup = createGamePickup(pickupModelId, tempJobData.locations[locationId].position, getGameConfig().pickupTypes[getServerGame()].job);
|
||||||
setElementOnAllDimensions(getJobData(jobId).locations[locationId].pickup, false);
|
if(pickup != false) {
|
||||||
setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "vrr.owner.type", VRR_PICKUP_JOB, false);
|
tempJobData.locations[locationId].pickup = pickup;
|
||||||
setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "vrr.owner.id", locationId, false);
|
setElementDimension(pickup, tempJobData.locations[locationId].dimension);
|
||||||
setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "vrr.label.type", VRR_LABEL_JOB, true);
|
setElementOnAllDimensions(pickup, false);
|
||||||
setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "vrr.label.name", getJobData(jobId).name, true);
|
setEntityData(pickup, "vrr.owner.type", VRR_PICKUP_JOB, false);
|
||||||
setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "vrr.label.jobType", getJobData(jobId).databaseId, true);
|
setEntityData(pickup, "vrr.owner.id", locationId, false);
|
||||||
addToWorld(getJobData(jobId).locations[locationId].pickup);
|
setEntityData(pickup, "vrr.label.type", VRR_LABEL_JOB, true);
|
||||||
|
setEntityData(pickup, "vrr.label.name", tempJobData.name, true);
|
||||||
|
setEntityData(pickup, "vrr.label.jobType", tempJobData.databaseId, true);
|
||||||
|
addToWorld(pickup);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// sendJobToPlayer(null, jobId, tempJobData.name, tempJobData.locations[locationId].position, pickupModel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2319,6 +2321,8 @@ function createJobLocationBlip(jobId, locationId) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let tempJobData = getJobData(jobId);
|
||||||
|
|
||||||
if(getJobData(jobId).blipModel != -1) {
|
if(getJobData(jobId).blipModel != -1) {
|
||||||
let blipModelId = getGameConfig().blipSprites[getServerGame()].Job;
|
let blipModelId = getGameConfig().blipSprites[getServerGame()].Job;
|
||||||
|
|
||||||
@@ -2326,12 +2330,17 @@ function createJobLocationBlip(jobId, locationId) {
|
|||||||
blipModelId = getJobData(jobId).blipModel;
|
blipModelId = getJobData(jobId).blipModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
getJobData(jobId).locations[locationId].blip = createGameBlip(getJobData(jobId).locations[locationId].position, blipModelId, getColourByType("job"));
|
if(areServerElementsSupported()) {
|
||||||
//setElementStreamInDistance(getServerData().jobs[i].locations[j].blip, 30);
|
let blip = createGameBlip(tempJobData.locations[locationId].position, blipModelId, getColourByType("job"));
|
||||||
//setElementStreamOutDistance(getServerData().jobs[i].locations[j].blip, 40);
|
if(blip != false) {
|
||||||
setElementOnAllDimensions(getJobData(jobId).locations[locationId].blip, false);
|
tempJobData.locations[locationId].blip = blip;
|
||||||
setElementDimension(getJobData(jobId).locations[locationId].blip, getJobData(jobId).locations[locationId].dimension);
|
}
|
||||||
addToWorld(getJobData(jobId).locations[locationId].blip);
|
setElementOnAllDimensions(blip, false);
|
||||||
|
setElementDimension(blip, tempJobData.locations[locationId].dimension);
|
||||||
|
addToWorld(blip);
|
||||||
|
} else {
|
||||||
|
sendJobToPlayer(null, jobId, tempJobData.name, tempJobData.locations[locationId].position, blipModelId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2408,31 +2417,31 @@ function isPlayerOnJobBlackList(client, jobId) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function playerArrivedAtJobRouteLocation(client) {
|
function playerArrivedAtJobRouteLocation(client) {
|
||||||
let jobId = getPlayerJob(client);
|
let jobId = getPlayerJob(client);
|
||||||
|
|
||||||
if(!isPlayerOnJobRoute(client)) {
|
if(!isPlayerOnJobRoute(client)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isLastLocationOnJobRoute(jobId, getPlayerJobRoute(client), getPlayerJobRouteLocation(client))) {
|
if(isLastLocationOnJobRoute(jobId, getPlayerJobRoute(client), getPlayerJobRouteLocation(client))) {
|
||||||
finishSuccessfulJobRoute(client);
|
finishSuccessfulJobRoute(client);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
showGameMessage(client, replaceJobRouteStringsInMessage(removeColoursInMessage(getJobRouteData(jobId, getPlayerJobRoute(client)).locationArriveMessage), jobId, getPlayerJobRoute(client)), getJobData(jobId).colour, 3500);
|
showGameMessage(client, replaceJobRouteStringsInMessage(removeColoursInMessage(getJobRouteData(jobId, getPlayerJobRoute(client)).locationArriveMessage), jobId, getPlayerJobRoute(client)), getJobData(jobId).colour, 3500);
|
||||||
if(getJobRouteLocationData(jobId, getPlayerJobRoute(client),getPlayerJobRouteLocation(client)).stopDelay > 0) {
|
if(getJobRouteLocationData(jobId, getPlayerJobRoute(client),getPlayerJobRouteLocation(client)).stopDelay > 0) {
|
||||||
freezePlayerJobVehicleForRouteLocation(client);
|
freezePlayerJobVehicleForRouteLocation(client);
|
||||||
getPlayerData(client).jobRouteLocation = getNextLocationOnJobRoute(jobId, getPlayerJobRoute(client), getPlayerJobRouteLocation(client));
|
getPlayerData(client).jobRouteLocation = getNextLocationOnJobRoute(jobId, getPlayerJobRoute(client), getPlayerJobRouteLocation(client));
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
showCurrentJobLocation(client);
|
showCurrentJobLocation(client);
|
||||||
showGameMessage(client, replaceJobRouteStringsInMessage(removeColoursInMessage(getJobRouteData(jobId, getPlayerJobRoute(client)).locationNextMessage), jobId, getPlayerJobRoute(client)), getJobData(jobId).colour, 3500);
|
showGameMessage(client, replaceJobRouteStringsInMessage(removeColoursInMessage(getJobRouteData(jobId, getPlayerJobRoute(client)).locationNextMessage), jobId, getPlayerJobRoute(client)), getJobData(jobId).colour, 3500);
|
||||||
unFreezePlayerJobVehicleForRouteLocation(client);
|
unFreezePlayerJobVehicleForRouteLocation(client);
|
||||||
}, getJobRouteLocationData(jobId, getPlayerJobRoute(client),getPlayerJobRouteLocation(client)).stopDelay);
|
}, getJobRouteLocationData(jobId, getPlayerJobRoute(client),getPlayerJobRouteLocation(client)).stopDelay);
|
||||||
} else {
|
} else {
|
||||||
getPlayerData(client).jobRouteLocation = getNextLocationOnJobRoute(jobId, getPlayerJobRoute(client), getPlayerJobRouteLocation(client));
|
getPlayerData(client).jobRouteLocation = getNextLocationOnJobRoute(jobId, getPlayerJobRoute(client), getPlayerJobRouteLocation(client));
|
||||||
showCurrentJobLocation(client);
|
showCurrentJobLocation(client);
|
||||||
showGameMessage(client, replaceJobRouteStringsInMessage(removeColoursInMessage(getJobRouteData(jobId, getPlayerJobRoute(client)).locationNextMessage), jobId, getPlayerJobRoute(client)), getJobData(jobId).colour, 3500);
|
showGameMessage(client, replaceJobRouteStringsInMessage(removeColoursInMessage(getJobRouteData(jobId, getPlayerJobRoute(client)).locationNextMessage), jobId, getPlayerJobRoute(client)), getJobData(jobId).colour, 3500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -2529,7 +2538,7 @@ function createJobRouteCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
createJobRoute(params, closestJobLocation);
|
createJobRoute(params, closestJobLocation);
|
||||||
messageAdmins(`${getPlayerName(client)}{MAINCOLOUR} created route {ALTCOLOUR}${params}{MAINCOLOUR} for job {jobYellow}${getJobData(jobId).name}`);
|
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} created route {ALTCOLOUR}${params}{MAINCOLOUR} for job {jobYellow}${getJobData(jobId).name}`);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2563,7 +2572,7 @@ function createJobRouteLocationCommand(command, params, client) {
|
|||||||
let routeLocationName = params;
|
let routeLocationName = params;
|
||||||
|
|
||||||
createJobRouteLocation(routeLocationName, getPlayerPosition(client), jobRouteData);
|
createJobRouteLocation(routeLocationName, getPlayerPosition(client), jobRouteData);
|
||||||
messageAdmins(`${getPlayerName(client)}{MAINCOLOUR} created location {ALTCOLOUR}${routeLocationName}{MAINCOLOUR} for route {ALTCOLOUR}${jobRouteData.name}{MAINCOLOUR} for job {jobYellow}${getJobData(jobId).name}`);
|
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} created location {ALTCOLOUR}${routeLocationName}{MAINCOLOUR} for route {ALTCOLOUR}${jobRouteData.name}{MAINCOLOUR} for job {jobYellow}${getJobData(jobId).name}`);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2579,14 +2588,14 @@ function createJobRoute(routeName, closestJobLocation) {
|
|||||||
tempJobRouteData.vehicleColour1 = 1;
|
tempJobRouteData.vehicleColour1 = 1;
|
||||||
tempJobRouteData.vehicleColour2 = 1;
|
tempJobRouteData.vehicleColour2 = 1;
|
||||||
tempJobRouteData.pay = 500;
|
tempJobRouteData.pay = 500;
|
||||||
tempJobRouteData.jobIndex = closestJobLocation.jobIndex;
|
tempJobRouteData.jobIndex = closestJobLocation.jobIndex;
|
||||||
tempJobRouteData.startMessage = `You are now on route {ALTCOLOUR}{JOBROUTENAME}{MAINCOLOUR} for the {jobYellow}{JOBNAME}{MAINCOLOUR} job!`;
|
tempJobRouteData.startMessage = `You are now on route {ALTCOLOUR}{JOBROUTENAME}{MAINCOLOUR} for the {jobYellow}{JOBNAME}{MAINCOLOUR} job!`;
|
||||||
tempJobRouteData.finishMessage = `You have finished the {ALTCOLOUR}{JOBROUTENAME}{MAINCOLOUR} route and {ALTCOLOUR}{JOBROUTEPAY}{MAINCOLOUR} has been added to your next paycheck!`;
|
tempJobRouteData.finishMessage = `You have finished the {ALTCOLOUR}{JOBROUTENAME}{MAINCOLOUR} route and {ALTCOLOUR}{JOBROUTEPAY}{MAINCOLOUR} has been added to your next paycheck!`;
|
||||||
tempJobRouteData.locationArriveMessage = `You arrived at a stop.`;
|
tempJobRouteData.locationArriveMessage = `You arrived at a stop.`;
|
||||||
tempJobRouteData.locationNextMessage = `Drive to the next stop.`;
|
tempJobRouteData.locationNextMessage = `Drive to the next stop.`;
|
||||||
|
|
||||||
getJobData(closestJobLocation.jobIndex).routes.push(tempJobRouteData);
|
getJobData(closestJobLocation.jobIndex).routes.push(tempJobRouteData);
|
||||||
saveJobRouteToDatabase(tempJobRouteData);
|
saveJobRouteToDatabase(tempJobRouteData);
|
||||||
setAllJobDataIndexes();
|
setAllJobDataIndexes();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2599,10 +2608,10 @@ function createJobRouteLocation(routeLocationName, position, jobRouteData) {
|
|||||||
tempJobRouteLocationData.enabled = true;
|
tempJobRouteLocationData.enabled = true;
|
||||||
tempJobRouteLocationData.needsSaved = true;
|
tempJobRouteLocationData.needsSaved = true;
|
||||||
tempJobRouteLocationData.position = position;
|
tempJobRouteLocationData.position = position;
|
||||||
tempJobRouteLocationData.routeIndex = jobRouteData.index;
|
tempJobRouteLocationData.routeIndex = jobRouteData.index;
|
||||||
|
|
||||||
getJobData(jobRouteData.jobIndex).routes[jobRouteData.index].locations.push(tempJobRouteLocationData);
|
getJobData(jobRouteData.jobIndex).routes[jobRouteData.index].locations.push(tempJobRouteLocationData);
|
||||||
saveJobRouteLocationToDatabase(tempJobRouteLocationData);
|
saveJobRouteLocationToDatabase(tempJobRouteLocationData);
|
||||||
setAllJobDataIndexes();
|
setAllJobDataIndexes();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2611,7 +2620,7 @@ function createJobRouteLocation(routeLocationName, position, jobRouteData) {
|
|||||||
function deleteJobRouteLocationCommand(command, params, client) {
|
function deleteJobRouteLocationCommand(command, params, client) {
|
||||||
let closestJobRouteLocation = getClosestJobRouteLocation(getPlayerPosition(client));
|
let closestJobRouteLocation = getClosestJobRouteLocation(getPlayerPosition(client));
|
||||||
|
|
||||||
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)}{MAINCOLOUR} deleted route location {ALTCOLOUR}${closestJobRouteLocation.index} (DB ID ${closestJobRouteLocation.databaseId}){MAINCOLOUR} for the {ALTCOLOUR}${closestJobRouteLocation.name}{jobYellow} route of the {jobYellow}${getJobData(closestJobLocation.jobIndex).name}{MAINCOLOUR} job`);
|
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} deleted route location {ALTCOLOUR}${closestJobRouteLocation.index} (DB ID ${closestJobRouteLocation.databaseId}){MAINCOLOUR} for the {ALTCOLOUR}${closestJobRouteLocation.name}{jobYellow} route of the {jobYellow}${getJobData(closestJobLocation.jobIndex).name}{MAINCOLOUR} job`);
|
||||||
|
|
||||||
if(closestJobRouteLocation.databaseId > 0) {
|
if(closestJobRouteLocation.databaseId > 0) {
|
||||||
quickDatabaseQuery(`DELETE FROM job_route_loc WHERE job_route_loc_id = ${closestJobRouteLocation.databaseId}`);
|
quickDatabaseQuery(`DELETE FROM job_route_loc WHERE job_route_loc_id = ${closestJobRouteLocation.databaseId}`);
|
||||||
@@ -2622,7 +2631,7 @@ function deleteJobRouteLocationCommand(command, params, client) {
|
|||||||
|
|
||||||
getJobData(getJobIdFromDatabaseId(tempJob)).routes[tempJobRoute].locations.splice(tempIndex, 1);
|
getJobData(getJobIdFromDatabaseId(tempJob)).routes[tempJobRoute].locations.splice(tempIndex, 1);
|
||||||
setAllJobDataIndexes();
|
setAllJobDataIndexes();
|
||||||
collectAllGarbage();
|
collectAllGarbage();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -2631,9 +2640,9 @@ function deleteJobRouteCommand(command, params, client) {
|
|||||||
let jobId = getPlayerJob(client);
|
let jobId = getPlayerJob(client);
|
||||||
let jobRoute = getPlayerData(client).jobRoute;
|
let jobRoute = getPlayerData(client).jobRoute;
|
||||||
|
|
||||||
if(!areParamsEmpty(client)) {
|
if(!areParamsEmpty(client)) {
|
||||||
jobRoute = getJobRouteFromParams(params, jobId);
|
jobRoute = getJobRouteFromParams(params, jobId);
|
||||||
}
|
}
|
||||||
|
|
||||||
let jobRouteData = getServerData().jobs[jobId].routes[jobRoute];
|
let jobRouteData = getServerData().jobs[jobId].routes[jobRoute];
|
||||||
|
|
||||||
@@ -2649,12 +2658,12 @@ function deleteJobRouteCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)}{MAINCOLOUR} deleted route {ALTCOLOUR}${jobRouteData.name} (DB ID ${jobRouteData.databaseId}) {MAINCOLOUR}for the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} deleted route {ALTCOLOUR}${jobRouteData.name} (DB ID ${jobRouteData.databaseId}){MAINCOLOUR} for the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
|
||||||
|
|
||||||
if(jobRouteData.databaseId > 0) {
|
if(jobRouteData.databaseId > 0) {
|
||||||
quickDatabaseQuery(`DELETE FROM job_route WHERE job_route_id = ${jobRouteData.databaseId}`);
|
quickDatabaseQuery(`DELETE FROM job_route WHERE job_route_id = ${jobRouteData.databaseId}`);
|
||||||
quickDatabaseQuery(`DELETE FROM job_route_loc WHERE job_route_loc_route = ${jobRouteData.databaseId}`);
|
quickDatabaseQuery(`DELETE FROM job_route_loc WHERE job_route_loc_route = ${jobRouteData.databaseId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
clearArray(getServerData().jobs[jobId].routes[jobRoute].locations);
|
clearArray(getServerData().jobs[jobId].routes[jobRoute].locations);
|
||||||
getServerData().jobs[jobId].routes.splice(jobRoute, 1);
|
getServerData().jobs[jobId].routes.splice(jobRoute, 1);
|
||||||
@@ -2728,7 +2737,7 @@ function getJobPointsInRange(position, distance) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function respawnJobVehicle(client) {
|
function respawnJobVehicle(client) {
|
||||||
respawnVehicle(getPlayerJobVehicle(client));
|
respawnVehicle(getPlayerJobVehicle(client));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -2740,12 +2749,12 @@ function getPlayerJobVehicle(client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getRandomJobRouteForLocation(closestJobLocation) {
|
function getRandomJobRouteForLocation(closestJobLocation) {
|
||||||
if(closestJobLocation.routeCache.length > 0) {
|
if(closestJobLocation.routeCache.length > 0) {
|
||||||
let randomRoute = getRandom(0, closestJobLocation.routeCache.length-1);
|
let randomRoute = getRandom(0, closestJobLocation.routeCache.length-1);
|
||||||
let routeId = closestJobLocation.routeCache[randomRoute];
|
let routeId = closestJobLocation.routeCache[randomRoute];
|
||||||
return getJobRouteData(closestJobLocation.jobIndex, routeId).index;
|
return getJobRouteData(closestJobLocation.jobIndex, routeId).index;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -2785,58 +2794,58 @@ function getClosestJobLocationForJob(position, jobId) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getPlayerJobRoute(client) {
|
function getPlayerJobRoute(client) {
|
||||||
return getPlayerData(client).jobRoute;
|
return getPlayerData(client).jobRoute;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getPlayerJobRouteLocation(client) {
|
function getPlayerJobRouteLocation(client) {
|
||||||
return getPlayerData(client).jobRouteLocation;
|
return getPlayerData(client).jobRouteLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showCurrentJobLocation(client) {
|
function showCurrentJobLocation(client) {
|
||||||
let jobId = getPlayerJob(client);
|
let jobId = getPlayerJob(client);
|
||||||
sendJobRouteLocationToPlayer(client, getJobRouteLocationData(jobId, getPlayerJobRoute(client), getPlayerJobRouteLocation(client)).position, getJobData(jobId).colour);
|
sendJobRouteLocationToPlayer(client, getJobRouteLocationData(jobId, getPlayerJobRoute(client), getPlayerJobRouteLocation(client)).position, getJobData(jobId).colour);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function finishSuccessfulJobRoute(client) {
|
function finishSuccessfulJobRoute(client) {
|
||||||
let jobId = getPlayerJob(client);
|
let jobId = getPlayerJob(client);
|
||||||
let jobRouteData = getJobRouteData(jobId, getPlayerJobRoute(client));
|
let jobRouteData = getJobRouteData(jobId, getPlayerJobRoute(client));
|
||||||
let payout = toInteger(applyServerInflationMultiplier(jobRouteData.pay));
|
let payout = toInteger(applyServerInflationMultiplier(jobRouteData.pay));
|
||||||
getPlayerData(client).payDayAmount = getPlayerData(client).payDayAmount + payout;
|
getPlayerData(client).payDayAmount = getPlayerData(client).payDayAmount + payout;
|
||||||
|
|
||||||
messagePlayerSuccess(client, replaceJobRouteStringsInMessage(jobRouteData.finishMessage, jobId, jobRouteData.index));
|
messagePlayerSuccess(client, replaceJobRouteStringsInMessage(jobRouteData.finishMessage, jobId, jobRouteData.index));
|
||||||
|
|
||||||
stopReturnToJobVehicleCountdown(client);
|
stopReturnToJobVehicleCountdown(client);
|
||||||
sendPlayerStopJobRoute(client);
|
sendPlayerStopJobRoute(client);
|
||||||
respawnVehicle(getPlayerData(client).jobRouteVehicle);
|
respawnVehicle(getPlayerData(client).jobRouteVehicle);
|
||||||
|
|
||||||
getPlayerData(client).jobRouteVehicle = false;
|
getPlayerData(client).jobRouteVehicle = false;
|
||||||
getPlayerData(client).jobRoute = -1;
|
getPlayerData(client).jobRoute = -1;
|
||||||
getPlayerData(client).jobRouteLocation = -1;
|
getPlayerData(client).jobRouteLocation = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getNextLocationOnJobRoute(jobId, routeId, currentLocationId) {
|
function getNextLocationOnJobRoute(jobId, routeId, currentLocationId) {
|
||||||
if(!isLastLocationOnJobRoute(jobId, routeId, currentLocationId)) {
|
if(!isLastLocationOnJobRoute(jobId, routeId, currentLocationId)) {
|
||||||
return currentLocationId+1;
|
return currentLocationId+1;
|
||||||
} else {
|
} else {
|
||||||
return getJobRouteData(jobId, routeId).locations.length-1;
|
return getJobRouteData(jobId, routeId).locations.length-1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function isLastLocationOnJobRoute(jobId, routeId, currentLocationId) {
|
function isLastLocationOnJobRoute(jobId, routeId, currentLocationId) {
|
||||||
if(currentLocationId == getJobRouteData(jobId, routeId).locations.length-1) {
|
if(currentLocationId == getJobRouteData(jobId, routeId).locations.length-1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -2860,21 +2869,21 @@ function getJobRouteFromParams(params, jobId) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function replaceJobRouteStringsInMessage(messageText, jobId, jobRouteId) {
|
function replaceJobRouteStringsInMessage(messageText, jobId, jobRouteId) {
|
||||||
let tempJobRouteData = getJobRouteData(jobId, jobRouteId);
|
let tempJobRouteData = getJobRouteData(jobId, jobRouteId);
|
||||||
|
|
||||||
let tempFind = `{JOBROUTENAME}`;
|
let tempFind = `{JOBROUTENAME}`;
|
||||||
let tempRegex = new RegExp(tempFind, 'g');
|
let tempRegex = new RegExp(tempFind, 'g');
|
||||||
messageText = messageText.replace(tempRegex, tempJobRouteData.name);
|
messageText = messageText.replace(tempRegex, tempJobRouteData.name);
|
||||||
|
|
||||||
tempFind = `{JOBROUTEPAY}`;
|
tempFind = `{JOBROUTEPAY}`;
|
||||||
tempRegex = new RegExp(tempFind, 'g');
|
tempRegex = new RegExp(tempFind, 'g');
|
||||||
messageText = messageText.replace(tempRegex, `$${tempJobRouteData.pay}`);
|
messageText = messageText.replace(tempRegex, `$${tempJobRouteData.pay}`);
|
||||||
|
|
||||||
tempFind = `{JOBNAME}`;
|
tempFind = `{JOBNAME}`;
|
||||||
tempRegex = new RegExp(tempFind, 'g');
|
tempRegex = new RegExp(tempFind, 'g');
|
||||||
messageText = messageText.replace(tempRegex, getJobData(tempJobRouteData.jobIndex).name);
|
messageText = messageText.replace(tempRegex, getJobData(tempJobRouteData.jobIndex).name);
|
||||||
|
|
||||||
return messageText;
|
return messageText;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"target": "es6",
|
"target": "es6",
|
||||||
"moduleResolution": "classic"
|
"moduleResolution": "classic"
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"*.js",
|
"*.js",
|
||||||
"job/*.js",
|
"job/*.js",
|
||||||
"business/*.js",
|
"business/*.js",
|
||||||
"item/*.js",
|
"item/*.js",
|
||||||
"npc/*.js",
|
"npc/*.js",
|
||||||
"native/*.js",
|
"native/*.js",
|
||||||
"../shared/*.js"
|
"../shared/*.js"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -10,190 +10,190 @@
|
|||||||
|
|
||||||
function initKeyBindScript() {
|
function initKeyBindScript() {
|
||||||
logToConsole(LOG_INFO, "[VRR.KeyBind]: Initializing key bind script ...");
|
logToConsole(LOG_INFO, "[VRR.KeyBind]: Initializing key bind script ...");
|
||||||
getGlobalConfig().keyBind = loadKeyBindConfiguration();
|
getGlobalConfig().keyBind = loadKeyBindConfiguration();
|
||||||
logToConsole(LOG_INFO, "[VRR.KeyBind]: Key bind script initialized!");
|
logToConsole(LOG_INFO, "[VRR.KeyBind]: Key bind script initialized!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function addKeyBindCommand(command, params, client) {
|
function addKeyBindCommand(command, params, client) {
|
||||||
let splitParams = params.split(" ");
|
let splitParams = params.split(" ");
|
||||||
|
|
||||||
let keyId = getKeyIdFromParams(getParam(params, " ", 1));
|
let keyId = getKeyIdFromParams(getParam(params, " ", 1));
|
||||||
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(" ") : "";
|
||||||
|
|
||||||
if(!keyId) {
|
if(!keyId) {
|
||||||
messagePlayerError(client, "The key ID or name you input is invalid!");
|
messagePlayerError(client, "The key ID or name you input is invalid!");
|
||||||
messagePlayerTip(client, "Use simple key names, letters, or numbers. Don't add spaces.");
|
messagePlayerTip(client, "Use simple key names, letters, or numbers. Don't add spaces.");
|
||||||
messagePlayerInfo(client, `Examples: {ALTCOLOUR}1, 2, a, b, numplus, num1, f1, f2, pageup, delete, insert, rightshift, leftctrl`);
|
messagePlayerInfo(client, `Examples: {ALTCOLOUR}1, 2, a, b, numplus, num1, f1, f2, pageup, delete, insert, rightshift, leftctrl`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!keyId) {
|
if(!keyId) {
|
||||||
messagePlayerError(client, "That key name/id is invalid!");
|
messagePlayerError(client, "That key name/id is invalid!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(areParamsEmpty(tempCommand)) {
|
if(areParamsEmpty(tempCommand)) {
|
||||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
addPlayerKeyBind(client, keyId, tempCommand, tempParams);
|
addPlayerKeyBind(client, keyId, tempCommand, tempParams);
|
||||||
messagePlayerSuccess(client, `You binded the {ALTCOLOUR}${toUpperCase(getKeyNameFromId(keyId))} {MAINCOLOUR}key to command: {ALTCOLOUR}/${tempCommand} ${tempParams}`);
|
messagePlayerSuccess(client, `You binded the {ALTCOLOUR}${toUpperCase(getKeyNameFromId(keyId))} {MAINCOLOUR}key to command: {ALTCOLOUR}/${tempCommand} ${tempParams}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function removeKeyBindCommand(command, params, client) {
|
function removeKeyBindCommand(command, params, client) {
|
||||||
let splitParams = params.split(" ");
|
let splitParams = params.split(" ");
|
||||||
|
|
||||||
let keyId = getKeyIdFromParams(getParam(params, " ", 1));
|
let keyId = getKeyIdFromParams(getParam(params, " ", 1));
|
||||||
|
|
||||||
if(!keyId) {
|
if(!keyId) {
|
||||||
messagePlayerError(client, "The key ID or name you input is invalid!");
|
messagePlayerError(client, "The key ID or name you input is invalid!");
|
||||||
messagePlayerTip(client, "Use simple key names, letters, or numbers. Don't add spaces.");
|
messagePlayerTip(client, "Use simple key names, letters, or numbers. Don't add spaces.");
|
||||||
messagePlayerInfo(client, `Examples: {ALTCOLOUR}1, 2, a, b, numplus, num1, f1, f2, pageup, delete, insert, rightshift, leftctrl`);
|
messagePlayerInfo(client, `Examples: {ALTCOLOUR}1, 2, a, b, numplus, num1, f1, f2, pageup, delete, insert, rightshift, leftctrl`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!keyId) {
|
if(!keyId) {
|
||||||
messagePlayerError(client, "That key name/id is invalid!");
|
messagePlayerError(client, "That key name/id is invalid!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
removePlayerKeyBind(client, keyId);
|
removePlayerKeyBind(client, keyId);
|
||||||
messagePlayerSuccess(client, `You removed the keybind for the {ALTCOLOUR}${toUpperCase(getKeyNameFromId(keyId))} {MAINCOLOUR}key`);
|
messagePlayerSuccess(client, `You removed the keybind for the {ALTCOLOUR}${toUpperCase(getKeyNameFromId(keyId))} {MAINCOLOUR}key`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function addPlayerKeyBind(client, keys, command, params, tempKey = false) {
|
function addPlayerKeyBind(client, keys, command, params, tempKey = false) {
|
||||||
let keyBindData = new KeyBindData(false, keys, `${command} ${params}`);
|
let keyBindData = new KeyBindData(false, keys, `${command} ${params}`);
|
||||||
if(tempKey == true) {
|
if(tempKey == true) {
|
||||||
keyBindData.databaseId = -1;
|
keyBindData.databaseId = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
getPlayerData(client).keyBinds.push(keyBindData);
|
getPlayerData(client).keyBinds.push(keyBindData);
|
||||||
sendAddAccountKeyBindToClient(client, keys, (keys.length > 1) ? VRR_KEYSTATE_COMBO : VRR_KEYSTATE_UP);
|
sendAddAccountKeyBindToClient(client, keys, (keys.length > 1) ? VRR_KEYSTATE_COMBO : VRR_KEYSTATE_UP);
|
||||||
|
|
||||||
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, `[VRR.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[VRR.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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function removePlayerKeyBind(client, keyId) {
|
function removePlayerKeyBind(client, keyId) {
|
||||||
if(isPlayerLoggedIn(client)) {
|
if(isPlayerLoggedIn(client)) {
|
||||||
quickDatabaseQuery(`DELETE FROM acct_hotkey WHERE acct_hotkey_acct = ${getPlayerData(client).accountData.databaseId} AND acct_hotkey_key = ${keyId}`);
|
quickDatabaseQuery(`DELETE FROM acct_hotkey WHERE acct_hotkey_acct = ${getPlayerData(client).accountData.databaseId} AND acct_hotkey_key = ${keyId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(let i in getPlayerData(client).keyBinds) {
|
for(let i in getPlayerData(client).keyBinds) {
|
||||||
if(getPlayerData(client).keyBinds[i].key == keyId) {
|
if(getPlayerData(client).keyBinds[i].key == keyId) {
|
||||||
getPlayerData(client).keyBinds.splice(i, 1);
|
getPlayerData(client).keyBinds.splice(i, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sendRemoveAccountKeyBindToClient(client, keyId);
|
sendRemoveAccountKeyBindToClient(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, `[VRR.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[VRR.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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function doesPlayerHaveKeyBindForCommand(client, command) {
|
function doesPlayerHaveKeyBindForCommand(client, command) {
|
||||||
for(let i in getPlayerData(client).keyBinds) {
|
for(let i in getPlayerData(client).keyBinds) {
|
||||||
if(toLowerCase(getPlayerData(client).keyBinds[i].commandString.split(" ")[0]) == toLowerCase(command)) {
|
if(toLowerCase(getPlayerData(client).keyBinds[i].commandString.split(" ")[0]) == toLowerCase(command)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getPlayerKeyBindForCommand(client, command) {
|
function getPlayerKeyBindForCommand(client, command) {
|
||||||
for(let i in getPlayerData(client).keyBinds) {
|
for(let i in getPlayerData(client).keyBinds) {
|
||||||
if(toLowerCase(getPlayerData(client).keyBinds[i].commandString.split(" ")[0]) == toLowerCase(command)) {
|
if(toLowerCase(getPlayerData(client).keyBinds[i].commandString.split(" ")[0]) == toLowerCase(command)) {
|
||||||
return getPlayerData(client).keyBinds[i];
|
return getPlayerData(client).keyBinds[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function doesPlayerHaveKeyBindForKey(client, key) {
|
function doesPlayerHaveKeyBindForKey(client, key) {
|
||||||
for(let i in getPlayerData(client).keyBinds) {
|
for(let i in getPlayerData(client).keyBinds) {
|
||||||
if(getPlayerData(client).keyBinds[i].key == key) {
|
if(getPlayerData(client).keyBinds[i].key == key) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function doesPlayerHaveKeyBindsDisabled(client) {
|
function doesPlayerHaveKeyBindsDisabled(client) {
|
||||||
return hasBitFlag(getPlayerData(client).accountData.settings, getAccountSettingsFlagValue("NoKeyBinds"));
|
return hasBitFlag(getPlayerData(client).accountData.settings, getAccountSettingsFlagValue("NoKeyBinds"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getPlayerKeyBindForKey(client, key) {
|
function getPlayerKeyBindForKey(client, key) {
|
||||||
for(let i in getPlayerData(client).keyBinds) {
|
for(let i in getPlayerData(client).keyBinds) {
|
||||||
if(getPlayerData(client).keyBinds[i].key == key) {
|
if(getPlayerData(client).keyBinds[i].key == key) {
|
||||||
return getPlayerData(client).keyBinds[i];
|
return getPlayerData(client).keyBinds[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function playerUsedKeyBind(client, key) {
|
function playerUsedKeyBind(client, key) {
|
||||||
if(!isPlayerLoggedIn(client)) {
|
if(!isPlayerLoggedIn(client)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isPlayerSpawned(client)) {
|
if(!isPlayerSpawned(client)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.KeyBind] ${getPlayerDisplayForConsole(client)} used keybind ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
logToConsole(LOG_DEBUG, `[VRR.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) {
|
||||||
let splitCommandString = keyBindData.commandString.split(" ");
|
let splitCommandString = keyBindData.commandString.split(" ");
|
||||||
let tempCommand = splitCommandString[0];
|
let tempCommand = splitCommandString[0];
|
||||||
let tempParams = "";
|
let tempParams = "";
|
||||||
if(splitCommandString.length > 1) {
|
if(splitCommandString.length > 1) {
|
||||||
tempParams = splitCommandString.slice(1).join(" ");
|
tempParams = splitCommandString.slice(1).join(" ");
|
||||||
}
|
}
|
||||||
getCommand(toLowerCase(tempCommand)).handlerFunction(tempCommand, tempParams, client);
|
getCommand(toLowerCase(tempCommand)).handlerFunction(tempCommand, tempParams, client);
|
||||||
//triggerEvent("OnPlayerCommand", null, tempCommand, tempParams, client);
|
//triggerEvent("OnPlayerCommand", null, tempCommand, tempParams, client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendAccountKeyBindsToClient(client) {
|
function sendAccountKeyBindsToClient(client) {
|
||||||
sendClearKeyBindsToClient(client);
|
sendClearKeyBindsToClient(client);
|
||||||
for(let i in getPlayerData(client).keyBinds) {
|
for(let i in getPlayerData(client).keyBinds) {
|
||||||
sendAddAccountKeyBindToClient(client, getPlayerData(client).keyBinds[i].key, getPlayerData(client).keyBinds[i].keyState);
|
sendAddAccountKeyBindToClient(client, getPlayerData(client).keyBinds[i].key, getPlayerData(client).keyBinds[i].keyState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -12,16 +12,16 @@ let translateURL = "http://api.mymemory.translated.net/get?de={3}&q={0}&langpair
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function initLocaleScript() {
|
function initLocaleScript() {
|
||||||
logToConsole(LOG_INFO, "[VRR.Locale]: Initializing locale script ...");
|
logToConsole(LOG_INFO, "[VRR.Locale]: Initializing locale script ...");
|
||||||
getServerData().localeStrings = loadAllLocaleStrings();
|
getServerData().localeStrings = loadAllLocaleStrings();
|
||||||
|
|
||||||
// Translation Cache
|
// Translation Cache
|
||||||
getServerData().cachedTranslations = new Array(getGlobalConfig().locale.locales.length);
|
getServerData().cachedTranslations = new Array(getGlobalConfig().locale.locales.length);
|
||||||
getServerData().cachedTranslationFrom = new Array(getGlobalConfig().locale.locales.length);
|
getServerData().cachedTranslationFrom = new Array(getGlobalConfig().locale.locales.length);
|
||||||
getServerData().cachedTranslationFrom.fill([]);
|
getServerData().cachedTranslationFrom.fill([]);
|
||||||
getServerData().cachedTranslations.fill(getServerData().cachedTranslationFrom);
|
getServerData().cachedTranslations.fill(getServerData().cachedTranslationFrom);
|
||||||
|
|
||||||
getGlobalConfig().locale.defaultLanguageId = getLocaleFromParams(getGlobalConfig().locale.defaultLanguageId);
|
getGlobalConfig().locale.defaultLanguageId = getLocaleFromParams(getGlobalConfig().locale.defaultLanguageId);
|
||||||
|
|
||||||
logToConsole(LOG_INFO, "[VRR.Locale]: Locale script initialized!");
|
logToConsole(LOG_INFO, "[VRR.Locale]: Locale script initialized!");
|
||||||
}
|
}
|
||||||
@@ -29,68 +29,68 @@ function initLocaleScript() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getLocaleString(client, stringName, ...args) {
|
function getLocaleString(client, stringName, ...args) {
|
||||||
let tempString = getRawLocaleString(stringName, getPlayerData(client).locale);
|
let tempString = getRawLocaleString(stringName, getPlayerData(client).locale);
|
||||||
if(tempString == "") {
|
if(tempString == "") {
|
||||||
submitBugReport(client, `(AUTOMATED REPORT) Locale string "${stringName}" is missing for "${getPlayerLocaleName(client)}"`);
|
submitBugReport(client, `(AUTOMATED REPORT) Locale string "${stringName}" is missing for "${getPlayerLocaleName(client)}"`);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(let i = 1; i <= args.length; i++) {
|
for(let i = 1; i <= args.length; i++) {
|
||||||
tempString = tempString.replace(`{${i}}`, args[i-1]);
|
tempString = tempString.replace(`{${i}}`, args[i-1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return tempString;
|
return tempString;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getGroupedLocaleString(client, stringName, index, ...args) {
|
function getGroupedLocaleString(client, stringName, index, ...args) {
|
||||||
let tempString = getRawGroupedLocaleString(stringName, getPlayerData(client).locale, index);
|
let tempString = getRawGroupedLocaleString(stringName, getPlayerData(client).locale, index);
|
||||||
|
|
||||||
for(let i = 1; i <= args.length; i++) {
|
for(let i = 1; i <= args.length; i++) {
|
||||||
tempString = tempString.replace(`{${i}}`, args[i-1]);
|
tempString = tempString.replace(`{${i}}`, args[i-1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return tempString;
|
return tempString;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getRawLocaleString(stringName, localeName) {
|
function getRawLocaleString(stringName, localeName) {
|
||||||
return getLocaleStrings()[localeName][stringName];
|
return getLocaleStrings()[localeName][stringName];
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getRawGroupedLocaleString(stringName, localeName, index) {
|
function getRawGroupedLocaleString(stringName, localeName, index) {
|
||||||
return getLocaleStrings()[localeName][stringName][index];
|
return getLocaleStrings()[localeName][stringName][index];
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getPlayerLocaleName(client) {
|
function getPlayerLocaleName(client) {
|
||||||
let localeId = getPlayerData(client).locale;
|
let localeId = getPlayerData(client).locale;
|
||||||
return getLocales()[localeId][0];
|
return getLocales()[localeId][0];
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function loadAllLocaleStrings() {
|
function loadAllLocaleStrings() {
|
||||||
let tempLocaleStrings = {};
|
let tempLocaleStrings = {};
|
||||||
|
|
||||||
let locales = getGlobalConfig().locale.locales;
|
let locales = getGlobalConfig().locale.locales;
|
||||||
for(let i in locales) {
|
for(let i in locales) {
|
||||||
let localeData = locales[i];
|
let localeData = locales[i];
|
||||||
let localeFile = JSON.parse(loadTextFile(`locale/${localeData[1]}.json`));
|
let localeFile = JSON.parse(loadTextFile(`locale/${localeData[1]}.json`));
|
||||||
tempLocaleStrings[i] = localeFile;
|
tempLocaleStrings[i] = localeFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
return tempLocaleStrings;
|
return tempLocaleStrings;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getLocaleStrings() {
|
function getLocaleStrings() {
|
||||||
return getServerData().localeStrings;
|
return getServerData().localeStrings;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -99,7 +99,7 @@ function getLocaleFromParams(params) {
|
|||||||
let locales = getLocales();
|
let locales = getLocales();
|
||||||
if(isNaN(params)) {
|
if(isNaN(params)) {
|
||||||
for(let i in locales) {
|
for(let i in locales) {
|
||||||
if(toLowerCase(locales[i][2]).indexOf(toLowerCase(params)) != -1) {
|
if(toLowerCase(locales[i][2]).indexOf(toLowerCase(params)) != -1) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@ function getLocaleFromParams(params) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getLocales() {
|
function getLocales() {
|
||||||
return getGlobalConfig().locale.locales;
|
return getGlobalConfig().locale.locales;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -138,41 +138,41 @@ function setLocaleCommand(command, params, client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let localeId = getLocaleFromParams(params);
|
let localeId = getLocaleFromParams(params);
|
||||||
|
|
||||||
if(!getLocaleData(localeId)) {
|
if(!getLocaleData(localeId)) {
|
||||||
messagePlayerInfo(client, getLocaleString(client, "InvalidLocale"));
|
messagePlayerInfo(client, getLocaleString(client, "InvalidLocale"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
getPlayerData(client).accountData.locale = localeId;
|
getPlayerData(client).accountData.locale = localeId;
|
||||||
getPlayerData(client).locale = localeId;
|
getPlayerData(client).locale = localeId;
|
||||||
messagePlayerSuccess(client, getLocaleString(client, "LocaleChanged1"), getLocaleString(client, "LocaleNativeName"));
|
messagePlayerSuccess(client, getLocaleString(client, "LocaleChanged1"), getLocaleString(client, "LocaleNativeName"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getLocaleData(localeId) {
|
function getLocaleData(localeId) {
|
||||||
if(typeof getLocales()[localeId] != "undefined") {
|
if(typeof getLocales()[localeId] != "undefined") {
|
||||||
return getLocales()[localeId];
|
return getLocales()[localeId];
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function reloadLocaleConfigurationCommand(command, params, client) {
|
function reloadLocaleConfigurationCommand(command, params, client) {
|
||||||
getGlobalConfig().locale = loadLocaleConfig();
|
getGlobalConfig().locale = loadLocaleConfig();
|
||||||
getServerData().localeStrings = loadAllLocaleStrings();
|
getServerData().localeStrings = loadAllLocaleStrings();
|
||||||
|
|
||||||
// Translation Cache
|
// Translation Cache
|
||||||
getServerData().cachedTranslations = new Array(getGlobalConfig().locale.locales.length);
|
getServerData().cachedTranslations = new Array(getGlobalConfig().locale.locales.length);
|
||||||
getServerData().cachedTranslationFrom = new Array(getGlobalConfig().locale.locales.length);
|
getServerData().cachedTranslationFrom = new Array(getGlobalConfig().locale.locales.length);
|
||||||
getServerData().cachedTranslationFrom.fill([]);
|
getServerData().cachedTranslationFrom.fill([]);
|
||||||
getServerData().cachedTranslations.fill(getServerData().cachedTranslationFrom);
|
getServerData().cachedTranslations.fill(getServerData().cachedTranslationFrom);
|
||||||
|
|
||||||
getGlobalConfig().locale.defaultLanguageId = getLocaleFromParams(getGlobalConfig().locale.defaultLanguage);
|
getGlobalConfig().locale.defaultLanguageId = getLocaleFromParams(getGlobalConfig().locale.defaultLanguage);
|
||||||
|
|
||||||
messageAdmins(`${client.name}{MAINCOLOUR} has reloaded the locale settings and texts`);
|
messageAdmins(`${client.name}{MAINCOLOUR} has reloaded the locale settings and texts`);
|
||||||
}
|
}
|
||||||
@@ -181,9 +181,9 @@ function reloadLocaleConfigurationCommand(command, params, client) {
|
|||||||
|
|
||||||
async function translateMessage(messageText, translateFrom = getGlobalConfig().locale.defaultLanguageId, translateTo = getGlobalConfig().locale.defaultLanguageId) {
|
async function translateMessage(messageText, translateFrom = getGlobalConfig().locale.defaultLanguageId, translateTo = getGlobalConfig().locale.defaultLanguageId) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
if(translateFrom == translateTo) {
|
if(translateFrom == translateTo) {
|
||||||
resolve(messageText);
|
resolve(messageText);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(let i in cachedTranslations[translateFrom][translateTo]) {
|
for(let i in cachedTranslations[translateFrom][translateTo]) {
|
||||||
if(cachedTranslations[translateFrom][translateTo][i][0] == messageText) {
|
if(cachedTranslations[translateFrom][translateTo][i][0] == messageText) {
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ function initMessagingScript() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function messageAdminAction(messageText) {
|
function messageAdminAction(messageText) {
|
||||||
messagePlayerNormal(null, `⚠️ ${messageText}`, getColourByName("orange"));
|
messagePlayerNormal(null, `⚠️ ${messageText}`, getColourByName("orange"));
|
||||||
if(getServerConfig().discordEnabled) {
|
if(getServerConfig().discordEnabled) {
|
||||||
messageDiscord(`:warning: ${messageText}`);
|
messageDiscord(`:warning: ${messageText}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -33,188 +33,188 @@ function messageAdminAction(messageText) {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function messagePlayerNormal(client, messageText, colour = COLOUR_WHITE) {
|
function messagePlayerNormal(client, messageText, colour = COLOUR_WHITE) {
|
||||||
//if(isConsole(client) || client == null) {
|
//if(isConsole(client) || client == null) {
|
||||||
// logToConsole(LOG_INFO, `${removeColoursInMessage(messageText)}`);
|
// logToConsole(LOG_INFO, `${removeColoursInMessage(messageText)}`);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
sendChatBoxMessageToPlayer(client, messageText, colour);
|
sendChatBoxMessageToPlayer(client, messageText, colour);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function messageAdmins(messageText, colour = getColourByName("softRed")) {
|
function messageAdmins(messageText, colour = getColourByName("softRed")) {
|
||||||
//let plainMessage = removeColoursInMessage(messageText);
|
//let plainMessage = removeColoursInMessage(messageText);
|
||||||
//console.warn(`🛡️ ${plainMessage}`);
|
//console.warn(`🛡️ ${plainMessage}`);
|
||||||
|
|
||||||
let clients = getClients();
|
let clients = getClients();
|
||||||
for(let i in clients) {
|
for(let i in clients) {
|
||||||
if(doesPlayerHaveStaffPermission(clients[i], getStaffFlagValue("BasicModeration"))) {
|
if(doesPlayerHaveStaffPermission(clients[i], getStaffFlagValue("BasicModeration"))) {
|
||||||
messagePlayerNormal(clients[i], `🛡️ ${messageText}`, colour);
|
messagePlayerNormal(clients[i], `🛡️ ${messageText}`, colour);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//if(getServerConfig().discordConfig.sendAdminEvents) {
|
//if(getServerConfig().discordConfig.sendAdminEvents) {
|
||||||
// messageDiscordAdminChannel(plainMessage);
|
// messageDiscordAdminChannel(plainMessage);
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function messagePlayerError(client, messageText) {
|
function messagePlayerError(client, messageText) {
|
||||||
if(isConsole(client)) {
|
if(isConsole(client)) {
|
||||||
logToConsole(LOG_INFO, `❌ ${messageText}`);
|
logToConsole(LOG_INFO, `❌ ${messageText}`);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isClientFromDiscord(client)) {
|
if(!isClientFromDiscord(client)) {
|
||||||
messagePlayerNormal(client, `❌ ${messageText}`, getColourByName("white"));
|
messagePlayerNormal(client, `❌ ${messageText}`, getColourByName("white"));
|
||||||
} else {
|
} else {
|
||||||
messageDiscordUser(client, `❌ ${messageText}`);
|
messageDiscordUser(client, `❌ ${messageText}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function messagePlayerSyntax(client, messageText) {
|
function messagePlayerSyntax(client, messageText) {
|
||||||
if(isConsole(client)) {
|
if(isConsole(client)) {
|
||||||
logToConsole(LOG_INFO, `⌨️ ${messageText}`);
|
logToConsole(LOG_INFO, `⌨️ ${messageText}`);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isClientFromDiscord(client)) {
|
if(!isClientFromDiscord(client)) {
|
||||||
messagePlayerNormal(client, `⌨️ USAGE: {MAINCOLOUR} ${messageText}`, getColourByType("syntaxMessage"));
|
messagePlayerNormal(client, `⌨️ USAGE: {MAINCOLOUR} ${messageText}`, getColourByType("syntaxMessage"));
|
||||||
} else {
|
} else {
|
||||||
messageDiscordUser(client, `⌨️ ${messageText}`);
|
messageDiscordUser(client, `⌨️ ${messageText}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function messagePlayerAlert(client, messageText) {
|
function messagePlayerAlert(client, messageText) {
|
||||||
if(isConsole(client)) {
|
if(isConsole(client)) {
|
||||||
logToConsole(LOG_INFO, `⚠️ ${messageText}`);
|
logToConsole(LOG_INFO, `⚠️ ${messageText}`);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isClientFromDiscord(client)) {
|
if(!isClientFromDiscord(client)) {
|
||||||
messagePlayerNormal(client, `⚠️ ${messageText}`, getColourByName("white"));
|
messagePlayerNormal(client, `⚠️ ${messageText}`, getColourByName("white"));
|
||||||
} else {
|
} else {
|
||||||
messageDiscordUser(client, `⚠️ ${messageText}`);
|
messageDiscordUser(client, `⚠️ ${messageText}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function messagePlayerSuccess(client, messageText) {
|
function messagePlayerSuccess(client, messageText) {
|
||||||
if(isConsole(client)) {
|
if(isConsole(client)) {
|
||||||
logToConsole(LOG_INFO, `✔️ ${messageText}`);
|
logToConsole(LOG_INFO, `✔️ ${messageText}`);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isClientFromDiscord(client)) {
|
if(!isClientFromDiscord(client)) {
|
||||||
messagePlayerNormal(client, `✔️ ${messageText}`, getColourByName("white"));
|
messagePlayerNormal(client, `✔️ ${messageText}`, getColourByName("white"));
|
||||||
} else {
|
} else {
|
||||||
messageDiscordUser(client, `✔️ ${messageText}`);
|
messageDiscordUser(client, `✔️ ${messageText}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function messagePlayerInfo(client, messageText) {
|
function messagePlayerInfo(client, messageText) {
|
||||||
if(isConsole(client)) {
|
if(isConsole(client)) {
|
||||||
logToConsole(LOG_INFO, `ℹ️ ${messageText}`);
|
logToConsole(LOG_INFO, `ℹ️ ${messageText}`);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isClientFromDiscord(client)) {
|
if(!isClientFromDiscord(client)) {
|
||||||
messagePlayerNormal(client, `ℹ️ ${messageText}`, getColourByName("white"));
|
messagePlayerNormal(client, `ℹ️ ${messageText}`, getColourByName("white"));
|
||||||
} else {
|
} else {
|
||||||
messageDiscordUser(client, `:information_source: ${messageText}`);
|
messageDiscordUser(client, `:information_source: ${messageText}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function messagePlayerTip(client, messageText) {
|
function messagePlayerTip(client, messageText) {
|
||||||
if(isConsole(client)) {
|
if(isConsole(client)) {
|
||||||
logToConsole(LOG_INFO, `ℹ️ ${messageText}`);
|
logToConsole(LOG_INFO, `ℹ️ ${messageText}`);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isClientFromDiscord(client)) {
|
if(!isClientFromDiscord(client)) {
|
||||||
messagePlayerNormal(client, `ℹ️ ${messageText}`, getColourByName("white"));
|
messagePlayerNormal(client, `ℹ️ ${messageText}`, getColourByName("white"));
|
||||||
} else {
|
} else {
|
||||||
messageDiscordUser(client, `:information_source: ${messageText}`);
|
messageDiscordUser(client, `:information_source: ${messageText}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function messagePlayerTalk(client, talkingClient, messageText) {
|
function messagePlayerTalk(client, talkingClient, messageText) {
|
||||||
messagePlayerNormal(client, `🗣️ ${getPlayerAccentInlineOutput(talkingClient)}${getClientSubAccountName(talkingClient)} says: ${messageText}`, getColourByType("talkMessage"));
|
messagePlayerNormal(client, `🗣️ ${getPlayerAccentInlineOutput(talkingClient)}${getClientSubAccountName(talkingClient)} says: ${messageText}`, getColourByType("talkMessage"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function messagePlayerWhisper(client, whisperingClient, messageText) {
|
function messagePlayerWhisper(client, whisperingClient, messageText) {
|
||||||
messagePlayerNormal(client, `🤫 ${getPlayerAccentInlineOutput(whisperingClient)}${getClientSubAccountName(whisperingClient)} whispers: ${messageText}`, getColourByType("whisperMessage"));
|
messagePlayerNormal(client, `🤫 ${getPlayerAccentInlineOutput(whisperingClient)}${getClientSubAccountName(whisperingClient)} whispers: ${messageText}`, getColourByType("whisperMessage"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function messagePlayerMegaPhone(client, shoutingClient, messageText) {
|
function messagePlayerMegaPhone(client, shoutingClient, messageText) {
|
||||||
messagePlayerNormal(client, `📢 ${getPlayerAccentInlineOutput(shoutingClient)}${getClientSubAccountName(shoutingClient)} (megaphone): ${messageText}!`, getColourByType("yellow"));
|
messagePlayerNormal(client, `📢 ${getPlayerAccentInlineOutput(shoutingClient)}${getClientSubAccountName(shoutingClient)} (megaphone): ${messageText}!`, getColourByType("yellow"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function messagePlayerShout(client, shoutingClient, messageText) {
|
function messagePlayerShout(client, shoutingClient, messageText) {
|
||||||
messagePlayerNormal(client, `🗣️ ${getPlayerAccentInlineOutput(shoutingClient)}${getClientSubAccountName(shoutingClient)} shouts: ${messageText}!`, getColourByType("shoutMessage"));
|
messagePlayerNormal(client, `🗣️ ${getPlayerAccentInlineOutput(shoutingClient)}${getClientSubAccountName(shoutingClient)} shouts: ${messageText}!`, getColourByType("shoutMessage"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function messagePlayerDoAction(client, doingActionClient, messageText) {
|
function messagePlayerDoAction(client, doingActionClient, messageText) {
|
||||||
if(!isClientFromDiscord(client)) {
|
if(!isClientFromDiscord(client)) {
|
||||||
messagePlayerNormal(client, `${messageText} * (${getClientSubAccountName(doingActionClient)})`, getColourByType("doActionMessage"));
|
messagePlayerNormal(client, `${messageText} * (${getClientSubAccountName(doingActionClient)})`, getColourByType("doActionMessage"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function messagePlayerMeAction(client, doingActionClient, messageText) {
|
function messagePlayerMeAction(client, doingActionClient, messageText) {
|
||||||
messagePlayerNormal(client, `${getClientSubAccountName(doingActionClient)} ${messageText}`, getColourByType("meActionMessage"));
|
messagePlayerNormal(client, `${getClientSubAccountName(doingActionClient)} ${messageText}`, getColourByType("meActionMessage"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function messagePlayerClanChat(client, clanChattingClient, messageText) {
|
function messagePlayerClanChat(client, clanChattingClient, messageText) {
|
||||||
messagePlayerNormal(client, `👥 ${getInlineChatColourByName("clanOrange")}${(getPlayerClanRankName(clanChattingClient) != false) ? getPlayerClanRankName(clanChattingClient) : "No Rank"} ${getCharacterFullName(clanChattingClient)} {MAINCOLOUR}says (clan): {ALTCOLOUR}${messageText}`, getColourByType("clanChatMessage"));
|
messagePlayerNormal(client, `👥 ${getInlineChatColourByName("clanOrange")}${(getPlayerClanRankName(clanChattingClient) != false) ? getPlayerClanRankName(clanChattingClient) : "No Rank"} ${getCharacterFullName(clanChattingClient)} {MAINCOLOUR}says (clan): {ALTCOLOUR}${messageText}`, getColourByType("clanChatMessage"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function messagePlayerAdminChat(client, adminChattingClient, messageText) {
|
function messagePlayerAdminChat(client, adminChattingClient, messageText) {
|
||||||
messagePlayerNormal(client, `🛡️ [ADMIN CHAT] {ALTCOLOUR}${getPlayerData(adminChattingClient).accountData.staffTitle} [#CCCCCC]${getPlayerData(adminChattingClient).accountData.name}: {MAINCOLOUR}${messageText}`, getColourByType("orange"));
|
messagePlayerNormal(client, `🛡️ [ADMIN CHAT] {ALTCOLOUR}${getPlayerData(adminChattingClient).accountData.staffTitle} [#CCCCCC]${getPlayerData(adminChattingClient).accountData.name}: {MAINCOLOUR}${messageText}`, getColourByType("orange"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function messagePlayerNewbieTip(client, message) {
|
function messagePlayerNewbieTip(client, message) {
|
||||||
if(!hasBitFlag(getPlayerData(client).accountData.settings, getAccountSettingsFlagValue("NoActionTips"))) {
|
if(!hasBitFlag(getPlayerData(client).accountData.settings, getAccountSettingsFlagValue("NoActionTips"))) {
|
||||||
messagePlayerNormal(client, `💡 ${message}`);
|
messagePlayerNormal(client, `💡 ${message}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function messagePlayerTimedRandomTip(client, message) {
|
function messagePlayerTimedRandomTip(client, message) {
|
||||||
if(isPlayerLoggedIn(client) && isPlayerSpawned(client)) {
|
if(isPlayerLoggedIn(client) && isPlayerSpawned(client)) {
|
||||||
if(!hasBitFlag(getPlayerData(client).accountData.settings, getAccountSettingsFlagValue("NoRandomTips"))) {
|
if(!hasBitFlag(getPlayerData(client).accountData.settings, getAccountSettingsFlagValue("NoRandomTips"))) {
|
||||||
messagePlayerNormal(client, `💡 ${message}`);
|
messagePlayerNormal(client, `💡 ${message}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -237,7 +237,7 @@ function clearChatBox(client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function messagePlayerHelpContent(client, messageString) {
|
function messagePlayerHelpContent(client, messageString) {
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}${messageString}`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}${messageString}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function startTutorial(client) {
|
function startTutorial(client) {
|
||||||
getPlayerData(client).tutorialItem = createGroundItem(tutorialItem[0], tutorialItem[1], tutorialItem[3]);
|
getPlayerData(client).tutorialItem = createGroundItem(tutorialItem[0], tutorialItem[1], tutorialItem[3]);
|
||||||
getPlayerData(client).tutorialVehicle = createGroundItem(tutorialItem[0], tutorialItem[1], tutorialItem[3]);
|
getPlayerData(client).tutorialVehicle = createGroundItem(tutorialItem[0], tutorialItem[1], tutorialItem[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -170,9 +170,9 @@ function spawnAllVehicles() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Vehicle} vehicle - The vehicle element
|
* @param {Vehicle} vehicle - The vehicle element
|
||||||
* @return {VehicleData} The vehicles's data (class instance)
|
* @return {VehicleData} The vehicles's data (class instance)
|
||||||
*/
|
*/
|
||||||
function getVehicleData(vehicle) {
|
function getVehicleData(vehicle) {
|
||||||
if(isVehicleObject(vehicle)) {
|
if(isVehicleObject(vehicle)) {
|
||||||
let dataIndex = getEntityData(vehicle, "vrr.dataSlot");
|
let dataIndex = getEntityData(vehicle, "vrr.dataSlot");
|
||||||
@@ -558,7 +558,7 @@ function buyVehicleCommand(command, params, client) {
|
|||||||
getPlayerData(client).buyingVehicle = vehicle;
|
getPlayerData(client).buyingVehicle = vehicle;
|
||||||
getVehicleData(vehicle).engine = true;
|
getVehicleData(vehicle).engine = true;
|
||||||
vehicle.engine = true;
|
vehicle.engine = true;
|
||||||
setEntityData(vehicle, "vrr.engine", getVehicleData(vehicle).engine, true);
|
setEntityData(vehicle, "vrr.engine", getVehicleData(vehicle).engine, true);
|
||||||
|
|
||||||
getVehicleData(vehicle).needsSaved = true;
|
getVehicleData(vehicle).needsSaved = true;
|
||||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_TESTDRIVE, vehicle.id, getVehiclePosition(vehicle));
|
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_TESTDRIVE, vehicle.id, getVehiclePosition(vehicle));
|
||||||
@@ -1079,10 +1079,10 @@ function reloadAllVehiclesCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function respawnVehicleCommand(command, params, client) {
|
function respawnVehicleCommand(command, params, client) {
|
||||||
if(isPlayerInAnyVehicle(client)) {
|
if(isPlayerInAnyVehicle(client)) {
|
||||||
removeAllOccupantsFromVehicle(getPlayerVehicle(client));
|
removeAllOccupantsFromVehicle(getPlayerVehicle(client));
|
||||||
respawnVehicle(getPlayerVehicle(client));
|
respawnVehicle(getPlayerVehicle(client));
|
||||||
}
|
}
|
||||||
|
|
||||||
setAllVehicleIndexes();
|
setAllVehicleIndexes();
|
||||||
|
|
||||||
@@ -1133,7 +1133,7 @@ function respawnJobVehiclesCommand(command, params, client) {
|
|||||||
if(getServerData().vehicles[i].ownerType == VRR_VEHOWNER_JOB) {
|
if(getServerData().vehicles[i].ownerType == VRR_VEHOWNER_JOB) {
|
||||||
respawnVehicle(getServerData().vehicles[i].vehicle);
|
respawnVehicle(getServerData().vehicles[i].vehicle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
messageAdminAction(`All job vehicles have been respawned by an admin!`);
|
messageAdminAction(`All job vehicles have been respawned by an admin!`);
|
||||||
}
|
}
|
||||||
@@ -1145,7 +1145,7 @@ function respawnClanVehiclesCommand(command, params, client) {
|
|||||||
if(getServerData().vehicles[i].ownerType == VRR_VEHOWNER_CLAN) {
|
if(getServerData().vehicles[i].ownerType == VRR_VEHOWNER_CLAN) {
|
||||||
respawnVehicle(getServerData().vehicles[i].vehicle);
|
respawnVehicle(getServerData().vehicles[i].vehicle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
messageAdminAction(`All clan vehicles have been respawned by an admin!`);
|
messageAdminAction(`All clan vehicles have been respawned by an admin!`);
|
||||||
}
|
}
|
||||||
@@ -1157,7 +1157,7 @@ function respawnPlayerVehiclesCommand(command, params, client) {
|
|||||||
if(getServerData().vehicles[i].ownerType == VRR_VEHOWNER_PLAYER) {
|
if(getServerData().vehicles[i].ownerType == VRR_VEHOWNER_PLAYER) {
|
||||||
respawnVehicle(getServerData().vehicles[i].vehicle);
|
respawnVehicle(getServerData().vehicles[i].vehicle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
messageAdminAction(`All player-owned vehicles have been respawned by an admin!`);
|
messageAdminAction(`All player-owned vehicles have been respawned by an admin!`);
|
||||||
}
|
}
|
||||||
@@ -1169,7 +1169,7 @@ function respawnPublicVehiclesCommand(command, params, client) {
|
|||||||
if(getServerData().vehicles[i].ownerType == VRR_VEHOWNER_PUBLIC) {
|
if(getServerData().vehicles[i].ownerType == VRR_VEHOWNER_PUBLIC) {
|
||||||
respawnVehicle(getServerData().vehicles[i].vehicle);
|
respawnVehicle(getServerData().vehicles[i].vehicle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
messageAdminAction(`All public vehicles have been respawned by an admin!`);
|
messageAdminAction(`All public vehicles have been respawned by an admin!`);
|
||||||
}
|
}
|
||||||
@@ -1181,7 +1181,7 @@ function respawnBusinessVehiclesCommand(command, params, client) {
|
|||||||
if(getServerData().vehicles[i].ownerType == VRR_VEHOWNER_BIZ) {
|
if(getServerData().vehicles[i].ownerType == VRR_VEHOWNER_BIZ) {
|
||||||
respawnVehicle(getServerData().vehicles[i].vehicle);
|
respawnVehicle(getServerData().vehicles[i].vehicle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
messageAdminAction(`All business-owned vehicles have been respawned by an admin!`);
|
messageAdminAction(`All business-owned vehicles have been respawned by an admin!`);
|
||||||
}
|
}
|
||||||
@@ -1411,64 +1411,65 @@ function createPermanentVehicle(modelIndex, position, heading, interior = 0, dim
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function processVehiclePurchasing() {
|
function processVehiclePurchasing() {
|
||||||
if(!getGlobalConfig().useServerSideVehiclePurchaseCheck) {
|
if(!getGlobalConfig().useServerSideVehiclePurchaseCheck) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
getClients().forEach((client) => {
|
getClients().forEach((client) => {
|
||||||
if(!isPlayerLoggedIn(client)) {
|
if(!isPlayerLoggedIn(client)) {
|
||||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isPlayerSpawned(client)) {
|
if(!isPlayerSpawned(client)) {
|
||||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!getPlayerData(client)) {
|
if(!getPlayerData(client)) {
|
||||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!getPlayerData(client).buyingVehicle) {
|
if(!getPlayerData(client).buyingVehicle) {
|
||||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isPlayerInAnyVehicle(client)) {
|
if(!isPlayerInAnyVehicle(client)) {
|
||||||
if(getPlayerData(client).buyingVehicle != false) {
|
if(getPlayerData(client).buyingVehicle != false) {
|
||||||
messagePlayerError(client, getLocaleString(client, "DealershipPurchaseExitedVehicle"));
|
messagePlayerError(client, getLocaleString(client, "DealershipPurchaseExitedVehicle"));
|
||||||
respawnVehicle(getPlayerData(client).buyingVehicle);
|
respawnVehicle(getPlayerData(client).buyingVehicle);
|
||||||
getPlayerData(client).buyingVehicle = false;
|
getPlayerData(client).buyingVehicle = false;
|
||||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getDistance(getVehiclePosition(getPlayerData(client).buyingVehicle), getVehicleData(getPlayerData(client).buyingVehicle).spawnPosition) > getGlobalConfig().buyVehicleDriveAwayDistance) {
|
if(getDistance(getVehiclePosition(getPlayerData(client).buyingVehicle), getVehicleData(getPlayerData(client).buyingVehicle).spawnPosition) > getGlobalConfig().buyVehicleDriveAwayDistance) {
|
||||||
if(getPlayerCurrentSubAccount(client).cash < getVehicleData(getPlayerData(client).buyingVehicle).buyPrice) {
|
if(getPlayerCurrentSubAccount(client).cash < getVehicleData(getPlayerData(client).buyingVehicle).buyPrice) {
|
||||||
messagePlayerError(client, getLocaleString(client, "VehiclePurchaseNotEnoughMoney"));
|
messagePlayerError(client, getLocaleString(client, "VehiclePurchaseNotEnoughMoney"));
|
||||||
respawnVehicle(getPlayerData(client).buyingVehicle);
|
respawnVehicle(getPlayerData(client).buyingVehicle);
|
||||||
getPlayerData(client).buyingVehicle = false;
|
getPlayerData(client).buyingVehicle = false;
|
||||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
createNewDealershipVehicle(getVehicleData(getPlayerData(client).buyingVehicle).model, getVehicleData(getPlayerData(client).buyingVehicle).spawnPosition, getVehicleData(getPlayerData(client).buyingVehicle).spawnRotation, getVehicleData(getPlayerData(client).buyingVehicle).buyPrice, getVehicleData(getPlayerData(client).buyingVehicle).ownerId);
|
createNewDealershipVehicle(getVehicleData(getPlayerData(client).buyingVehicle).model, getVehicleData(getPlayerData(client).buyingVehicle).spawnPosition, getVehicleData(getPlayerData(client).buyingVehicle).spawnRotation, getVehicleData(getPlayerData(client).buyingVehicle).buyPrice, getVehicleData(getPlayerData(client).buyingVehicle).ownerId);
|
||||||
takePlayerCash(client, getVehicleData(getPlayerData(client).buyingVehicle).buyPrice);
|
takePlayerCash(client, getVehicleData(getPlayerData(client).buyingVehicle).buyPrice);
|
||||||
updatePlayerCash(client);
|
updatePlayerCash(client);
|
||||||
getVehicleData(getPlayerData(client).buyingVehicle).ownerId = getPlayerCurrentSubAccount(client).databaseId;
|
getVehicleData(getPlayerData(client).buyingVehicle).ownerId = getPlayerCurrentSubAccount(client).databaseId;
|
||||||
getVehicleData(getPlayerData(client).buyingVehicle).ownerType = VRR_VEHOWNER_PLAYER;
|
getVehicleData(getPlayerData(client).buyingVehicle).ownerType = VRR_VEHOWNER_PLAYER;
|
||||||
getVehicleData(getPlayerData(client).buyingVehicle).buyPrice = 0;
|
getVehicleData(getPlayerData(client).buyingVehicle).buyPrice = 0;
|
||||||
getVehicleData(getPlayerData(client).buyingVehicle).rentPrice = 0;
|
getVehicleData(getPlayerData(client).buyingVehicle).rentPrice = 0;
|
||||||
getVehicleData(getPlayerData(client).buyingVehicle).spawnLocked = false;
|
getVehicleData(getPlayerData(client).buyingVehicle).spawnLocked = false;
|
||||||
getPlayerData(client).buyingVehicle = false;
|
getVehicleData(getPlayerData(client).buyingVehicle).needsSaved = true;
|
||||||
messagePlayerSuccess(client, getLocaleString(client, "VehiclePurchaseComplete"));
|
getPlayerData(client).buyingVehicle = false;
|
||||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
messagePlayerSuccess(client, getLocaleString(client, "VehiclePurchaseComplete"));
|
||||||
return true;
|
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||||
}
|
return true;
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1478,9 +1479,9 @@ function processVehiclePurchasing() {
|
|||||||
function processVehicleBurning() {
|
function processVehicleBurning() {
|
||||||
let vehicles = getElementsByType(ELEMENT_VEHICLE);
|
let vehicles = getElementsByType(ELEMENT_VEHICLE);
|
||||||
for(let i in vehicles) {
|
for(let i in vehicles) {
|
||||||
if(vehicles[i].health <= 250) {
|
if(vehicles[i].health <= 250) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1518,19 +1519,19 @@ function setAllVehicleIndexes() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function doesVehicleHaveMegaphone(vehicle) {
|
function doesVehicleHaveMegaphone(vehicle) {
|
||||||
if(getVehicleData(vehicle).ownerType == VRR_VEHOWNER_JOB) {
|
if(getVehicleData(vehicle).ownerType == VRR_VEHOWNER_JOB) {
|
||||||
if(getJobType(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)) == VRR_JOB_POLICE) {
|
if(getJobType(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)) == VRR_JOB_POLICE) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getJobType(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)) == VRR_JOB_FIRE) {
|
if(getJobType(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)) == VRR_JOB_FIRE) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getJobType(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)) == VRR_JOB_MEDICAL) {
|
if(getJobType(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)) == VRR_JOB_MEDICAL) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1575,11 +1576,11 @@ function getVehicleTrunkPosition(vehicle) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function removeAllOccupantsFromVehicle(vehicle) {
|
function removeAllOccupantsFromVehicle(vehicle) {
|
||||||
for(let i = 0 ; i <= 16 ; i++) {
|
for(let i = 0 ; i <= 16 ; i++) {
|
||||||
if(vehicle.getOccupant(i) != null) {
|
if(vehicle.getOccupant(i) != null) {
|
||||||
removePlayerFromVehicle(vehicle.getOccupant(i));
|
removePlayerFromVehicle(vehicle.getOccupant(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user