Mass convert indentation + add ped speech cmd
This commit is contained in:
@@ -21,7 +21,7 @@ function processLostFocusAFK(event) {
|
||||
// ===========================================================================
|
||||
|
||||
function processFocusAFK(event) {
|
||||
sendServerNewAFKStatus(false);
|
||||
sendServerNewAFKStatus(false);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -8,68 +8,68 @@
|
||||
// ===========================================================================
|
||||
|
||||
function makePedPlayAnimation(pedId, animGroup, animId, animType, animSpeed, loop, loopNoControl, freezeLastFrame, returnToOriginalPosition, freezePlayer) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Animation] Playing animation ${animGroup}/${animId} for ped ${pedId}`);
|
||||
if(getGame() < VRR_GAME_GTA_IV) {
|
||||
if(animType == VRR_ANIMTYPE_NORMAL || animType == VRR_ANIMTYPE_SURRENDER) {
|
||||
if(getGame() == VRR_GAME_GTA_VC || getGame() == VRR_GAME_GTA_SA) {
|
||||
getElementFromId(pedId).clearAnimations();
|
||||
} else {
|
||||
getElementFromId(pedId).clearObjective();
|
||||
}
|
||||
getElementFromId(pedId).addAnimation(animGroup, animId);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Animation] Playing animation ${animGroup}/${animId} for ped ${pedId}`);
|
||||
if(getGame() < VRR_GAME_GTA_IV) {
|
||||
if(animType == VRR_ANIMTYPE_NORMAL || animType == VRR_ANIMTYPE_SURRENDER) {
|
||||
if(getGame() == VRR_GAME_GTA_VC || getGame() == VRR_GAME_GTA_SA) {
|
||||
getElementFromId(pedId).clearAnimations();
|
||||
} else {
|
||||
getElementFromId(pedId).clearObjective();
|
||||
}
|
||||
getElementFromId(pedId).addAnimation(animGroup, animId);
|
||||
|
||||
if(getElementFromId(pedId) == localPlayer && freezePlayer == true) {
|
||||
inAnimation = true;
|
||||
setLocalPlayerControlState(false, false);
|
||||
localPlayer.collisionsEnabled = false;
|
||||
}
|
||||
} else if(animType == VRR_ANIMTYPE_BLEND) {
|
||||
getElementFromId(pedId).position = getElementFromId(pedId).position;
|
||||
getElementFromId(pedId).blendAnimation(animGroup, animId, animSpeed);
|
||||
}
|
||||
} else {
|
||||
natives.requestAnims(animGroup);
|
||||
natives.taskPlayAnimNonInterruptable(getElementFromId(pedId), animId, animGroup, animSpeed, loop, loopNoControl, freezeLastFrame, returnToOriginalPosition, -1);
|
||||
}
|
||||
if(getElementFromId(pedId) == localPlayer && freezePlayer == true) {
|
||||
inAnimation = true;
|
||||
setLocalPlayerControlState(false, false);
|
||||
localPlayer.collisionsEnabled = false;
|
||||
}
|
||||
} else if(animType == VRR_ANIMTYPE_BLEND) {
|
||||
getElementFromId(pedId).position = getElementFromId(pedId).position;
|
||||
getElementFromId(pedId).blendAnimation(animGroup, animId, animSpeed);
|
||||
}
|
||||
} else {
|
||||
natives.requestAnims(animGroup);
|
||||
natives.taskPlayAnimNonInterruptable(getElementFromId(pedId), animId, animGroup, animSpeed, loop, loopNoControl, freezeLastFrame, returnToOriginalPosition, -1);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function forcePedAnimation(pedId, animGroup, animId, animType, animSpeed, loop, loopNoControl, freezeLastFrame, returnToOriginalPosition) {
|
||||
if(getGame() < VRR_GAME_GTA_IV) {
|
||||
forcedAnimation = [animGroup, animId];
|
||||
getElementFromId(pedId).position = getElementFromId(pedId).position;
|
||||
getElementFromId(pedId).addAnimation(animGroup, animId);
|
||||
if(getGame() < VRR_GAME_GTA_IV) {
|
||||
forcedAnimation = [animGroup, animId];
|
||||
getElementFromId(pedId).position = getElementFromId(pedId).position;
|
||||
getElementFromId(pedId).addAnimation(animGroup, animId);
|
||||
|
||||
if(getElementFromId(pedId) == localPlayer) {
|
||||
inAnimation = true;
|
||||
setLocalPlayerControlState(false, false);
|
||||
localPlayer.collisionsEnabled = false;
|
||||
}
|
||||
}
|
||||
if(getElementFromId(pedId) == localPlayer) {
|
||||
inAnimation = true;
|
||||
setLocalPlayerControlState(false, false);
|
||||
localPlayer.collisionsEnabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function makePedStopAnimation(pedId) {
|
||||
if(getElementFromId(pedId) == null) {
|
||||
return false;
|
||||
}
|
||||
if(getElementFromId(pedId) == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getGame() != VRR_GAME_GTA_IV) {
|
||||
if(getGame() == VRR_GAME_GTA_VC || getGame() == VRR_GAME_GTA_SA) {
|
||||
getElementFromId(pedId).clearAnimations();
|
||||
} else {
|
||||
getElementFromId(pedId).clearObjective();
|
||||
}
|
||||
}
|
||||
if(getGame() != VRR_GAME_GTA_IV) {
|
||||
if(getGame() == VRR_GAME_GTA_VC || getGame() == VRR_GAME_GTA_SA) {
|
||||
getElementFromId(pedId).clearAnimations();
|
||||
} else {
|
||||
getElementFromId(pedId).clearObjective();
|
||||
}
|
||||
}
|
||||
|
||||
if(getElementFromId(pedId) == localPlayer) {
|
||||
if(getGame() != VRR_GAME_GTA_IV) {
|
||||
localPlayer.collisionsEnabled = true;
|
||||
}
|
||||
setLocalPlayerControlState(true, false);
|
||||
}
|
||||
if(getElementFromId(pedId) == localPlayer) {
|
||||
if(getGame() != VRR_GAME_GTA_IV) {
|
||||
localPlayer.collisionsEnabled = true;
|
||||
}
|
||||
setLocalPlayerControlState(true, false);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -8,83 +8,83 @@
|
||||
// ===========================================================================
|
||||
|
||||
class BusinessData {
|
||||
constructor(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems) {
|
||||
this.index = -1;
|
||||
this.businessId = businessId;
|
||||
this.name = name;
|
||||
this.entrancePosition = entrancePosition;
|
||||
this.blipModel = blipModel;
|
||||
this.pickupModel = pickupModel;
|
||||
this.hasInterior = hasInterior;
|
||||
this.hasItems = hasItems;
|
||||
this.blipId = -1;
|
||||
}
|
||||
constructor(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems) {
|
||||
this.index = -1;
|
||||
this.businessId = businessId;
|
||||
this.name = name;
|
||||
this.entrancePosition = entrancePosition;
|
||||
this.blipModel = blipModel;
|
||||
this.pickupModel = pickupModel;
|
||||
this.hasInterior = hasInterior;
|
||||
this.hasItems = hasItems;
|
||||
this.blipId = -1;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Business] Received business ${businessId} (${name}) from server`);
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if(getBusinessData(businessId) != false) {
|
||||
let businessData = getBusinessData(businessId);
|
||||
businessData.name = name;
|
||||
businessData.entrancePosition = entrancePosition;
|
||||
businessData.blipModel = blipModel;
|
||||
businessData.pickupModel = pickupModel;
|
||||
businessData.hasInterior = hasInterior;
|
||||
businessData.hasItems = hasItems;
|
||||
logToConsole(LOG_DEBUG, `[VRR.Business] Received business ${businessId} (${name}) from server`);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId} already exists. Checking blip ...`);
|
||||
if(blipModel == -1) {
|
||||
if(businessData.blipId != -1) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been removed by the server`);
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.removeBlipAndClearIndex(getBusinessData(businessId).blipId);
|
||||
} else {
|
||||
destroyElement(getElementFromId(blipId));
|
||||
}
|
||||
businessData.blipId = -1;
|
||||
//businesses.splice(businessData.index, 1);
|
||||
//setAllBusinessDataIndexes();
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip is unchanged`);
|
||||
}
|
||||
} else {
|
||||
if(businessData.blipId != -1) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been changed by the server`);
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.setBlipCoordinates(businessData.blipId, businessData.entrancePosition);
|
||||
natives.changeBlipSprite(businessData.blipId, businessData.blipModel);
|
||||
natives.setBlipMarkerLongDistance(businessData.blipId, false);
|
||||
natives.setBlipAsShortRange(tempBusinessData.blipId, true);
|
||||
natives.changeBlipNameFromAscii(businessData.blipId, `${businessData.name.substr(0, 24)}${(businessData.name.length > 24) ? " ...": ""}`);
|
||||
}
|
||||
} else {
|
||||
let blipId = createGameBlip(tempBusinessData.blipModel, tempBusinessData.entrancePosition, tempBusinessData.name);
|
||||
if(blipId != -1) {
|
||||
tempBusinessData.blipId = blipId;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId} doesn't exist. Adding ...`);
|
||||
let tempBusinessData = new BusinessData(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems);
|
||||
if(blipModel != -1) {
|
||||
let blipId = createGameBlip(tempBusinessData.blipModel, tempBusinessData.entrancePosition, tempBusinessData.name);
|
||||
if(blipId != -1) {
|
||||
tempBusinessData.blipId = blipId;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId} has no blip.`);
|
||||
}
|
||||
businesses.push(tempBusinessData);
|
||||
setAllBusinessDataIndexes();
|
||||
}
|
||||
}
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if(getBusinessData(businessId) != false) {
|
||||
let businessData = getBusinessData(businessId);
|
||||
businessData.name = name;
|
||||
businessData.entrancePosition = entrancePosition;
|
||||
businessData.blipModel = blipModel;
|
||||
businessData.pickupModel = pickupModel;
|
||||
businessData.hasInterior = hasInterior;
|
||||
businessData.hasItems = hasItems;
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId} already exists. Checking blip ...`);
|
||||
if(blipModel == -1) {
|
||||
if(businessData.blipId != -1) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been removed by the server`);
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.removeBlipAndClearIndex(getBusinessData(businessId).blipId);
|
||||
} else {
|
||||
destroyElement(getElementFromId(blipId));
|
||||
}
|
||||
businessData.blipId = -1;
|
||||
//businesses.splice(businessData.index, 1);
|
||||
//setAllBusinessDataIndexes();
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip is unchanged`);
|
||||
}
|
||||
} else {
|
||||
if(businessData.blipId != -1) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been changed by the server`);
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.setBlipCoordinates(businessData.blipId, businessData.entrancePosition);
|
||||
natives.changeBlipSprite(businessData.blipId, businessData.blipModel);
|
||||
natives.setBlipMarkerLongDistance(businessData.blipId, false);
|
||||
natives.setBlipAsShortRange(tempBusinessData.blipId, true);
|
||||
natives.changeBlipNameFromAscii(businessData.blipId, `${businessData.name.substr(0, 24)}${(businessData.name.length > 24) ? " ...": ""}`);
|
||||
}
|
||||
} else {
|
||||
let blipId = createGameBlip(tempBusinessData.blipModel, tempBusinessData.entrancePosition, tempBusinessData.name);
|
||||
if(blipId != -1) {
|
||||
tempBusinessData.blipId = blipId;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId} doesn't exist. Adding ...`);
|
||||
let tempBusinessData = new BusinessData(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems);
|
||||
if(blipModel != -1) {
|
||||
let blipId = createGameBlip(tempBusinessData.blipModel, tempBusinessData.entrancePosition, tempBusinessData.name);
|
||||
if(blipId != -1) {
|
||||
tempBusinessData.blipId = blipId;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Business] Business ${businessId} has no blip.`);
|
||||
}
|
||||
businesses.push(tempBusinessData);
|
||||
setAllBusinessDataIndexes();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -94,23 +94,23 @@ function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel
|
||||
* @return {BusinessData} The business's data (class instance)
|
||||
*/
|
||||
function getBusinessData(businessId) {
|
||||
//let tempBusinessData = businesses.find((b) => b.businessId == businessId);
|
||||
//return (typeof tempBusinessData != "undefined") ? tempBusinessData[0] : false;
|
||||
for(let i in businesses) {
|
||||
if(businesses[i].businessId == businessId) {
|
||||
return businesses[i];
|
||||
}
|
||||
}
|
||||
//let tempBusinessData = businesses.find((b) => b.businessId == businessId);
|
||||
//return (typeof tempBusinessData != "undefined") ? tempBusinessData[0] : false;
|
||||
for(let i in businesses) {
|
||||
if(businesses[i].businessId == businessId) {
|
||||
return businesses[i];
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setAllBusinessDataIndexes() {
|
||||
for(let i in businesses) {
|
||||
businesses[i].index = i;
|
||||
}
|
||||
for(let i in businesses) {
|
||||
businesses[i].index = i;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -22,89 +22,89 @@ let scrollDownKey = false;
|
||||
// ===========================================================================
|
||||
|
||||
function initChatBoxScript() {
|
||||
logToConsole(LOG_DEBUG, "[VRR.ChatBox]: Initializing chatbox script ...");
|
||||
scrollUpKey = getKeyIdFromParams("pageup");
|
||||
scrollDownKey = getKeyIdFromParams("pagedown");
|
||||
bindChatBoxKeys();
|
||||
logToConsole(LOG_DEBUG, "[VRR.ChatBox]: Chatbox script initialized!");
|
||||
logToConsole(LOG_DEBUG, "[VRR.ChatBox]: Initializing chatbox script ...");
|
||||
scrollUpKey = getKeyIdFromParams("pageup");
|
||||
scrollDownKey = getKeyIdFromParams("pagedown");
|
||||
bindChatBoxKeys();
|
||||
logToConsole(LOG_DEBUG, "[VRR.ChatBox]: Chatbox script initialized!");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function bindChatBoxKeys() {
|
||||
bindKey(toInteger(scrollUpKey), KEYSTATE_DOWN, chatBoxScrollUp);
|
||||
bindKey(toInteger(scrollDownKey), KEYSTATE_DOWN, chatBoxScrollDown);
|
||||
bindKey(toInteger(scrollUpKey), KEYSTATE_DOWN, chatBoxScrollUp);
|
||||
bindKey(toInteger(scrollDownKey), KEYSTATE_DOWN, chatBoxScrollDown);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function unBindChatBoxKeys() {
|
||||
unbindKey(toInteger(scrollUpKey));
|
||||
unbindKey(toInteger(scrollDownKey));
|
||||
unbindKey(toInteger(scrollUpKey));
|
||||
unbindKey(toInteger(scrollDownKey));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function receiveChatBoxMessageFromServer(messageString, colour) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.ChatBox]: Received chatbox message from server: ${messageString}`);
|
||||
let colouredString = replaceColoursInMessage(messageString);
|
||||
logToConsole(LOG_DEBUG, `[VRR.ChatBox]: Received chatbox message from server: ${messageString}`);
|
||||
let colouredString = replaceColoursInMessage(messageString);
|
||||
|
||||
if(bottomMessageIndex >= chatBoxHistory.length-1) {
|
||||
message(colouredString, colour);
|
||||
bottomMessageIndex = chatBoxHistory.length-1;
|
||||
}
|
||||
addToChatBoxHistory(colouredString, colour);
|
||||
if(bottomMessageIndex >= chatBoxHistory.length-1) {
|
||||
message(colouredString, colour);
|
||||
bottomMessageIndex = chatBoxHistory.length-1;
|
||||
}
|
||||
addToChatBoxHistory(colouredString, colour);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setChatScrollLines(amount) {
|
||||
scrollAmount = amount;
|
||||
scrollAmount = amount;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function addToChatBoxHistory(messageString, colour) {
|
||||
chatBoxHistory.push([messageString, colour]);
|
||||
chatBoxHistory.push([messageString, colour]);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function chatBoxScrollUp() {
|
||||
if(bottomMessageIndex > maxChatBoxLines) {
|
||||
bottomMessageIndex = bottomMessageIndex-scrollAmount;
|
||||
updateChatBox();
|
||||
}
|
||||
if(bottomMessageIndex > maxChatBoxLines) {
|
||||
bottomMessageIndex = bottomMessageIndex-scrollAmount;
|
||||
updateChatBox();
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function chatBoxScrollDown() {
|
||||
if(bottomMessageIndex < chatBoxHistory.length-1) {
|
||||
bottomMessageIndex = bottomMessageIndex+scrollAmount;
|
||||
updateChatBox();
|
||||
}
|
||||
if(bottomMessageIndex < chatBoxHistory.length-1) {
|
||||
bottomMessageIndex = bottomMessageIndex+scrollAmount;
|
||||
updateChatBox();
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function clearChatBox() {
|
||||
for(let i = 0 ; i <= maxChatBoxLines ; i++) {
|
||||
message("", COLOUR_WHITE);
|
||||
}
|
||||
for(let i = 0 ; i <= maxChatBoxLines ; i++) {
|
||||
message("", COLOUR_WHITE);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function updateChatBox() {
|
||||
clearChatBox();
|
||||
for(let i = bottomMessageIndex-maxChatBoxLines ; i <= bottomMessageIndex ; i++) {
|
||||
if(typeof chatBoxHistory[i] != "undefined") {
|
||||
message(chatBoxHistory[i][0], chatBoxHistory[i][1]);
|
||||
} else {
|
||||
message("", COLOUR_WHITE);
|
||||
}
|
||||
}
|
||||
clearChatBox();
|
||||
for(let i = bottomMessageIndex-maxChatBoxLines ; i <= bottomMessageIndex ; i++) {
|
||||
if(typeof chatBoxHistory[i] != "undefined") {
|
||||
message(chatBoxHistory[i][0], chatBoxHistory[i][1]);
|
||||
} else {
|
||||
message("", COLOUR_WHITE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -8,58 +8,58 @@
|
||||
// ===========================================================================
|
||||
|
||||
function getCustomImage(imageName) {
|
||||
let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
|
||||
if(contentResource != null) {
|
||||
if(contentResource.isStarted) {
|
||||
let image = contentResource.exports.getCustomImage(imageName);
|
||||
if(image != null) {
|
||||
return image;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
|
||||
if(contentResource != null) {
|
||||
if(contentResource.isStarted) {
|
||||
let image = contentResource.exports.getCustomImage(imageName);
|
||||
if(image != null) {
|
||||
return image;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getCustomFont(fontName) {
|
||||
let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
|
||||
if(contentResource != null) {
|
||||
if(contentResource.isStarted) {
|
||||
let font = contentResource.exports.getCustomFont(fontName);
|
||||
if(font != null) {
|
||||
return font;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
|
||||
if(contentResource != null) {
|
||||
if(contentResource.isStarted) {
|
||||
let font = contentResource.exports.getCustomFont(fontName);
|
||||
if(font != null) {
|
||||
return font;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getCustomAudio(audioName) {
|
||||
let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
|
||||
if(contentResource != null) {
|
||||
if(contentResource.isStarted) {
|
||||
let audioFile = contentResource.exports.getCustomAudio(audioName);
|
||||
if(audioFile != null) {
|
||||
return audioFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
|
||||
if(contentResource != null) {
|
||||
if(contentResource.isStarted) {
|
||||
let audioFile = contentResource.exports.getCustomAudio(audioName);
|
||||
if(audioFile != null) {
|
||||
return audioFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function playCustomAudio(audioName, volume = 0.5, loop = false) {
|
||||
let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
|
||||
if(contentResource != null) {
|
||||
if(contentResource.isStarted) {
|
||||
contentResource.exports.playCustomAudio(audioName, volume, loop);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
|
||||
if(contentResource != null) {
|
||||
if(contentResource.isStarted) {
|
||||
contentResource.exports.playCustomAudio(audioName, volume, loop);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -8,210 +8,210 @@
|
||||
// ===========================================================================
|
||||
|
||||
function initEventScript() {
|
||||
logToConsole(LOG_DEBUG, "[VRR.Event]: Initializing event script ...");
|
||||
addCustomEvents();
|
||||
addAllEventHandlers();
|
||||
logToConsole(LOG_DEBUG, "[VRR.Event]: Event script initialized!");
|
||||
logToConsole(LOG_DEBUG, "[VRR.Event]: Initializing event script ...");
|
||||
addCustomEvents();
|
||||
addAllEventHandlers();
|
||||
logToConsole(LOG_DEBUG, "[VRR.Event]: Event script initialized!");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function addCustomEvents() {
|
||||
addEvent("OnLocalPlayerEnterSphere", 1);
|
||||
addEvent("OnLocalPlayerExitSphere", 1);
|
||||
addEvent("OnLocalPlayerEnteredVehicle", 1);
|
||||
addEvent("OnLocalPlayerExitedVehicle", 1);
|
||||
addEvent("OnLocalPlayerSwitchWeapon", 2);
|
||||
addEvent("OnLocalPlayerEnterSphere", 1);
|
||||
addEvent("OnLocalPlayerExitSphere", 1);
|
||||
addEvent("OnLocalPlayerEnteredVehicle", 1);
|
||||
addEvent("OnLocalPlayerExitedVehicle", 1);
|
||||
addEvent("OnLocalPlayerSwitchWeapon", 2);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function addAllEventHandlers() {
|
||||
bindEventHandler("OnResourceStart", thisResource, onResourceStart);
|
||||
bindEventHandler("OnResourceReady", thisResource, onResourceReady);
|
||||
bindEventHandler("OnResourceStop", thisResource, onResourceStop);
|
||||
bindEventHandler("OnResourceStart", thisResource, onResourceStart);
|
||||
bindEventHandler("OnResourceReady", thisResource, onResourceReady);
|
||||
bindEventHandler("OnResourceStop", thisResource, onResourceStop);
|
||||
|
||||
addEventHandler("OnProcess", onProcess);
|
||||
addEventHandler("OnKeyUp", onKeyUp);
|
||||
addEventHandler("OnDrawnHUD", onDrawnHUD);
|
||||
addEventHandler("OnProcess", onProcess);
|
||||
addEventHandler("OnKeyUp", onKeyUp);
|
||||
addEventHandler("OnDrawnHUD", onDrawnHUD);
|
||||
|
||||
addEventHandler("OnPedWasted", onPedWasted);
|
||||
addEventHandler("OnPedWasted", onPedWasted);
|
||||
|
||||
addEventHandler("OnElementStreamIn", onElementStreamIn);
|
||||
addEventHandler("OnElementStreamIn", onElementStreamIn);
|
||||
|
||||
addEventHandler("OnLocalPlayerEnteredVehicle", onLocalPlayerEnteredVehicle);
|
||||
addEventHandler("OnLocalPlayerExitedVehicle", onLocalPlayerExitedVehicle);
|
||||
addEventHandler("OnLocalPlayerEnterSphere", onLocalPlayerEnterSphere);
|
||||
addEventHandler("OnLocalPlayerExitSphere", onLocalPlayerExitSphere);
|
||||
addEventHandler("OnLocalPlayerSwitchWeapon", onLocalPlayerSwitchWeapon);
|
||||
addEventHandler("OnLocalPlayerEnteredVehicle", onLocalPlayerEnteredVehicle);
|
||||
addEventHandler("OnLocalPlayerExitedVehicle", onLocalPlayerExitedVehicle);
|
||||
addEventHandler("OnLocalPlayerEnterSphere", onLocalPlayerEnterSphere);
|
||||
addEventHandler("OnLocalPlayerExitSphere", onLocalPlayerExitSphere);
|
||||
addEventHandler("OnLocalPlayerSwitchWeapon", onLocalPlayerSwitchWeapon);
|
||||
|
||||
addEventHandler("OnPedInflictDamage", onPedInflictDamage);
|
||||
addEventHandler("OnPedInflictDamage", onPedInflictDamage);
|
||||
|
||||
addEventHandler("OnLostFocus", onLostFocus);
|
||||
addEventHandler("OnFocus", onFocus);
|
||||
addEventHandler("OnLostFocus", onLostFocus);
|
||||
addEventHandler("OnFocus", onFocus);
|
||||
|
||||
addEventHandler("OnCameraProcess", onCameraProcess);
|
||||
addEventHandler("OnCameraProcess", onCameraProcess);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onResourceStart(event, resource) {
|
||||
sendResourceStartedSignalToServer();
|
||||
setUpInitialGame();
|
||||
garbageCollectorInterval = setInterval(collectAllGarbage, 1000*60);
|
||||
sendResourceStartedSignalToServer();
|
||||
setUpInitialGame();
|
||||
garbageCollectorInterval = setInterval(collectAllGarbage, 1000*60);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onResourceStop(event, resource) {
|
||||
sendResourceStoppedSignalToServer();
|
||||
sendResourceStoppedSignalToServer();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onResourceReady(event, resource) {
|
||||
sendResourceReadySignalToServer();
|
||||
sendResourceReadySignalToServer();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onProcess(event, deltaTime) {
|
||||
if(localPlayer == null) {
|
||||
return false;
|
||||
}
|
||||
if(localPlayer == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!isSpawned) {
|
||||
return false;
|
||||
}
|
||||
if(!isSpawned) {
|
||||
return false;
|
||||
}
|
||||
|
||||
processSync();
|
||||
processLocalPlayerControlState();
|
||||
processLocalPlayerVehicleControlState();
|
||||
processLocalPlayerSphereEntryExitHandling();
|
||||
processLocalPlayerVehicleEntryExitHandling();
|
||||
processJobRouteSphere();
|
||||
forceLocalPlayerEquippedWeaponItem();
|
||||
processWantedLevelReset();
|
||||
processGameSpecifics();
|
||||
processNearbyPickups();
|
||||
processVehiclePurchasing();
|
||||
//processVehicleFires();
|
||||
processSync();
|
||||
processLocalPlayerControlState();
|
||||
processLocalPlayerVehicleControlState();
|
||||
processLocalPlayerSphereEntryExitHandling();
|
||||
processLocalPlayerVehicleEntryExitHandling();
|
||||
processJobRouteSphere();
|
||||
forceLocalPlayerEquippedWeaponItem();
|
||||
processWantedLevelReset();
|
||||
processGameSpecifics();
|
||||
processNearbyPickups();
|
||||
processVehiclePurchasing();
|
||||
//processVehicleFires();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onKeyUp(event, keyCode, scanCode, keyModifiers) {
|
||||
processSkinSelectKeyPress(keyCode);
|
||||
//processKeyDuringAnimation();
|
||||
processGUIKeyPress(keyCode);
|
||||
processToggleGUIKeyPress(keyCode);
|
||||
processSkinSelectKeyPress(keyCode);
|
||||
//processKeyDuringAnimation();
|
||||
processGUIKeyPress(keyCode);
|
||||
processToggleGUIKeyPress(keyCode);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onDrawnHUD(event) {
|
||||
if(!renderHUD) {
|
||||
return false;
|
||||
}
|
||||
if(!renderHUD) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(localPlayer == null) {
|
||||
return false;
|
||||
}
|
||||
if(localPlayer == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
processSmallGameMessageRendering();
|
||||
processScoreBoardRendering();
|
||||
processLabelRendering();
|
||||
processLogoRendering();
|
||||
processItemActionRendering();
|
||||
processSkinSelectRendering();
|
||||
processNameTagRendering();
|
||||
processInteriorLightsRendering();
|
||||
processSmallGameMessageRendering();
|
||||
processScoreBoardRendering();
|
||||
processLabelRendering();
|
||||
processLogoRendering();
|
||||
processItemActionRendering();
|
||||
processSkinSelectRendering();
|
||||
processNameTagRendering();
|
||||
processInteriorLightsRendering();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onPedWasted(event, wastedPed, killerPed, weapon, pedPiece) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Ped ${wastedPed.name} died`);
|
||||
wastedPed.clearWeapons();
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Ped ${wastedPed.name} died`);
|
||||
wastedPed.clearWeapons();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onElementStreamIn(event, element) {
|
||||
syncElementProperties(element);
|
||||
syncElementProperties(element);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onLocalPlayerExitedVehicle(event, vehicle, seat) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Local player exited vehicle`);
|
||||
sendNetworkEventToServer("vrr.onPlayerExitVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Local player exited vehicle`);
|
||||
sendNetworkEventToServer("vrr.onPlayerExitVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
||||
|
||||
if(inVehicleSeat) {
|
||||
parkedVehiclePosition = false;
|
||||
parkedVehicleHeading = false;
|
||||
}
|
||||
if(inVehicleSeat) {
|
||||
parkedVehiclePosition = false;
|
||||
parkedVehicleHeading = false;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onLocalPlayerEnteredVehicle(event, vehicle, seat) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Local player entered vehicle`);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Local player entered vehicle`);
|
||||
|
||||
sendNetworkEventToServer("vrr.onPlayerEnterVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
||||
sendNetworkEventToServer("vrr.onPlayerEnterVehicle", getVehicleForNetworkEvent(vehicle), seat);
|
||||
|
||||
if(inVehicleSeat == 0) {
|
||||
inVehicle.engine = false;
|
||||
if(!inVehicle.engine) {
|
||||
parkedVehiclePosition = inVehicle.position;
|
||||
parkedVehicleHeading = inVehicle.heading;
|
||||
}
|
||||
}
|
||||
if(inVehicleSeat == 0) {
|
||||
inVehicle.engine = false;
|
||||
if(!inVehicle.engine) {
|
||||
parkedVehiclePosition = inVehicle.position;
|
||||
parkedVehicleHeading = inVehicle.heading;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onPedInflictDamage(event, damagedEntity, damagerEntity, weaponId, healthLoss, pedPiece) {
|
||||
//let damagerEntityString = (!isNull(damagedEntity)) ? `${damagerEntity.name} (${damagerEntity.name}, ${damagerEntity.type} - ${typeof damagerEntity})` : `Unknown ped`;
|
||||
//let damagedEntityString = (!isNull(damagedEntity)) ? `${damagedEntity.name} (${damagedEntity.name}, ${damagedEntity.type} - ${typeof damagedEntity})` : `Unknown ped`;
|
||||
//logToConsole(LOG_DEBUG, `[VRR.Event] ${damagerEntityString} damaged ${damagedEntityString}'s '${pedPiece} with weapon ${weaponId}`);
|
||||
if(!isNull(damagedEntity) && !isNull(damagerEntity)) {
|
||||
if(damagedEntity.isType(ELEMENT_PLAYER)) {
|
||||
if(damagedEntity == localPlayer) {
|
||||
//if(!weaponDamageEnabled[damagerEntity.name]) {
|
||||
event.preventDefault();
|
||||
sendNetworkEventToServer("vrr.weaponDamage", damagerEntity.name, weaponId, pedPiece, healthLoss);
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
//let damagerEntityString = (!isNull(damagedEntity)) ? `${damagerEntity.name} (${damagerEntity.name}, ${damagerEntity.type} - ${typeof damagerEntity})` : `Unknown ped`;
|
||||
//let damagedEntityString = (!isNull(damagedEntity)) ? `${damagedEntity.name} (${damagedEntity.name}, ${damagedEntity.type} - ${typeof damagedEntity})` : `Unknown ped`;
|
||||
//logToConsole(LOG_DEBUG, `[VRR.Event] ${damagerEntityString} damaged ${damagedEntityString}'s '${pedPiece} with weapon ${weaponId}`);
|
||||
if(!isNull(damagedEntity) && !isNull(damagerEntity)) {
|
||||
if(damagedEntity.isType(ELEMENT_PLAYER)) {
|
||||
if(damagedEntity == localPlayer) {
|
||||
//if(!weaponDamageEnabled[damagerEntity.name]) {
|
||||
event.preventDefault();
|
||||
sendNetworkEventToServer("vrr.weaponDamage", damagerEntity.name, weaponId, pedPiece, healthLoss);
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onLocalPlayerEnterSphere(event, sphere) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Local player entered sphere`);
|
||||
if(sphere == jobRouteLocationSphere) {
|
||||
enteredJobRouteSphere();
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Local player entered sphere`);
|
||||
if(sphere == jobRouteLocationSphere) {
|
||||
enteredJobRouteSphere();
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
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) {
|
||||
processLostFocusAFK();
|
||||
processLostFocusAFK();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onFocus(event) {
|
||||
processFocusAFK();
|
||||
processFocusAFK();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -227,8 +227,8 @@ function onCameraProcess(event) {
|
||||
// ===========================================================================
|
||||
|
||||
function onChatOutput(event, messageText, colour) {
|
||||
//event.preventDefault();
|
||||
//receiveChatBoxMessageFromServer(messageText, colour);
|
||||
//event.preventDefault();
|
||||
//receiveChatBoxMessageFromServer(messageText, colour);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -104,7 +104,7 @@ function closeAllWindows() {
|
||||
listDialog.window.shown = false;
|
||||
resetPassword.window.shown = false;
|
||||
passwordChange.window.shown = false;
|
||||
|
||||
|
||||
mexui.setInput(false);
|
||||
mexui.focusedControl = false;
|
||||
|
||||
@@ -284,8 +284,8 @@ addNetworkEventHandler("vrr.guiInit", function() {
|
||||
// ===========================================================================
|
||||
|
||||
function hideAllGUI() {
|
||||
closeAllWindows();
|
||||
setChatWindowEnabled(true);
|
||||
closeAllWindows();
|
||||
setChatWindowEnabled(true);
|
||||
guiSubmitKey = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,77 +8,77 @@
|
||||
// ===========================================================================
|
||||
|
||||
class HouseData {
|
||||
constructor(houseId, entrancePosition, blipModel, pickupModel, hasInterior) {
|
||||
this.index = -1;
|
||||
this.houseId = houseId;
|
||||
this.entrancePosition = entrancePosition;
|
||||
this.blipModel = blipModel;
|
||||
this.pickupModel = pickupModel;
|
||||
this.hasInterior = hasInterior;
|
||||
this.blipId = -1;
|
||||
}
|
||||
constructor(houseId, entrancePosition, blipModel, pickupModel, hasInterior) {
|
||||
this.index = -1;
|
||||
this.houseId = houseId;
|
||||
this.entrancePosition = entrancePosition;
|
||||
this.blipModel = blipModel;
|
||||
this.pickupModel = pickupModel;
|
||||
this.hasInterior = hasInterior;
|
||||
this.blipId = -1;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function receiveHouseFromServer(houseId, entrancePosition, blipModel, pickupModel, hasInterior) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.House] Received house ${houseId} (${name}) from server`);
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if(getHouseData(houseId) != false) {
|
||||
let houseData = getHouseData(houseId);
|
||||
houseData.entrancePosition = entrancePosition;
|
||||
houseData.blipModel = blipModel;
|
||||
houseData.pickupModel = pickupModel;
|
||||
houseData.hasInterior = hasInterior;
|
||||
logToConsole(LOG_DEBUG, `[VRR.House] Received house ${houseId} (${name}) from server`);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId} already exists. Checking blip ...`);
|
||||
if(blipModel == -1) {
|
||||
if(houseData.blipId != -1) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId}'s blip has been removed by the server`);
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.removeBlipAndClearIndex(getHouseData(houseId).blipId);
|
||||
} else {
|
||||
destroyElement(getElementFromId(blipId));
|
||||
}
|
||||
houseData.blipId = -1;
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId}'s blip is unchanged`);
|
||||
}
|
||||
} else {
|
||||
if(houseData.blipId != -1) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId}'s blip has been changed by the server`);
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.setBlipCoordinates(houseData.blipId, houseData.entrancePosition);
|
||||
natives.changeBlipSprite(houseData.blipId, houseData.blipModel);
|
||||
natives.setBlipMarkerLongDistance(houseData.blipId, false);
|
||||
natives.setBlipAsShortRange(houseData.blipId, true);
|
||||
natives.changeBlipNameFromAscii(houseData.blipId, `${houseData.name.substr(0, 24)}${(houseData.name.length > 24) ? " ...": ""}`);
|
||||
}
|
||||
} else {
|
||||
let blipId = createGameBlip(houseData.blipModel, houseData.entrancePosition, houseData.name);
|
||||
if(blipId != -1) {
|
||||
houseData.blipId = blipId;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId} doesn't exist. Adding ...`);
|
||||
let tempHouseData = new HouseData(houseId, entrancePosition, blipModel, pickupModel, hasInterior);
|
||||
if(blipModel != -1) {
|
||||
let blipId = createGameBlip(tempHouseData.blipModel, tempHouseData.entrancePosition, "House");
|
||||
if(blipId != -1) {
|
||||
tempHouseData.blipId = blipId;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId} has no blip.`);
|
||||
}
|
||||
houses.push(tempHouseData);
|
||||
setAllHouseDataIndexes();
|
||||
}
|
||||
}
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if(getHouseData(houseId) != false) {
|
||||
let houseData = getHouseData(houseId);
|
||||
houseData.entrancePosition = entrancePosition;
|
||||
houseData.blipModel = blipModel;
|
||||
houseData.pickupModel = pickupModel;
|
||||
houseData.hasInterior = hasInterior;
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId} already exists. Checking blip ...`);
|
||||
if(blipModel == -1) {
|
||||
if(houseData.blipId != -1) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId}'s blip has been removed by the server`);
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.removeBlipAndClearIndex(getHouseData(houseId).blipId);
|
||||
} else {
|
||||
destroyElement(getElementFromId(blipId));
|
||||
}
|
||||
houseData.blipId = -1;
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId}'s blip is unchanged`);
|
||||
}
|
||||
} else {
|
||||
if(houseData.blipId != -1) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId}'s blip has been changed by the server`);
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.setBlipCoordinates(houseData.blipId, houseData.entrancePosition);
|
||||
natives.changeBlipSprite(houseData.blipId, houseData.blipModel);
|
||||
natives.setBlipMarkerLongDistance(houseData.blipId, false);
|
||||
natives.setBlipAsShortRange(houseData.blipId, true);
|
||||
natives.changeBlipNameFromAscii(houseData.blipId, `${houseData.name.substr(0, 24)}${(houseData.name.length > 24) ? " ...": ""}`);
|
||||
}
|
||||
} else {
|
||||
let blipId = createGameBlip(houseData.blipModel, houseData.entrancePosition, houseData.name);
|
||||
if(blipId != -1) {
|
||||
houseData.blipId = blipId;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId} doesn't exist. Adding ...`);
|
||||
let tempHouseData = new HouseData(houseId, entrancePosition, blipModel, pickupModel, hasInterior);
|
||||
if(blipModel != -1) {
|
||||
let blipId = createGameBlip(tempHouseData.blipModel, tempHouseData.entrancePosition, "House");
|
||||
if(blipId != -1) {
|
||||
tempHouseData.blipId = blipId;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[VRR.House] House ${houseId} has no blip.`);
|
||||
}
|
||||
houses.push(tempHouseData);
|
||||
setAllHouseDataIndexes();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -88,21 +88,21 @@ function receiveHouseFromServer(houseId, entrancePosition, blipModel, pickupMode
|
||||
* @return {HouseData} The house's data (class instance)
|
||||
*/
|
||||
function getHouseData(houseId) {
|
||||
for(let i in houses) {
|
||||
if(houses[i].houseId == houseId) {
|
||||
return houses[i];
|
||||
}
|
||||
}
|
||||
for(let i in houses) {
|
||||
if(houses[i].houseId == houseId) {
|
||||
return houses[i];
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setAllHouseDataIndexes() {
|
||||
for(let i in houses) {
|
||||
houses[i].index = i;
|
||||
}
|
||||
for(let i in houses) {
|
||||
houses[i].index = i;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -23,40 +23,40 @@ function initItemScript() {
|
||||
// ===========================================================================
|
||||
|
||||
function processItemActionRendering() {
|
||||
if(renderItemActionDelay) {
|
||||
if(itemActionDelayEnabled) {
|
||||
let finishTime = itemActionDelayStart+itemActionDelayDuration;
|
||||
if(sdl.ticks >= finishTime) {
|
||||
itemActionDelayEnabled = false;
|
||||
itemActionDelayDuration = 0;
|
||||
itemActionDelayStart = 0;
|
||||
tellServerItemActionDelayComplete();
|
||||
} else {
|
||||
let currentTick = sdl.ticks-itemActionDelayStart;
|
||||
let progressPercent = Math.ceil(currentTick*100/itemActionDelayDuration);
|
||||
let width = Math.ceil(getPercentage(itemActionDelaySize.x, progressPercent));
|
||||
if(renderItemActionDelay) {
|
||||
if(itemActionDelayEnabled) {
|
||||
let finishTime = itemActionDelayStart+itemActionDelayDuration;
|
||||
if(sdl.ticks >= finishTime) {
|
||||
itemActionDelayEnabled = false;
|
||||
itemActionDelayDuration = 0;
|
||||
itemActionDelayStart = 0;
|
||||
tellServerItemActionDelayComplete();
|
||||
} else {
|
||||
let currentTick = sdl.ticks-itemActionDelayStart;
|
||||
let progressPercent = Math.ceil(currentTick*100/itemActionDelayDuration);
|
||||
let width = Math.ceil(getPercentage(itemActionDelaySize.x, progressPercent));
|
||||
|
||||
let backgroundColour = toColour(0, 0, 0, 255);
|
||||
graphics.drawRectangle(null, [itemActionDelayPosition.x-(itemActionDelaySize.x/2)-1, itemActionDelayPosition.y-(itemActionDelaySize.y/2)-1], [itemActionDelaySize.x+2, itemActionDelaySize.y+2], backgroundColour, backgroundColour, backgroundColour, backgroundColour);
|
||||
graphics.drawRectangle(null, [itemActionDelayPosition.x-(itemActionDelaySize.x/2), itemActionDelayPosition.y-(itemActionDelaySize.y/2)-2], [width, itemActionDelaySize.y], COLOUR_LIME, COLOUR_LIME, COLOUR_LIME, COLOUR_LIME);
|
||||
}
|
||||
}
|
||||
}
|
||||
let backgroundColour = toColour(0, 0, 0, 255);
|
||||
graphics.drawRectangle(null, [itemActionDelayPosition.x-(itemActionDelaySize.x/2)-1, itemActionDelayPosition.y-(itemActionDelaySize.y/2)-1], [itemActionDelaySize.x+2, itemActionDelaySize.y+2], backgroundColour, backgroundColour, backgroundColour, backgroundColour);
|
||||
graphics.drawRectangle(null, [itemActionDelayPosition.x-(itemActionDelaySize.x/2), itemActionDelayPosition.y-(itemActionDelaySize.y/2)-2], [width, itemActionDelaySize.y], COLOUR_LIME, COLOUR_LIME, COLOUR_LIME, COLOUR_LIME);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function updatePlayerHotBar(activeSlot, itemsArray) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Main] Updating hotbar`);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Main] Updating hotbar`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showItemActionDelay(duration) {
|
||||
itemActionDelayDuration = duration;
|
||||
itemActionDelayStart = sdl.ticks;
|
||||
itemActionDelayEnabled = true;
|
||||
logToConsole(LOG_DEBUG, `Item action delay started. Duration: ${itemActionDelayDuration}, Start: ${itemActionDelayStart}, Rendering Enabled: ${renderItemActionDelay}`);
|
||||
itemActionDelayDuration = duration;
|
||||
itemActionDelayStart = sdl.ticks;
|
||||
itemActionDelayEnabled = true;
|
||||
logToConsole(LOG_DEBUG, `Item action delay started. Duration: ${itemActionDelayDuration}, Start: ${itemActionDelayStart}, Rendering Enabled: ${renderItemActionDelay}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -15,15 +15,15 @@ let jobRouteLocationSphere = null;
|
||||
// ===========================================================================
|
||||
|
||||
class JobData {
|
||||
constructor(jobId, name, position, blipModel, pickupModel) {
|
||||
this.index = -1;
|
||||
this.jobId = jobId;
|
||||
this.name = name;
|
||||
this.position = position;
|
||||
this.blipModel = blipModel;
|
||||
this.pickupModel = pickupModel;
|
||||
this.blipId = -1;
|
||||
}
|
||||
constructor(jobId, name, position, blipModel, pickupModel) {
|
||||
this.index = -1;
|
||||
this.jobId = jobId;
|
||||
this.name = name;
|
||||
this.position = position;
|
||||
this.blipModel = blipModel;
|
||||
this.pickupModel = pickupModel;
|
||||
this.blipId = -1;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -36,136 +36,136 @@ function initJobScript() {
|
||||
// ===========================================================================
|
||||
|
||||
function setLocalPlayerJobType(tempJobType) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Job] Set local player job type to ${tempJobType}`);
|
||||
localPlayerJobType = tempJobType;
|
||||
logToConsole(LOG_DEBUG, `[VRR.Job] Set local player job type to ${tempJobType}`);
|
||||
localPlayerJobType = tempJobType;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setLocalPlayerWorkingState(tempWorking) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Job] Setting working state to ${tempWorking}`);
|
||||
localPlayerWorking = tempWorking;
|
||||
logToConsole(LOG_DEBUG, `[VRR.Job] Setting working state to ${tempWorking}`);
|
||||
localPlayerWorking = tempWorking;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showJobRouteLocation(position, colour) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Job] Showing job route location`);
|
||||
if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
|
||||
if(game.game == VRR_GAME_GTA_SA) {
|
||||
jobRouteLocationSphere = game.createPickup(1318, position, 1);
|
||||
} else {
|
||||
jobRouteLocationSphere = game.createSphere(position, 3);
|
||||
jobRouteLocationSphere.colour = colour;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[VRR.Job] Showing job route location`);
|
||||
if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
|
||||
if(game.game == VRR_GAME_GTA_SA) {
|
||||
jobRouteLocationSphere = game.createPickup(1318, position, 1);
|
||||
} else {
|
||||
jobRouteLocationSphere = game.createSphere(position, 3);
|
||||
jobRouteLocationSphere.colour = colour;
|
||||
}
|
||||
|
||||
if(jobRouteLocationBlip != null) {
|
||||
destroyElement(jobRouteLocationBlip);
|
||||
}
|
||||
if(jobRouteLocationBlip != null) {
|
||||
destroyElement(jobRouteLocationBlip);
|
||||
}
|
||||
|
||||
blinkJobRouteLocationBlip(10, position, colour);
|
||||
}
|
||||
blinkJobRouteLocationBlip(10, position, colour);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function enteredJobRouteSphere() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Job] Entered job route sphere`);
|
||||
tellServerPlayerArrivedAtJobRouteLocation();
|
||||
destroyElement(jobRouteLocationSphere);
|
||||
destroyElement(jobRouteLocationBlip);
|
||||
jobRouteLocationSphere = null;
|
||||
jobRouteLocationBlip = null;
|
||||
logToConsole(LOG_DEBUG, `[VRR.Job] Entered job route sphere`);
|
||||
tellServerPlayerArrivedAtJobRouteLocation();
|
||||
destroyElement(jobRouteLocationSphere);
|
||||
destroyElement(jobRouteLocationBlip);
|
||||
jobRouteLocationSphere = null;
|
||||
jobRouteLocationBlip = null;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function blinkJobRouteLocationBlip(times, position, colour) {
|
||||
for(let i = 1 ; i <= times ; i++) {
|
||||
setTimeout(function() {
|
||||
if(jobRouteLocationBlip != null) {
|
||||
destroyElement(jobRouteLocationBlip);
|
||||
jobRouteLocationBlip = null;
|
||||
} else {
|
||||
jobRouteLocationBlip = game.createBlip(position, 0, 2, colour);
|
||||
}
|
||||
}, 500*i);
|
||||
}
|
||||
for(let i = 1 ; i <= times ; i++) {
|
||||
setTimeout(function() {
|
||||
if(jobRouteLocationBlip != null) {
|
||||
destroyElement(jobRouteLocationBlip);
|
||||
jobRouteLocationBlip = null;
|
||||
} else {
|
||||
jobRouteLocationBlip = game.createBlip(position, 0, 2, colour);
|
||||
}
|
||||
}, 500*i);
|
||||
}
|
||||
|
||||
setTimeout(function() {
|
||||
jobRouteLocationBlip = game.createBlip(position, 0, 2, colour);
|
||||
}, 500*times+1);
|
||||
setTimeout(function() {
|
||||
jobRouteLocationBlip = game.createBlip(position, 0, 2, colour);
|
||||
}, 500*times+1);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function hideJobRouteLocation() {
|
||||
destroyElement(jobRouteLocationSphere);
|
||||
destroyElement(jobRouteLocationBlip);
|
||||
jobRouteLocationSphere = null;
|
||||
jobRouteLocationBlip = null;
|
||||
destroyElement(jobRouteLocationSphere);
|
||||
destroyElement(jobRouteLocationBlip);
|
||||
jobRouteLocationSphere = null;
|
||||
jobRouteLocationBlip = null;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function receiveJobFromServer(jobId, name, position, blipModel, pickupModel) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Job] Received job ${jobId} (${name}) from server`);
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if(getJobData(jobId) != false) {
|
||||
let jobData = getJobData(jobId);
|
||||
jobData.name = name;
|
||||
jobData.position = position;
|
||||
jobData.blipModel = blipModel;
|
||||
jobData.pickupModel = pickupModel;
|
||||
logToConsole(LOG_DEBUG, `[VRR.Job] Received job ${jobId} (${name}) from server`);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId} already exists. Checking blip ...`);
|
||||
if(blipModel == -1) {
|
||||
if(jobData.blipId != -1) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId}'s blip has been removed by the server`);
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.removeBlipAndClearIndex(getJobData(jobId).blipId);
|
||||
} else {
|
||||
destroyElement(getElementFromId(blipId));
|
||||
}
|
||||
jobData.blipId = -1;
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId}'s blip is unchanged`);
|
||||
}
|
||||
} else {
|
||||
if(jobData.blipId != -1) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId}'s blip has been changed by the server`);
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.setBlipCoordinates(jobData.blipId, jobData.position);
|
||||
natives.changeBlipSprite(jobData.blipId, jobData.blipModel);
|
||||
natives.setBlipMarkerLongDistance(jobData.blipId, false);
|
||||
natives.setBlipAsShortRange(jobData.blipId, true);
|
||||
natives.changeBlipNameFromAscii(jobData.blipId, `${jobData.name.substr(0, 24)}${(jobData.name.length > 24) ? " ...": ""}`);
|
||||
}
|
||||
} else {
|
||||
let blipId = createGameBlip(jobData.blipModel, jobData.position, jobData.name);
|
||||
if(blipId != -1) {
|
||||
jobData.blipId = blipId;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId} doesn't exist. Adding ...`);
|
||||
let tempJobData = new JobData(jobId, name, position, blipModel, pickupModel);
|
||||
if(blipModel != -1) {
|
||||
let blipId = createGameBlip(tempJobData.blipModel, tempJobData.position, tempJobData.name);
|
||||
if(blipId != -1) {
|
||||
tempJobData.blipId = blipId;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId} has no blip.`);
|
||||
}
|
||||
jobs.push(tempJobData);
|
||||
setAllJobDataIndexes();
|
||||
}
|
||||
}
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if(getJobData(jobId) != false) {
|
||||
let jobData = getJobData(jobId);
|
||||
jobData.name = name;
|
||||
jobData.position = position;
|
||||
jobData.blipModel = blipModel;
|
||||
jobData.pickupModel = pickupModel;
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId} already exists. Checking blip ...`);
|
||||
if(blipModel == -1) {
|
||||
if(jobData.blipId != -1) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId}'s blip has been removed by the server`);
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.removeBlipAndClearIndex(getJobData(jobId).blipId);
|
||||
} else {
|
||||
destroyElement(getElementFromId(blipId));
|
||||
}
|
||||
jobData.blipId = -1;
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId}'s blip is unchanged`);
|
||||
}
|
||||
} else {
|
||||
if(jobData.blipId != -1) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId}'s blip has been changed by the server`);
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.setBlipCoordinates(jobData.blipId, jobData.position);
|
||||
natives.changeBlipSprite(jobData.blipId, jobData.blipModel);
|
||||
natives.setBlipMarkerLongDistance(jobData.blipId, false);
|
||||
natives.setBlipAsShortRange(jobData.blipId, true);
|
||||
natives.changeBlipNameFromAscii(jobData.blipId, `${jobData.name.substr(0, 24)}${(jobData.name.length > 24) ? " ...": ""}`);
|
||||
}
|
||||
} else {
|
||||
let blipId = createGameBlip(jobData.blipModel, jobData.position, jobData.name);
|
||||
if(blipId != -1) {
|
||||
jobData.blipId = blipId;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId} doesn't exist. Adding ...`);
|
||||
let tempJobData = new JobData(jobId, name, position, blipModel, pickupModel);
|
||||
if(blipModel != -1) {
|
||||
let blipId = createGameBlip(tempJobData.blipModel, tempJobData.position, tempJobData.name);
|
||||
if(blipId != -1) {
|
||||
tempJobData.blipId = blipId;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId}'s blip has been added by the server (Model ${blipModel}, ID ${blipId})`);
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Job] Job ${jobId} has no blip.`);
|
||||
}
|
||||
jobs.push(tempJobData);
|
||||
setAllJobDataIndexes();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -175,21 +175,21 @@ function receiveJobFromServer(jobId, name, position, blipModel, pickupModel) {
|
||||
* @return {JobData} The job's data (class instance)
|
||||
*/
|
||||
function getJobData(jobId) {
|
||||
for(let i in jobs) {
|
||||
if(jobs[i].jobId == jobId) {
|
||||
return jobs[i];
|
||||
}
|
||||
}
|
||||
for(let i in jobs) {
|
||||
if(jobs[i].jobId == jobId) {
|
||||
return jobs[i];
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setAllJobDataIndexes() {
|
||||
for(let i in jobs) {
|
||||
jobs[i].index = i;
|
||||
}
|
||||
for(let i in jobs) {
|
||||
jobs[i].index = i;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1,14 +1,14 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"moduleResolution": "classic"
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"moduleResolution": "classic"
|
||||
},
|
||||
"include": [
|
||||
"*.js",
|
||||
"gui/*.js",
|
||||
"native/*.js",
|
||||
"../shared/*.js",
|
||||
"../third-party/mexui/*"
|
||||
"*.js",
|
||||
"gui/*.js",
|
||||
"native/*.js",
|
||||
"../shared/*.js",
|
||||
"../third-party/mexui/*"
|
||||
]
|
||||
}
|
||||
@@ -23,71 +23,71 @@ function initKeyBindScript() {
|
||||
// ===========================================================================
|
||||
|
||||
function bindAccountKey(key, keyState) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Binded key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
||||
keyBinds.push(toInteger(key));
|
||||
bindKey(toInteger(key), keyState, function(event) {
|
||||
if(isAnyGUIActive()) {
|
||||
return false;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Binded key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
||||
keyBinds.push(toInteger(key));
|
||||
bindKey(toInteger(key), keyState, function(event) {
|
||||
if(isAnyGUIActive()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(hasKeyBindDelayElapsed()) {
|
||||
if(canLocalPlayerUseKeyBinds()) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Using keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
||||
lastKeyBindUse = sdl.ticks;
|
||||
tellServerPlayerUsedKeyBind(key);
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Failed to use keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key}) - Not allowed to use keybinds!`);
|
||||
}
|
||||
} 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!`);
|
||||
}
|
||||
});
|
||||
if(hasKeyBindDelayElapsed()) {
|
||||
if(canLocalPlayerUseKeyBinds()) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Using keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
||||
lastKeyBindUse = sdl.ticks;
|
||||
tellServerPlayerUsedKeyBind(key);
|
||||
} else {
|
||||
logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Failed to use keybind for key ${toUpperCase(getKeyNameFromId(key))} (${key}) - Not allowed to use keybinds!`);
|
||||
}
|
||||
} 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!`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function unBindAccountKey(key) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Unbinded key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
||||
unbindKey(key);
|
||||
keyBinds.splice(keyBinds.indexOf(key), 1);
|
||||
return true;
|
||||
logToConsole(LOG_DEBUG, `[VRR.KeyBind]: Unbinded key ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
||||
unbindKey(key);
|
||||
keyBinds.splice(keyBinds.indexOf(key), 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function hasKeyBindDelayElapsed() {
|
||||
if(sdl.ticks-lastKeyBindUse >= keyBindDelayTime) {
|
||||
return true;
|
||||
}
|
||||
if(sdl.ticks-lastKeyBindUse >= keyBindDelayTime) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function canLocalPlayerUseKeyBinds() {
|
||||
if(isAnyGUIActive()) {
|
||||
return false;
|
||||
}
|
||||
if(isAnyGUIActive()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!isSpawned) {
|
||||
return false;
|
||||
}
|
||||
if(!isSpawned) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(itemActionDelayEnabled) {
|
||||
return false;
|
||||
}
|
||||
if(itemActionDelayEnabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function clearKeyBinds() {
|
||||
for(let i in keyBinds) {
|
||||
unbindKey(keyBinds[i]);
|
||||
}
|
||||
keyBinds = [];
|
||||
for(let i in keyBinds) {
|
||||
unbindKey(keyBinds[i]);
|
||||
}
|
||||
keyBinds = [];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -42,280 +42,280 @@ function initLabelScript() {
|
||||
// ===========================================================================
|
||||
|
||||
function initLabelPropertyNameFont() {
|
||||
return lucasFont.createDefaultFont(16.0, "Roboto", "Regular");
|
||||
return lucasFont.createDefaultFont(16.0, "Roboto", "Regular");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initLabelPropertyLockedFont() {
|
||||
return lucasFont.createDefaultFont(12.0, "Roboto", "Light");
|
||||
return lucasFont.createDefaultFont(12.0, "Roboto", "Light");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initLabelJobNameFont() {
|
||||
return lucasFont.createDefaultFont(16.0, "Roboto", "Regular");
|
||||
return lucasFont.createDefaultFont(16.0, "Roboto", "Regular");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
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) {
|
||||
if(localPlayer == null) {
|
||||
return false;
|
||||
}
|
||||
if(localPlayer == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(propertyLabelNameFont == null) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(propertyLabelLockedFont == null) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
let tempPosition = position;
|
||||
tempPosition.z = tempPosition.z + propertyLabelHeight;
|
||||
let screenPosition = getScreenFromWorldPosition(tempPosition);
|
||||
let tempPosition = position;
|
||||
tempPosition.z = tempPosition.z + propertyLabelHeight;
|
||||
let screenPosition = getScreenFromWorldPosition(tempPosition);
|
||||
|
||||
if(screenPosition.x < 0 || screenPosition.x > game.width) {
|
||||
return false;
|
||||
}
|
||||
if(screenPosition.x < 0 || screenPosition.x > game.width) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let text = "";
|
||||
if(price > "0") {
|
||||
text = `For sale: $${price}`;
|
||||
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);
|
||||
let text = "";
|
||||
if(price > "0") {
|
||||
text = `For sale: $${price}`;
|
||||
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);
|
||||
|
||||
screenPosition.y -= propertyLabelPriceOffset;
|
||||
}
|
||||
screenPosition.y -= propertyLabelPriceOffset;
|
||||
}
|
||||
|
||||
text = "";
|
||||
if(rentPrice != "0") {
|
||||
text = `For rent: $${rentPrice} every payday`;
|
||||
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);
|
||||
text = "";
|
||||
if(rentPrice != "0") {
|
||||
text = `For rent: $${rentPrice} every payday`;
|
||||
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);
|
||||
|
||||
screenPosition.y -= propertyLabelPriceOffset;
|
||||
}
|
||||
screenPosition.y -= propertyLabelPriceOffset;
|
||||
}
|
||||
|
||||
|
||||
if(isBusiness) {
|
||||
text = (locked) ? "CLOSED" : "OPEN";
|
||||
} else {
|
||||
text = (locked) ? "LOCKED" : "UNLOCKED";
|
||||
}
|
||||
if(isBusiness) {
|
||||
text = (locked) ? "CLOSED" : "OPEN";
|
||||
} else {
|
||||
text = (locked) ? "LOCKED" : "UNLOCKED";
|
||||
}
|
||||
|
||||
if(!locked && labelInfoType != VRR_PROPLABEL_INFO_NONE) {
|
||||
let infoText = "";
|
||||
switch(labelInfoType) {
|
||||
case VRR_PROPLABEL_INFO_ENTER:
|
||||
if(enterPropertyKey) {
|
||||
infoText = `Press ${toUpperCase(getKeyNameFromId(enterPropertyKey))} to enter`;
|
||||
} else {
|
||||
infoText = `Use /enter to enter`;
|
||||
}
|
||||
break;
|
||||
if(!locked && labelInfoType != VRR_PROPLABEL_INFO_NONE) {
|
||||
let infoText = "";
|
||||
switch(labelInfoType) {
|
||||
case VRR_PROPLABEL_INFO_ENTER:
|
||||
if(enterPropertyKey) {
|
||||
infoText = `Press ${toUpperCase(getKeyNameFromId(enterPropertyKey))} to enter`;
|
||||
} else {
|
||||
infoText = `Use /enter to enter`;
|
||||
}
|
||||
break;
|
||||
|
||||
case VRR_PROPLABEL_INFO_BUY:
|
||||
infoText = `Use /buy to purchase items`;
|
||||
break;
|
||||
case VRR_PROPLABEL_INFO_BUY:
|
||||
infoText = `Use /buy to purchase items`;
|
||||
break;
|
||||
|
||||
case VRR_PROPLABEL_INFO_BUYBIZ:
|
||||
infoText = `Use /buy to purchase items`;
|
||||
break;
|
||||
case VRR_PROPLABEL_INFO_BUYBIZ:
|
||||
infoText = `Use /buy to purchase items`;
|
||||
break;
|
||||
|
||||
//case VRR_PROPLABEL_INFO_RENTBIZ:
|
||||
// infoText = `Use /bizrent to buy this business`;
|
||||
// break;
|
||||
//case VRR_PROPLABEL_INFO_RENTBIZ:
|
||||
// infoText = `Use /bizrent to buy this business`;
|
||||
// break;
|
||||
|
||||
case VRR_PROPLABEL_INFO_BUYHOUSE:
|
||||
infoText = `Use /housebuy to buy this house`;
|
||||
break;
|
||||
case VRR_PROPLABEL_INFO_BUYHOUSE:
|
||||
infoText = `Use /housebuy to buy this house`;
|
||||
break;
|
||||
|
||||
case VRR_PROPLABEL_INFO_RENTHOUSE:
|
||||
infoText = `Use /houserent to rent this house`;
|
||||
break;
|
||||
case VRR_PROPLABEL_INFO_RENTHOUSE:
|
||||
infoText = `Use /houserent to rent this house`;
|
||||
break;
|
||||
|
||||
case VRR_PROPLABEL_INFO_ENTERVEH:
|
||||
infoText = "Enter a vehicle in the parking lot to buy it";
|
||||
break;
|
||||
case VRR_PROPLABEL_INFO_ENTERVEH:
|
||||
infoText = "Enter a vehicle in the parking lot to buy it";
|
||||
break;
|
||||
|
||||
case VRR_PROPLABEL_INFO_NONE:
|
||||
default:
|
||||
infoText = "";
|
||||
break;
|
||||
}
|
||||
if(getDistance(localPlayer.position, position) <= renderLabelDistance-2) {
|
||||
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);
|
||||
screenPosition.y -= propertyLabelLockedOffset;
|
||||
}
|
||||
}
|
||||
case VRR_PROPLABEL_INFO_NONE:
|
||||
default:
|
||||
infoText = "";
|
||||
break;
|
||||
}
|
||||
if(getDistance(localPlayer.position, position) <= renderLabelDistance-2) {
|
||||
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);
|
||||
screenPosition.y -= propertyLabelLockedOffset;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
screenPosition.y -= propertyLabelNameOffset;
|
||||
screenPosition.y -= propertyLabelNameOffset;
|
||||
|
||||
text = name || " ";
|
||||
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);
|
||||
text = name || " ";
|
||||
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);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
function renderPropertyExitLabel(position) {
|
||||
if(localPlayer == null) {
|
||||
return false;
|
||||
}
|
||||
if(localPlayer == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(propertyLabelNameFont == null) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(propertyLabelLockedFont == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let tempPosition = position;
|
||||
tempPosition.z = tempPosition.z + propertyLabelHeight;
|
||||
let screenPosition = getScreenFromWorldPosition(tempPosition);
|
||||
let tempPosition = position;
|
||||
tempPosition.z = tempPosition.z + propertyLabelHeight;
|
||||
let screenPosition = getScreenFromWorldPosition(tempPosition);
|
||||
|
||||
if(screenPosition.x < 0 || screenPosition.x > game.width) {
|
||||
return false;
|
||||
}
|
||||
if(screenPosition.x < 0 || screenPosition.x > game.width) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let text = "EXIT";
|
||||
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);
|
||||
let text = "EXIT";
|
||||
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);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
function renderJobLabel(name, position, jobType) {
|
||||
if(localPlayer == null) {
|
||||
return false;
|
||||
}
|
||||
if(localPlayer == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(jobNameLabelFont == null) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(jobHelpLabelFont == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let tempPosition = position;
|
||||
tempPosition.z = tempPosition.z + propertyLabelHeight;
|
||||
let screenPosition = getScreenFromWorldPosition(tempPosition);
|
||||
let tempPosition = position;
|
||||
tempPosition.z = tempPosition.z + propertyLabelHeight;
|
||||
let screenPosition = getScreenFromWorldPosition(tempPosition);
|
||||
|
||||
if(screenPosition.x < 0 || screenPosition.x > game.width) {
|
||||
return false;
|
||||
}
|
||||
if(screenPosition.x < 0 || screenPosition.x > game.width) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let text = "";
|
||||
if(jobType == localPlayerJobType) {
|
||||
if(localPlayerWorking) {
|
||||
text = "Use /uniform and /equip for job stuff, or /stopwork to go off duty";
|
||||
} else {
|
||||
text = "Use /startwork to go on duty";
|
||||
}
|
||||
} else {
|
||||
if(localPlayerJobType == 0) {
|
||||
text = "Use /takejob to work here";
|
||||
} else {
|
||||
text = "You already have a job. Use /quitjob if you want this one";
|
||||
}
|
||||
}
|
||||
let text = "";
|
||||
if(jobType == localPlayerJobType) {
|
||||
if(localPlayerWorking) {
|
||||
text = "Use /uniform and /equip for job stuff, or /stopwork to go off duty";
|
||||
} else {
|
||||
text = "Use /startwork to go on duty";
|
||||
}
|
||||
} else {
|
||||
if(localPlayerJobType == 0) {
|
||||
text = "Use /takejob to work here";
|
||||
} else {
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
|
||||
screenPosition.y -= 18;
|
||||
screenPosition.y -= 18;
|
||||
|
||||
text = name + " Job";
|
||||
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);
|
||||
text = name + " Job";
|
||||
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);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
function processLabelRendering() {
|
||||
if(renderLabels) {
|
||||
if(!areServerElementsSupported()) {
|
||||
if(localPlayer != null) {
|
||||
for(let i in businesses) {
|
||||
if(getDistance(localPlayer.position, businesses[i].entrancePosition) <= 75.0) {
|
||||
natives.drawColouredCylinder(getPosBelowPos(businesses[i].entrancePosition, 1.0), 0.0, 0.0, 0, 153, 255, 255);
|
||||
}
|
||||
}
|
||||
if(renderLabels) {
|
||||
if(!areServerElementsSupported()) {
|
||||
if(localPlayer != null) {
|
||||
for(let i in businesses) {
|
||||
if(getDistance(localPlayer.position, businesses[i].entrancePosition) <= 75.0) {
|
||||
natives.drawColouredCylinder(getPosBelowPos(businesses[i].entrancePosition, 1.0), 0.0, 0.0, 0, 153, 255, 255);
|
||||
}
|
||||
}
|
||||
|
||||
for(let i in houses) {
|
||||
if(getDistance(localPlayer.position, houses[i].entrancePosition) <= 75.0) {
|
||||
natives.drawColouredCylinder(getPosBelowPos(houses[i].entrancePosition, 1.0), 0.0, 0.0, 0, 200, 0, 255);
|
||||
}
|
||||
}
|
||||
|
||||
for(let i in jobs) {
|
||||
if(getDistance(localPlayer.position, jobs[i].position) <= 75.0) {
|
||||
natives.drawColouredCylinder(getPosBelowPos(jobs[i].position, 1.0), 0.0, 0.0, 255, 255, 0, 255);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(areWorldLabelsSupported()) {
|
||||
if(localPlayer != null) {
|
||||
let pickups = getElementsByType(ELEMENT_PICKUP);
|
||||
for(let i in pickups) {
|
||||
if(pickups[i].getData("vrr.label.type") != null) {
|
||||
if(getDistance(localPlayer.position, pickups[i].position) <= renderLabelDistance) {
|
||||
if(!pickups[i].isOnScreen) {
|
||||
let price = "0";
|
||||
let rentPrice = "0";
|
||||
let labelInfoType = VRR_PROPLABEL_INFO_NONE;
|
||||
if(pickups[i].getData("vrr.label.price") != null) {
|
||||
price = makeLargeNumberReadable(pickups[i].getData("vrr.label.price"));
|
||||
}
|
||||
|
||||
if(pickups[i].getData("vrr.label.rentprice") != null) {
|
||||
rentPrice = makeLargeNumberReadable(pickups[i].getData("vrr.label.rentprice"));
|
||||
}
|
||||
|
||||
if(pickups[i].getData("vrr.label.help") != null) {
|
||||
labelInfoType = pickups[i].getData("vrr.label.help");
|
||||
}
|
||||
|
||||
switch(pickups[i].getData("vrr.label.type")) {
|
||||
case VRR_LABEL_BUSINESS:
|
||||
renderPropertyEntranceLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.locked"), true, price, rentPrice, labelInfoType);
|
||||
break;
|
||||
|
||||
case VRR_LABEL_HOUSE:
|
||||
renderPropertyEntranceLabel("House", pickups[i].position, pickups[i].getData("vrr.label.locked"), false, price, rentPrice, labelInfoType);
|
||||
break;
|
||||
|
||||
case VRR_LABEL_JOB:
|
||||
renderJobLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.jobType"));
|
||||
break;
|
||||
|
||||
case VRR_LABEL_EXIT:
|
||||
renderPropertyExitLabel(pickups[i].position);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for(let i in houses) {
|
||||
if(getDistance(localPlayer.position, houses[i].entrancePosition) <= 75.0) {
|
||||
natives.drawColouredCylinder(getPosBelowPos(houses[i].entrancePosition, 1.0), 0.0, 0.0, 0, 200, 0, 255);
|
||||
}
|
||||
}
|
||||
|
||||
for(let i in jobs) {
|
||||
if(getDistance(localPlayer.position, jobs[i].position) <= 75.0) {
|
||||
natives.drawColouredCylinder(getPosBelowPos(jobs[i].position, 1.0), 0.0, 0.0, 255, 255, 0, 255);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(areWorldLabelsSupported()) {
|
||||
if(localPlayer != null) {
|
||||
let pickups = getElementsByType(ELEMENT_PICKUP);
|
||||
for(let i in pickups) {
|
||||
if(pickups[i].getData("vrr.label.type") != null) {
|
||||
if(getDistance(localPlayer.position, pickups[i].position) <= renderLabelDistance) {
|
||||
if(!pickups[i].isOnScreen) {
|
||||
let price = "0";
|
||||
let rentPrice = "0";
|
||||
let labelInfoType = VRR_PROPLABEL_INFO_NONE;
|
||||
if(pickups[i].getData("vrr.label.price") != null) {
|
||||
price = makeLargeNumberReadable(pickups[i].getData("vrr.label.price"));
|
||||
}
|
||||
|
||||
if(pickups[i].getData("vrr.label.rentprice") != null) {
|
||||
rentPrice = makeLargeNumberReadable(pickups[i].getData("vrr.label.rentprice"));
|
||||
}
|
||||
|
||||
if(pickups[i].getData("vrr.label.help") != null) {
|
||||
labelInfoType = pickups[i].getData("vrr.label.help");
|
||||
}
|
||||
|
||||
switch(pickups[i].getData("vrr.label.type")) {
|
||||
case VRR_LABEL_BUSINESS:
|
||||
renderPropertyEntranceLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.locked"), true, price, rentPrice, labelInfoType);
|
||||
break;
|
||||
|
||||
case VRR_LABEL_HOUSE:
|
||||
renderPropertyEntranceLabel("House", pickups[i].position, pickups[i].getData("vrr.label.locked"), false, price, rentPrice, labelInfoType);
|
||||
break;
|
||||
|
||||
case VRR_LABEL_JOB:
|
||||
renderJobLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.jobType"));
|
||||
break;
|
||||
|
||||
case VRR_LABEL_EXIT:
|
||||
renderPropertyExitLabel(pickups[i].position);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
@@ -15,38 +15,38 @@ let logoSize = toVector2(128, 128);
|
||||
|
||||
function initLogoScript() {
|
||||
logToConsole(LOG_DEBUG, "[VRR.Logo]: Initializing logo script ...");
|
||||
//logoImage = loadLogoImage();
|
||||
//logoImage = loadLogoImage();
|
||||
logToConsole(LOG_DEBUG, "[VRR.Logo]: Logo script initialized!");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadLogoImage() {
|
||||
let logoStream = openFile(mainLogoPath);
|
||||
let tempLogoImage = null;
|
||||
if(logoStream != null) {
|
||||
tempLogoImage = graphics.loadPNG(logoStream);
|
||||
logoStream.close();
|
||||
}
|
||||
let logoStream = openFile(mainLogoPath);
|
||||
let tempLogoImage = null;
|
||||
if(logoStream != null) {
|
||||
tempLogoImage = graphics.loadPNG(logoStream);
|
||||
logoStream.close();
|
||||
}
|
||||
|
||||
return tempLogoImage;
|
||||
return tempLogoImage;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function processLogoRendering() {
|
||||
if(renderLogo) {
|
||||
if(logoImage != null) {
|
||||
graphics.drawRectangle(logoImage, logoPos, logoSize);
|
||||
}
|
||||
}
|
||||
if(renderLogo) {
|
||||
if(logoImage != null) {
|
||||
graphics.drawRectangle(logoImage, logoPos, logoSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setServerLogoRenderState(state) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Main] Server logo ${(state) ? "enabled" : "disabled"}`);
|
||||
renderLogo = state;
|
||||
logToConsole(LOG_DEBUG, `[VRR.Main] Server logo ${(state) ? "enabled" : "disabled"}`);
|
||||
renderLogo = state;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -16,64 +16,64 @@ let smallGameMessageTimer = null;
|
||||
|
||||
function initMessagingScript() {
|
||||
logToConsole(LOG_DEBUG, "[VRR.Messaging]: Initializing messaging script ...");
|
||||
smallGameMessageFont = loadSmallGameMessageFont();
|
||||
smallGameMessageFont = loadSmallGameMessageFont();
|
||||
logToConsole(LOG_DEBUG, "[VRR.Messaging]: Messaging script initialized!");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadSmallGameMessageFont() {
|
||||
let tempSmallGameMessageFont = null;
|
||||
let fontStream = openFile("files/fonts/pricedown.ttf");
|
||||
if(fontStream != null) {
|
||||
tempSmallGameMessageFont = lucasFont.createFont(fontStream, 20.0);
|
||||
fontStream.close();
|
||||
}
|
||||
let tempSmallGameMessageFont = null;
|
||||
let fontStream = openFile("files/fonts/pricedown.ttf");
|
||||
if(fontStream != null) {
|
||||
tempSmallGameMessageFont = lucasFont.createFont(fontStream, 20.0);
|
||||
fontStream.close();
|
||||
}
|
||||
|
||||
return tempSmallGameMessageFont;
|
||||
return tempSmallGameMessageFont;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadBigGameMessageFont() {
|
||||
let tempBigGameMessageFont = null;
|
||||
let fontStream = openFile("files/fonts/pricedown.ttf");
|
||||
if(fontStream != null) {
|
||||
tempBigGameMessageFont = lucasFont.createFont(fontStream, 28.0);
|
||||
fontStream.close();
|
||||
}
|
||||
let tempBigGameMessageFont = null;
|
||||
let fontStream = openFile("files/fonts/pricedown.ttf");
|
||||
if(fontStream != null) {
|
||||
tempBigGameMessageFont = lucasFont.createFont(fontStream, 28.0);
|
||||
fontStream.close();
|
||||
}
|
||||
|
||||
return tempBigGameMessageFont;
|
||||
return tempBigGameMessageFont;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function processSmallGameMessageRendering() {
|
||||
if(renderSmallGameMessage) {
|
||||
if(smallGameMessageFont != null) {
|
||||
if(smallGameMessageFont != "") {
|
||||
smallGameMessageFont.render(smallGameMessageText, [0, game.height-90], game.width, 0.5, 0.0, smallGameMessageFont.size, smallGameMessageColour, true, true, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(renderSmallGameMessage) {
|
||||
if(smallGameMessageFont != null) {
|
||||
if(smallGameMessageFont != "") {
|
||||
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) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Messaging] Showing small game message '${text}' for ${duration}ms`);
|
||||
if(smallGameMessageText != "") {
|
||||
clearTimeout(smallGameMessageTimer);
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[VRR.Messaging] Showing small game message '${text}' for ${duration}ms`);
|
||||
if(smallGameMessageText != "") {
|
||||
clearTimeout(smallGameMessageTimer);
|
||||
}
|
||||
|
||||
smallGameMessageColour = colour;
|
||||
smallGameMessageText = text;
|
||||
smallGameMessageColour = colour;
|
||||
smallGameMessageText = text;
|
||||
|
||||
smallGameMessageTimer = setTimeout(function() {
|
||||
smallGameMessageText = "";
|
||||
smallGameMessageColour = COLOUR_WHITE;
|
||||
smallGameMessageTimer = null;
|
||||
}, duration);
|
||||
smallGameMessageTimer = setTimeout(function() {
|
||||
smallGameMessageText = "";
|
||||
smallGameMessageColour = COLOUR_WHITE;
|
||||
smallGameMessageTimer = null;
|
||||
}, duration);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -632,10 +632,10 @@ function update()
|
||||
|
||||
addEventHandler("OnCameraProcess", (event) =>
|
||||
{
|
||||
if(mouseCameraEnabled) {
|
||||
update();
|
||||
event.preventDefault();
|
||||
}
|
||||
if(mouseCameraEnabled) {
|
||||
update();
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
function toggleMouseCamera() {
|
||||
|
||||
@@ -74,11 +74,11 @@ function drawNametag(x, y, health, armour, text, ping, alpha, distance, colour,
|
||||
alpha *= 0.75;
|
||||
let width = nametagWidth;
|
||||
health = Math.max(0.0, Math.min(1.0, health));
|
||||
armour = Math.max(0.0, Math.min(1.0, armour));
|
||||
armour = Math.max(0.0, Math.min(1.0, armour));
|
||||
|
||||
// Starts at bottom and works it's way up
|
||||
// -------------------------------------------
|
||||
// Health Bar
|
||||
// Starts at bottom and works it's way up
|
||||
// -------------------------------------------
|
||||
// Health Bar
|
||||
|
||||
if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
|
||||
if(game.game == VRR_GAME_GTA_III) {
|
||||
@@ -104,7 +104,7 @@ function drawNametag(x, y, health, armour, text, ping, alpha, distance, colour,
|
||||
graphics.drawRectangle(null, [hx+2, hy+2], [(width-4)*health, 10-6], colour, colour, colour, colour);
|
||||
}
|
||||
|
||||
// Armour Bar
|
||||
// Armour Bar
|
||||
if (armour > 0.0)
|
||||
{
|
||||
// Go up 10 pixels to draw the next part
|
||||
@@ -119,16 +119,16 @@ function drawNametag(x, y, health, armour, text, ping, alpha, distance, colour,
|
||||
|
||||
y -= 20;
|
||||
|
||||
// Nametag
|
||||
// Nametag
|
||||
if(nametagFont != null) {
|
||||
let size = nametagFont.measure(text, game.width, 0.0, 0.0, nametagFont.size, false, false);
|
||||
nametagFont.render(text, [x-size[0]/2, y-size[1]/2], game.width, 0.0, 0.0, nametagFont.size, colour, false, false, false, true);
|
||||
}
|
||||
|
||||
// Go up another 10 pixels for the next part
|
||||
y -= 20;
|
||||
// Go up another 10 pixels for the next part
|
||||
y -= 20;
|
||||
|
||||
// AFK Status
|
||||
// AFK Status
|
||||
if(afkStatusFont != null) {
|
||||
if(afk) {
|
||||
let size = afkStatusFont.measure("PAUSED", game.width, 0.0, 0.0, afkStatusFont.size, false, false);
|
||||
@@ -147,7 +147,7 @@ function updateNametags(element) {
|
||||
if(localPlayer != null) {
|
||||
let playerPos = localPlayer.position;
|
||||
let elementPos = element.position;
|
||||
let client = getClientFromPlayerElement(element);
|
||||
let client = getClientFromPlayerElement(element);
|
||||
|
||||
elementPos[2] += 0.9;
|
||||
|
||||
@@ -173,26 +173,26 @@ function updateNametags(element) {
|
||||
}
|
||||
|
||||
if(element.type == ELEMENT_PLAYER) {
|
||||
let name = element.name;
|
||||
let colour = COLOUR_WHITE;
|
||||
let name = element.name;
|
||||
let colour = COLOUR_WHITE;
|
||||
let paused = false;
|
||||
let ping = -1;
|
||||
|
||||
if(typeof playerNames[element.name] != "undefined") {
|
||||
name = playerNames[element.name];
|
||||
}
|
||||
|
||||
if(typeof playerPaused[element.name] != "undefined") {
|
||||
paused = playerPaused[element.name];
|
||||
}
|
||||
|
||||
if(typeof playerColours[element.name] != "undefined") {
|
||||
colour = playerColours[element.name];
|
||||
if(typeof playerNames[element.name] != "undefined") {
|
||||
name = playerNames[element.name];
|
||||
}
|
||||
|
||||
if(typeof playerPing[element.name] != "undefined") {
|
||||
ping = playerPing[element.name];
|
||||
}
|
||||
if(typeof playerPaused[element.name] != "undefined") {
|
||||
paused = playerPaused[element.name];
|
||||
}
|
||||
|
||||
if(typeof playerColours[element.name] != "undefined") {
|
||||
colour = playerColours[element.name];
|
||||
}
|
||||
|
||||
if(typeof playerPing[element.name] != "undefined") {
|
||||
ping = playerPing[element.name];
|
||||
}
|
||||
|
||||
drawNametag(screenPos[0], screenPos[1], health, armour, name, ping, 1.0-distance/nametagDistance, distance, colour, paused, element.skin);
|
||||
}
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
// ===========================================================================
|
||||
|
||||
function sendNetworkEventToPlayer(networkEvent, client, ...args) {
|
||||
triggerNetworkEvent.apply(null, networkEvent, client, args);
|
||||
triggerNetworkEvent.apply(null, networkEvent, client, args);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerPosition() {
|
||||
return localPlayer.position;
|
||||
return localPlayer.position;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -30,39 +30,39 @@ function setPlayerPosition(position) {
|
||||
// ===========================================================================
|
||||
|
||||
function getElementPosition(element) {
|
||||
return element.position;
|
||||
return element.position;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setElementPosition(element, position) {
|
||||
if(!element.isSyncer) {
|
||||
return false;
|
||||
}
|
||||
if(!element.isSyncer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
element.position = position;
|
||||
element.position = position;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function deleteGameElement(element, position) {
|
||||
if(!element.isOwner) {
|
||||
return false;
|
||||
}
|
||||
if(!element.isOwner) {
|
||||
return false;
|
||||
}
|
||||
|
||||
destroyGameElement(element);
|
||||
destroyGameElement(element);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function createGameVehicle(modelIndex, position, heading) {
|
||||
return game.createVehicle(getGameConfig().vehicles[getGame()][modelIndex][0], position, heading);
|
||||
return game.createVehicle(getGameConfig().vehicles[getGame()][modelIndex][0], position, heading);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function addNetworkEventHandler(eventName, handlerFunction) {
|
||||
addNetworkHandler(eventName, handlerFunction);
|
||||
addNetworkHandler(eventName, handlerFunction);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -156,7 +156,7 @@ function createGameBlip(blipModel, position, name = "") {
|
||||
natives.setBlipAsShortRange(blipId, true);
|
||||
natives.changeBlipNameFromAscii(blipId, `${name.substr(0, 24)}${(name.length > 24) ? " ...": ""}`);
|
||||
return blipId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
||||
@@ -8,39 +8,39 @@
|
||||
// ===========================================================================
|
||||
|
||||
function playStreamingRadio(url, loop, volume, element = false) {
|
||||
if(streamingRadio != null) {
|
||||
streamingRadio.stop();
|
||||
}
|
||||
if(streamingRadio != null) {
|
||||
streamingRadio.stop();
|
||||
}
|
||||
|
||||
streamingRadioVolume = volume;
|
||||
streamingRadioVolume = volume;
|
||||
|
||||
streamingRadio = audio.createSoundFromURL(url, loop);
|
||||
streamingRadio.volume = volume/100;
|
||||
streamingRadio.play();
|
||||
streamingRadio = audio.createSoundFromURL(url, loop);
|
||||
streamingRadio.volume = volume/100;
|
||||
streamingRadio.play();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function stopStreamingRadio() {
|
||||
if(streamingRadio != null) {
|
||||
streamingRadio.stop();
|
||||
}
|
||||
streamingRadio = null;
|
||||
if(streamingRadio != null) {
|
||||
streamingRadio.stop();
|
||||
}
|
||||
streamingRadio = null;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setStreamingRadioVolume(volume) {
|
||||
if(streamingRadio != null) {
|
||||
streamingRadioVolume = volume;
|
||||
streamingRadio.volume = volume/100;
|
||||
}
|
||||
if(streamingRadio != null) {
|
||||
streamingRadioVolume = volume;
|
||||
streamingRadio.volume = volume/100;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function playAudioFile(audioName, loop, volume) {
|
||||
playCustomAudio(audioName, volume/100, loop);
|
||||
playCustomAudio(audioName, volume/100, loop);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -43,7 +43,7 @@ function processScoreBoardRendering() {
|
||||
}
|
||||
|
||||
if(renderScoreBoard) {
|
||||
if(isKeyDown(SDLK_TAB)) {
|
||||
if(isKeyDown(SDLK_TAB)) {
|
||||
if(scoreBoardListFont != null && scoreBoardTitleFont != null) {
|
||||
let scoreboardStart = (game.height/2)-(Math.floor(getClients().length/2)*20);
|
||||
let titleSize = scoreBoardTitleFont.measure("PLAYERS", game.width, 0.0, 1.0, 10, false, false);
|
||||
|
||||
@@ -8,198 +8,186 @@
|
||||
// ===========================================================================
|
||||
|
||||
function initServerScript() {
|
||||
logToConsole(LOG_DEBUG, "[VRR.Server]: Initializing server script ...");
|
||||
addAllNetworkHandlers();
|
||||
logToConsole(LOG_DEBUG, "[VRR.Server]: Server script initialized!");
|
||||
logToConsole(LOG_DEBUG, "[VRR.Server]: Initializing server script ...");
|
||||
addAllNetworkHandlers();
|
||||
logToConsole(LOG_DEBUG, "[VRR.Server]: Server script initialized!");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function addAllNetworkHandlers() {
|
||||
logToConsole(LOG_DEBUG, "[VRR.Server]: Adding network handlers ...");
|
||||
logToConsole(LOG_DEBUG, "[VRR.Server]: Adding network handlers ...");
|
||||
|
||||
addNetworkEventHandler("vrr.smallGameMessage", showSmallGameMessage);
|
||||
addNetworkEventHandler("vrr.working", setLocalPlayerWorkingState);
|
||||
addNetworkEventHandler("vrr.jobType", setLocalPlayerJobType);
|
||||
addNetworkEventHandler("vrr.passenger", enterVehicleAsPassenger);
|
||||
|
||||
addNetworkEventHandler("vrr.freeze", setLocalPlayerFrozenState);
|
||||
addNetworkEventHandler("vrr.control", setLocalPlayerControlState);
|
||||
addNetworkEventHandler("vrr.fadeCamera", fadeLocalCamera);
|
||||
addNetworkEventHandler("vrr.removeFromVehicle", removeLocalPlayerFromVehicle);
|
||||
addNetworkEventHandler("vrr.clearPeds", clearLocalPlayerOwnedPeds);
|
||||
addNetworkEventHandler("vrr.restoreCamera", restoreLocalCamera);
|
||||
addNetworkEventHandler("vrr.cameraLookAt", setLocalCameraLookAt);
|
||||
addNetworkEventHandler("vrr.logo", setServerLogoRenderState);
|
||||
addNetworkEventHandler("vrr.ambience", setCityAmbienceState);
|
||||
addNetworkEventHandler("vrr.runCode", runClientCode);
|
||||
addNetworkEventHandler("vrr.clearWeapons", clearLocalPlayerWeapons);
|
||||
addNetworkEventHandler("vrr.giveWeapon", giveLocalPlayerWeapon);
|
||||
addNetworkEventHandler("vrr.position", setLocalPlayerPosition);
|
||||
addNetworkEventHandler("vrr.heading", setLocalPlayerHeading);
|
||||
addNetworkEventHandler("vrr.interior", setLocalPlayerInterior);
|
||||
addNetworkEventHandler("vrr.minuteDuration", setMinuteDuration);
|
||||
addNetworkEventHandler("vrr.showJobRouteLocation", showJobRouteLocation);
|
||||
addNetworkEventHandler("vrr.hideJobRouteLocation", hideJobRouteLocation);
|
||||
addNetworkEventHandler("vrr.snow", setSnowState);
|
||||
addNetworkEventHandler("vrr.health", setLocalPlayerHealth);
|
||||
addNetworkEventHandler("vrr.enterPropertyKey", setEnterPropertyKey);
|
||||
addNetworkEventHandler("vrr.skinSelect", toggleSkinSelect);
|
||||
addNetworkEventHandler("vrr.hotbar", updatePlayerHotBar);
|
||||
addNetworkEventHandler("vrr.pedSpeech", playPedSpeech);
|
||||
addNetworkEventHandler("vrr.clearPedState", clearLocalPedState);
|
||||
addNetworkEventHandler("vrr.drunkEffect", setLocalPlayerDrunkEffect);
|
||||
addNetworkEventHandler("vrr.showItemActionDelay", showItemActionDelay);
|
||||
addNetworkEventHandler("vrr.set2DRendering", setPlayer2DRendering);
|
||||
addNetworkEventHandler("vrr.mouseCursor", toggleMouseCursor);
|
||||
addNetworkEventHandler("vrr.mouseCamera", toggleMouseCamera);
|
||||
addNetworkEventHandler("vrr.mouseCameraForce", setMouseCameraState);
|
||||
addNetworkEventHandler("vrr.weaponDamageEnabled", setPlayerWeaponDamageEnabled);
|
||||
addNetworkEventHandler("vrr.weaponDamageEvent", setPlayerWeaponDamageEvent);
|
||||
addNetworkEventHandler("vrr.spawned", onServerSpawnedPlayer);
|
||||
addNetworkEventHandler("vrr.money", setLocalPlayerCash);
|
||||
addNetworkEventHandler("vrr.armour", setLocalPlayerArmour);
|
||||
addNetworkEventHandler("vrr.wantedLevel", forceLocalPlayerWantedLevel);
|
||||
|
||||
addNetworkEventHandler("vrr.delKeyBind", unBindAccountKey);
|
||||
addNetworkEventHandler("vrr.addKeyBind", bindAccountKey);
|
||||
addNetworkEventHandler("vrr.clearKeyBinds", clearKeyBinds);
|
||||
|
||||
addNetworkEventHandler("vrr.nametag", updatePlayerNameTag);
|
||||
addNetworkEventHandler("vrr.ping", updatePlayerPing);
|
||||
|
||||
addNetworkEventHandler("vrr.m", receiveChatBoxMessageFromServer);
|
||||
addNetworkEventHandler("vrr.chatScrollLines", setChatScrollLines);
|
||||
|
||||
addNetworkEventHandler("vrr.radioStream", playStreamingRadio);
|
||||
addNetworkEventHandler("vrr.audioFileStream", playAudioFile);
|
||||
addNetworkEventHandler("vrr.stopRadioStream", stopStreamingRadio);
|
||||
addNetworkEventHandler("vrr.radioVolume", setStreamingRadioVolume);
|
||||
|
||||
addNetworkEventHandler("vrr.veh.lights", setVehicleLights);
|
||||
addNetworkEventHandler("vrr.veh.engine", setVehicleEngine);
|
||||
addNetworkEventHandler("vrr.veh.repair", repairVehicle);
|
||||
|
||||
addNetworkEventHandler("vrr.pedAnim", makePedPlayAnimation);
|
||||
addNetworkEventHandler("vrr.pedStopAnim", makePedStopAnimation);
|
||||
addNetworkEventHandler("vrr.localPlayerSkin", setLocalPlayerSkin);
|
||||
addNetworkEventHandler("vrr.forcePedAnim", forcePedAnimation);
|
||||
addNetworkEventHandler("vrr.hideAllGUI", hideAllGUI);
|
||||
addNetworkEventHandler("vrr.clientInfo", serverRequestedClientInfo);
|
||||
addNetworkEventHandler("vrr.interiorLights", updateInteriorLightsState);
|
||||
addNetworkEventHandler("vrr.cutsceneInterior", setCutsceneInterior);
|
||||
|
||||
addNetworkEventHandler("vrr.syncElement", forceSyncElementProperties);
|
||||
addNetworkEventHandler("vrr.elementPosition", setElementPosition);
|
||||
addNetworkEventHandler("vrr.elementCollisions", setElementCollisionsEnabled);
|
||||
|
||||
addNetworkEventHandler("vrr.vehBuyState", setVehiclePurchaseState);
|
||||
|
||||
addNetworkEventHandler("vrr.showRegistration", showRegistrationGUI);
|
||||
addNetworkEventHandler("vrr.showNewCharacter", showNewCharacterGUI);
|
||||
addNetworkEventHandler("vrr.showLogin", showLoginGUI);
|
||||
|
||||
addNetworkEventHandler("vrr.logLevel", setLogLevel);
|
||||
addNetworkEventHandler("vrr.infiniteRun", setLocalPlayerInfiniteRun);
|
||||
|
||||
addNetworkEventHandler("vrr.business", receiveBusinessFromServer);
|
||||
addNetworkEventHandler("vrr.house", receiveHouseFromServer);
|
||||
|
||||
addNetworkEventHandler("vrr.holdObject", makePedHoldObject);
|
||||
|
||||
addNetworkEventHandler("vrr.playerPedId", sendLocalPlayerNetworkIdToServer);
|
||||
|
||||
addNetworkEventHandler("vrr.ped", setLocalPlayerPedPartsAndProps);
|
||||
addNetworkEventHandler("vrr.smallGameMessage", showSmallGameMessage);
|
||||
addNetworkEventHandler("vrr.working", setLocalPlayerWorkingState);
|
||||
addNetworkEventHandler("vrr.jobType", setLocalPlayerJobType);
|
||||
addNetworkEventHandler("vrr.passenger", enterVehicleAsPassenger);
|
||||
addNetworkEventHandler("vrr.freeze", setLocalPlayerFrozenState);
|
||||
addNetworkEventHandler("vrr.control", setLocalPlayerControlState);
|
||||
addNetworkEventHandler("vrr.fadeCamera", fadeLocalCamera);
|
||||
addNetworkEventHandler("vrr.removeFromVehicle", removeLocalPlayerFromVehicle);
|
||||
addNetworkEventHandler("vrr.clearPeds", clearLocalPlayerOwnedPeds);
|
||||
addNetworkEventHandler("vrr.restoreCamera", restoreLocalCamera);
|
||||
addNetworkEventHandler("vrr.cameraLookAt", setLocalCameraLookAt);
|
||||
addNetworkEventHandler("vrr.logo", setServerLogoRenderState);
|
||||
addNetworkEventHandler("vrr.ambience", setCityAmbienceState);
|
||||
addNetworkEventHandler("vrr.runCode", runClientCode);
|
||||
addNetworkEventHandler("vrr.clearWeapons", clearLocalPlayerWeapons);
|
||||
addNetworkEventHandler("vrr.giveWeapon", giveLocalPlayerWeapon);
|
||||
addNetworkEventHandler("vrr.position", setLocalPlayerPosition);
|
||||
addNetworkEventHandler("vrr.heading", setLocalPlayerHeading);
|
||||
addNetworkEventHandler("vrr.interior", setLocalPlayerInterior);
|
||||
addNetworkEventHandler("vrr.minuteDuration", setMinuteDuration);
|
||||
addNetworkEventHandler("vrr.showJobRouteLocation", showJobRouteLocation);
|
||||
addNetworkEventHandler("vrr.hideJobRouteLocation", hideJobRouteLocation);
|
||||
addNetworkEventHandler("vrr.snow", setSnowState);
|
||||
addNetworkEventHandler("vrr.health", setLocalPlayerHealth);
|
||||
addNetworkEventHandler("vrr.enterPropertyKey", setEnterPropertyKey);
|
||||
addNetworkEventHandler("vrr.skinSelect", toggleSkinSelect);
|
||||
addNetworkEventHandler("vrr.hotbar", updatePlayerHotBar);
|
||||
addNetworkEventHandler("vrr.pedSpeech", playPedSpeech);
|
||||
addNetworkEventHandler("vrr.clearPedState", clearLocalPedState);
|
||||
addNetworkEventHandler("vrr.drunkEffect", setLocalPlayerDrunkEffect);
|
||||
addNetworkEventHandler("vrr.showItemActionDelay", showItemActionDelay);
|
||||
addNetworkEventHandler("vrr.set2DRendering", setPlayer2DRendering);
|
||||
addNetworkEventHandler("vrr.mouseCursor", toggleMouseCursor);
|
||||
addNetworkEventHandler("vrr.mouseCamera", toggleMouseCamera);
|
||||
addNetworkEventHandler("vrr.mouseCameraForce", setMouseCameraState);
|
||||
addNetworkEventHandler("vrr.weaponDamageEnabled", setPlayerWeaponDamageEnabled);
|
||||
addNetworkEventHandler("vrr.weaponDamageEvent", setPlayerWeaponDamageEvent);
|
||||
addNetworkEventHandler("vrr.spawned", onServerSpawnedPlayer);
|
||||
addNetworkEventHandler("vrr.money", setLocalPlayerCash);
|
||||
addNetworkEventHandler("vrr.armour", setLocalPlayerArmour);
|
||||
addNetworkEventHandler("vrr.wantedLevel", forceLocalPlayerWantedLevel);
|
||||
addNetworkEventHandler("vrr.delKeyBind", unBindAccountKey);
|
||||
addNetworkEventHandler("vrr.addKeyBind", bindAccountKey);
|
||||
addNetworkEventHandler("vrr.clearKeyBinds", clearKeyBinds);
|
||||
addNetworkEventHandler("vrr.nametag", updatePlayerNameTag);
|
||||
addNetworkEventHandler("vrr.ping", updatePlayerPing);
|
||||
addNetworkEventHandler("vrr.m", receiveChatBoxMessageFromServer);
|
||||
addNetworkEventHandler("vrr.chatScrollLines", setChatScrollLines);
|
||||
addNetworkEventHandler("vrr.radioStream", playStreamingRadio);
|
||||
addNetworkEventHandler("vrr.audioFileStream", playAudioFile);
|
||||
addNetworkEventHandler("vrr.stopRadioStream", stopStreamingRadio);
|
||||
addNetworkEventHandler("vrr.radioVolume", setStreamingRadioVolume);
|
||||
addNetworkEventHandler("vrr.veh.lights", setVehicleLights);
|
||||
addNetworkEventHandler("vrr.veh.engine", setVehicleEngine);
|
||||
addNetworkEventHandler("vrr.veh.repair", repairVehicle);
|
||||
addNetworkEventHandler("vrr.pedAnim", makePedPlayAnimation);
|
||||
addNetworkEventHandler("vrr.pedStopAnim", makePedStopAnimation);
|
||||
addNetworkEventHandler("vrr.localPlayerSkin", setLocalPlayerSkin);
|
||||
addNetworkEventHandler("vrr.forcePedAnim", forcePedAnimation);
|
||||
addNetworkEventHandler("vrr.hideAllGUI", hideAllGUI);
|
||||
addNetworkEventHandler("vrr.clientInfo", serverRequestedClientInfo);
|
||||
addNetworkEventHandler("vrr.interiorLights", updateInteriorLightsState);
|
||||
addNetworkEventHandler("vrr.cutsceneInterior", setCutsceneInterior);
|
||||
addNetworkEventHandler("vrr.syncElement", forceSyncElementProperties);
|
||||
addNetworkEventHandler("vrr.elementPosition", setElementPosition);
|
||||
addNetworkEventHandler("vrr.elementCollisions", setElementCollisionsEnabled);
|
||||
addNetworkEventHandler("vrr.vehBuyState", setVehiclePurchaseState);
|
||||
addNetworkEventHandler("vrr.showRegistration", showRegistrationGUI);
|
||||
addNetworkEventHandler("vrr.showNewCharacter", showNewCharacterGUI);
|
||||
addNetworkEventHandler("vrr.showLogin", showLoginGUI);
|
||||
addNetworkEventHandler("vrr.logLevel", setLogLevel);
|
||||
addNetworkEventHandler("vrr.infiniteRun", setLocalPlayerInfiniteRun);
|
||||
addNetworkEventHandler("vrr.business", receiveBusinessFromServer);
|
||||
addNetworkEventHandler("vrr.house", receiveHouseFromServer);
|
||||
addNetworkEventHandler("vrr.job", receiveJobFromServer);
|
||||
addNetworkEventHandler("vrr.vehicle", receiveVehicleFromServer);
|
||||
addNetworkEventHandler("vrr.holdObject", makePedHoldObject);
|
||||
addNetworkEventHandler("vrr.playerPedId", sendLocalPlayerNetworkIdToServer);
|
||||
addNetworkEventHandler("vrr.ped", setLocalPlayerPedPartsAndProps);
|
||||
addNetworkEventHandler("vrr.pedSpeak", makePlayerPedSpeak);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendResourceReadySignalToServer() {
|
||||
sendNetworkEventToServer("vrr.clientReady");
|
||||
sendNetworkEventToServer("vrr.clientReady");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendResourceStartedSignalToServer() {
|
||||
sendNetworkEventToServer("vrr.clientStarted");
|
||||
sendNetworkEventToServer("vrr.clientStarted");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendResourceStoppedSignalToServer() {
|
||||
if(isConnected) {
|
||||
sendNetworkEventToServer("vrr.clientStopped");
|
||||
}
|
||||
if(isConnected) {
|
||||
sendNetworkEventToServer("vrr.clientStopped");
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
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})`);
|
||||
renderHUD = hudState;
|
||||
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;
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.displayCash(hudState);
|
||||
natives.displayAmmo(hudState);
|
||||
natives.displayHud(hudState);
|
||||
natives.displayRadar(hudState);
|
||||
natives.displayAreaName(hudState);
|
||||
} else {
|
||||
if(typeof setHUDEnabled != "undefined") {
|
||||
setHUDEnabled(hudState);
|
||||
}
|
||||
}
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.displayCash(hudState);
|
||||
natives.displayAmmo(hudState);
|
||||
natives.displayHud(hudState);
|
||||
natives.displayRadar(hudState);
|
||||
natives.displayAreaName(hudState);
|
||||
} else {
|
||||
if(typeof setHUDEnabled != "undefined") {
|
||||
setHUDEnabled(hudState);
|
||||
}
|
||||
}
|
||||
|
||||
renderLabels = labelState;
|
||||
renderSmallGameMessage = smallGameMessageState;
|
||||
renderScoreBoard = scoreboardState;
|
||||
renderHotBar = hotBarState;
|
||||
renderItemActionDelay = itemActionDelayState;
|
||||
renderLabels = labelState;
|
||||
renderSmallGameMessage = smallGameMessageState;
|
||||
renderScoreBoard = scoreboardState;
|
||||
renderHotBar = hotBarState;
|
||||
renderItemActionDelay = itemActionDelayState;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onServerSpawnedPlayer(state) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Main] Setting spawned state to ${state}`);
|
||||
isSpawned = state;
|
||||
if(state) {
|
||||
setUpInitialGame();
|
||||
calledDeathEvent = false;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[VRR.Main] Setting spawned state to ${state}`);
|
||||
isSpawned = state;
|
||||
if(state) {
|
||||
setUpInitialGame();
|
||||
calledDeathEvent = false;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function tellServerPlayerUsedKeyBind(key) {
|
||||
sendNetworkEventToServer("vrr.useKeyBind", key);
|
||||
sendNetworkEventToServer("vrr.useKeyBind", key);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function tellServerPlayerArrivedAtJobRouteLocation() {
|
||||
sendNetworkEventToServer("vrr.arrivedAtJobRouteLocation");
|
||||
sendNetworkEventToServer("vrr.arrivedAtJobRouteLocation");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function tellServerItemActionDelayComplete() {
|
||||
sendNetworkEventToServer("vrr.itemActionDelayComplete");
|
||||
sendNetworkEventToServer("vrr.itemActionDelayComplete");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendServerClientInfo() {
|
||||
let clientVersion = "0.0.0.0";
|
||||
if(typeof CLIENT_VERSION_MAJOR != "undefined") {
|
||||
clientVersion = `${CLIENT_VERSION_MAJOR}.${CLIENT_VERSION_MINOR}.${CLIENT_VERSION_PATCH}.${CLIENT_VERSION_BUILD}`;
|
||||
}
|
||||
sendNetworkEventToServer("vrr.clientInfo", clientVersion, game.width, game.height);
|
||||
let clientVersion = "0.0.0.0";
|
||||
if(typeof CLIENT_VERSION_MAJOR != "undefined") {
|
||||
clientVersion = `${CLIENT_VERSION_MAJOR}.${CLIENT_VERSION_MINOR}.${CLIENT_VERSION_PATCH}.${CLIENT_VERSION_BUILD}`;
|
||||
}
|
||||
sendNetworkEventToServer("vrr.clientInfo", clientVersion, game.width, game.height);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendServerNewAFKStatus(state) {
|
||||
sendNetworkEventToServer("vrr.afk", state);
|
||||
sendNetworkEventToServer("vrr.afk", state);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -211,135 +199,144 @@ function anchorBoat(vehicleId) {
|
||||
// ===========================================================================
|
||||
|
||||
function setEnterPropertyKey(key) {
|
||||
enterPropertyKey = key;
|
||||
enterPropertyKey = key;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function serverRequestedClientInfo() {
|
||||
sendServerClientInfo();
|
||||
sendServerClientInfo();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function updateInteriorLightsState(state) {
|
||||
interiorLightsEnabled = state;
|
||||
interiorLightsEnabled = state;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function forceSyncElementProperties(elementId) {
|
||||
if(getElementFromId(elementId) == null) {
|
||||
return false;
|
||||
}
|
||||
if(getElementFromId(elementId) == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
syncElementProperties(getElementFromId(elementId));
|
||||
syncElementProperties(getElementFromId(elementId));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setElementPosition(elementId, position) {
|
||||
if(getElementFromId(elementId) == null) {
|
||||
return false;
|
||||
}
|
||||
if(getElementFromId(elementId) == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!getElementFromId(elementId).isSyncer) {
|
||||
return false;
|
||||
}
|
||||
if(!getElementFromId(elementId).isSyncer) {
|
||||
return false;
|
||||
}
|
||||
|
||||
getElementFromId(elementId).position = position;
|
||||
getElementFromId(elementId).position = position;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setElementCollisionsEnabled(elementId, state) {
|
||||
if(getElementFromId(elementId) == null) {
|
||||
return false;
|
||||
}
|
||||
if(getElementFromId(elementId) == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
getElementFromId(elementId).collisionsEnabled = state;
|
||||
getElementFromId(elementId).collisionsEnabled = state;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setLocalPlayerArmour(armour) {
|
||||
if(typeof localPlayer.armour != "undefined") {
|
||||
localPlayer.armour = armour;
|
||||
}
|
||||
if(typeof localPlayer.armour != "undefined") {
|
||||
localPlayer.armour = armour;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function forceLocalPlayerWantedLevel(wantedLevel) {
|
||||
forceWantedLevel = toInteger(wantedLevel);
|
||||
forceWantedLevel = toInteger(wantedLevel);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setLogLevel(level) {
|
||||
logLevel = level;
|
||||
logLevel = level;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setLocalPlayerInfiniteRun(state) {
|
||||
if(localPlayer != null) {
|
||||
if(getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
|
||||
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), boolToInt(state));
|
||||
}
|
||||
}
|
||||
if(localPlayer != null) {
|
||||
if(getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
|
||||
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), boolToInt(state));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setLocalPlayerSkin(skinId) {
|
||||
logToConsole(LOG_INFO, skinId);
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if(natives.isModelInCdimage(skinId)) {
|
||||
natives.requestModel(skinId);
|
||||
natives.loadAllObjectsNow();
|
||||
if(natives.hasModelLoaded(skinId)) {
|
||||
natives.changePlayerModel(natives.getPlayerId(), skinId);
|
||||
}
|
||||
}
|
||||
|
||||
//natives.requestModel(skinId);
|
||||
//natives.changePlayerModel(natives.getPlayerId(), skinId);
|
||||
|
||||
//localPlayer.skin = allowedSkins[skinSelectorIndex][0];
|
||||
//localPlayer.modelIndex = allowedSkins[skinSelectorIndex][0];
|
||||
} else {
|
||||
localPlayer.skin = skinId;
|
||||
}
|
||||
logToConsole(LOG_INFO, skinId);
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if(natives.isModelInCdimage(skinId)) {
|
||||
natives.requestModel(skinId);
|
||||
natives.loadAllObjectsNow();
|
||||
if(natives.hasModelLoaded(skinId)) {
|
||||
natives.changePlayerModel(natives.getPlayerId(), skinId);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
localPlayer.skin = skinId;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function makePedHoldObject(pedId, modelIndex) {
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.givePedAmbientObject(natives.getPedFromNetworkId(pedId), getGameConfig().objects[getGame()][modelIndex][1])
|
||||
}
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.givePedAmbientObject(natives.getPedFromNetworkId(pedId), getGameConfig().objects[getGame()][modelIndex][1])
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendLocalPlayerNetworkIdToServer() {
|
||||
sendNetworkEventToServer("vrr.playerPedId", natives.getNetworkIdFromPed(localPlayer));
|
||||
sendNetworkEventToServer("vrr.playerPedId", natives.getNetworkIdFromPed(localPlayer));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setCutsceneInterior(cutsceneName) {
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if(cutsceneName == "") {
|
||||
natives.clearCutscene();
|
||||
} else {
|
||||
if(natives.isInteriorScene()) {
|
||||
natives.clearCutscene();
|
||||
}
|
||||
natives.initCutscene(cutsceneName);
|
||||
}
|
||||
}
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if(cutsceneName == "") {
|
||||
natives.clearCutscene();
|
||||
} else {
|
||||
if(natives.isInteriorScene()) {
|
||||
natives.clearCutscene();
|
||||
}
|
||||
natives.initCutscene(cutsceneName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function makePlayerPedSpeak(speechName) {
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
// if player is in vehicle, allow megaphone (if last arg is "1", it will cancel megaphone echo)
|
||||
// Only speeches with _MEGAPHONE will have the bullhorn effect
|
||||
// Afaik it only works on police voices anyway
|
||||
if(localPlayer.vehicle != null) {
|
||||
natives.sayAmbientSpeech(localPlayer, speechName, true, false, 0);
|
||||
} else {
|
||||
natives.sayAmbientSpeech(localPlayer, speechName, true, false, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -45,111 +45,111 @@ function loadSkinSelectMessageFontBottom() {
|
||||
|
||||
function processSkinSelectKeyPress(keyCode) {
|
||||
if(usingSkinSelector) {
|
||||
if(keyCode == SDLK_PAGEUP) {
|
||||
if(skinSelectorIndex >= allowedSkins.length-1) {
|
||||
skinSelectorIndex = 1;
|
||||
} else {
|
||||
skinSelectorIndex = skinSelectorIndex + 1;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `Switching to skin ${allowedSkins[skinSelectorIndex][1]} (Index: ${skinSelectorIndex}, Skin: ${allowedSkins[skinSelectorIndex][0]})`);
|
||||
skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
let skinId = allowedSkins[skinSelectorIndex][0];
|
||||
if(natives.isModelInCdimage(skinId)) {
|
||||
natives.requestModel(skinId);
|
||||
natives.loadAllObjectsNow();
|
||||
if(natives.hasModelLoaded(skinId)) {
|
||||
natives.changePlayerModel(natives.getPlayerId(), skinId);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
|
||||
}
|
||||
} else if(keyCode == SDLK_PAGEDOWN) {
|
||||
if(skinSelectorIndex <= 0) {
|
||||
skinSelectorIndex = allowedSkins.length-1;
|
||||
} else {
|
||||
skinSelectorIndex = skinSelectorIndex - 1;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `Switching to skin ${allowedSkins[skinSelectorIndex][1]} (Index: ${skinSelectorIndex}, Skin: ${allowedSkins[skinSelectorIndex][0]})`);
|
||||
skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
let skinId = allowedSkins[skinSelectorIndex][0];
|
||||
if(natives.isModelInCdimage(skinId)) {
|
||||
natives.requestModel(skinId);
|
||||
natives.loadAllObjectsNow();
|
||||
if(natives.hasModelLoaded(skinId)) {
|
||||
natives.changePlayerModel(natives.getPlayerId(), skinId);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
|
||||
}
|
||||
} else if(keyCode == SDLK_RETURN) {
|
||||
sendNetworkEventToServer("vrr.skinSelected", skinSelectorIndex);
|
||||
toggleSkinSelect(false);
|
||||
return true;
|
||||
} else if(keyCode == SDLK_BACKSPACE) {
|
||||
sendNetworkEventToServer("vrr.skinSelected", -1);
|
||||
toggleSkinSelect(false);
|
||||
return true;
|
||||
}
|
||||
localPlayer.heading = skinSelectHeading;
|
||||
}
|
||||
if(keyCode == SDLK_PAGEUP) {
|
||||
if(skinSelectorIndex >= allowedSkins.length-1) {
|
||||
skinSelectorIndex = 1;
|
||||
} else {
|
||||
skinSelectorIndex = skinSelectorIndex + 1;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `Switching to skin ${allowedSkins[skinSelectorIndex][1]} (Index: ${skinSelectorIndex}, Skin: ${allowedSkins[skinSelectorIndex][0]})`);
|
||||
skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
let skinId = allowedSkins[skinSelectorIndex][0];
|
||||
if(natives.isModelInCdimage(skinId)) {
|
||||
natives.requestModel(skinId);
|
||||
natives.loadAllObjectsNow();
|
||||
if(natives.hasModelLoaded(skinId)) {
|
||||
natives.changePlayerModel(natives.getPlayerId(), skinId);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
|
||||
}
|
||||
} else if(keyCode == SDLK_PAGEDOWN) {
|
||||
if(skinSelectorIndex <= 0) {
|
||||
skinSelectorIndex = allowedSkins.length-1;
|
||||
} else {
|
||||
skinSelectorIndex = skinSelectorIndex - 1;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `Switching to skin ${allowedSkins[skinSelectorIndex][1]} (Index: ${skinSelectorIndex}, Skin: ${allowedSkins[skinSelectorIndex][0]})`);
|
||||
skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
let skinId = allowedSkins[skinSelectorIndex][0];
|
||||
if(natives.isModelInCdimage(skinId)) {
|
||||
natives.requestModel(skinId);
|
||||
natives.loadAllObjectsNow();
|
||||
if(natives.hasModelLoaded(skinId)) {
|
||||
natives.changePlayerModel(natives.getPlayerId(), skinId);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
|
||||
}
|
||||
} else if(keyCode == SDLK_RETURN) {
|
||||
sendNetworkEventToServer("vrr.skinSelected", skinSelectorIndex);
|
||||
toggleSkinSelect(false);
|
||||
return true;
|
||||
} else if(keyCode == SDLK_BACKSPACE) {
|
||||
sendNetworkEventToServer("vrr.skinSelected", -1);
|
||||
toggleSkinSelect(false);
|
||||
return true;
|
||||
}
|
||||
localPlayer.heading = skinSelectHeading;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function processSkinSelectRendering() {
|
||||
if(usingSkinSelector) {
|
||||
if(skinSelectMessageFontTop != null && skinSelectMessageFontBottom != null) {
|
||||
if(skinSelectMessageTextTop != "" && skinSelectMessageTextBottom != "") {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(skinSelectMessageFontTop != null && skinSelectMessageFontBottom != null) {
|
||||
if(skinSelectMessageTextTop != "" && skinSelectMessageTextBottom != "") {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function toggleSkinSelect(state) {
|
||||
if(state) {
|
||||
skinSelectorIndex = getAllowedSkinIndexFromSkin(localPlayer.skin);
|
||||
if(!skinSelectorIndex) {
|
||||
skinSelectorIndex = 0;
|
||||
}
|
||||
if(state) {
|
||||
skinSelectorIndex = getAllowedSkinIndexFromSkin(localPlayer.skin);
|
||||
if(!skinSelectorIndex) {
|
||||
skinSelectorIndex = 0;
|
||||
}
|
||||
|
||||
usingSkinSelector = true;
|
||||
skinSelectPosition = localPlayer.position;
|
||||
skinSelectHeading = localPlayer.heading;
|
||||
usingSkinSelector = true;
|
||||
skinSelectPosition = localPlayer.position;
|
||||
skinSelectHeading = localPlayer.heading;
|
||||
|
||||
if(isCustomCameraSupported()) {
|
||||
let tempPosition = localPlayer.position;
|
||||
tempPosition.z += 0.5;
|
||||
let frontCameraPosition = getPosInFrontOfPos(tempPosition, localPlayer.heading, 3);
|
||||
game.setCameraLookAt(frontCameraPosition, localPlayer.position, true);
|
||||
}
|
||||
if(isCustomCameraSupported()) {
|
||||
let tempPosition = localPlayer.position;
|
||||
tempPosition.z += 0.5;
|
||||
let frontCameraPosition = getPosInFrontOfPos(tempPosition, localPlayer.heading, 3);
|
||||
game.setCameraLookAt(frontCameraPosition, localPlayer.position, true);
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
let skinId = allowedSkins[skinSelectorIndex][0];
|
||||
if(natives.isModelInCdimage(skinId)) {
|
||||
natives.requestModel(skinId);
|
||||
natives.loadAllObjectsNow();
|
||||
if(natives.hasModelLoaded(skinId)) {
|
||||
natives.changePlayerModel(natives.getPlayerId(), skinId);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
|
||||
}
|
||||
|
||||
skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
|
||||
setLocalPlayerControlState(false, false);
|
||||
} else {
|
||||
usingSkinSelector = false;
|
||||
setLocalPlayerControlState(false, false);
|
||||
}
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
let skinId = allowedSkins[skinSelectorIndex][0];
|
||||
if(natives.isModelInCdimage(skinId)) {
|
||||
natives.requestModel(skinId);
|
||||
natives.loadAllObjectsNow();
|
||||
if(natives.hasModelLoaded(skinId)) {
|
||||
natives.changePlayerModel(natives.getPlayerId(), skinId);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
|
||||
}
|
||||
|
||||
skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
|
||||
setLocalPlayerControlState(false, false);
|
||||
} else {
|
||||
usingSkinSelector = false;
|
||||
setLocalPlayerControlState(false, false);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -8,164 +8,165 @@
|
||||
// ===========================================================================
|
||||
|
||||
function initClientScripts() {
|
||||
initGUIScript();
|
||||
initNameTagScript();
|
||||
initScoreBoardScript();
|
||||
initMessagingScript();
|
||||
initServerScript();
|
||||
initLogoScript();
|
||||
initLabelScript();
|
||||
initChatBoxScript();
|
||||
initAFKScript();
|
||||
initKeyBindScript();
|
||||
initEventScript();
|
||||
initSkinSelectScript();
|
||||
initGUIScript();
|
||||
initNameTagScript();
|
||||
initScoreBoardScript();
|
||||
initMessagingScript();
|
||||
initServerScript();
|
||||
initLogoScript();
|
||||
initLabelScript();
|
||||
initChatBoxScript();
|
||||
initAFKScript();
|
||||
initKeyBindScript();
|
||||
initEventScript();
|
||||
initSkinSelectScript();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setUpInitialGame() {
|
||||
if(getGame() == VRR_GAME_GTA_III) {
|
||||
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0);
|
||||
game.setGameStat(STAT_PROGRESSMADE, 9999);
|
||||
game.setGameStat(STAT_TOTALPROGRESSINGAME, 9999);
|
||||
game.SET_CAR_DENSITY_MULTIPLIER(3.0);
|
||||
game.SET_PED_DENSITY_MULTIPLIER(3.0);
|
||||
game.onMission = true;
|
||||
SetStandardControlsEnabled(true);
|
||||
return true;
|
||||
}
|
||||
if(getGame() == VRR_GAME_GTA_III) {
|
||||
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0);
|
||||
game.setGameStat(STAT_PROGRESSMADE, 9999);
|
||||
game.setGameStat(STAT_TOTALPROGRESSINGAME, 9999);
|
||||
game.SET_CAR_DENSITY_MULTIPLIER(3.0);
|
||||
game.SET_PED_DENSITY_MULTIPLIER(3.0);
|
||||
game.onMission = true;
|
||||
SetStandardControlsEnabled(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_VC) {
|
||||
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0);
|
||||
game.setGameStat(STAT_PROGRESSMADE, 9999);
|
||||
game.setGameStat(STAT_TOTALPROGRESSINGAME, 9999);
|
||||
game.SET_CAR_DENSITY_MULTIPLIER(3.0);
|
||||
game.SET_PED_DENSITY_MULTIPLIER(3.0);
|
||||
if(getGame() == VRR_GAME_GTA_VC) {
|
||||
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0);
|
||||
game.setGameStat(STAT_PROGRESSMADE, 9999);
|
||||
game.setGameStat(STAT_TOTALPROGRESSINGAME, 9999);
|
||||
game.SET_CAR_DENSITY_MULTIPLIER(3.0);
|
||||
game.SET_PED_DENSITY_MULTIPLIER(3.0);
|
||||
|
||||
game.REQUEST_ANIMATION("bikev");
|
||||
game.REQUEST_ANIMATION("bikeh");
|
||||
game.REQUEST_ANIMATION("biked");
|
||||
game.REQUEST_ANIMATION("knife");
|
||||
game.REQUEST_ANIMATION("python");
|
||||
game.REQUEST_ANIMATION("shotgun");
|
||||
game.REQUEST_ANIMATION("buddy");
|
||||
game.REQUEST_ANIMATION("tec");
|
||||
game.REQUEST_ANIMATION("uzi");
|
||||
game.REQUEST_ANIMATION("rifle");
|
||||
game.REQUEST_ANIMATION("m60");
|
||||
game.REQUEST_ANIMATION("sniper");
|
||||
game.REQUEST_ANIMATION("grenade");
|
||||
game.REQUEST_ANIMATION("flame");
|
||||
game.REQUEST_ANIMATION("medic");
|
||||
game.REQUEST_ANIMATION("sunbathe");
|
||||
//game.REQUEST_ANIMATION("playidles");
|
||||
game.REQUEST_ANIMATION("riot");
|
||||
game.REQUEST_ANIMATION("strip");
|
||||
game.REQUEST_ANIMATION("lance");
|
||||
game.REQUEST_ANIMATION("skate");
|
||||
game.REQUEST_ANIMATION("bikev");
|
||||
game.REQUEST_ANIMATION("bikeh");
|
||||
game.REQUEST_ANIMATION("biked");
|
||||
game.REQUEST_ANIMATION("knife");
|
||||
game.REQUEST_ANIMATION("python");
|
||||
game.REQUEST_ANIMATION("shotgun");
|
||||
game.REQUEST_ANIMATION("buddy");
|
||||
game.REQUEST_ANIMATION("tec");
|
||||
game.REQUEST_ANIMATION("uzi");
|
||||
game.REQUEST_ANIMATION("rifle");
|
||||
game.REQUEST_ANIMATION("m60");
|
||||
game.REQUEST_ANIMATION("sniper");
|
||||
game.REQUEST_ANIMATION("grenade");
|
||||
game.REQUEST_ANIMATION("flame");
|
||||
game.REQUEST_ANIMATION("medic");
|
||||
game.REQUEST_ANIMATION("sunbathe");
|
||||
//game.REQUEST_ANIMATION("playidles");
|
||||
game.REQUEST_ANIMATION("riot");
|
||||
game.REQUEST_ANIMATION("strip");
|
||||
game.REQUEST_ANIMATION("lance");
|
||||
game.REQUEST_ANIMATION("skate");
|
||||
|
||||
game.LOAD_ALL_MODELS_NOW();
|
||||
game.onMission = true;
|
||||
SetStandardControlsEnabled(true);
|
||||
return true;
|
||||
}
|
||||
game.LOAD_ALL_MODELS_NOW();
|
||||
game.onMission = true;
|
||||
SetStandardControlsEnabled(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_SA) {
|
||||
game.setGameStat(STAT_WEAPONTYPE_PISTOL_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_PISTOL_SILENCED_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_DESERT_EAGLE_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_SHOTGUN_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_SAWNOFF_SHOTGUN_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_SPAS12_SHOTGUN_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_MICRO_UZI_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_MP5_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_AK47_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_M4_SKILL, 400);
|
||||
game.setGameStat(STAT_DRIVING_SKILL, 9999);
|
||||
game.setGameStat(STAT_FAT, 9999);
|
||||
game.setGameStat(STAT_ENERGY, 9999);
|
||||
game.setGameStat(STAT_CYCLE_SKILL, 9999);
|
||||
game.setGameStat(STAT_BIKE_SKILL, 9999);
|
||||
game.setGameStat(STAT_GAMBLING, 9999);
|
||||
game.setGameStat(STAT_PROGRESS_MADE, 9999);
|
||||
game.setGameStat(STAT_RESPECT, 0);
|
||||
game.setGameStat(STAT_RESPECT_TOTAL, 0);
|
||||
game.setGameStat(STAT_SEX_APPEAL, 0);
|
||||
game.setGameStat(STAT_STAMINA, 9999);
|
||||
game.setGameStat(STAT_TOTAL_PROGRESS, 9999);
|
||||
game.setGameStat(STAT_UNDERWATER_STAMINA, 9999);
|
||||
game.setGameStat(STAT_BODY_MUSCLE, 9999);
|
||||
if(getGame() == VRR_GAME_GTA_SA) {
|
||||
game.setGameStat(STAT_WEAPONTYPE_PISTOL_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_PISTOL_SILENCED_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_DESERT_EAGLE_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_SHOTGUN_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_SAWNOFF_SHOTGUN_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_SPAS12_SHOTGUN_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_MICRO_UZI_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_MP5_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_AK47_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_M4_SKILL, 400);
|
||||
game.setGameStat(STAT_DRIVING_SKILL, 9999);
|
||||
game.setGameStat(STAT_FAT, 9999);
|
||||
game.setGameStat(STAT_ENERGY, 9999);
|
||||
game.setGameStat(STAT_CYCLE_SKILL, 9999);
|
||||
game.setGameStat(STAT_BIKE_SKILL, 9999);
|
||||
game.setGameStat(STAT_GAMBLING, 9999);
|
||||
game.setGameStat(STAT_PROGRESS_MADE, 9999);
|
||||
game.setGameStat(STAT_RESPECT, 0);
|
||||
game.setGameStat(STAT_RESPECT_TOTAL, 0);
|
||||
game.setGameStat(STAT_SEX_APPEAL, 0);
|
||||
game.setGameStat(STAT_STAMINA, 9999);
|
||||
game.setGameStat(STAT_TOTAL_PROGRESS, 9999);
|
||||
game.setGameStat(STAT_UNDERWATER_STAMINA, 9999);
|
||||
game.setGameStat(STAT_BODY_MUSCLE, 9999);
|
||||
|
||||
game.setDefaultInteriors(false);
|
||||
game.onMission = true;
|
||||
return true;
|
||||
}
|
||||
game.setDefaultInteriors(false);
|
||||
game.onMission = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.allowEmergencyServices(false);
|
||||
natives.setCreateRandomCops(true);
|
||||
natives.setMaxWantedLevel(0);
|
||||
natives.setWantedMultiplier(0.0);
|
||||
natives.allowPlayerToCarryNonMissionObjects(natives.getPlayerId(), true);
|
||||
natives.setPlayerTeam(natives.getPlayerId(), 0);
|
||||
natives.loadAllObjectsNow();
|
||||
natives.setCellphoneRanked(false);
|
||||
natives.setOverrideNoSprintingOnPhoneInMultiplayer(false);
|
||||
natives.setSyncWeatherAndGameTime(false);
|
||||
natives.usePlayerColourInsteadOfTeamColour(true);
|
||||
natives.disablePauseMenu(true);
|
||||
natives.allowReactionAnims(localPlayer, true);
|
||||
natives.allowGameToPauseForStreaming(false);
|
||||
natives.allowStuntJumpsToTrigger(false);
|
||||
natives.setPickupsFixCars(false);
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.allowEmergencyServices(false);
|
||||
natives.setCreateRandomCops(true);
|
||||
natives.setMaxWantedLevel(0);
|
||||
natives.setWantedMultiplier(0.0);
|
||||
natives.allowPlayerToCarryNonMissionObjects(natives.getPlayerId(), true);
|
||||
natives.setPlayerTeam(natives.getPlayerId(), 0);
|
||||
natives.loadAllObjectsNow();
|
||||
natives.setCellphoneRanked(false);
|
||||
natives.setOverrideNoSprintingOnPhoneInMultiplayer(false);
|
||||
natives.setSyncWeatherAndGameTime(false);
|
||||
natives.usePlayerColourInsteadOfTeamColour(true);
|
||||
natives.disablePauseMenu(true);
|
||||
natives.allowReactionAnims(localPlayer, false);
|
||||
natives.allowGameToPauseForStreaming(false);
|
||||
natives.allowStuntJumpsToTrigger(false);
|
||||
natives.setPickupsFixCars(false);
|
||||
natives.forceFullVoice(localPlayer);
|
||||
|
||||
// HUD and Display
|
||||
//natives.displayCash(false);
|
||||
//natives.displayAmmo(false);
|
||||
//natives.displayHud(false);
|
||||
//natives.displayRadar(false);
|
||||
//natives.displayAreaName(false);
|
||||
natives.displayPlayerNames(true);
|
||||
natives.setPoliceRadarBlips(false);
|
||||
natives.removeTemporaryRadarBlipsForPickups();
|
||||
natives.displayNonMinigameHelpMessages(false);
|
||||
natives.setDisplayPlayerNameAndIcon(natives.getPlayerId(), true);
|
||||
// HUD and Display
|
||||
//natives.displayCash(false);
|
||||
//natives.displayAmmo(false);
|
||||
//natives.displayHud(false);
|
||||
//natives.displayRadar(false);
|
||||
//natives.displayAreaName(false);
|
||||
natives.displayPlayerNames(true);
|
||||
natives.setPoliceRadarBlips(false);
|
||||
natives.removeTemporaryRadarBlipsForPickups();
|
||||
natives.displayNonMinigameHelpMessages(false);
|
||||
natives.setDisplayPlayerNameAndIcon(natives.getPlayerId(), true);
|
||||
|
||||
// Item/Money Dropping
|
||||
natives.setMoneyCarriedByAllNewPeds(0);
|
||||
natives.setDeadPedsDropWeapons(false);
|
||||
natives.setPlayersDropMoneyInNetworkGame(false);
|
||||
// Item/Money Dropping
|
||||
natives.setMoneyCarriedByAllNewPeds(0);
|
||||
natives.setDeadPedsDropWeapons(false);
|
||||
natives.setPlayersDropMoneyInNetworkGame(false);
|
||||
|
||||
// Population
|
||||
//natives.dontSuppressAnyCarModels(5.0);
|
||||
//natives.dontSuppressAnyPedModels(5.0);
|
||||
//natives.forceGenerateParkedCarsTooCloseToOthers(true);
|
||||
//natives.setParkedCarDensityMultiplier(5.0);
|
||||
//natives.setRandomCarDensityMultiplier(5.0);
|
||||
//natives.setPedDensityMultiplier(5.0);
|
||||
//natives.setCarDensityMultiplier(5.0);
|
||||
//natives.setScenarioPedDensityMultiplier(5.0, 5.0);
|
||||
natives.switchRandomTrains(true);
|
||||
natives.switchRandomBoats(true);
|
||||
natives.switchAmbientPlanes(true);
|
||||
natives.switchMadDrivers(false);
|
||||
// Population
|
||||
//natives.dontSuppressAnyCarModels(5.0);
|
||||
//natives.dontSuppressAnyPedModels(5.0);
|
||||
//natives.forceGenerateParkedCarsTooCloseToOthers(true);
|
||||
//natives.setParkedCarDensityMultiplier(5.0);
|
||||
//natives.setRandomCarDensityMultiplier(5.0);
|
||||
//natives.setPedDensityMultiplier(5.0);
|
||||
//natives.setCarDensityMultiplier(5.0);
|
||||
//natives.setScenarioPedDensityMultiplier(5.0, 5.0);
|
||||
natives.switchRandomTrains(true);
|
||||
natives.switchRandomBoats(true);
|
||||
natives.switchAmbientPlanes(true);
|
||||
natives.switchMadDrivers(false);
|
||||
|
||||
// Singleplayer Cellphone
|
||||
natives.requestScript("spcellphone");
|
||||
natives.startNewScript("spcellphone", 0);
|
||||
//natives.setMessagesWaiting(false);
|
||||
// Singleplayer Cellphone
|
||||
natives.requestScript("spcellphone");
|
||||
natives.startNewScript("spcellphone", 0);
|
||||
//natives.setMessagesWaiting(false);
|
||||
|
||||
// Animation libraries
|
||||
natives.requestAnims("DANCING");
|
||||
return true;
|
||||
}
|
||||
// Animation libraries
|
||||
natives.requestAnims("DANCING");
|
||||
return true;
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_MAFIA_ONE) {
|
||||
game.mapEnabled = false;
|
||||
game.setTrafficEnabled(false);
|
||||
return true;
|
||||
}
|
||||
if(getGame() == VRR_GAME_MAFIA_ONE) {
|
||||
game.mapEnabled = false;
|
||||
game.setTrafficEnabled(false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -8,37 +8,37 @@
|
||||
// ===========================================================================
|
||||
|
||||
function processSync(event, deltaTime) {
|
||||
if(localPlayer != null) {
|
||||
if(!areServerElementsSupported()) {
|
||||
sendNetworkEventToServer("vrr.plr.pos", (localPlayer.vehicle != null) ? localPlayer.vehicle.position : localPlayer.position);
|
||||
sendNetworkEventToServer("vrr.plr.rot", (localPlayer.vehicle != null) ? localPlayer.vehicle.heading : localPlayer.heading);
|
||||
if(localPlayer != null) {
|
||||
if(!areServerElementsSupported()) {
|
||||
sendNetworkEventToServer("vrr.plr.pos", (localPlayer.vehicle != null) ? localPlayer.vehicle.position : localPlayer.position);
|
||||
sendNetworkEventToServer("vrr.plr.rot", (localPlayer.vehicle != null) ? localPlayer.vehicle.heading : localPlayer.heading);
|
||||
|
||||
//if(localPlayer.vehicle != null) {
|
||||
// sendNetworkEventToServer("vrr.veh.pos", getVehicleForNetworkEvent(localPlayer.vehicle), localPlayer.vehicle.position);
|
||||
// sendNetworkEventToServer("vrr.veh.rot", getVehicleForNetworkEvent(localPlayer.vehicle), localPlayer.vehicle.heading);
|
||||
//}
|
||||
}
|
||||
//if(localPlayer.vehicle != null) {
|
||||
// sendNetworkEventToServer("vrr.veh.pos", getVehicleForNetworkEvent(localPlayer.vehicle), localPlayer.vehicle.position);
|
||||
// sendNetworkEventToServer("vrr.veh.rot", getVehicleForNetworkEvent(localPlayer.vehicle), localPlayer.vehicle.heading);
|
||||
//}
|
||||
}
|
||||
|
||||
if(localPlayer.health <= 0) {
|
||||
if(!calledDeathEvent) {
|
||||
logToConsole(LOG_DEBUG, `Local player died`);
|
||||
localPlayer.clearWeapons();
|
||||
calledDeathEvent = true;
|
||||
sendNetworkEventToServer("vrr.playerDeath");
|
||||
}
|
||||
}
|
||||
if(localPlayer.health <= 0) {
|
||||
if(!calledDeathEvent) {
|
||||
logToConsole(LOG_DEBUG, `Local player died`);
|
||||
localPlayer.clearWeapons();
|
||||
calledDeathEvent = true;
|
||||
sendNetworkEventToServer("vrr.playerDeath");
|
||||
}
|
||||
}
|
||||
|
||||
if(streamingRadioElement) {
|
||||
streamingRadio.position = getElementPosition(streamingRadioElement);
|
||||
//streamingRadio.volume = getStreamingRadioVolumeForPosition(streamingRadio.position);
|
||||
}
|
||||
}
|
||||
if(streamingRadioElement) {
|
||||
streamingRadio.position = getElementPosition(streamingRadioElement);
|
||||
//streamingRadio.volume = getStreamingRadioVolumeForPosition(streamingRadio.position);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setVehicleEngine(vehicleId, state) {
|
||||
getElementFromId(vehicleId).engine = state;
|
||||
getElementFromId(vehicleId).engine = state;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -46,370 +46,370 @@ function setVehicleEngine(vehicleId, state) {
|
||||
function setVehicleLights(vehicleId, state) {
|
||||
|
||||
|
||||
if(getGame() != VRR_GAME_MAFIA_ONE) {
|
||||
if(!state) {
|
||||
getElementFromId(vehicleId).lightStatus = 2;
|
||||
} else {
|
||||
getElementFromId(vehicleId).lightStatus = 1;
|
||||
}
|
||||
} else if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if(!state) {
|
||||
natives.forceCarLights(natives.getVehicleFromNetworkId(vehicleId, 0));
|
||||
} else {
|
||||
natives.forceCarLights(natives.getVehicleFromNetworkId(vehicleId, 1));
|
||||
}
|
||||
} else {
|
||||
if(!state) {
|
||||
getElementFromId(vehicleId).lights = false;
|
||||
} else {
|
||||
getElementFromId(vehicleId).lights = true;
|
||||
}
|
||||
}
|
||||
if(getGame() != VRR_GAME_MAFIA_ONE) {
|
||||
if(!state) {
|
||||
getElementFromId(vehicleId).lightStatus = 2;
|
||||
} else {
|
||||
getElementFromId(vehicleId).lightStatus = 1;
|
||||
}
|
||||
} else if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if(!state) {
|
||||
natives.forceCarLights(natives.getVehicleFromNetworkId(vehicleId, 0));
|
||||
} else {
|
||||
natives.forceCarLights(natives.getVehicleFromNetworkId(vehicleId, 1));
|
||||
}
|
||||
} else {
|
||||
if(!state) {
|
||||
getElementFromId(vehicleId).lights = false;
|
||||
} else {
|
||||
getElementFromId(vehicleId).lights = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function repairVehicle(syncId) {
|
||||
getVehicleFromSyncId(syncId).fix();
|
||||
getVehicleFromSyncId(syncId).fix();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function syncVehicleProperties(vehicle) {
|
||||
if(!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
if(!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(vehicle, "vrr.lights")) {
|
||||
let lightStatus = getEntityData(vehicle, "vrr.lights");
|
||||
if(!lightStatus) {
|
||||
vehicle.lightStatus = 2;
|
||||
} else {
|
||||
vehicle.lightStatus = 1;
|
||||
}
|
||||
}
|
||||
if(doesEntityDataExist(vehicle, "vrr.lights")) {
|
||||
let lightStatus = getEntityData(vehicle, "vrr.lights");
|
||||
if(!lightStatus) {
|
||||
vehicle.lightStatus = 2;
|
||||
} else {
|
||||
vehicle.lightStatus = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(vehicle, "vrr.invincible")) {
|
||||
let invincible = getEntityData(vehicle, "vrr.invincible");
|
||||
element.setProofs(invincible, invincible, invincible, invincible, invincible);
|
||||
}
|
||||
if(doesEntityDataExist(vehicle, "vrr.invincible")) {
|
||||
let invincible = getEntityData(vehicle, "vrr.invincible");
|
||||
element.setProofs(invincible, invincible, invincible, invincible, invincible);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(vehicle, "vrr.panelStatus")) {
|
||||
let panelsStatus = getEntityData(vehicle, "vrr.panelStatus");
|
||||
for(let i in panelsStatus) {
|
||||
vehicle.setPanelStatus(i, panelsStatus[i]);
|
||||
}
|
||||
}
|
||||
if(doesEntityDataExist(vehicle, "vrr.panelStatus")) {
|
||||
let panelsStatus = getEntityData(vehicle, "vrr.panelStatus");
|
||||
for(let i in panelsStatus) {
|
||||
vehicle.setPanelStatus(i, panelsStatus[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(vehicle, "vrr.wheelStatus")) {
|
||||
let wheelsStatus = getEntityData(vehicle, "vrr.wheelStatus");
|
||||
for(let i in wheelsStatus) {
|
||||
vehicle.setWheelStatus(i, wheelsStatus[i]);
|
||||
}
|
||||
}
|
||||
if(doesEntityDataExist(vehicle, "vrr.wheelStatus")) {
|
||||
let wheelsStatus = getEntityData(vehicle, "vrr.wheelStatus");
|
||||
for(let i in wheelsStatus) {
|
||||
vehicle.setWheelStatus(i, wheelsStatus[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(vehicle, "vrr.lightStatus")) {
|
||||
let lightStatus = getEntityData(vehicle, "vrr.lightStatus");
|
||||
for(let i in lightStatus) {
|
||||
vehicle.setLightStatus(i, lightStatus[i]);
|
||||
}
|
||||
}
|
||||
if(doesEntityDataExist(vehicle, "vrr.lightStatus")) {
|
||||
let lightStatus = getEntityData(vehicle, "vrr.lightStatus");
|
||||
for(let i in lightStatus) {
|
||||
vehicle.setLightStatus(i, lightStatus[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(vehicle, "vrr.suspensionHeight")) {
|
||||
let suspensionHeight = getEntityData(vehicle, "vrr.suspensionHeight");
|
||||
vehicle.setSuspensionHeight(suspensionHeight);
|
||||
}
|
||||
if(doesEntityDataExist(vehicle, "vrr.suspensionHeight")) {
|
||||
let suspensionHeight = getEntityData(vehicle, "vrr.suspensionHeight");
|
||||
vehicle.setSuspensionHeight(suspensionHeight);
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_SA) {
|
||||
let allUpgrades = getGameConfig().vehicleUpgrades[getGame()];
|
||||
for(let i in allUpgrades) {
|
||||
vehicle.removeUpgrade(i);
|
||||
}
|
||||
if(getGame() == VRR_GAME_GTA_SA) {
|
||||
let allUpgrades = getGameConfig().vehicleUpgrades[getGame()];
|
||||
for(let i in allUpgrades) {
|
||||
vehicle.removeUpgrade(i);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(vehicle, "vrr.upgrades")) {
|
||||
let upgrades = getEntityData(vehicle, "vrr.upgrades");
|
||||
for(let i in upgrades) {
|
||||
if(upgrades[i] != 0) {
|
||||
vehicle.addUpgrade(upgrades[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(doesEntityDataExist(vehicle, "vrr.upgrades")) {
|
||||
let upgrades = getEntityData(vehicle, "vrr.upgrades");
|
||||
for(let i in upgrades) {
|
||||
if(upgrades[i] != 0) {
|
||||
vehicle.addUpgrade(upgrades[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_SA || getGame() == VRR_GAME_GTA_IV) {
|
||||
if(doesEntityDataExist(vehicle, "vrr.livery")) {
|
||||
let livery = getEntityData(vehicle, "vrr.livery");
|
||||
if(getGame() == VRR_GAME_GTA_SA) {
|
||||
vehicle.setPaintJob(livery);
|
||||
} else if(getGame() == VRR_GAME_GTA_IV) {
|
||||
vehicle.livery = livery;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(getGame() == VRR_GAME_GTA_SA || getGame() == VRR_GAME_GTA_IV) {
|
||||
if(doesEntityDataExist(vehicle, "vrr.livery")) {
|
||||
let livery = getEntityData(vehicle, "vrr.livery");
|
||||
if(getGame() == VRR_GAME_GTA_SA) {
|
||||
vehicle.setPaintJob(livery);
|
||||
} else if(getGame() == VRR_GAME_GTA_IV) {
|
||||
vehicle.livery = livery;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function syncCivilianProperties(civilian) {
|
||||
if(!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
if(!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_III) {
|
||||
if(doesEntityDataExist(civilian, "vrr.scale")) {
|
||||
let scaleFactor = getEntityData(civilian, "vrr.scale");
|
||||
let tempMatrix = civilian.matrix;
|
||||
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
|
||||
let tempPosition = civilian.position;
|
||||
civilian.matrix = tempMatrix;
|
||||
tempPosition.z += scaleFactor.z;
|
||||
civilian.position = tempPosition;
|
||||
}
|
||||
}
|
||||
if(getGame() == VRR_GAME_GTA_III) {
|
||||
if(doesEntityDataExist(civilian, "vrr.scale")) {
|
||||
let scaleFactor = getEntityData(civilian, "vrr.scale");
|
||||
let tempMatrix = civilian.matrix;
|
||||
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
|
||||
let tempPosition = civilian.position;
|
||||
civilian.matrix = tempMatrix;
|
||||
tempPosition.z += scaleFactor.z;
|
||||
civilian.position = tempPosition;
|
||||
}
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_SA) {
|
||||
if(doesEntityDataExist(civilian, "vrr.fightStyle")) {
|
||||
let fightStyle = getEntityData(civilian, "vrr.fightStyle");
|
||||
civilian.setFightStyle(fightStyle[0], fightStyle[1]);
|
||||
}
|
||||
}
|
||||
if(getGame() == VRR_GAME_GTA_SA) {
|
||||
if(doesEntityDataExist(civilian, "vrr.fightStyle")) {
|
||||
let fightStyle = getEntityData(civilian, "vrr.fightStyle");
|
||||
civilian.setFightStyle(fightStyle[0], fightStyle[1]);
|
||||
}
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_III) {
|
||||
if(doesEntityDataExist(civilian, "vrr.walkStyle")) {
|
||||
let walkStyle = getEntityData(civilian, "vrr.walkStyle");
|
||||
civilian.walkStyle = walkStyle;
|
||||
}
|
||||
}
|
||||
if(getGame() == VRR_GAME_GTA_III) {
|
||||
if(doesEntityDataExist(civilian, "vrr.walkStyle")) {
|
||||
let walkStyle = getEntityData(civilian, "vrr.walkStyle");
|
||||
civilian.walkStyle = walkStyle;
|
||||
}
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropHair")) {
|
||||
let bodyPropHair = getEntityData(civilian, "vrr.bodyPropHair");
|
||||
civilian.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
|
||||
}
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropHair")) {
|
||||
let bodyPropHair = getEntityData(civilian, "vrr.bodyPropHair");
|
||||
civilian.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropHead")) {
|
||||
let bodyPropHead = getEntityData(civilian, "vrr.bodyPropHead");
|
||||
civilian.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
|
||||
}
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropHead")) {
|
||||
let bodyPropHead = getEntityData(civilian, "vrr.bodyPropHead");
|
||||
civilian.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropEyes")) {
|
||||
let bodyPropEyes = getEntityData(civilian, "vrr.bodyPropEyes");
|
||||
civilian.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
|
||||
}
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropEyes")) {
|
||||
let bodyPropEyes = getEntityData(civilian, "vrr.bodyPropEyes");
|
||||
civilian.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropLeftHand")) {
|
||||
let bodyPropLeftHand = getEntityData(civilian, "vrr.bodyPropLeftHand");
|
||||
civilian.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
|
||||
}
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropLeftHand")) {
|
||||
let bodyPropLeftHand = getEntityData(civilian, "vrr.bodyPropLeftHand");
|
||||
civilian.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropRightHand")) {
|
||||
let bodyPropRightHand = getEntityData(civilian, "vrr.bodyPropRightHand");
|
||||
civilian.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
|
||||
}
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropRightHand")) {
|
||||
let bodyPropRightHand = getEntityData(civilian, "vrr.bodyPropRightHand");
|
||||
civilian.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropLeftWrist")) {
|
||||
let bodyPropLeftWrist = getEntityData(civilian, "vrr.bodyPropLeftWrist");
|
||||
civilian.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
|
||||
}
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropLeftWrist")) {
|
||||
let bodyPropLeftWrist = getEntityData(civilian, "vrr.bodyPropLeftWrist");
|
||||
civilian.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropRightWrist")) {
|
||||
let bodyPropRightWrist = getEntityData(civilian, "vrr.bodyPropRightWrist");
|
||||
civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
||||
}
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropRightWrist")) {
|
||||
let bodyPropRightWrist = getEntityData(civilian, "vrr.bodyPropRightWrist");
|
||||
civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropRightWrist")) {
|
||||
let bodyPropRightWrist = getEntityData(civilian, "vrr.bodyPropRightWrist");
|
||||
civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
||||
}
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropRightWrist")) {
|
||||
let bodyPropRightWrist = getEntityData(civilian, "vrr.bodyPropRightWrist");
|
||||
civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropHip")) {
|
||||
let bodyPropHip = getEntityData(civilian, "vrr.bodyPropHip");
|
||||
civilian.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
|
||||
}
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropHip")) {
|
||||
let bodyPropHip = getEntityData(civilian, "vrr.bodyPropHip");
|
||||
civilian.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropLeftFoot")) {
|
||||
let bodyPropLeftFoot = getEntityData(civilian, "vrr.bodyPropLeftFoot");
|
||||
civilian.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
|
||||
}
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropLeftFoot")) {
|
||||
let bodyPropLeftFoot = getEntityData(civilian, "vrr.bodyPropLeftFoot");
|
||||
civilian.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropRightFoot")) {
|
||||
let bodyPropRightFoot = getEntityData(civilian, "vrr.bodyPropRightFoot");
|
||||
civilian.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
|
||||
}
|
||||
}
|
||||
if(doesEntityDataExist(civilian, "vrr.bodyPropRightFoot")) {
|
||||
let bodyPropRightFoot = getEntityData(civilian, "vrr.bodyPropRightFoot");
|
||||
civilian.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
|
||||
}
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(civilian, "vrr.anim")) {
|
||||
let animData = getEntityData(vehicle, "vrr.anim");
|
||||
civilian.addAnimation(animData[0], animData[1]);
|
||||
}
|
||||
if(doesEntityDataExist(civilian, "vrr.anim")) {
|
||||
let animData = getEntityData(vehicle, "vrr.anim");
|
||||
civilian.addAnimation(animData[0], animData[1]);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function syncPlayerProperties(player) {
|
||||
if(!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
if(!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_III) {
|
||||
if(doesEntityDataExist(player, "vrr.scale")) {
|
||||
let scaleFactor = getEntityData(player, "vrr.scale");
|
||||
let tempMatrix = player.matrix;
|
||||
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
|
||||
let tempPosition = player.position;
|
||||
player.matrix = tempMatrix;
|
||||
tempPosition.z += scaleFactor.z;
|
||||
player.position = tempPosition;
|
||||
}
|
||||
}
|
||||
if(getGame() == VRR_GAME_GTA_III) {
|
||||
if(doesEntityDataExist(player, "vrr.scale")) {
|
||||
let scaleFactor = getEntityData(player, "vrr.scale");
|
||||
let tempMatrix = player.matrix;
|
||||
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
|
||||
let tempPosition = player.position;
|
||||
player.matrix = tempMatrix;
|
||||
tempPosition.z += scaleFactor.z;
|
||||
player.position = tempPosition;
|
||||
}
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_SA) {
|
||||
if(doesEntityDataExist(player, "vrr.fightStyle")) {
|
||||
let fightStyle = getEntityData(player, "vrr.fightStyle");
|
||||
player.setFightStyle(fightStyle[0], fightStyle[1]);
|
||||
}
|
||||
}
|
||||
if(getGame() == VRR_GAME_GTA_SA) {
|
||||
if(doesEntityDataExist(player, "vrr.fightStyle")) {
|
||||
let fightStyle = getEntityData(player, "vrr.fightStyle");
|
||||
player.setFightStyle(fightStyle[0], fightStyle[1]);
|
||||
}
|
||||
}
|
||||
|
||||
//if(getGame() == VRR_GAME_GTA_SA) {
|
||||
// if(doesEntityDataExist(player, "vrr.walkStyle")) {
|
||||
// let walkStyle = getEntityData(player, "vrr.walkStyle");
|
||||
// player.walkStyle = walkStyle;
|
||||
// }
|
||||
//}
|
||||
//if(getGame() == VRR_GAME_GTA_SA) {
|
||||
// if(doesEntityDataExist(player, "vrr.walkStyle")) {
|
||||
// let walkStyle = getEntityData(player, "vrr.walkStyle");
|
||||
// player.walkStyle = walkStyle;
|
||||
// }
|
||||
//}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if(doesEntityDataExist(player, "vrr.bodyPartHair")) {
|
||||
let bodyPartHead = getEntityData(player, "vrr.bodyPartHair");
|
||||
player.changeBodyPart(0, bodyPartHead[0], bodyPartHair[1]);
|
||||
}
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if(doesEntityDataExist(player, "vrr.bodyPartHair")) {
|
||||
let bodyPartHead = getEntityData(player, "vrr.bodyPartHair");
|
||||
player.changeBodyPart(0, bodyPartHead[0], bodyPartHair[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPartHead")) {
|
||||
let bodyPartHead = getEntityData(player, "vrr.bodyPartHead");
|
||||
player.changeBodyPart(1, bodyPartHead[0], bodyPartHead[1]);
|
||||
}
|
||||
if(doesEntityDataExist(player, "vrr.bodyPartHead")) {
|
||||
let bodyPartHead = getEntityData(player, "vrr.bodyPartHead");
|
||||
player.changeBodyPart(1, bodyPartHead[0], bodyPartHead[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPartUpper")) {
|
||||
let bodyPartUpper = getEntityData(player, "vrr.bodyPartUpper");
|
||||
player.changeBodyPart(1, bodyPartUpper[0], bodyPartUpper[1]);
|
||||
}
|
||||
if(doesEntityDataExist(player, "vrr.bodyPartUpper")) {
|
||||
let bodyPartUpper = getEntityData(player, "vrr.bodyPartUpper");
|
||||
player.changeBodyPart(1, bodyPartUpper[0], bodyPartUpper[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPartLower")) {
|
||||
let bodyPartLower = getEntityData(player, "vrr.bodyPartLower");
|
||||
player.changeBodyPart(1, bodyPartLower[0], bodyPartLower[1]);
|
||||
}
|
||||
}
|
||||
if(doesEntityDataExist(player, "vrr.bodyPartLower")) {
|
||||
let bodyPartLower = getEntityData(player, "vrr.bodyPartLower");
|
||||
player.changeBodyPart(1, bodyPartLower[0], bodyPartLower[1]);
|
||||
}
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropHair")) {
|
||||
let bodyPropHair = getEntityData(player, "vrr.bodyPropHair");
|
||||
player.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
|
||||
}
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropHair")) {
|
||||
let bodyPropHair = getEntityData(player, "vrr.bodyPropHair");
|
||||
player.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropHead")) {
|
||||
let bodyPropHead = getEntityData(player, "vrr.bodyPropHead");
|
||||
player.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
|
||||
}
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropHead")) {
|
||||
let bodyPropHead = getEntityData(player, "vrr.bodyPropHead");
|
||||
player.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropEyes")) {
|
||||
let bodyPropEyes = getEntityData(player, "vrr.bodyPropEyes");
|
||||
player.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
|
||||
}
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropEyes")) {
|
||||
let bodyPropEyes = getEntityData(player, "vrr.bodyPropEyes");
|
||||
player.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropLeftHand")) {
|
||||
let bodyPropLeftHand = getEntityData(player, "vrr.bodyPropLeftHand");
|
||||
player.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
|
||||
}
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropLeftHand")) {
|
||||
let bodyPropLeftHand = getEntityData(player, "vrr.bodyPropLeftHand");
|
||||
player.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropRightHand")) {
|
||||
let bodyPropRightHand = getEntityData(player, "vrr.bodyPropRightHand");
|
||||
player.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
|
||||
}
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropRightHand")) {
|
||||
let bodyPropRightHand = getEntityData(player, "vrr.bodyPropRightHand");
|
||||
player.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropLeftWrist")) {
|
||||
let bodyPropLeftWrist = getEntityData(player, "vrr.bodyPropLeftWrist");
|
||||
player.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
|
||||
}
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropLeftWrist")) {
|
||||
let bodyPropLeftWrist = getEntityData(player, "vrr.bodyPropLeftWrist");
|
||||
player.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropRightWrist")) {
|
||||
let bodyPropRightWrist = getEntityData(player, "vrr.bodyPropRightWrist");
|
||||
player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
||||
}
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropRightWrist")) {
|
||||
let bodyPropRightWrist = getEntityData(player, "vrr.bodyPropRightWrist");
|
||||
player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropRightWrist")) {
|
||||
let bodyPropRightWrist = getEntityData(player, "vrr.bodyPropRightWrist");
|
||||
player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
||||
}
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropRightWrist")) {
|
||||
let bodyPropRightWrist = getEntityData(player, "vrr.bodyPropRightWrist");
|
||||
player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropHip")) {
|
||||
let bodyPropHip = getEntityData(player, "vrr.bodyPropHip");
|
||||
player.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
|
||||
}
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropHip")) {
|
||||
let bodyPropHip = getEntityData(player, "vrr.bodyPropHip");
|
||||
player.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropLeftFoot")) {
|
||||
let bodyPropLeftFoot = getEntityData(player, "vrr.bodyPropLeftFoot");
|
||||
player.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
|
||||
}
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropLeftFoot")) {
|
||||
let bodyPropLeftFoot = getEntityData(player, "vrr.bodyPropLeftFoot");
|
||||
player.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropRightFoot")) {
|
||||
let bodyPropRightFoot = getEntityData(player, "vrr.bodyPropRightFoot");
|
||||
player.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
|
||||
}
|
||||
}
|
||||
if(doesEntityDataExist(player, "vrr.bodyPropRightFoot")) {
|
||||
let bodyPropRightFoot = getEntityData(player, "vrr.bodyPropRightFoot");
|
||||
player.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function syncObjectProperties(object) {
|
||||
if(!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
if(!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
|
||||
if(doesEntityDataExist(object, "vrr.scale")) {
|
||||
let scaleFactor = getEntityData(object, "vrr.scale");
|
||||
let tempMatrix = object.matrix;
|
||||
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
|
||||
let tempPosition = object.position;
|
||||
object.matrix = tempMatrix;
|
||||
tempPosition.z += scaleFactor.z;
|
||||
object.position = tempPosition;
|
||||
}
|
||||
}
|
||||
if(getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
|
||||
if(doesEntityDataExist(object, "vrr.scale")) {
|
||||
let scaleFactor = getEntityData(object, "vrr.scale");
|
||||
let tempMatrix = object.matrix;
|
||||
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
|
||||
let tempPosition = object.position;
|
||||
object.matrix = tempMatrix;
|
||||
tempPosition.z += scaleFactor.z;
|
||||
object.position = tempPosition;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function syncElementProperties(element) {
|
||||
if(!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
if(!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(element, "vrr.interior")) {
|
||||
if(typeof element.interior != "undefined") {
|
||||
element.interior = getEntityData(element, "vrr.interior");
|
||||
}
|
||||
}
|
||||
if(doesEntityDataExist(element, "vrr.interior")) {
|
||||
if(typeof element.interior != "undefined") {
|
||||
element.interior = getEntityData(element, "vrr.interior");
|
||||
}
|
||||
}
|
||||
|
||||
switch(element.type) {
|
||||
case ELEMENT_VEHICLE:
|
||||
syncVehicleProperties(element);
|
||||
break;
|
||||
switch(element.type) {
|
||||
case ELEMENT_VEHICLE:
|
||||
syncVehicleProperties(element);
|
||||
break;
|
||||
|
||||
case ELEMENT_PED:
|
||||
syncCivilianProperties(element);
|
||||
break;
|
||||
case ELEMENT_PED:
|
||||
syncCivilianProperties(element);
|
||||
break;
|
||||
|
||||
case ELEMENT_PLAYER:
|
||||
syncPlayerProperties(element);
|
||||
break;
|
||||
case ELEMENT_PLAYER:
|
||||
syncPlayerProperties(element);
|
||||
break;
|
||||
|
||||
case ELEMENT_OBJECT:
|
||||
syncObjectProperties(element);
|
||||
break;
|
||||
case ELEMENT_OBJECT:
|
||||
syncObjectProperties(element);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -417,21 +417,21 @@ function syncElementProperties(element) {
|
||||
// ===========================================================================
|
||||
|
||||
function receiveHouseFromServer(houseId, entrancePosition, blipModel, pickupModel, hasInterior) {
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
|
||||
}
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setLocalPlayerPedPartsAndProps(parts, props) {
|
||||
for(let i in parts) {
|
||||
localPlayer.changeBodyPart(parts[i][0], parts[i][1], parts[i][2]);
|
||||
}
|
||||
for(let i in parts) {
|
||||
localPlayer.changeBodyPart(parts[i][0], parts[i][1], parts[i][2]);
|
||||
}
|
||||
|
||||
for(let j in props) {
|
||||
localPlayer.changeBodyProp(props[j][0], props[j][1]);
|
||||
}
|
||||
for(let j in props) {
|
||||
localPlayer.changeBodyProp(props[j][0], props[j][1]);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
File diff suppressed because it is too large
Load Diff
@@ -8,30 +8,30 @@
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerAccentText(client) {
|
||||
return getPlayerCurrentSubAccount(client).accent;
|
||||
return getPlayerCurrentSubAccount(client).accent;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerAccentText(client, text) {
|
||||
getPlayerCurrentSubAccount(client).accent = text;
|
||||
getPlayerCurrentSubAccount(client).accent = text;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function doesPlayerHaveAccent(client) {
|
||||
return (getPlayerCurrentSubAccount(client).accent != "");
|
||||
return (getPlayerCurrentSubAccount(client).accent != "");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerAccentInlineOutput(client) {
|
||||
let outputText = "";
|
||||
if(doesPlayerHaveAccent(client)) {
|
||||
outputText = `[${getPlayerAccentText(client)}] `;
|
||||
}
|
||||
let outputText = "";
|
||||
if(doesPlayerHaveAccent(client)) {
|
||||
outputText = `[${getPlayerAccentText(client)}] `;
|
||||
}
|
||||
|
||||
return outputText;
|
||||
return outputText;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -581,7 +581,7 @@ function loginSuccess(client) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the "not a tester" error message (GUI disabled).`);
|
||||
messagePlayerError(client, getLocaleString(client, "NotATester"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -948,7 +948,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
|
||||
setAccountEmailVerificationCode(getPlayerData(client).accountData, emailVerificationCode);
|
||||
sendEmailVerificationEmail(client, emailVerificationCode);
|
||||
logToConsole(LOG_WARN, `${getPlayerDisplayForConsole(client)} was sent a registration email verification code`);
|
||||
}
|
||||
}
|
||||
|
||||
if(doesServerHaveTesterOnlyEnabled() && !isPlayerATester(client)) {
|
||||
setTimeout(function() {
|
||||
@@ -963,7 +963,7 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
|
||||
logToConsole(LOG_DEBUG, `[VRR.Account] ${getPlayerDisplayForConsole(client)} is being shown the "not a tester" error message (GUI disabled).`);
|
||||
messagePlayerError(client, getLocaleString(client, "NotATester"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
messagePlayerAlert(client, getLocaleString(client, "RegistrationCreateCharReminder"));
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ function playPlayerAnimationCommand(command, params, client) {
|
||||
}
|
||||
|
||||
let animationSlot = getAnimationFromParams(getParam(params, " ", 1));
|
||||
let animationPositionOffset = 1;
|
||||
let animationPositionOffset = 1;
|
||||
|
||||
if(!animationSlot) {
|
||||
messagePlayerError(client, getLocaleString(client, "AnimationNotFound"));
|
||||
@@ -61,7 +61,7 @@ function stopPlayerAnimationCommand(command, params, client) {
|
||||
getPlayerData(client).currentAnimation = -1;
|
||||
getPlayerData(client).currentAnimationPositionOffset = false;
|
||||
getPlayerData(client).currentAnimationPositionReturnTo = false;
|
||||
getPlayerData(client).animationStart = 0;
|
||||
getPlayerData(client).animationStart = 0;
|
||||
getPlayerData(client).animationForced = false;
|
||||
|
||||
setPlayerMouseCameraState(client, false);
|
||||
@@ -88,7 +88,7 @@ function showAnimationListCommand(command, params, client) {
|
||||
* @return {Array} The animation's data (array)
|
||||
*/
|
||||
function getAnimationData(animationSlot, gameId = getServerGame()) {
|
||||
return getGameConfig().animations[gameId][animationSlot];
|
||||
return getGameConfig().animations[gameId][animationSlot];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -100,13 +100,13 @@ function isPlayerInForcedAnimation(client) {
|
||||
// ===========================================================================
|
||||
|
||||
function makePlayerPlayAnimation(client, animationSlot, offsetPosition = 1) {
|
||||
getPlayerData(client).currentAnimation = animationSlot;
|
||||
getPlayerData(client).currentAnimation = animationSlot;
|
||||
getPlayerData(client).currentAnimationPositionOffset = offsetPosition;
|
||||
getPlayerData(client).currentAnimationPositionReturnTo = getPlayerPosition(client);
|
||||
getPlayerData(client).animationStart = getCurrentUnixTimestamp();
|
||||
getPlayerData(client).animationStart = getCurrentUnixTimestamp();
|
||||
getPlayerData(client).animationForced = false;
|
||||
|
||||
makePedPlayAnimation(getPlayerData(client).ped, animationSlot, offsetPosition);
|
||||
makePedPlayAnimation(getPlayerData(client).ped, animationSlot, offsetPosition);
|
||||
|
||||
//if(getAnimationData(animationSlot)[9] != VRR_ANIMMOVE_NONE) {
|
||||
// if(getGame() < VRR_GAME_GTA_SA) {
|
||||
@@ -118,10 +118,10 @@ function makePlayerPlayAnimation(client, animationSlot, offsetPosition = 1) {
|
||||
// ===========================================================================
|
||||
|
||||
function forcePlayerPlayAnimation(client, animationSlot, offsetPosition = 1) {
|
||||
getPlayerData(client).currentAnimation = animationSlot;
|
||||
getPlayerData(client).currentAnimation = animationSlot;
|
||||
getPlayerData(client).currentAnimationPositionOffset = offsetPosition;
|
||||
getPlayerData(client).currentAnimationPositionReturnTo = getPlayerPosition(client);
|
||||
getPlayerData(client).animationStart = getCurrentUnixTimestamp();
|
||||
getPlayerData(client).animationStart = getCurrentUnixTimestamp();
|
||||
getPlayerData(client).animationForced = true;
|
||||
|
||||
setPlayerControlState(client, false);
|
||||
@@ -137,7 +137,7 @@ function makePlayerStopAnimation(client) {
|
||||
getPlayerData(client).currentAnimation = -1;
|
||||
getPlayerData(client).currentAnimationPositionOffset = false;
|
||||
getPlayerData(client).currentAnimationPositionReturnTo = false;
|
||||
getPlayerData(client).animationStart = 0;
|
||||
getPlayerData(client).animationStart = 0;
|
||||
getPlayerData(client).animationForced = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
// ===========================================================================
|
||||
|
||||
function initAntiCheatScript() {
|
||||
logToConsole(LOG_DEBUG, "[VRR.AntiCheat]: Initializing anticheat script ...");
|
||||
logToConsole(LOG_DEBUG, "[VRR.AntiCheat]: Initializing anticheat script ...");
|
||||
logToConsole(LOG_DEBUG, "[VRR.AntiCheat]: Anticheat script initialized!");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function clearPlayerStateToEnterExitProperty(client) {
|
||||
if(getPlayerData(client).pedState != VRR_PEDSTATE_READY) {
|
||||
if(getPlayerData(client).pedState != VRR_PEDSTATE_READY) {
|
||||
if(getPlayerData(client).pedState == VRR_PEDSTATE_ENTERINGVEHICLE) {
|
||||
sendPlayerClearPedState(client);
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
// ===========================================================================
|
||||
|
||||
function initBanScript() {
|
||||
logToConsole(LOG_INFO, "[VRR.Ban]: Initializing ban script ...");
|
||||
logToConsole(LOG_INFO, "[VRR.Ban]: Ban script initialized!");
|
||||
logToConsole(LOG_INFO, "[VRR.Ban]: Initializing ban script ...");
|
||||
logToConsole(LOG_INFO, "[VRR.Ban]: Ban script initialized!");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -22,22 +22,22 @@ function accountBanCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let reason = splitParams.slice(1).join(" ");
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let reason = splitParams.slice(1).join(" ");
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, "That player is not connected!")
|
||||
return false;
|
||||
}
|
||||
|
||||
// Prevent banning admins with really high permissions
|
||||
if(doesPlayerHaveStaffPermission(targetClient, "ManageServer") || doesPlayerHaveStaffPermission(targetClient, "Developer")) {
|
||||
messagePlayerError(client, getLocaleString(client, "CantBanPlayer"));
|
||||
return false;
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, "That player is not connected!")
|
||||
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.`);
|
||||
banAccount(getPlayerData(targetClient).accountData.databaseId, getPlayerData(client).accountData.databaseId, reason);
|
||||
@@ -52,27 +52,27 @@ function subAccountBanCommand(command, params, client, fromDiscord) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let reason = splitParams.slice(1).join(" ");
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let reason = splitParams.slice(1).join(" ");
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, "That player is not connected!")
|
||||
return false;
|
||||
}
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, "That player is not connected!")
|
||||
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})'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.`);
|
||||
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)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let reason = splitParams.slice(1).join(" ");
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let reason = splitParams.slice(1).join(" ");
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, "That player is not connected!")
|
||||
return false;
|
||||
}
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, "That player is not connected!")
|
||||
return false;
|
||||
}
|
||||
|
||||
// Prevent banning admins with really high permissions
|
||||
if(doesPlayerHaveStaffPermission(targetClient, "ManageServer") || doesPlayerHaveStaffPermission(targetClient, "Developer")) {
|
||||
messagePlayerError(client, getLocaleString(client, "CantBanPlayer"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
messageAdminAction(`{ALTCOLOUR}${getPlayerData(targetClient).currentSubAccountData.name} {MAINCOLOUR}has been IP banned.`);
|
||||
banIPAddress(targetClient.ip, getPlayerData(client).accountData.databaseId, reason);
|
||||
messageAdminAction(`{ALTCOLOUR}${getPlayerData(targetClient).currentSubAccountData.name} {MAINCOLOUR}has been IP banned.`);
|
||||
banIPAddress(targetClient.ip, getPlayerData(client).accountData.databaseId, reason);
|
||||
|
||||
server.banIP(targetClient.ip);
|
||||
targetClient.disconnect();
|
||||
server.banIP(targetClient.ip);
|
||||
targetClient.disconnect();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -111,190 +111,189 @@ function subNetBanCommand(command, params, client, fromDiscord) {
|
||||
if(areParamsEmpty(params)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let octetAmount = Number(getParam(params, " ", 2));
|
||||
let reason = splitParams.slice(2).join(" ");
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let octetAmount = Number(getParam(params, " ", 2));
|
||||
let reason = splitParams.slice(2).join(" ");
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, "That player is not connected!")
|
||||
return false;
|
||||
}
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, "That player is not connected!")
|
||||
return false;
|
||||
}
|
||||
|
||||
// Prevent banning admins with really high permissions
|
||||
if(doesPlayerHaveStaffPermission(targetClient, "ManageServer") || doesPlayerHaveStaffPermission(targetClient, "Developer")) {
|
||||
messagePlayerError(client, getLocaleString(client, "CantBanPlayer"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
messageAdminAction(`{ALTCOLOUR}${getPlayerData(targetClient).currentSubAccountData.name} {MAINCOLOUR}has been subnet banned`);
|
||||
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) {
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
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}');`);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
dbConnection.close();
|
||||
return true;
|
||||
}
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
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}');`);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
dbConnection.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function banSubAccount(subAccountId, adminAccountId, reason) {
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
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}');`);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
dbConnection.close();
|
||||
return true;
|
||||
}
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
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}');`);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
dbConnection.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function banIPAddress(ipAddress, adminAccountId, reason) {
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
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}');`);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
dbConnection.close();
|
||||
return true;
|
||||
}
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
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}');`);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
dbConnection.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function banSubNet(ipAddressStart, ipAddressEnd, adminAccountId, reason) {
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
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}');`);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
dbConnection.close();
|
||||
return true;
|
||||
}
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
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}');`);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
dbConnection.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function unbanAccount(accountId, adminAccountId) {
|
||||
let dbConnection = connectToDatabase();
|
||||
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}`);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
dbConnection.close();
|
||||
return true;
|
||||
}
|
||||
let dbConnection = connectToDatabase();
|
||||
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}`);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
dbConnection.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function unbanSubAccount(subAccountId, adminAccountId) {
|
||||
let dbConnection = connectToDatabase();
|
||||
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}`);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
dbConnection.close();
|
||||
return true;
|
||||
}
|
||||
let dbConnection = connectToDatabase();
|
||||
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}`);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
dbConnection.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function unbanIPAddress(ipAddress, adminAccountId) {
|
||||
let dbConnection = connectToDatabase();
|
||||
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})`);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
dbConnection.close();
|
||||
return true;
|
||||
}
|
||||
let dbConnection = connectToDatabase();
|
||||
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})`);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
dbConnection.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function unbanSubNet(ipAddressStart, ipAddressEnd, adminAccountId) {
|
||||
let dbConnection = connectToDatabase();
|
||||
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})`);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
dbConnection.close();
|
||||
return true;
|
||||
}
|
||||
let dbConnection = connectToDatabase();
|
||||
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})`);
|
||||
freeDatabaseQuery(dbQuery);
|
||||
dbConnection.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function isAccountBanned(accountId) {
|
||||
let bans = getServerData().bans;
|
||||
for(let i in bans) {
|
||||
if(bans[i].type == VRR_BANTYPE_ACCOUNT) {
|
||||
if(bans[i].detail == accountId) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
let bans = getServerData().bans;
|
||||
for(let i in bans) {
|
||||
if(bans[i].type == VRR_BANTYPE_ACCOUNT) {
|
||||
if(bans[i].detail == accountId) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function isSubAccountBanned(subAccountId) {
|
||||
let bans = getServerData().bans;
|
||||
for(let i in bans) {
|
||||
if(bans[i].type == VRR_BANTYPE_SUBACCOUNT) {
|
||||
if(bans[i].detail == subAccountId) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
let bans = getServerData().bans;
|
||||
for(let i in bans) {
|
||||
if(bans[i].type == VRR_BANTYPE_SUBACCOUNT) {
|
||||
if(bans[i].detail == subAccountId) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function isIpAddressBanned(ipAddress) {
|
||||
let bans = getServerData().bans;
|
||||
for(let i in bans) {
|
||||
if(bans[i].type == VRR_BANTYPE_IPADDRESS) {
|
||||
if(bans[i].detail == ipAddress) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
let bans = getServerData().bans;
|
||||
for(let i in bans) {
|
||||
if(bans[i].type == VRR_BANTYPE_IPADDRESS) {
|
||||
if(bans[i].detail == ipAddress) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
|
||||
@@ -311,15 +311,15 @@ function doesPlayerHaveStaffPermission(client, requiredFlags) {
|
||||
}
|
||||
|
||||
// -1 is automatic override (having -1 for staff flags is basically god mode admin level)
|
||||
if(staffFlags == getStaffFlagValue("All")) {
|
||||
return true;
|
||||
}
|
||||
if(staffFlags == getStaffFlagValue("All")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(hasBitFlag(staffFlags, requiredFlags)) {
|
||||
return true;
|
||||
}
|
||||
if(hasBitFlag(staffFlags, requiredFlags)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -341,22 +341,22 @@ function doesPlayerHaveClanPermission(client, requiredFlags) {
|
||||
clanFlags = getPlayerCurrentSubAccount(client).clanFlags | getClanRankFlags(getPlayerCurrentSubAccount(client).clanRank);
|
||||
|
||||
// -1 is automatic override (having -1 for staff flags is basically god mode admin level)
|
||||
if(clanFlags == getClanFlagValue("All")) {
|
||||
return true;
|
||||
}
|
||||
if(clanFlags == getClanFlagValue("All")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(hasBitFlag(clanFlags, requiredFlags)) {
|
||||
return true;
|
||||
}
|
||||
if(hasBitFlag(clanFlags, requiredFlags)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getStaffFlagValue(flagName) {
|
||||
if(flagName == "All") {
|
||||
return -1;
|
||||
if(flagName == "All") {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(typeof serverBitFlags.staffFlags[flagName] == "undefined") {
|
||||
@@ -369,8 +369,8 @@ function getStaffFlagValue(flagName) {
|
||||
// ===========================================================================
|
||||
|
||||
function getClanFlagValue(flagName) {
|
||||
if(flagName == "All") {
|
||||
return -1;
|
||||
if(flagName == "All") {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(typeof getServerBitFlags().clanFlags[flagName] == "undefined") {
|
||||
@@ -383,8 +383,8 @@ function getClanFlagValue(flagName) {
|
||||
// ===========================================================================
|
||||
|
||||
function getAccountSettingsFlagValue(flagName) {
|
||||
if(flagName == "All") {
|
||||
return -1;
|
||||
if(flagName == "All") {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(typeof serverBitFlags.accountSettingsFlags[flagName] == "undefined") {
|
||||
@@ -397,8 +397,8 @@ function getAccountSettingsFlagValue(flagName) {
|
||||
// ===========================================================================
|
||||
|
||||
function getModerationFlagValue(flagName) {
|
||||
if(flagName == "All") {
|
||||
return -1;
|
||||
if(flagName == "All") {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(typeof serverBitFlags.moderationFlags[flagName] == "undefined") {
|
||||
@@ -411,8 +411,8 @@ function getModerationFlagValue(flagName) {
|
||||
// ===========================================================================
|
||||
|
||||
function getServerSettingsFlagValue(flagName) {
|
||||
if(flagName == "All") {
|
||||
return -1;
|
||||
if(flagName == "All") {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(typeof serverBitFlags.serverSettings[flagName] == "undefined") {
|
||||
|
||||
@@ -1251,9 +1251,9 @@ function saveAllBusinessesToDatabase() {
|
||||
function saveBusinessToDatabase(businessId) {
|
||||
let tempBusinessData = getServerData().businesses[businessId];
|
||||
|
||||
if(!tempBusinessData.needsSaved) {
|
||||
return false;
|
||||
}
|
||||
if(!tempBusinessData.needsSaved) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Business]: Saving business '${tempBusinessData.name}' to database ...`);
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -1344,7 +1344,7 @@ function createAllBusinessBlips() {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function createBusinessEntrancePickup(businessId) {
|
||||
function createBusinessEntrancePickup(businessId) {
|
||||
if(!getServerConfig().createBusinessPickups) {
|
||||
return false;
|
||||
}
|
||||
@@ -1357,7 +1357,7 @@ function createBusinessEntrancePickup(businessId) {
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating entrance pickup for business ${getBusinessData(businessId).name} (model ${pickupModelId})`);
|
||||
|
||||
|
||||
if(areServerElementsSupported()) {
|
||||
getBusinessData(businessId).entrancePickup = createGamePickup(pickupModelId, getBusinessData(businessId).entrancePosition, getGameConfig().pickupTypes[getServerGame()].business);
|
||||
setElementOnAllDimensions(getBusinessData(businessId).entrancePickup, false);
|
||||
@@ -1389,7 +1389,7 @@ function createBusinessEntranceBlip(businessId) {
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating entrance blip for business ${getBusinessData(businessId).name} (model ${blipModelId})`);
|
||||
|
||||
|
||||
if(areServerElementsSupported()) {
|
||||
getBusinessData(businessId).entranceBlip = createGameBlip(getBusinessData(businessId).entrancePosition, blipModelId, 1, getColourByName("businessBlue"));
|
||||
setElementOnAllDimensions(getBusinessData(businessId).entranceBlip, false);
|
||||
@@ -1417,7 +1417,7 @@ function createBusinessExitPickup(businessId) {
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating exit pickup for business ${getBusinessData(businessId).name} (model ${pickupModelId})`);
|
||||
|
||||
|
||||
if(areServerElementsSupported()) {
|
||||
getBusinessData(businessId).exitPickup = createGamePickup(pickupModelId, getBusinessData(businessId).exitPosition, getGameConfig().pickupTypes[getServerGame()].business);
|
||||
setElementDimension(getBusinessData(businessId).exitPickup, getBusinessData(businessId).exitDimension);
|
||||
@@ -2214,17 +2214,17 @@ function getBusinessFromParams(params) {
|
||||
// ===========================================================================
|
||||
|
||||
function deleteAllBusinessBlips() {
|
||||
for(let i in getServerData().businesses) {
|
||||
deleteBusinessBlips(i);
|
||||
}
|
||||
for(let i in getServerData().businesses) {
|
||||
deleteBusinessBlips(i);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function deleteAllBusinessPickups() {
|
||||
for(let i in getServerData().businesses) {
|
||||
deleteBusinessPickups(i);
|
||||
}
|
||||
for(let i in getServerData().businesses) {
|
||||
deleteBusinessPickups(i);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -8,60 +8,60 @@
|
||||
// ===========================================================================
|
||||
|
||||
let deckCards = [
|
||||
DeckCardData("deckCardSpadeAce", VRR_DECKCARD_SUIT_SPADE, 1),
|
||||
DeckCardData("deckCardSpade2", VRR_DECKCARD_SUIT_SPADE, 2),
|
||||
DeckCardData("deckCardSpade3", VRR_DECKCARD_SUIT_SPADE, 3),
|
||||
DeckCardData("deckCardSpade4", VRR_DECKCARD_SUIT_SPADE, 4),
|
||||
DeckCardData("deckCardSpade5", VRR_DECKCARD_SUIT_SPADE, 5),
|
||||
DeckCardData("deckCardSpade6", VRR_DECKCARD_SUIT_SPADE, 6),
|
||||
DeckCardData("deckCardSpade7", VRR_DECKCARD_SUIT_SPADE, 7),
|
||||
DeckCardData("deckCardSpade8", VRR_DECKCARD_SUIT_SPADE, 8),
|
||||
DeckCardData("deckCardSpade9", VRR_DECKCARD_SUIT_SPADE, 9),
|
||||
DeckCardData("deckCardSpade10", VRR_DECKCARD_SUIT_SPADE, 10),
|
||||
DeckCardData("deckCardSpadeJack", VRR_DECKCARD_SUIT_SPADE, 11),
|
||||
DeckCardData("deckCardSpadeQueen", VRR_DECKCARD_SUIT_SPADE, 12),
|
||||
DeckCardData("deckCardSpadeKing", VRR_DECKCARD_SUIT_SPADE, 13),
|
||||
DeckCardData("deckCardClubAce", VRR_DECKCARD_SUIT_CLUB, 1),
|
||||
DeckCardData("deckCardClub2", VRR_DECKCARD_SUIT_CLUB, 2),
|
||||
DeckCardData("deckCardClub3", VRR_DECKCARD_SUIT_CLUB, 3),
|
||||
DeckCardData("deckCardClub4", VRR_DECKCARD_SUIT_CLUB, 4),
|
||||
DeckCardData("deckCardClub5", VRR_DECKCARD_SUIT_CLUB, 5),
|
||||
DeckCardData("deckCardClub6", VRR_DECKCARD_SUIT_CLUB, 6),
|
||||
DeckCardData("deckCardClub7", VRR_DECKCARD_SUIT_CLUB, 7),
|
||||
DeckCardData("deckCardClub8", VRR_DECKCARD_SUIT_CLUB, 8),
|
||||
DeckCardData("deckCardClub9", VRR_DECKCARD_SUIT_CLUB, 9),
|
||||
DeckCardData("deckCardClub10", VRR_DECKCARD_SUIT_CLUB, 10),
|
||||
DeckCardData("deckCardClubJack", VRR_DECKCARD_SUIT_CLUB, 11),
|
||||
DeckCardData("deckCardClubQueen", VRR_DECKCARD_SUIT_CLUB, 12),
|
||||
DeckCardData("deckCardClubKing", VRR_DECKCARD_SUIT_CLUB, 13),
|
||||
DeckCardData("deckCardHeartAce", VRR_DECKCARD_SUIT_HEART, 1),
|
||||
DeckCardData("deckCardHeart2", VRR_DECKCARD_SUIT_HEART, 2),
|
||||
DeckCardData("deckCardHeart3", VRR_DECKCARD_SUIT_HEART, 3),
|
||||
DeckCardData("deckCardHeart4", VRR_DECKCARD_SUIT_HEART, 4),
|
||||
DeckCardData("deckCardHeart5", VRR_DECKCARD_SUIT_HEART, 5),
|
||||
DeckCardData("deckCardHeart6", VRR_DECKCARD_SUIT_HEART, 6),
|
||||
DeckCardData("deckCardHeart7", VRR_DECKCARD_SUIT_HEART, 7),
|
||||
DeckCardData("deckCardHeart8", VRR_DECKCARD_SUIT_HEART, 8),
|
||||
DeckCardData("deckCardHeart9", VRR_DECKCARD_SUIT_HEART, 9),
|
||||
DeckCardData("deckCardHeart10", VRR_DECKCARD_SUIT_HEART, 10),
|
||||
DeckCardData("deckCardHeartJack", VRR_DECKCARD_SUIT_HEART, 11),
|
||||
DeckCardData("deckCardHeartQueen", VRR_DECKCARD_SUIT_HEART, 12),
|
||||
DeckCardData("deckCardHeartKing", VRR_DECKCARD_SUIT_HEART, 13),
|
||||
DeckCardData("deckCardDiamondAce", VRR_DECKCARD_SUIT_DIAMOND, 1),
|
||||
DeckCardData("deckCardDiamond2", VRR_DECKCARD_SUIT_DIAMOND, 2),
|
||||
DeckCardData("deckCardDiamond3", VRR_DECKCARD_SUIT_DIAMOND, 3),
|
||||
DeckCardData("deckCardDiamond4", VRR_DECKCARD_SUIT_DIAMOND, 4),
|
||||
DeckCardData("deckCardDiamond5", VRR_DECKCARD_SUIT_DIAMOND, 5),
|
||||
DeckCardData("deckCardDiamond6", VRR_DECKCARD_SUIT_DIAMOND, 6),
|
||||
DeckCardData("deckCardDiamond7", VRR_DECKCARD_SUIT_DIAMOND, 7),
|
||||
DeckCardData("deckCardDiamond8", VRR_DECKCARD_SUIT_DIAMOND, 8),
|
||||
DeckCardData("deckCardDiamond9", VRR_DECKCARD_SUIT_DIAMOND, 9),
|
||||
DeckCardData( "deckCardDiamond10", VRR_DECKCARD_SUIT_DIAMOND, 10),
|
||||
DeckCardData("deckCardDiamondJack", VRR_DECKCARD_SUIT_DIAMOND, 11),
|
||||
DeckCardData("deckCardDiamondQueen", VRR_DECKCARD_SUIT_DIAMOND, 12),
|
||||
DeckCardData("deckCardDiamondKing", VRR_DECKCARD_SUIT_DIAMOND, 13),
|
||||
DeckCardData("deckCardSpadeAce", VRR_DECKCARD_SUIT_SPADE, 1),
|
||||
DeckCardData("deckCardSpade2", VRR_DECKCARD_SUIT_SPADE, 2),
|
||||
DeckCardData("deckCardSpade3", VRR_DECKCARD_SUIT_SPADE, 3),
|
||||
DeckCardData("deckCardSpade4", VRR_DECKCARD_SUIT_SPADE, 4),
|
||||
DeckCardData("deckCardSpade5", VRR_DECKCARD_SUIT_SPADE, 5),
|
||||
DeckCardData("deckCardSpade6", VRR_DECKCARD_SUIT_SPADE, 6),
|
||||
DeckCardData("deckCardSpade7", VRR_DECKCARD_SUIT_SPADE, 7),
|
||||
DeckCardData("deckCardSpade8", VRR_DECKCARD_SUIT_SPADE, 8),
|
||||
DeckCardData("deckCardSpade9", VRR_DECKCARD_SUIT_SPADE, 9),
|
||||
DeckCardData("deckCardSpade10", VRR_DECKCARD_SUIT_SPADE, 10),
|
||||
DeckCardData("deckCardSpadeJack", VRR_DECKCARD_SUIT_SPADE, 11),
|
||||
DeckCardData("deckCardSpadeQueen", VRR_DECKCARD_SUIT_SPADE, 12),
|
||||
DeckCardData("deckCardSpadeKing", VRR_DECKCARD_SUIT_SPADE, 13),
|
||||
DeckCardData("deckCardClubAce", VRR_DECKCARD_SUIT_CLUB, 1),
|
||||
DeckCardData("deckCardClub2", VRR_DECKCARD_SUIT_CLUB, 2),
|
||||
DeckCardData("deckCardClub3", VRR_DECKCARD_SUIT_CLUB, 3),
|
||||
DeckCardData("deckCardClub4", VRR_DECKCARD_SUIT_CLUB, 4),
|
||||
DeckCardData("deckCardClub5", VRR_DECKCARD_SUIT_CLUB, 5),
|
||||
DeckCardData("deckCardClub6", VRR_DECKCARD_SUIT_CLUB, 6),
|
||||
DeckCardData("deckCardClub7", VRR_DECKCARD_SUIT_CLUB, 7),
|
||||
DeckCardData("deckCardClub8", VRR_DECKCARD_SUIT_CLUB, 8),
|
||||
DeckCardData("deckCardClub9", VRR_DECKCARD_SUIT_CLUB, 9),
|
||||
DeckCardData("deckCardClub10", VRR_DECKCARD_SUIT_CLUB, 10),
|
||||
DeckCardData("deckCardClubJack", VRR_DECKCARD_SUIT_CLUB, 11),
|
||||
DeckCardData("deckCardClubQueen", VRR_DECKCARD_SUIT_CLUB, 12),
|
||||
DeckCardData("deckCardClubKing", VRR_DECKCARD_SUIT_CLUB, 13),
|
||||
DeckCardData("deckCardHeartAce", VRR_DECKCARD_SUIT_HEART, 1),
|
||||
DeckCardData("deckCardHeart2", VRR_DECKCARD_SUIT_HEART, 2),
|
||||
DeckCardData("deckCardHeart3", VRR_DECKCARD_SUIT_HEART, 3),
|
||||
DeckCardData("deckCardHeart4", VRR_DECKCARD_SUIT_HEART, 4),
|
||||
DeckCardData("deckCardHeart5", VRR_DECKCARD_SUIT_HEART, 5),
|
||||
DeckCardData("deckCardHeart6", VRR_DECKCARD_SUIT_HEART, 6),
|
||||
DeckCardData("deckCardHeart7", VRR_DECKCARD_SUIT_HEART, 7),
|
||||
DeckCardData("deckCardHeart8", VRR_DECKCARD_SUIT_HEART, 8),
|
||||
DeckCardData("deckCardHeart9", VRR_DECKCARD_SUIT_HEART, 9),
|
||||
DeckCardData("deckCardHeart10", VRR_DECKCARD_SUIT_HEART, 10),
|
||||
DeckCardData("deckCardHeartJack", VRR_DECKCARD_SUIT_HEART, 11),
|
||||
DeckCardData("deckCardHeartQueen", VRR_DECKCARD_SUIT_HEART, 12),
|
||||
DeckCardData("deckCardHeartKing", VRR_DECKCARD_SUIT_HEART, 13),
|
||||
DeckCardData("deckCardDiamondAce", VRR_DECKCARD_SUIT_DIAMOND, 1),
|
||||
DeckCardData("deckCardDiamond2", VRR_DECKCARD_SUIT_DIAMOND, 2),
|
||||
DeckCardData("deckCardDiamond3", VRR_DECKCARD_SUIT_DIAMOND, 3),
|
||||
DeckCardData("deckCardDiamond4", VRR_DECKCARD_SUIT_DIAMOND, 4),
|
||||
DeckCardData("deckCardDiamond5", VRR_DECKCARD_SUIT_DIAMOND, 5),
|
||||
DeckCardData("deckCardDiamond6", VRR_DECKCARD_SUIT_DIAMOND, 6),
|
||||
DeckCardData("deckCardDiamond7", VRR_DECKCARD_SUIT_DIAMOND, 7),
|
||||
DeckCardData("deckCardDiamond8", VRR_DECKCARD_SUIT_DIAMOND, 8),
|
||||
DeckCardData("deckCardDiamond9", VRR_DECKCARD_SUIT_DIAMOND, 9),
|
||||
DeckCardData( "deckCardDiamond10", VRR_DECKCARD_SUIT_DIAMOND, 10),
|
||||
DeckCardData("deckCardDiamondJack", VRR_DECKCARD_SUIT_DIAMOND, 11),
|
||||
DeckCardData("deckCardDiamondQueen", VRR_DECKCARD_SUIT_DIAMOND, 12),
|
||||
DeckCardData("deckCardDiamondKing", VRR_DECKCARD_SUIT_DIAMOND, 13),
|
||||
];
|
||||
|
||||
let deckCardBacks = [
|
||||
|
||||
]
|
||||
];
|
||||
@@ -42,9 +42,9 @@ function processPlayerChat(client, messageText) {
|
||||
} else {
|
||||
messagePlayerNormal(null, `🛡️ (ADMIN) - ${messageText}`);
|
||||
}
|
||||
|
||||
/*
|
||||
let clients = getClients();
|
||||
|
||||
/*
|
||||
let clients = getClients();
|
||||
for(let i in clients) {
|
||||
let translatedText;
|
||||
translatedText = await translateMessage(messageText, getPlayerData(client).locale, getPlayerData(clients[i]).locale);
|
||||
@@ -52,9 +52,9 @@ function processPlayerChat(client, messageText) {
|
||||
let original = (getPlayerData(client).locale == getPlayerData(clients[i]).locale) ? `` : ` {ALTCOLOUR}(${messageText})`;
|
||||
messagePlayerNormal(clients[i], `💬 ${getCharacterFullName(client)}: [#FFFFFF]${translatedText}${original}`, clients[i], getColourByName("mediumGrey"));
|
||||
}
|
||||
*/
|
||||
|
||||
//messageDiscordChatChannel(`💬 ${getCharacterFullName(client)}: ${messageText}`);
|
||||
*/
|
||||
|
||||
//messageDiscordChatChannel(`💬 ${getCharacterFullName(client)}: ${messageText}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -948,9 +948,9 @@ function saveClanToDatabase(clanId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!tempClanData.needsSaved) {
|
||||
return false;
|
||||
}
|
||||
if(!tempClanData.needsSaved) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
@@ -994,41 +994,41 @@ function saveClanToDatabase(clanId) {
|
||||
function saveClanRankToDatabase(clanId, rankId) {
|
||||
let tempClanRankData = getClanRankData(clanId, rankId);
|
||||
|
||||
if(!tempClanRankData.needsSaved) {
|
||||
return false;
|
||||
}
|
||||
if(!tempClanRankData.needsSaved) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
let safeName = escapeDatabaseString(dbConnection, tempClanRankData.name);
|
||||
let safeTag = escapeDatabaseString(dbConnection, tempClanRankData.customTag);
|
||||
//let safeTitle = escapeDatabaseString(dbConnection, tempClanRankData.name);
|
||||
let safeName = escapeDatabaseString(dbConnection, tempClanRankData.name);
|
||||
let safeTag = escapeDatabaseString(dbConnection, tempClanRankData.customTag);
|
||||
//let safeTitle = escapeDatabaseString(dbConnection, tempClanRankData.name);
|
||||
|
||||
let data = [
|
||||
["clan_rank_name", safeName],
|
||||
["clan_rank_clan", tempClanRankData.clan],
|
||||
["clan_rank_custom_tag", safeTag],
|
||||
//["clan_rank_title", safeTitle],
|
||||
["clan_rank_flags", tempClanRankData.flags],
|
||||
["clan_rank_level", tempClanRankData.level],
|
||||
["clan_rank_enabled", boolToInt(tempClanRankData.enabled)],
|
||||
];
|
||||
let data = [
|
||||
["clan_rank_name", safeName],
|
||||
["clan_rank_clan", tempClanRankData.clan],
|
||||
["clan_rank_custom_tag", safeTag],
|
||||
//["clan_rank_title", safeTitle],
|
||||
["clan_rank_flags", tempClanRankData.flags],
|
||||
["clan_rank_level", tempClanRankData.level],
|
||||
["clan_rank_enabled", boolToInt(tempClanRankData.enabled)],
|
||||
];
|
||||
|
||||
let dbQuery = null;
|
||||
if(tempClanRankData.databaseId == 0) {
|
||||
let queryString = createDatabaseInsertQuery("clan_rank", data);
|
||||
dbQuery = queryDatabase(dbConnection, queryString);
|
||||
getClanRankData(clanId, rankId).databaseId = getDatabaseInsertId(dbConnection);
|
||||
getClanRankData(clanId, rankId).needsSaved = false;
|
||||
} else {
|
||||
let queryString = createDatabaseUpdateQuery("clan_rank", data, `clan_rank_id=${tempClanRankData.databaseId} LIMIT 1`);
|
||||
dbQuery = queryDatabase(dbConnection, queryString);
|
||||
getClanRankData(clanId, rankId).needsSaved = false;
|
||||
}
|
||||
let dbQuery = null;
|
||||
if(tempClanRankData.databaseId == 0) {
|
||||
let queryString = createDatabaseInsertQuery("clan_rank", data);
|
||||
dbQuery = queryDatabase(dbConnection, queryString);
|
||||
getClanRankData(clanId, rankId).databaseId = getDatabaseInsertId(dbConnection);
|
||||
getClanRankData(clanId, rankId).needsSaved = false;
|
||||
} else {
|
||||
let queryString = createDatabaseUpdateQuery("clan_rank", data, `clan_rank_id=${tempClanRankData.databaseId} LIMIT 1`);
|
||||
dbQuery = queryDatabase(dbConnection, queryString);
|
||||
getClanRankData(clanId, rankId).needsSaved = false;
|
||||
}
|
||||
|
||||
freeDatabaseQuery(dbQuery);
|
||||
disconnectFromDatabase(dbConnection);
|
||||
return true;
|
||||
freeDatabaseQuery(dbQuery);
|
||||
disconnectFromDatabase(dbConnection);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -241,7 +241,7 @@ class ClientData {
|
||||
this.enteringVehicle = null;
|
||||
|
||||
this.customDisconnectReason = "";
|
||||
|
||||
|
||||
this.interiorCutscene = "";
|
||||
}
|
||||
};
|
||||
@@ -578,7 +578,7 @@ class BusinessData {
|
||||
|
||||
this.labelHelpType = toInteger(dbAssoc["biz_label_help_type"]);
|
||||
this.streamingRadioStation = toInteger(dbAssoc["biz_radiostation"]);
|
||||
|
||||
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -1721,7 +1721,7 @@ class JobRouteData {
|
||||
this.pay = toInteger(dbAssoc["job_route_pay"]);
|
||||
this.startMessage = toString(dbAssoc["job_route_start_msg"]);
|
||||
this.finishMessage = toString(dbAssoc["job_route_finish_msg"]);
|
||||
this.locationArriveMessage = toString(dbAssoc["job_route_loc_arrive_msg"]);
|
||||
this.locationArriveMessage = toString(dbAssoc["job_route_loc_arrive_msg"]);
|
||||
this.locationNextMessage = toString(dbAssoc["job_route_loc_next_msg"]);
|
||||
this.vehicleColour1 = toInteger(dbAssoc["job_route_veh_colour1"]);
|
||||
this.vehicleColour2 = toInteger(dbAssoc["job_route_veh_colour2"]);
|
||||
@@ -1737,7 +1737,7 @@ class JobRouteLocationData {
|
||||
this.routeId = 0;
|
||||
this.enabled = false;
|
||||
this.index = -1;
|
||||
this.jobIndex = -1;
|
||||
this.jobIndex = -1;
|
||||
this.routeIndex = -1;
|
||||
this.needsSaved = false;
|
||||
this.position = toVector3(0.0, 0.0, 0.0);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -283,18 +283,18 @@ function setTimeCommand(command, params, client) {
|
||||
if(hour > 23 || hour < 0) {
|
||||
messagePlayerError(client, "The hour must be between 0 and 23!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(minute > 59 || minute < 0) {
|
||||
messagePlayerError(client, "The minute must be between 0 and 59!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
getServerConfig().hour = hour;
|
||||
getServerConfig().minute = minute;
|
||||
|
||||
game.time.hour = getServerConfig().hour;
|
||||
game.time.minute = getServerConfig().minute;
|
||||
game.time.hour = getServerConfig().hour;
|
||||
game.time.minute = getServerConfig().minute;
|
||||
|
||||
//checkServerGameTime();
|
||||
|
||||
@@ -322,7 +322,7 @@ function setMinuteDurationCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let minuteDuration = toInteger(params);
|
||||
let minuteDuration = toInteger(params);
|
||||
getServerConfig().minuteDuration = minuteDuration;
|
||||
setTimeMinuteDuration(null, minuteDuration);
|
||||
|
||||
@@ -354,15 +354,15 @@ function setWeatherCommand(command, params, client) {
|
||||
if(!weatherId) {
|
||||
messagePlayerError(client, `That weather ID or name is invalid!`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
game.forceWeather(toInteger(weatherId));
|
||||
game.forceWeather(toInteger(weatherId));
|
||||
getServerConfig().weather = weatherId;
|
||||
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
messageAdminAction(`${getPlayerName(client)} set the weather to {ALTCOLOUR}${getGameConfig().weatherNames[getServerGame()][toInteger(weatherId)]}`);
|
||||
updateServerRules();
|
||||
messageAdminAction(`${getPlayerName(client)} set the weather to {ALTCOLOUR}${getGameConfig().weatherNames[getServerGame()][toInteger(weatherId)]}`);
|
||||
updateServerRules();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -384,7 +384,7 @@ function setSnowingCommand(command, params, client) {
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let falling = toInteger(getParam(params, " ", 1));
|
||||
let falling = toInteger(getParam(params, " ", 1));
|
||||
let ground = toInteger(getParam(params, " ", 2));
|
||||
|
||||
getServerConfig().fallingSnow = intToBool(falling);
|
||||
@@ -394,8 +394,8 @@ function setSnowingCommand(command, params, client) {
|
||||
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned falling snow ${getBoolRedGreenInlineColour(falling)}${getOnOffFromBool(falling)} {MAINCOLOUR}and ground snow ${getBoolRedGreenInlineColour(ground)}${getOnOffFromBool(ground)}`);
|
||||
updateServerRules();
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned falling snow ${getBoolRedGreenInlineColour(falling)}${getOnOffFromBool(falling)} {MAINCOLOUR}and ground snow ${getBoolRedGreenInlineColour(ground)}${getOnOffFromBool(ground)}`);
|
||||
updateServerRules();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -417,7 +417,7 @@ function setServerGUIColoursCommand(command, params, client) {
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let colourRed = toInteger(getParam(params, " ", 1)) || 255;
|
||||
let colourRed = toInteger(getParam(params, " ", 1)) || 255;
|
||||
let colourGreen = toInteger(getParam(params, " ", 2)) || 255;
|
||||
let colourBlue = toInteger(getParam(params, " ", 3)) || 255;
|
||||
|
||||
@@ -430,8 +430,8 @@ function setServerGUIColoursCommand(command, params, client) {
|
||||
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
//messageAdminAction(`${getPlayerName(client)} ${getInlineChatColourByName("orange")}set the server ${getBoolRedGreenInlineColour(fallingSnow)}${getOnOffFromBool(fallingSnow)} ${getInlineChatColourByName("orange")}and ground snow ${getBoolRedGreenInlineColour(groundSnow)}${getOnOffFromBool(groundSnow)}`);
|
||||
//updateServerRules();
|
||||
//messageAdminAction(`${getPlayerName(client)} ${getInlineChatColourByName("orange")}set the server ${getBoolRedGreenInlineColour(fallingSnow)}${getOnOffFromBool(fallingSnow)} ${getInlineChatColourByName("orange")}and ground snow ${getBoolRedGreenInlineColour(groundSnow)}${getOnOffFromBool(groundSnow)}`);
|
||||
//updateServerRules();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -452,8 +452,8 @@ function toggleServerLogoCommand(command, params, client) {
|
||||
|
||||
updatePlayerShowLogoState(null, getServerConfig().useLogo);
|
||||
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned the server logo image ${getBoolRedGreenInlineColour(doesServerHaveServerLogoEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().useLogo))}`);
|
||||
updateServerRules();
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned the server logo image ${getBoolRedGreenInlineColour(doesServerHaveServerLogoEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().useLogo))}`);
|
||||
updateServerRules();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -472,7 +472,7 @@ function toggleServerLogoCommand(command, params, client) {
|
||||
getServerConfig().createJobBlips = !getServerConfig().createJobBlips;
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveJobBlipsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createJobBlips))} {MAINCOLOUR}all job blips`);
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveJobBlipsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createJobBlips))} {MAINCOLOUR}all job blips`);
|
||||
resetAllJobBlips();
|
||||
return true;
|
||||
}
|
||||
@@ -492,7 +492,7 @@ function toggleServerLogoCommand(command, params, client) {
|
||||
getServerConfig().createJobPickups = !getServerConfig().createJobPickups;
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveJobPickupsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createJobPickups))} {MAINCOLOUR}all job pickups`);
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveJobPickupsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createJobPickups))} {MAINCOLOUR}all job pickups`);
|
||||
resetAllJobPickups();
|
||||
return true;
|
||||
}
|
||||
@@ -509,10 +509,10 @@ function toggleServerLogoCommand(command, params, client) {
|
||||
*
|
||||
*/
|
||||
function toggleServerBusinessBlipsCommand(command, params, client) {
|
||||
getServerConfig().createBusinessBlips = !getServerConfig().createBusinessBlips;
|
||||
getServerConfig().createBusinessBlips = !getServerConfig().createBusinessBlips;
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveBusinessBlipsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createBusinessBlips))} {MAINCOLOUR}all business blips`);
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveBusinessBlipsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createBusinessBlips))} {MAINCOLOUR}all business blips`);
|
||||
resetAllBusinessBlips();
|
||||
return true;
|
||||
}
|
||||
@@ -529,10 +529,10 @@ function toggleServerLogoCommand(command, params, client) {
|
||||
*
|
||||
*/
|
||||
function toggleServerBusinessPickupsCommand(command, params, client) {
|
||||
getServerConfig().createBusinessPickups = !getServerConfig().createBusinessPickups;
|
||||
getServerConfig().createBusinessPickups = !getServerConfig().createBusinessPickups;
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveBusinessPickupsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createBusinessPickups))} {MAINCOLOUR}all business pickups`);
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveBusinessPickupsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createBusinessPickups))} {MAINCOLOUR}all business pickups`);
|
||||
resetAllBusinessPickups();
|
||||
return true;
|
||||
}
|
||||
@@ -549,10 +549,10 @@ function toggleServerLogoCommand(command, params, client) {
|
||||
*
|
||||
*/
|
||||
function toggleServerHouseBlipsCommand(command, params, client) {
|
||||
getServerConfig().createHouseBlips = !getServerConfig().createHouseBlips;
|
||||
getServerConfig().createHouseBlips = !getServerConfig().createHouseBlips;
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveHouseBlipsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createHouseBlips))} {MAINCOLOUR}all house blips`);
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveHouseBlipsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createHouseBlips))} {MAINCOLOUR}all house blips`);
|
||||
resetAllHouseBlips();
|
||||
return true;
|
||||
}
|
||||
@@ -572,7 +572,7 @@ function toggleServerLogoCommand(command, params, client) {
|
||||
getServerConfig().createHousePickups = !getServerConfig().createHousePickups;
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveHousePickupsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createHousePickups))} {MAINCOLOUR}all house pickups`);
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveHousePickupsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createHousePickups))} {MAINCOLOUR}all house pickups`);
|
||||
resetAllHousePickups();
|
||||
return true;
|
||||
}
|
||||
@@ -593,8 +593,8 @@ function toggleServerGUICommand(command, params, client) {
|
||||
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned GUI ${toLowerCase(getOnOffFromBool(doesServerHaveGUIEnabled()))} for this server`);
|
||||
updateServerRules();
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned GUI ${toLowerCase(getOnOffFromBool(doesServerHaveGUIEnabled()))} for this server`);
|
||||
updateServerRules();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -611,12 +611,12 @@ function toggleServerGUICommand(command, params, client) {
|
||||
*/
|
||||
function toggleServerUseRealWorldTimeCommand(command, params, client) {
|
||||
getServerConfig().useRealTime = !getServerConfig().useRealTime;
|
||||
|
||||
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned real-world time ${getServerConfig().useRealTime} for this server (GMT ${addPositiveNegativeSymbol(getServerConfig().realTimeZone)})`);
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned real-world time ${getServerConfig().useRealTime} for this server (GMT ${addPositiveNegativeSymbol(getServerConfig().realTimeZone)})`);
|
||||
updateServerGameTime();
|
||||
updateServerRules();
|
||||
updateServerRules();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -637,12 +637,12 @@ function setServerRealWorldTimeZoneCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
getServerConfig().realTimeZone = toInteger(params);
|
||||
getServerConfig().realTimeZone = toInteger(params);
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}set the time zone for in-game's real-world time to GMT ${addPositiveNegativeSymbol(getServerConfig().realTimeZone)}`);
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}set the time zone for in-game's real-world time to GMT ${addPositiveNegativeSymbol(getServerConfig().realTimeZone)}`);
|
||||
updateServerGameTime();
|
||||
updateServerRules();
|
||||
updateServerRules();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -662,7 +662,7 @@ function reloadServerConfigurationCommand(command, params, client) {
|
||||
applyConfigToServer(serverConfig);
|
||||
updateServerRules();
|
||||
|
||||
messagePlayerSuccess(client, `You reloaded the server configuration!`);
|
||||
messagePlayerSuccess(client, `You reloaded the server configuration!`);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -679,7 +679,7 @@ function reloadServerConfigurationCommand(command, params, client) {
|
||||
*/
|
||||
function reloadEmailConfigurationCommand(command, params, client) {
|
||||
emailConfig = loadEmailConfiguration();
|
||||
messagePlayerSuccess(client, `You reloaded the email configuration!`);
|
||||
messagePlayerSuccess(client, `You reloaded the email configuration!`);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,4 +20,3 @@ function initDatabaseScript() {
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
|
||||
@@ -572,9 +572,9 @@ function streamAudioNameToAllPlayersCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function fixAllServerBlipsCommand(command, params, client) {
|
||||
deleteAllBusinessBlips();
|
||||
deleteAllJobBlips();
|
||||
deleteAllHouseBlips();
|
||||
deleteAllBusinessBlips();
|
||||
deleteAllJobBlips();
|
||||
deleteAllHouseBlips();
|
||||
|
||||
let blips = getElementsByType(ELEMENT_BLIP);
|
||||
blips.forEach((blip) => {
|
||||
|
||||
@@ -16,31 +16,31 @@ function initDiscordScript() {
|
||||
|
||||
/*
|
||||
addEventHandler("OnDiscordCommand", function(command, params, discordUser) {
|
||||
let commandData = getCommand(command);
|
||||
let commandData = getCommand(command);
|
||||
|
||||
if(!commandData) {
|
||||
messagePlayerError(discordUser, "That command does not exist!");
|
||||
return false;
|
||||
}
|
||||
if(!commandData) {
|
||||
messagePlayerError(discordUser, "That command does not exist!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(isCommandAllowedOnDiscord(command)) {
|
||||
messagePlayerError(discordUser, "That command can not be used on Discord!");
|
||||
return false;
|
||||
}
|
||||
if(isCommandAllowedOnDiscord(command)) {
|
||||
messagePlayerError(discordUser, "That command can not be used on Discord!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(doesClientHavePermission(discordUser, getCommandRequiredPermissions(command))) {
|
||||
messagePlayerError(discordUser, "You do not have permission to use that command!");
|
||||
return false;
|
||||
}
|
||||
if(doesClientHavePermission(discordUser, getCommandRequiredPermissions(command))) {
|
||||
messagePlayerError(discordUser, "You do not have permission to use that command!");
|
||||
return false;
|
||||
}
|
||||
|
||||
commandData.handlerFunction(command, params, discordUser);
|
||||
commandData.handlerFunction(command, params, discordUser);
|
||||
});
|
||||
*/
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messageDiscordUser(discordUser, messageText) {
|
||||
let socketData = JSON.stringify({
|
||||
let socketData = JSON.stringify({
|
||||
type: "chat.message.text",
|
||||
payload: {
|
||||
author: discordUser.name,
|
||||
@@ -53,88 +53,88 @@ function messageDiscordUser(discordUser, messageText) {
|
||||
// ===========================================================================
|
||||
|
||||
function sendDiscordSocketData(socketData) {
|
||||
if(!getDiscordSocket()) {
|
||||
return false;
|
||||
}
|
||||
if(!getDiscordSocket()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
getDiscordSocket().send(module.hash.encodeBase64(socketData) + "\r\n");
|
||||
getDiscordSocket().send(module.hash.encodeBase64(socketData) + "\r\n");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function isClientFromDiscord(client) {
|
||||
if(client == null) {
|
||||
return false;
|
||||
}
|
||||
if(client == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(client instanceof Client) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
if(client instanceof Client) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getDiscordSocket() {
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getDiscordUserData(discordUserId) {
|
||||
return loadAccountFromDiscordUserId(discordUserId);
|
||||
return loadAccountFromDiscordUserId(discordUserId);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messageDiscordChatChannel(message) {
|
||||
if(!getServerConfig().discordConfig.sendChat) {
|
||||
return false;
|
||||
}
|
||||
if(!getServerConfig().discordConfig.sendChat) {
|
||||
return false;
|
||||
}
|
||||
|
||||
message = removeColoursInMessage(message);
|
||||
console.warn(message);
|
||||
let payloadData = {
|
||||
"username": "Chat",
|
||||
"content": message,
|
||||
};
|
||||
message = removeColoursInMessage(message);
|
||||
console.warn(message);
|
||||
let payloadData = {
|
||||
"username": "Chat",
|
||||
"content": message,
|
||||
};
|
||||
|
||||
triggerWebHook(getServerConfig().discordConfig.chatChannelWebHookURL, JSON.stringify(payloadData));
|
||||
triggerWebHook(getServerConfig().discordConfig.chatChannelWebHookURL, JSON.stringify(payloadData));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messageDiscordAdminChannel(message) {
|
||||
if(!getServerConfig().discordConfig.sendAdminEvents) {
|
||||
return false;
|
||||
}
|
||||
if(!getServerConfig().discordConfig.sendAdminEvents) {
|
||||
return false;
|
||||
}
|
||||
|
||||
message = removeColoursInMessage(message);
|
||||
console.warn(message);
|
||||
let payloadData = {
|
||||
"username": "Admin Event",
|
||||
"content": message,
|
||||
};
|
||||
message = removeColoursInMessage(message);
|
||||
console.warn(message);
|
||||
let payloadData = {
|
||||
"username": "Admin Event",
|
||||
"content": message,
|
||||
};
|
||||
|
||||
triggerWebHook(getServerConfig().discordConfig.adminChannelWebHookURL, JSON.stringify(payloadData));
|
||||
triggerWebHook(getServerConfig().discordConfig.adminChannelWebHookURL, JSON.stringify(payloadData));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messageDiscordEventChannel(message) {
|
||||
if(!getServerConfig().discordConfig.sendEvents) {
|
||||
return false;
|
||||
}
|
||||
if(!getServerConfig().discordConfig.sendEvents) {
|
||||
return false;
|
||||
}
|
||||
|
||||
message = removeColoursInMessage(message);
|
||||
console.warn(message);
|
||||
let payloadData = {
|
||||
"username": "Event",
|
||||
"content": message,
|
||||
};
|
||||
message = removeColoursInMessage(message);
|
||||
console.warn(message);
|
||||
let payloadData = {
|
||||
"username": "Event",
|
||||
"content": message,
|
||||
};
|
||||
|
||||
triggerWebHook(getServerConfig().discordConfig.eventChannelWebHookURL, JSON.stringify(payloadData));
|
||||
triggerWebHook(getServerConfig().discordConfig.eventChannelWebHookURL, JSON.stringify(payloadData));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -30,10 +30,10 @@ function playerPayDay(client) {
|
||||
let wealth = calculateWealth(client);
|
||||
let grossIncome = getPlayerData(client).payDayAmount;
|
||||
|
||||
// Passive income
|
||||
// Passive income
|
||||
grossIncome = grossIncome + getGlobalConfig().economy.passiveIncomePerPayDay;
|
||||
|
||||
// Payday bonus
|
||||
// Payday bonus
|
||||
grossIncome = grossIncome*getGlobalConfig().economy.grossIncomeMultiplier;
|
||||
|
||||
let incomeTaxAmount = calculateIncomeTax(wealth);
|
||||
@@ -120,12 +120,12 @@ function setPayDayBonusMultiplier(command, params, client) {
|
||||
|
||||
let newMultiplier = params;
|
||||
|
||||
if(isNaN(newMultiplier)) {
|
||||
messagePlayerError(client, getLocaleString(client, "AmountNotNumber"));
|
||||
return false;
|
||||
}
|
||||
if(isNaN(newMultiplier)) {
|
||||
messagePlayerError(client, getLocaleString(client, "AmountNotNumber"));
|
||||
return false;
|
||||
}
|
||||
|
||||
getGlobalConfig().economy.grossIncomeMultiplier = newMultiplier;
|
||||
getGlobalConfig().economy.grossIncomeMultiplier = newMultiplier;
|
||||
|
||||
messageAdminAction(`${client.name} set payday bonus to ${newMultiplier*100}%`);
|
||||
}
|
||||
|
||||
@@ -8,47 +8,47 @@
|
||||
// ===========================================================================
|
||||
|
||||
function initEmailScript() {
|
||||
if(!checkForSMTPModule()) {
|
||||
return false;
|
||||
}
|
||||
if(!checkForSMTPModule()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_INFO, "[VRR.Email]: Initializing email script ...");
|
||||
emailConfig = loadEmailConfiguration();
|
||||
emailConfig = loadEmailConfiguration();
|
||||
logToConsole(LOG_INFO, "[VRR.Email]: Email script initialized successfully!");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendEmail(toEmail, toName, subject, body) {
|
||||
if(!checkForSMTPModule()) {
|
||||
return false;
|
||||
}
|
||||
if(!checkForSMTPModule()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
module.smtp.send(
|
||||
getEmailConfig().smtp.host,
|
||||
getEmailConfig().smtp.port,
|
||||
intToBool(getEmailConfig().smtp.useTLS),
|
||||
getEmailConfig().smtp.username,
|
||||
getEmailConfig().smtp.password,
|
||||
toEmail,
|
||||
toName,
|
||||
subject,
|
||||
body,
|
||||
getEmailConfig().smtp.from,
|
||||
getEmailConfig().smtp.fromName);
|
||||
module.smtp.send(
|
||||
getEmailConfig().smtp.host,
|
||||
getEmailConfig().smtp.port,
|
||||
intToBool(getEmailConfig().smtp.useTLS),
|
||||
getEmailConfig().smtp.username,
|
||||
getEmailConfig().smtp.password,
|
||||
toEmail,
|
||||
toName,
|
||||
subject,
|
||||
body,
|
||||
getEmailConfig().smtp.from,
|
||||
getEmailConfig().smtp.fromName);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadEmailConfiguration() {
|
||||
let emailConfigFile = loadTextFile("config/email.json");
|
||||
let emailConfigFile = loadTextFile("config/email.json");
|
||||
return JSON.parse(emailConfigFile);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getEmailConfig() {
|
||||
return emailConfig;
|
||||
return emailConfig;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -8,60 +8,60 @@
|
||||
// ===========================================================================
|
||||
|
||||
function initEventScript() {
|
||||
logToConsole(LOG_INFO, "[VRR.Event]: Initializing event script ...");
|
||||
addAllEventHandlers();
|
||||
logToConsole(LOG_INFO, "[VRR.Event]: Event script initialized!");
|
||||
logToConsole(LOG_INFO, "[VRR.Event]: Initializing event script ...");
|
||||
addAllEventHandlers();
|
||||
logToConsole(LOG_INFO, "[VRR.Event]: Event script initialized!");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function addAllEventHandlers() {
|
||||
addEventHandler("onResourceStart", onResourceStart);
|
||||
addEventHandler("onResourceStop", onResourceStop);
|
||||
addEventHandler("onServerStop", onResourceStop);
|
||||
addEventHandler("onResourceStart", onResourceStart);
|
||||
addEventHandler("onResourceStop", onResourceStop);
|
||||
addEventHandler("onServerStop", onResourceStop);
|
||||
|
||||
addEventHandler("onProcess", onProcess);
|
||||
addEventHandler("onEntityProcess", onEntityProcess);
|
||||
addEventHandler("onProcess", onProcess);
|
||||
addEventHandler("onEntityProcess", onEntityProcess);
|
||||
|
||||
addEventHandler("onPlayerConnect", onPlayerConnect);
|
||||
addEventHandler("onPlayerJoin", onPlayerJoin);
|
||||
addEventHandler("onPlayerJoined", onPlayerJoined);
|
||||
addEventHandler("onPlayerChat", onPlayerChat);
|
||||
addEventHandler("onPlayerQuit", onPlayerQuit);
|
||||
addEventHandler("onElementStreamIn", onElementStreamIn);
|
||||
addEventHandler("onElementStreamOut", onElementStreamOut);
|
||||
addEventHandler("onPlayerConnect", onPlayerConnect);
|
||||
addEventHandler("onPlayerJoin", onPlayerJoin);
|
||||
addEventHandler("onPlayerJoined", onPlayerJoined);
|
||||
addEventHandler("onPlayerChat", onPlayerChat);
|
||||
addEventHandler("onPlayerQuit", onPlayerQuit);
|
||||
addEventHandler("onElementStreamIn", onElementStreamIn);
|
||||
addEventHandler("onElementStreamOut", onElementStreamOut);
|
||||
|
||||
addEventHandler("onPedSpawn", onPedSpawn);
|
||||
addEventHandler("onPedEnterVehicle", onPedEnteringVehicle);
|
||||
addEventHandler("onPedExitVehicle", onPedExitingVehicle);
|
||||
addEventHandler("onPedSpawn", onPedSpawn);
|
||||
addEventHandler("onPedEnterVehicle", onPedEnteringVehicle);
|
||||
addEventHandler("onPedExitVehicle", onPedExitingVehicle);
|
||||
|
||||
addEventHandler("onPedEnteringVehicle", onPedEnteringVehicle);
|
||||
addEventHandler("onPedExitingVehicle", onPedExitingVehicle);
|
||||
addEventHandler("onPedEnteringVehicle", onPedEnteringVehicle);
|
||||
addEventHandler("onPedExitingVehicle", onPedExitingVehicle);
|
||||
|
||||
addEventHandler("OnPlayerCommand", onPlayerCommand);
|
||||
addEventHandler("OnPlayerCommand", onPlayerCommand);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onPlayerConnect(event, ipAddress, port) {
|
||||
logToConsole(LOG_INFO, `[VRR.Event] Client connecting (IP: ${ipAddress})`);
|
||||
//if(isIpAddressBanned(ipAddress)) {
|
||||
// messagePlayerError(client, "You are banned from this server!");
|
||||
// return false;
|
||||
//}
|
||||
logToConsole(LOG_INFO, `[VRR.Event] Client connecting (IP: ${ipAddress})`);
|
||||
//if(isIpAddressBanned(ipAddress)) {
|
||||
// messagePlayerError(client, "You are banned from this server!");
|
||||
// return false;
|
||||
//}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
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()) {
|
||||
fadeCamera(client, true, 1.0);
|
||||
}
|
||||
if(isFadeCameraSupported()) {
|
||||
fadeCamera(client, true, 1.0);
|
||||
}
|
||||
|
||||
messageAdmins(`${client.name} is joining the server ...`);
|
||||
//messageDiscordEventChannel(`👋 ${getPlayerDisplayForConsole(client)} has joined the server.`);
|
||||
messageAdmins(`${client.name} is joining the server ...`);
|
||||
//messageDiscordEventChannel(`👋 ${getPlayerDisplayForConsole(client)} has joined the server.`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -73,16 +73,16 @@ function onPlayerJoined(event, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function onElementStreamIn(event, element, client) {
|
||||
//if(getPlayerDimension(client) != getElementDimension(element)) {
|
||||
// event.preventDefault();
|
||||
//}
|
||||
//if(getPlayerDimension(client) != getElementDimension(element)) {
|
||||
// event.preventDefault();
|
||||
//}
|
||||
|
||||
if(getPlayerData(getClientFromIndex(element.owner)) != false ) {
|
||||
if(hasBitFlag(getPlayerData(getClientFromIndex(element.owner)).accountData.flags.moderation, getModerationFlagValue("DontSyncClientElements"))) {
|
||||
event.preventDefault();
|
||||
destroyGameElement(element);
|
||||
}
|
||||
}
|
||||
if(getPlayerData(getClientFromIndex(element.owner)) != false ) {
|
||||
if(hasBitFlag(getPlayerData(getClientFromIndex(element.owner)).accountData.flags.moderation, getModerationFlagValue("DontSyncClientElements"))) {
|
||||
event.preventDefault();
|
||||
destroyGameElement(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -94,43 +94,43 @@ function onElementStreamOut(event, element, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function onPlayerQuit(event, client, quitReasonId) {
|
||||
logToConsole(LOG_INFO, `👋 Client ${getPlayerDisplayForConsole(client)} disconnected (${disconnectReasons[quitReasonId]}[${quitReasonId}])`);
|
||||
updateConnectionLogOnQuit(client, quitReasonId);
|
||||
logToConsole(LOG_INFO, `👋 Client ${getPlayerDisplayForConsole(client)} disconnected (${disconnectReasons[quitReasonId]}[${quitReasonId}])`);
|
||||
updateConnectionLogOnQuit(client, quitReasonId);
|
||||
|
||||
if(isPlayerLoggedIn(client)) {
|
||||
let reasonText = disconnectReasons[quitReasonId];
|
||||
if(getPlayerData(client).customDisconnectReason != "") {
|
||||
reasonText = getPlayerData(client).customDisconnectReason;
|
||||
}
|
||||
messagePlayerNormal(null, `👋 ${getPlayerName(client)} has left the server (${reasonText})`, getColourByName("softYellow"));
|
||||
savePlayerToDatabase(client);
|
||||
resetClientStuff(client);
|
||||
getServerData().clients[client.index] = null;
|
||||
}
|
||||
if(isPlayerLoggedIn(client)) {
|
||||
let reasonText = disconnectReasons[quitReasonId];
|
||||
if(getPlayerData(client).customDisconnectReason != "") {
|
||||
reasonText = getPlayerData(client).customDisconnectReason;
|
||||
}
|
||||
messagePlayerNormal(null, `👋 ${getPlayerName(client)} has left the server (${reasonText})`, getColourByName("softYellow"));
|
||||
savePlayerToDatabase(client);
|
||||
resetClientStuff(client);
|
||||
getServerData().clients[client.index] = null;
|
||||
}
|
||||
|
||||
messageDiscordEventChannel(`👋 ${getPlayerDisplayForConsole(client)} has left the server.`);
|
||||
messageDiscordEventChannel(`👋 ${getPlayerDisplayForConsole(client)} has left the server.`);
|
||||
|
||||
clearTemporaryVehicles();
|
||||
clearTemporaryPeds();
|
||||
clearTemporaryVehicles();
|
||||
clearTemporaryPeds();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
async function onPlayerChat(event, client, messageText) {
|
||||
event.preventDefault();
|
||||
event.preventDefault();
|
||||
|
||||
processPlayerChat(client, messageText);
|
||||
processPlayerChat(client, messageText);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onProcess(event, deltaTime) {
|
||||
updateServerGameTime();
|
||||
//checkPlayerSpawning();
|
||||
//checkPlayerPedState();
|
||||
//checkVehicleBurning();
|
||||
updateServerGameTime();
|
||||
//checkPlayerSpawning();
|
||||
//checkPlayerPedState();
|
||||
//checkVehicleBurning();
|
||||
|
||||
processVehiclePurchasing();
|
||||
processVehiclePurchasing();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -141,89 +141,89 @@ function onEntityProcess(event, entity) {
|
||||
// ===========================================================================
|
||||
|
||||
function onPedEnteringVehicle(event, ped, vehicle, seat) {
|
||||
if(ped.isType(ELEMENT_PLAYER)) {
|
||||
let client = getClientFromPlayerElement(ped);
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_ENTERINGVEHICLE;
|
||||
if(ped.isType(ELEMENT_PLAYER)) {
|
||||
let client = getClientFromPlayerElement(ped);
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_ENTERINGVEHICLE;
|
||||
|
||||
if(!getVehicleData(vehicle)) {
|
||||
return false;
|
||||
}
|
||||
if(!getVehicleData(vehicle)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getVehicleData(vehicle).locked) {
|
||||
if(doesPlayerHaveVehicleKeys(client, vehicle)) {
|
||||
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.`);
|
||||
} else {
|
||||
messagePlayerNormal(client, `🔒 This ${getVehicleName(vehicle)} is locked. Use /lock to unlock it`);
|
||||
}
|
||||
} else {
|
||||
messagePlayerNormal(client, `🔒 This ${getVehicleName(vehicle)} is locked and you don't have the keys to unlock it`);
|
||||
}
|
||||
if(getVehicleData(vehicle).locked) {
|
||||
if(doesPlayerHaveVehicleKeys(client, vehicle)) {
|
||||
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.`);
|
||||
} else {
|
||||
messagePlayerNormal(client, `🔒 This ${getVehicleName(vehicle)} is locked. Use /lock to unlock it`);
|
||||
}
|
||||
} else {
|
||||
messagePlayerNormal(client, `🔒 This ${getVehicleName(vehicle)} is locked and you don't have the keys to unlock it`);
|
||||
}
|
||||
|
||||
getPlayerData(client).enteringVehicle = null;
|
||||
makePlayerStopAnimation(client);
|
||||
return false;
|
||||
}
|
||||
getPlayerData(client).enteringVehicle = null;
|
||||
makePlayerStopAnimation(client);
|
||||
return false;
|
||||
}
|
||||
|
||||
getPlayerData(client).enteringVehicle = vehicle;
|
||||
}
|
||||
getPlayerData(client).enteringVehicle = vehicle;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onPedExitingVehicle(event, ped, vehicle) {
|
||||
if(!getVehicleData(vehicle)) {
|
||||
return false;
|
||||
}
|
||||
if(!getVehicleData(vehicle)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(ped.isType(ELEMENT_PLAYER)) {
|
||||
let client = getClientFromPlayerElement(ped);
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_EXITINGVEHICLE;
|
||||
}
|
||||
if(ped.isType(ELEMENT_PLAYER)) {
|
||||
let client = getClientFromPlayerElement(ped);
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_EXITINGVEHICLE;
|
||||
}
|
||||
|
||||
if(!getVehicleData(vehicle).spawnLocked) {
|
||||
getVehicleData(vehicle).spawnPosition = getVehiclePosition(vehicle);
|
||||
getVehicleData(vehicle).spawnRotation = getVehicleHeading(vehicle);
|
||||
getVehicleData(vehicle).needsSaved = true;
|
||||
}
|
||||
if(!getVehicleData(vehicle).spawnLocked) {
|
||||
getVehicleData(vehicle).spawnPosition = getVehiclePosition(vehicle);
|
||||
getVehicleData(vehicle).spawnRotation = getVehicleHeading(vehicle);
|
||||
getVehicleData(vehicle).needsSaved = true;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onResourceStart(event, resource) {
|
||||
logToConsole(LOG_WARN, `[VRR.Event] ${resource.name} started!`);
|
||||
logToConsole(LOG_WARN, `[VRR.Event] ${resource.name} started!`);
|
||||
|
||||
if(resource != thisResource) {
|
||||
messageAdmins(`{MAINCOLOUR}Resource {ALTCOLOUR}${resource.name} {MAINCOLOUR}started!`);
|
||||
}
|
||||
if(resource != thisResource) {
|
||||
messageAdmins(`{MAINCOLOUR}Resource {ALTCOLOUR}${resource.name} {MAINCOLOUR}started!`);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onResourceStop(event, resource) {
|
||||
logToConsole(LOG_WARN, `[VRR.Event] ${resource.name} stopped!`);
|
||||
logToConsole(LOG_WARN, `[VRR.Event] ${resource.name} stopped!`);
|
||||
|
||||
if(resource != thisResource) {
|
||||
messageAdmins(`{MAINCOLOUR}Resource {ALTCOLOUR}${resource.name} {MAINCOLOUR}stopped!`);
|
||||
}
|
||||
if(resource != thisResource) {
|
||||
messageAdmins(`{MAINCOLOUR}Resource {ALTCOLOUR}${resource.name} {MAINCOLOUR}stopped!`);
|
||||
}
|
||||
|
||||
if(resource == thisResource) {
|
||||
saveAllServerDataToDatabase();
|
||||
clearArray(getServerData().vehicles);
|
||||
clearArray(getServerData().clients);
|
||||
clearArray(getServerData().businesses);
|
||||
clearArray(getServerData().houses);
|
||||
clearArray(getServerData().factions);
|
||||
clearArray(getServerData().jobs);
|
||||
clearArray(getServerData().clans);
|
||||
clearArray(getServerData().items);
|
||||
clearArray(getServerData().itemTypes);
|
||||
clearArray(getServerData().groundItemCache);
|
||||
clearArray(getServerData().groundPlantCache);
|
||||
kickAllClients();
|
||||
}
|
||||
if(resource == thisResource) {
|
||||
saveAllServerDataToDatabase();
|
||||
clearArray(getServerData().vehicles);
|
||||
clearArray(getServerData().clients);
|
||||
clearArray(getServerData().businesses);
|
||||
clearArray(getServerData().houses);
|
||||
clearArray(getServerData().factions);
|
||||
clearArray(getServerData().jobs);
|
||||
clearArray(getServerData().clans);
|
||||
clearArray(getServerData().items);
|
||||
clearArray(getServerData().itemTypes);
|
||||
clearArray(getServerData().groundItemCache);
|
||||
clearArray(getServerData().groundPlantCache);
|
||||
kickAllClients();
|
||||
}
|
||||
|
||||
collectAllGarbage();
|
||||
collectAllGarbage();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -241,184 +241,184 @@ function onPlayerExitedSphere(client, sphere) {
|
||||
// ===========================================================================
|
||||
|
||||
async function onPlayerEnteredVehicle(client, clientVehicle, seat) {
|
||||
if(client == null) {
|
||||
return false;
|
||||
}
|
||||
if(client == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let vehicle = null;
|
||||
let vehicle = null;
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
vehicle = getVehicleFromIVNetworkId(clientVehicle);
|
||||
} else {
|
||||
if(client.player == null) {
|
||||
return false;
|
||||
}
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
vehicle = getVehicleFromIVNetworkId(clientVehicle);
|
||||
} else {
|
||||
if(client.player == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
await waitUntil(() => client != null && client.player != null && client.player.vehicle != null);
|
||||
await waitUntil(() => client != null && client.player != null && client.player.vehicle != null);
|
||||
|
||||
vehicle = client.player.vehicle;
|
||||
}
|
||||
vehicle = client.player.vehicle;
|
||||
}
|
||||
|
||||
if(!getVehicleData(vehicle)) {
|
||||
return false;
|
||||
}
|
||||
if(!getVehicleData(vehicle)) {
|
||||
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;
|
||||
getVehicleData(vehicle).lastActiveTime = getCurrentUnixTimestamp();
|
||||
getPlayerData(client).lastVehicle = vehicle;
|
||||
getVehicleData(vehicle).lastActiveTime = getCurrentUnixTimestamp();
|
||||
|
||||
if(getPlayerVehicleSeat(client) == VRR_VEHSEAT_DRIVER) {
|
||||
vehicle.engine = getVehicleData(vehicle).engine;
|
||||
if(getPlayerVehicleSeat(client) == VRR_VEHSEAT_DRIVER) {
|
||||
vehicle.engine = getVehicleData(vehicle).engine;
|
||||
|
||||
if(getVehicleData(vehicle).buyPrice > 0) {
|
||||
messagePlayerAlert(client, getLocaleString(client, "VehicleForSale", getVehicleName(vehicle), `{ALTCOLOUR}$${makeLargeNumberReadable(getVehicleData(vehicle).buyPrice)}{MAINCOLOUR}`, `{ALTCOLOUR}/vehbuy{MAINCOLOUR}`));
|
||||
resetVehiclePosition(vehicle);
|
||||
} else if(getVehicleData(vehicle).rentPrice > 0) {
|
||||
if(getVehicleData(vehicle).rentedBy != client) {
|
||||
messagePlayerAlert(client, getLocaleString(client, "VehicleForRent", getVehicleName(vehicle), `{ALTCOLOUR}$${makeLargeNumberReadable(getVehicleData(vehicle).rentPrice)}{MAINCOLOUR}`, `{ALTCOLOUR}/vehrent{MAINCOLOUR}`));
|
||||
resetVehiclePosition(vehicle);
|
||||
} 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.`);
|
||||
}
|
||||
} else {
|
||||
let ownerName = "Nobody";
|
||||
let ownerType = "None";
|
||||
ownerType = toLowerCase(getVehicleOwnerTypeText(getVehicleData(vehicle).ownerType));
|
||||
switch(getVehicleData(vehicle).ownerType) {
|
||||
case VRR_VEHOWNER_CLAN:
|
||||
ownerName = getClanData(getClanIdFromDatabaseId(getVehicleData(vehicle).ownerId)).name;
|
||||
ownerType = "clan";
|
||||
break;
|
||||
if(getVehicleData(vehicle).buyPrice > 0) {
|
||||
messagePlayerAlert(client, getLocaleString(client, "VehicleForSale", getVehicleName(vehicle), `{ALTCOLOUR}$${makeLargeNumberReadable(getVehicleData(vehicle).buyPrice)}{MAINCOLOUR}`, `{ALTCOLOUR}/vehbuy{MAINCOLOUR}`));
|
||||
resetVehiclePosition(vehicle);
|
||||
} else if(getVehicleData(vehicle).rentPrice > 0) {
|
||||
if(getVehicleData(vehicle).rentedBy != client) {
|
||||
messagePlayerAlert(client, getLocaleString(client, "VehicleForRent", getVehicleName(vehicle), `{ALTCOLOUR}$${makeLargeNumberReadable(getVehicleData(vehicle).rentPrice)}{MAINCOLOUR}`, `{ALTCOLOUR}/vehrent{MAINCOLOUR}`));
|
||||
resetVehiclePosition(vehicle);
|
||||
} 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.`);
|
||||
}
|
||||
} else {
|
||||
let ownerName = "Nobody";
|
||||
let ownerType = "None";
|
||||
ownerType = toLowerCase(getVehicleOwnerTypeText(getVehicleData(vehicle).ownerType));
|
||||
switch(getVehicleData(vehicle).ownerType) {
|
||||
case VRR_VEHOWNER_CLAN:
|
||||
ownerName = getClanData(getClanIdFromDatabaseId(getVehicleData(vehicle).ownerId)).name;
|
||||
ownerType = "clan";
|
||||
break;
|
||||
|
||||
case VRR_VEHOWNER_JOB:
|
||||
ownerName = getJobData(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)).name;
|
||||
ownerType = "job";
|
||||
break;
|
||||
case VRR_VEHOWNER_JOB:
|
||||
ownerName = getJobData(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)).name;
|
||||
ownerType = "job";
|
||||
break;
|
||||
|
||||
case VRR_VEHOWNER_PLAYER:
|
||||
let subAccountData = loadSubAccountFromId(getVehicleData(vehicle).ownerId);
|
||||
ownerName = `${subAccountData.firstName} ${subAccountData.lastName}`;
|
||||
ownerType = "player";
|
||||
break;
|
||||
case VRR_VEHOWNER_PLAYER:
|
||||
let subAccountData = loadSubAccountFromId(getVehicleData(vehicle).ownerId);
|
||||
ownerName = `${subAccountData.firstName} ${subAccountData.lastName}`;
|
||||
ownerType = "player";
|
||||
break;
|
||||
|
||||
case VRR_VEHOWNER_BIZ:
|
||||
ownerName = getBusinessData(getVehicleData(vehicle).ownerId).name;
|
||||
ownerType = "business";
|
||||
break;
|
||||
case VRR_VEHOWNER_BIZ:
|
||||
ownerName = getBusinessData(getVehicleData(vehicle).ownerId).name;
|
||||
ownerType = "business";
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
messagePlayerAlert(client, `This ${getVehicleName(vehicle)} belongs to {ALTCOLOUR}${ownerName} (${ownerType})`);
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
messagePlayerAlert(client, `This ${getVehicleName(vehicle)} belongs to {ALTCOLOUR}${ownerName} (${ownerType})`);
|
||||
}
|
||||
|
||||
if(!getVehicleData(vehicle).engine) {
|
||||
if(getVehicleData(vehicle).buyPrice == 0 && getVehicleData(vehicle).rentPrice == 0) {
|
||||
if(doesPlayerHaveVehicleKeys(client, vehicle)) {
|
||||
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.`);
|
||||
} else {
|
||||
messagePlayerAlert(client, `This ${getVehicleName(vehicle)}'s engine is off. Use /engine to start it`);
|
||||
}
|
||||
} else {
|
||||
messagePlayerAlert(client, `This ${getVehicleName(vehicle)}'s engine is off and you don't have the keys to start it`);
|
||||
if(!getVehicleData(vehicle).engine) {
|
||||
if(getVehicleData(vehicle).buyPrice == 0 && getVehicleData(vehicle).rentPrice == 0) {
|
||||
if(doesPlayerHaveVehicleKeys(client, vehicle)) {
|
||||
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.`);
|
||||
} else {
|
||||
messagePlayerAlert(client, `This ${getVehicleName(vehicle)}'s engine is off. Use /engine to start it`);
|
||||
}
|
||||
} else {
|
||||
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(getVehicleData(vehicle).ownerType == VRR_VEHOWNER_JOB) {
|
||||
if(getVehicleData(vehicle).ownerId == getPlayerCurrentSubAccount(client).job) {
|
||||
getPlayerCurrentSubAccount(client).lastJobVehicle = vehicle;
|
||||
messagePlayerInfo(client, `Use /startroute to start working in this vehicle`);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(isPlayerWorking(client)) {
|
||||
if(getVehicleData(vehicle).ownerType == VRR_VEHOWNER_JOB) {
|
||||
if(getVehicleData(vehicle).ownerId == getPlayerCurrentSubAccount(client).job) {
|
||||
getPlayerCurrentSubAccount(client).lastJobVehicle = vehicle;
|
||||
messagePlayerInfo(client, `Use /startroute to start working in this vehicle`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(isPlayerWorking(client)) {
|
||||
if(isPlayerOnJobRoute(client)) {
|
||||
if(vehicle == getPlayerJobRouteVehicle(client)) {
|
||||
stopReturnToJobVehicleCountdown(client);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(isPlayerWorking(client)) {
|
||||
if(isPlayerOnJobRoute(client)) {
|
||||
if(vehicle == getPlayerJobRouteVehicle(client)) {
|
||||
stopReturnToJobVehicleCountdown(client);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(getVehicleData(vehicle).streamingRadioStation != -1) {
|
||||
if(getPlayerData(client).streamingRadioStation != getVehicleData(vehicle).streamingRadioStation) {
|
||||
playRadioStreamForPlayer(client, radioStations[getVehicleData(vehicle).streamingRadioStation].url, true, getPlayerStreamingRadioVolume(client));
|
||||
}
|
||||
}
|
||||
if(getVehicleData(vehicle).streamingRadioStation != -1) {
|
||||
if(getPlayerData(client).streamingRadioStation != getVehicleData(vehicle).streamingRadioStation) {
|
||||
playRadioStreamForPlayer(client, radioStations[getVehicleData(vehicle).streamingRadioStation].url, true, getPlayerStreamingRadioVolume(client));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onPlayerExitedVehicle(client, vehicle) {
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
||||
|
||||
stopRadioStreamForPlayer(client);
|
||||
stopRadioStreamForPlayer(client);
|
||||
|
||||
if(!getVehicleData(vehicle)) {
|
||||
return false;
|
||||
}
|
||||
if(!getVehicleData(vehicle)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(isPlayerWorking(client)) {
|
||||
if(isPlayerOnJobRoute(client)) {
|
||||
if(vehicle == getPlayerJobRouteVehicle(client)) {
|
||||
startReturnToJobVehicleCountdown(client);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(isPlayerWorking(client)) {
|
||||
if(isPlayerOnJobRoute(client)) {
|
||||
if(vehicle == getPlayerJobRouteVehicle(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) {
|
||||
logToConsole(LOG_INFO, `${getPlayerDisplayForConsole(client)} died.`);
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_DEAD;
|
||||
logToConsole(LOG_INFO, `${getPlayerDisplayForConsole(client)} died.`);
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_DEAD;
|
||||
updatePlayerSpawnedState(client, false);
|
||||
setPlayerControlState(client, false);
|
||||
setPlayerControlState(client, false);
|
||||
setTimeout(function() {
|
||||
if(isFadeCameraSupported()) {
|
||||
fadeCamera(client, false, 1.0);
|
||||
}
|
||||
if(isFadeCameraSupported()) {
|
||||
fadeCamera(client, false, 1.0);
|
||||
}
|
||||
setTimeout(function() {
|
||||
if(getPlayerCurrentSubAccount(client).inJail) {
|
||||
let closestJail = getClosestPoliceStation(getPlayerPosition(client));
|
||||
client.despawnPlayer();
|
||||
getPlayerCurrentSubAccount(client).interior = closestJail.interior;
|
||||
getPlayerCurrentSubAccount(client).dimension = closestJail.dimension;
|
||||
spawnPlayer(client, closestJail.position, closestJail.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
||||
let closestJail = getClosestPoliceStation(getPlayerPosition(client));
|
||||
client.despawnPlayer();
|
||||
getPlayerCurrentSubAccount(client).interior = closestJail.interior;
|
||||
getPlayerCurrentSubAccount(client).dimension = closestJail.dimension;
|
||||
spawnPlayer(client, closestJail.position, closestJail.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
||||
|
||||
if(isFadeCameraSupported()) {
|
||||
fadeCamera(client, true, 1.0);
|
||||
}
|
||||
updatePlayerSpawnedState(client, true);
|
||||
makePlayerStopAnimation(client);
|
||||
setPlayerControlState(client, true);
|
||||
if(isFadeCameraSupported()) {
|
||||
fadeCamera(client, true, 1.0);
|
||||
}
|
||||
updatePlayerSpawnedState(client, true);
|
||||
makePlayerStopAnimation(client);
|
||||
setPlayerControlState(client, true);
|
||||
} else {
|
||||
let closestHospital = getClosestHospital(getPlayerPosition(client));
|
||||
client.despawnPlayer();
|
||||
getPlayerCurrentSubAccount(client).interior = closestHospital.interior;
|
||||
getPlayerCurrentSubAccount(client).dimension = closestHospital.dimension;
|
||||
spawnPlayer(client, closestHospital.position, closestHospital.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
||||
let closestHospital = getClosestHospital(getPlayerPosition(client));
|
||||
client.despawnPlayer();
|
||||
getPlayerCurrentSubAccount(client).interior = closestHospital.interior;
|
||||
getPlayerCurrentSubAccount(client).dimension = closestHospital.dimension;
|
||||
spawnPlayer(client, closestHospital.position, closestHospital.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
||||
|
||||
if(isFadeCameraSupported()) {
|
||||
fadeCamera(client, true, 1.0);
|
||||
}
|
||||
|
||||
updatePlayerSpawnedState(client, true);
|
||||
makePlayerStopAnimation(client);
|
||||
setPlayerControlState(client, true);
|
||||
if(isFadeCameraSupported()) {
|
||||
fadeCamera(client, true, 1.0);
|
||||
}
|
||||
|
||||
updatePlayerSpawnedState(client, true);
|
||||
makePlayerStopAnimation(client);
|
||||
setPlayerControlState(client, true);
|
||||
}
|
||||
}, 2000);
|
||||
}, 1000);
|
||||
@@ -427,179 +427,179 @@ function onPlayerDeath(client, position) {
|
||||
// ===========================================================================
|
||||
|
||||
function onPedSpawn(ped) {
|
||||
if(ped.type == ELEMENT_PLAYER) {
|
||||
//setTimeout(onPlayerSpawn, 250, ped);
|
||||
onPlayerSpawn();
|
||||
}
|
||||
if(ped.type == ELEMENT_PLAYER) {
|
||||
//setTimeout(onPlayerSpawn, 250, ped);
|
||||
onPlayerSpawn();
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onPlayerSpawn(client) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Checking for ${getPlayerDisplayForConsole(client)}'s player ped`);
|
||||
//if(client.player == null) {
|
||||
// logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player element not set yet. Rechecking ...`);
|
||||
// setTimeout(onPlayerSpawn, 500, client);
|
||||
// return false;
|
||||
//}
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Checking for ${getPlayerDisplayForConsole(client)}'s player ped`);
|
||||
//if(client.player == null) {
|
||||
// logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player element not set yet. Rechecking ...`);
|
||||
// setTimeout(onPlayerSpawn, 500, client);
|
||||
// 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`);
|
||||
if(!getPlayerData(client)) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player data is invalid. Kicking them from server.`);
|
||||
client.disconnect();
|
||||
return false;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s player data`);
|
||||
if(!getPlayerData(client)) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player data is invalid. Kicking them from server.`);
|
||||
client.disconnect();
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s login status`);
|
||||
if(!getPlayerData(client).loggedIn) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} is NOT logged in. Despawning their player.`);
|
||||
client.disconnect();
|
||||
return false;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s login status`);
|
||||
if(!getPlayerData(client).loggedIn) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} is NOT logged in. Despawning their player.`);
|
||||
client.disconnect();
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s selected character status`);
|
||||
if(getPlayerData(client).currentSubAccount == -1) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} has NOT selected a character. Despawning their player.`);
|
||||
client.disconnect();
|
||||
return false;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s selected character status`);
|
||||
if(getPlayerData(client).currentSubAccount == -1) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} has NOT selected a character. Despawning their player.`);
|
||||
client.disconnect();
|
||||
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) {
|
||||
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.bodyProps", getPlayerCurrentSubAccount(client).bodyProps, true);
|
||||
}
|
||||
if(getServerGame() == VRR_GAME_GTA_IV) {
|
||||
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.bodyProps", getPlayerCurrentSubAccount(client).bodyProps, true);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped scale (${getPlayerCurrentSubAccount(client).pedScale})`);
|
||||
setEntityData(client.player, "vrr.scale", getPlayerCurrentSubAccount(client).pedScale, true);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped scale (${getPlayerCurrentSubAccount(client).pedScale})`);
|
||||
setEntityData(client.player, "vrr.scale", getPlayerCurrentSubAccount(client).pedScale, true);
|
||||
|
||||
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'`);
|
||||
return false;
|
||||
}
|
||||
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'`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(isCustomCameraSupported()) {
|
||||
restorePlayerCamera(client);
|
||||
}
|
||||
if(isCustomCameraSupported()) {
|
||||
restorePlayerCamera(client);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Storing ${getPlayerDisplayForConsole(client)} ped in client data `);
|
||||
if(areServerElementsSupported()) {
|
||||
getPlayerData(client).ped = client.player;
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Storing ${getPlayerDisplayForConsole(client)} ped in client data `);
|
||||
if(areServerElementsSupported()) {
|
||||
getPlayerData(client).ped = client.player;
|
||||
}
|
||||
|
||||
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"));
|
||||
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"));
|
||||
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"));
|
||||
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"));
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Updating spawned state for ${getPlayerDisplayForConsole(client)} to true`);
|
||||
updatePlayerSpawnedState(client, true);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Updating spawned state for ${getPlayerDisplayForConsole(client)} to true`);
|
||||
updatePlayerSpawnedState(client, true);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting player interior for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).interior}`);
|
||||
setPlayerInterior(client, getPlayerCurrentSubAccount(client).interior);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting player interior for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).interior}`);
|
||||
setPlayerInterior(client, getPlayerCurrentSubAccount(client).interior);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting player dimension for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).dimension}`);
|
||||
setPlayerDimension(client, getPlayerCurrentSubAccount(client).dimension);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting player dimension for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).dimension}`);
|
||||
setPlayerDimension(client, getPlayerCurrentSubAccount(client).dimension);
|
||||
|
||||
//if(getPlayerCurrentSubAccount(client).interior != 0 || getPlayerCurrentSubAccount(client).dimension != 0) {
|
||||
// updateAllInteriorVehiclesForPlayer(client, getPlayerCurrentSubAccount(client).interior, getPlayerCurrentSubAccount(client).dimension);
|
||||
//}
|
||||
//if(getPlayerCurrentSubAccount(client).interior != 0 || getPlayerCurrentSubAccount(client).dimension != 0) {
|
||||
// updateAllInteriorVehiclesForPlayer(client, getPlayerCurrentSubAccount(client).interior, getPlayerCurrentSubAccount(client).dimension);
|
||||
//}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting player health for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).health}`);
|
||||
setPlayerHealth(client, getPlayerCurrentSubAccount(client).health);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting player health for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).health}`);
|
||||
setPlayerHealth(client, getPlayerCurrentSubAccount(client).health);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting player armour for ${getPlayerDisplayForConsole(client)} to ${getPlayerCurrentSubAccount(client).armour}`);
|
||||
setPlayerArmour(client, getPlayerCurrentSubAccount(client).armour);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting player armour for ${getPlayerDisplayForConsole(client)} to ${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))})`);
|
||||
sendPlayerJobType(client, getPlayerCurrentSubAccount(client).job);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Sending ${getPlayerDisplayForConsole(client)}'s job type to their client (${getJobIndexFromDatabaseId(getPlayerCurrentSubAccount(client))})`);
|
||||
sendPlayerJobType(client, getPlayerCurrentSubAccount(client).job);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Enabling all rendering states for ${getPlayerDisplayForConsole(client)}`);
|
||||
setPlayer2DRendering(client, true, true, true, true, true, true);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Enabling all rendering states for ${getPlayerDisplayForConsole(client)}`);
|
||||
setPlayer2DRendering(client, true, true, true, true, true, true);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Sending snow states to ${getPlayerDisplayForConsole(client)}`);
|
||||
if(isSnowSupported()) {
|
||||
updatePlayerSnowState(client);
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Sending snow states to ${getPlayerDisplayForConsole(client)}`);
|
||||
if(isSnowSupported()) {
|
||||
updatePlayerSnowState(client);
|
||||
}
|
||||
|
||||
if(areServerElementsSupported() && getServerGame() == VRR_GAME_GTA_SA) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting player walk and fightstyle for ${getPlayerDisplayForConsole(client)}`);
|
||||
setEntityData(client.player, "vrr.walkStyle", getPlayerCurrentSubAccount(client).walkStyle, true);
|
||||
if(areServerElementsSupported() && getServerGame() == VRR_GAME_GTA_SA) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting player walk and fightstyle for ${getPlayerDisplayForConsole(client)}`);
|
||||
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)}`);
|
||||
if(getServerConfig().showLogo && doesPlayerHaveLogoEnabled(client)) {
|
||||
updatePlayerShowLogoState(client, true);
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Updating logo state for ${getPlayerDisplayForConsole(client)}`);
|
||||
if(getServerConfig().showLogo && doesPlayerHaveLogoEnabled(client)) {
|
||||
updatePlayerShowLogoState(client, true);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Caching ${getPlayerDisplayForConsole(client)}'s hotbar items`);
|
||||
cachePlayerHotBarItems(client);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Caching ${getPlayerDisplayForConsole(client)}'s hotbar items`);
|
||||
cachePlayerHotBarItems(client);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Syncing ${getPlayerDisplayForConsole(client)}'s hotbar`);
|
||||
updatePlayerHotBar(client);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Syncing ${getPlayerDisplayForConsole(client)}'s hotbar`);
|
||||
updatePlayerHotBar(client);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s switchchar state to false`);
|
||||
getPlayerData(client).switchingCharacter = false;
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s switchchar state to false`);
|
||||
getPlayerData(client).switchingCharacter = false;
|
||||
|
||||
if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "enter")) {
|
||||
let keyId = getPlayerKeyBindForCommand(client, "enter");
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
|
||||
sendPlayerEnterPropertyKey(client, keyId.key);
|
||||
}
|
||||
if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(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)}`);
|
||||
sendPlayerEnterPropertyKey(client, keyId.key);
|
||||
}
|
||||
|
||||
//if(isGTAIV()) {
|
||||
// setEntityData(client.player, "vrr.bodyPartHair", getPlayerCurrentSubAccount(client).bodyParts.hair, 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.bodyPartLower", getPlayerCurrentSubAccount(client).bodyParts.lower, 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.bodyPartHead", getPlayerCurrentSubAccount(client).bodyProps.head, 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.bodyPartLeftWrist", getPlayerCurrentSubAccount(client).bodyProps.leftWrist, 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.bodyPartLeftFoot", getPlayerCurrentSubAccount(client).bodyProps.leftFoot, true);
|
||||
// setEntityData(client.player, "vrr.bodyPartRightFoot", getPlayerCurrentSubAccount(client).bodyProps.rightFoot, true);
|
||||
//}
|
||||
//if(isGTAIV()) {
|
||||
// setEntityData(client.player, "vrr.bodyPartHair", getPlayerCurrentSubAccount(client).bodyParts.hair, 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.bodyPartLower", getPlayerCurrentSubAccount(client).bodyParts.lower, 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.bodyPartHead", getPlayerCurrentSubAccount(client).bodyProps.head, 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.bodyPartLeftWrist", getPlayerCurrentSubAccount(client).bodyProps.leftWrist, 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.bodyPartLeftFoot", getPlayerCurrentSubAccount(client).bodyProps.leftFoot, true);
|
||||
// setEntityData(client.player, "vrr.bodyPartRightFoot", getPlayerCurrentSubAccount(client).bodyProps.rightFoot, true);
|
||||
//}
|
||||
|
||||
if(isGTAIV()) {
|
||||
//sendPlayerPedPartsAndProps(client);
|
||||
}
|
||||
if(isGTAIV()) {
|
||||
//sendPlayerPedPartsAndProps(client);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped state to ready`);
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped state to ready`);
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
||||
|
||||
if(areServerElementsSupported()) {
|
||||
syncPlayerProperties(client);
|
||||
//setTimeout(function() {
|
||||
// syncPlayerProperties(client);
|
||||
//}, 1000);
|
||||
}
|
||||
if(areServerElementsSupported()) {
|
||||
syncPlayerProperties(client);
|
||||
//setTimeout(function() {
|
||||
// syncPlayerProperties(client);
|
||||
//}, 1000);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Syncing ${getPlayerDisplayForConsole(client)}'s cash ${getPlayerCurrentSubAccount(client).cash}`);
|
||||
updatePlayerCash(client);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Syncing ${getPlayerDisplayForConsole(client)}'s cash ${getPlayerCurrentSubAccount(client).cash}`);
|
||||
updatePlayerCash(client);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Updating all player name tags`);
|
||||
updateAllPlayerNameTags();
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Updating all player name tags`);
|
||||
updateAllPlayerNameTags();
|
||||
|
||||
if(!areServerElementsSupported()) {
|
||||
sendAllBusinessesToPlayer(client);
|
||||
sendAllHousesToPlayer(client);
|
||||
sendAllJobsToPlayer(client);
|
||||
//sendAllVehiclesToPlayer(client);
|
||||
if(!areServerElementsSupported()) {
|
||||
sendAllBusinessesToPlayer(client);
|
||||
sendAllHousesToPlayer(client);
|
||||
sendAllJobsToPlayer(client);
|
||||
//sendAllVehiclesToPlayer(client);
|
||||
|
||||
requestPlayerPedNetworkId(client);
|
||||
}
|
||||
requestPlayerPedNetworkId(client);
|
||||
}
|
||||
|
||||
getPlayerData(client).payDayTickStart = sdl.ticks;
|
||||
getPlayerData(client).payDayTickStart = sdl.ticks;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -54,7 +54,7 @@ function doesPlayerHaveGateKeys(client, vehicle) {
|
||||
}
|
||||
}
|
||||
|
||||
if(gateData.ownerType == VRR_GATEOWNER_BUSINESS) {
|
||||
if(gateData.ownerType == VRR_GATEOWNER_BUSINESS) {
|
||||
if(doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageBusinesses"))) {
|
||||
return true;
|
||||
}
|
||||
@@ -64,7 +64,7 @@ function doesPlayerHaveGateKeys(client, vehicle) {
|
||||
}
|
||||
}
|
||||
|
||||
if(gateData.ownerType == VRR_GATEOWNER_HOUSE) {
|
||||
if(gateData.ownerType == VRR_GATEOWNER_HOUSE) {
|
||||
if(doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageHouses"))) {
|
||||
return true;
|
||||
}
|
||||
@@ -80,11 +80,11 @@ function doesPlayerHaveGateKeys(client, vehicle) {
|
||||
// ===========================================================================
|
||||
|
||||
function getGateData(gateId) {
|
||||
if(typeof getServerData().gates[gateId] != "undefined") {
|
||||
return getServerData().gates[gateId];
|
||||
}
|
||||
if(typeof getServerData().gates[gateId] != "undefined") {
|
||||
return getServerData().gates[gateId];
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -15,121 +15,121 @@ function initGUIScript() {
|
||||
// ===========================================================================
|
||||
|
||||
function playerPromptAnswerNo(client) {
|
||||
if(getPlayerData(client).promptType == VRR_PROMPT_NONE) {
|
||||
return false;
|
||||
}
|
||||
if(getPlayerData(client).promptType == VRR_PROMPT_NONE) {
|
||||
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) {
|
||||
case VRR_PROMPT_CREATEFIRSTCHAR:
|
||||
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");
|
||||
setTimeout(function() { client.disconnect(); }, 5000);
|
||||
break;
|
||||
switch(getPlayerData(client).promptType) {
|
||||
case VRR_PROMPT_CREATEFIRSTCHAR:
|
||||
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");
|
||||
setTimeout(function() { client.disconnect(); }, 5000);
|
||||
break;
|
||||
|
||||
case VRR_PROMPT_BIZORDER:
|
||||
if(getPlayerData(client).businessOrderAmount > 0) {
|
||||
if(canPlayerUseGUI(client)) {
|
||||
showPlayerErrorGUI(client, "You canceled the order.", "Business Order Canceled");
|
||||
} 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)}`);
|
||||
messagePlayerError(client, "You canceled the order!");
|
||||
}
|
||||
} else {
|
||||
showPlayerErrorGUI(client, "You aren't ordering anything for a business!", "Business Order Canceled");
|
||||
}
|
||||
break;
|
||||
case VRR_PROMPT_BIZORDER:
|
||||
if(getPlayerData(client).businessOrderAmount > 0) {
|
||||
if(canPlayerUseGUI(client)) {
|
||||
showPlayerErrorGUI(client, "You canceled the order.", "Business Order Canceled");
|
||||
} 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)}`);
|
||||
messagePlayerError(client, "You canceled the order!");
|
||||
}
|
||||
} else {
|
||||
showPlayerErrorGUI(client, "You aren't ordering anything for a business!", "Business Order Canceled");
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
getPlayerData(client).promptType = VRR_PROMPT_NONE;
|
||||
getPlayerData(client).promptType = VRR_PROMPT_NONE;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function playerPromptAnswerYes(client) {
|
||||
if(getPlayerData(client).promptType == VRR_PROMPT_NONE) {
|
||||
return false;
|
||||
}
|
||||
if(getPlayerData(client).promptType == VRR_PROMPT_NONE) {
|
||||
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) {
|
||||
case VRR_PROMPT_CREATEFIRSTCHAR:
|
||||
showPlayerNewCharacterGUI(client);
|
||||
break;
|
||||
switch(getPlayerData(client).promptType) {
|
||||
case VRR_PROMPT_CREATEFIRSTCHAR:
|
||||
showPlayerNewCharacterGUI(client);
|
||||
break;
|
||||
|
||||
case VRR_PROMPT_BIZORDER:
|
||||
if(getPlayerData(client).businessOrderAmount > 0) {
|
||||
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)`);
|
||||
showPlayerErrorGUI(client, "This business doesn't have enough money! Deposit some using /bizdeposit", "Business Order Canceled");
|
||||
getPlayerData(client).businessOrderAmount = 0;
|
||||
getPlayerData(client).businessOrderBusiness = false;
|
||||
getPlayerData(client).businessOrderItem = -1;
|
||||
getPlayerData(client).businessOrderValue = -1;
|
||||
} 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}`);
|
||||
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);
|
||||
cacheBusinessItems(getPlayerData(client).businessOrderBusiness);
|
||||
getBusinessData(getPlayerData(client).businessOrderBusiness).till -= getPlayerData(client).businessOrderCost;
|
||||
updateBusinessPickupLabelData(getPlayerData(client).businessOrderBusiness);
|
||||
getPlayerData(client).businessOrderAmount = 0;
|
||||
getPlayerData(client).businessOrderBusiness = false;
|
||||
getPlayerData(client).businessOrderItem = -1;
|
||||
getPlayerData(client).businessOrderValue = -1;
|
||||
case VRR_PROMPT_BIZORDER:
|
||||
if(getPlayerData(client).businessOrderAmount > 0) {
|
||||
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)`);
|
||||
showPlayerErrorGUI(client, "This business doesn't have enough money! Deposit some using /bizdeposit", "Business Order Canceled");
|
||||
getPlayerData(client).businessOrderAmount = 0;
|
||||
getPlayerData(client).businessOrderBusiness = false;
|
||||
getPlayerData(client).businessOrderItem = -1;
|
||||
getPlayerData(client).businessOrderValue = -1;
|
||||
} 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}`);
|
||||
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);
|
||||
cacheBusinessItems(getPlayerData(client).businessOrderBusiness);
|
||||
getBusinessData(getPlayerData(client).businessOrderBusiness).till -= getPlayerData(client).businessOrderCost;
|
||||
updateBusinessPickupLabelData(getPlayerData(client).businessOrderBusiness);
|
||||
getPlayerData(client).businessOrderAmount = 0;
|
||||
getPlayerData(client).businessOrderBusiness = false;
|
||||
getPlayerData(client).businessOrderItem = -1;
|
||||
getPlayerData(client).businessOrderValue = -1;
|
||||
|
||||
}
|
||||
} else {
|
||||
showPlayerErrorGUI(client, `You aren't ordering anything for a business!`, `Business Order Canceled`);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
showPlayerErrorGUI(client, `You aren't ordering anything for a business!`, `Business Order Canceled`);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
getPlayerData(client).promptType = VRR_PROMPT_NONE;
|
||||
getPlayerData(client).promptType = VRR_PROMPT_NONE;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function canPlayerUseGUI(client) {
|
||||
return (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client));
|
||||
return (doesServerHaveGUIEnabled() && doesPlayerHaveGUIEnabled(client));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function playerPromptAnswerYesCommand(command, params, client) {
|
||||
playerPromptAnswerYes(client);
|
||||
playerPromptAnswerYes(client);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function playerPromptAnswerNoCommand(command, params, client) {
|
||||
playerPromptAnswerNo(client);
|
||||
playerPromptAnswerNo(client);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function playerToggledGUI(client) {
|
||||
toggleAccountGUICommand("gui", "", client);
|
||||
toggleAccountGUICommand("gui", "", client);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerChangePasswordGUI(client) {
|
||||
sendNetworkEventToPlayer("vrr.changePassword", client);
|
||||
sendNetworkEventToPlayer("vrr.changePassword", client);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerTwoFactorAuthenticationGUI(client) {
|
||||
sendNetworkEventToPlayer("vrr.2fa", client);
|
||||
sendNetworkEventToPlayer("vrr.2fa", client);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -15,144 +15,144 @@ function initHelpScript() {
|
||||
// ===========================================================================
|
||||
|
||||
let randomTips = [
|
||||
`{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}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}Press ℹ️ to see your inventory, and use number keys to select an item`,
|
||||
`{MAINCOLOUR}Use /buy at a business to purchase items.`,
|
||||
`{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}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 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}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}/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}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 your car was destroyed. Visit an insurance agency today!`,
|
||||
//`{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}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}Press [#0066FF]G {MAINCOLOUR}to enter a vehicle as passenger.`,
|
||||
//`{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}Legal weapons can be purchased at any ammunation.`,
|
||||
`{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}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}Press ℹ️ to see your inventory, and use number keys to select an item`,
|
||||
`{MAINCOLOUR}Use /buy at a business to purchase items.`,
|
||||
`{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}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 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}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}/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}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 your car was destroyed. Visit an insurance agency today!`,
|
||||
//`{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}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}Press [#0066FF]G {MAINCOLOUR}to enter a vehicle as passenger.`,
|
||||
//`{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}Legal weapons can be purchased at any ammunation.`,
|
||||
];
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function helpCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
showMainHelpMessage(client);
|
||||
return false;
|
||||
}
|
||||
showMainHelpMessage(client);
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split(" ");
|
||||
let splitParams = params.split(" ");
|
||||
|
||||
switch(toLowerCase(getParam(params, " ", 1))) {
|
||||
case "account":
|
||||
showAccountHelpMessage(client);
|
||||
break;
|
||||
switch(toLowerCase(getParam(params, " ", 1))) {
|
||||
case "account":
|
||||
showAccountHelpMessage(client);
|
||||
break;
|
||||
|
||||
case "vehicle":
|
||||
case "veh":
|
||||
case "vehs":
|
||||
case "vehicles":
|
||||
case "car":
|
||||
case "cars":
|
||||
showVehicleHelpMessage(client);
|
||||
break;
|
||||
case "vehicle":
|
||||
case "veh":
|
||||
case "vehs":
|
||||
case "vehicles":
|
||||
case "car":
|
||||
case "cars":
|
||||
showVehicleHelpMessage(client);
|
||||
break;
|
||||
|
||||
case "dealership":
|
||||
showVehicleDealershipHelpMessage(client);
|
||||
break;
|
||||
case "dealership":
|
||||
showVehicleDealershipHelpMessage(client);
|
||||
break;
|
||||
|
||||
case "business":
|
||||
showBusinessHelpMessage(client);
|
||||
break;
|
||||
case "business":
|
||||
showBusinessHelpMessage(client);
|
||||
break;
|
||||
|
||||
case "job":
|
||||
showJobHelpMessage(client);
|
||||
break;
|
||||
case "job":
|
||||
showJobHelpMessage(client);
|
||||
break;
|
||||
|
||||
case "chat":
|
||||
showChatHelpMessage(client);
|
||||
break;
|
||||
case "chat":
|
||||
showChatHelpMessage(client);
|
||||
break;
|
||||
|
||||
case "rules":
|
||||
showRulesHelpMessage(client);
|
||||
break;
|
||||
case "rules":
|
||||
showRulesHelpMessage(client);
|
||||
break;
|
||||
|
||||
case "website":
|
||||
showWebsiteHelpMessage(client);
|
||||
break;
|
||||
case "website":
|
||||
showWebsiteHelpMessage(client);
|
||||
break;
|
||||
|
||||
case "discord":
|
||||
showDiscordHelpMessage(client);
|
||||
break;
|
||||
case "discord":
|
||||
showDiscordHelpMessage(client);
|
||||
break;
|
||||
|
||||
case "anim":
|
||||
case "anims":
|
||||
case "animation":
|
||||
case "animations":
|
||||
showAnimationHelpMessage(client);
|
||||
break;
|
||||
case "anim":
|
||||
case "anims":
|
||||
case "animation":
|
||||
case "animations":
|
||||
showAnimationHelpMessage(client);
|
||||
break;
|
||||
|
||||
case "skin":
|
||||
case "skins":
|
||||
case "clothes":
|
||||
showClothesHelpMessage(client);
|
||||
break;
|
||||
case "skin":
|
||||
case "skins":
|
||||
case "clothes":
|
||||
showClothesHelpMessage(client);
|
||||
break;
|
||||
|
||||
case "key":
|
||||
case "keys":
|
||||
case "keybinds":
|
||||
case "keybind":
|
||||
case "bindkey":
|
||||
case "bindkeys":
|
||||
showBindKeysHelpMessage(client);
|
||||
break;
|
||||
case "key":
|
||||
case "keys":
|
||||
case "keybinds":
|
||||
case "keybind":
|
||||
case "bindkey":
|
||||
case "bindkeys":
|
||||
showBindKeysHelpMessage(client);
|
||||
break;
|
||||
|
||||
case "command":
|
||||
case "cmd":
|
||||
showCommandHelpMessage(client, getParam(params, " ", 2));
|
||||
break;
|
||||
case "command":
|
||||
case "cmd":
|
||||
showCommandHelpMessage(client, getParam(params, " ", 2));
|
||||
break;
|
||||
|
||||
case "clan":
|
||||
case "clans":
|
||||
case "group":
|
||||
case "groups":
|
||||
case "faction":
|
||||
case "factions":
|
||||
case "family":
|
||||
case "families":
|
||||
showClanHelpMessage(client);
|
||||
break;
|
||||
case "clan":
|
||||
case "clans":
|
||||
case "group":
|
||||
case "groups":
|
||||
case "faction":
|
||||
case "factions":
|
||||
case "family":
|
||||
case "families":
|
||||
showClanHelpMessage(client);
|
||||
break;
|
||||
|
||||
case "radio":
|
||||
case "radiostations":
|
||||
case "music":
|
||||
showRadioHelpMessage(client);
|
||||
break;
|
||||
case "radio":
|
||||
case "radiostations":
|
||||
case "music":
|
||||
showRadioHelpMessage(client);
|
||||
break;
|
||||
|
||||
case "economy":
|
||||
case "wealth":
|
||||
case "tax":
|
||||
case "taxes":
|
||||
case "payday":
|
||||
showWealthAndTaxHelpMessage(client);
|
||||
break;
|
||||
case "economy":
|
||||
case "wealth":
|
||||
case "tax":
|
||||
case "taxes":
|
||||
case "payday":
|
||||
showWealthAndTaxHelpMessage(client);
|
||||
break;
|
||||
|
||||
default:
|
||||
showMainHelpMessage(client);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
showMainHelpMessage(client);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// == Account Help =============================
|
||||
@@ -184,152 +184,152 @@ function helpCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function showMainHelpMessage(client) {
|
||||
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}Help Categories: [#A9A9A9]account, command, vehicle, job, chat, rules, website, animation`);
|
||||
messagePlayerNormal(client, `{clanOrange}• [#A9A9A9]skin, mechanic, dealership, discord, colour, keybind`);
|
||||
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}Help Categories: [#A9A9A9]account, command, vehicle, job, chat, rules, website, animation`);
|
||||
messagePlayerNormal(client, `{clanOrange}• [#A9A9A9]skin, mechanic, dealership, discord, colour, keybind`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showAccountHelpMessage(client) {
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderAccountHelp")));
|
||||
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}Some settings you can use: {ALTCOLOUR}/gui, /logo, /iplogin, /autolastchar, /2fa, /loginalert`);
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderAccountHelp")));
|
||||
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}Some settings you can use: {ALTCOLOUR}/gui, /logo, /iplogin, /autolastchar, /2fa, /loginalert`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showVehicleHelpMessage(client) {
|
||||
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}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}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.`);
|
||||
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}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}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.`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showVehicleDealershipHelpMessage(client) {
|
||||
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}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}A new car for sale will appear when you drive away from the dealer.`);
|
||||
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}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}A new car for sale will appear when you drive away from the dealer.`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showJobHelpMessage(client) {
|
||||
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}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}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.`);
|
||||
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}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}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.`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showChatHelpMessage(client) {
|
||||
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}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 have shorter names available ({ALTCOLOUR}/t {MAINCOLOUR}for talk, {ALTCOLOUR}/s {MAINCOLOUR}for shout, etc)`);
|
||||
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}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 have shorter names available ({ALTCOLOUR}/t {MAINCOLOUR}for talk, {ALTCOLOUR}/s {MAINCOLOUR}for shout, etc)`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showRulesHelpMessage(client) {
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderServerRulesList")));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RulesHelp", 0));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RulesHelp", 1));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RulesHelp", 2));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RulesHelp", 3));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RulesHelp", 4), `{ALTCOLOUR}/help language {MAINCOLOUR}`);
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderServerRulesList")));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RulesHelp", 0));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RulesHelp", 1));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RulesHelp", 2));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RulesHelp", 3));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RulesHelp", 4), `{ALTCOLOUR}/help language {MAINCOLOUR}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showWebsiteHelpMessage(client) {
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderWebsiteInfo")));
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}${server.getRule("Website")}`);
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderWebsiteInfo")));
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}${server.getRule("Website")}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showDiscordHelpMessage(client) {
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderDiscordInfo")));
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}${server.getRule("Website")}`);
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderDiscordInfo")));
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}${server.getRule("Website")}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showAnimationHelpMessage(client) {
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderAnimationHelp")));
|
||||
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", 2, `{ALTCOLOUR}/animlist {MAINCOLOUR}`));
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderAnimationHelp")));
|
||||
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", 2, `{ALTCOLOUR}/animlist {MAINCOLOUR}`));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showClothesHelpMessage(client) {
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderSkinHelp")));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "SkinHelp", 0, `{ALTCOLOUR}/buy {MAINCOLOUR}`));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "SkinHelp", 1, `{ALTCOLOUR}/help items {MAINCOLOUR}`));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "SkinHelp", 2));
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderSkinHelp")));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "SkinHelp", 0, `{ALTCOLOUR}/buy {MAINCOLOUR}`));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "SkinHelp", 1, `{ALTCOLOUR}/help items {MAINCOLOUR}`));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "SkinHelp", 2));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showBindKeysHelpMessage(client) {
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderBindableKeysHelp")));
|
||||
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", 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", 4, `{ALTCOLOUR}U {MAINCOLOUR}`, `{ALTCOLOUR}O {MAINCOLOUR}`, `{ALTCOLOUR}P {MAINCOLOUR}`));
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderBindableKeysHelp")));
|
||||
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", 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", 4, `{ALTCOLOUR}U {MAINCOLOUR}`, `{ALTCOLOUR}O {MAINCOLOUR}`, `{ALTCOLOUR}P {MAINCOLOUR}`));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showBusinessHelpMessage(client) {
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderBusinessHelp")));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "BusinessHelp", 0));
|
||||
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", 3));
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderBusinessHelp")));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "BusinessHelp", 0));
|
||||
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", 3));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showClanHelpMessage(client) {
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderClanHelp")));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "ClanHelp", 0));
|
||||
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", 3, `{ALTCOLOUR}/clanranks, /clanflags, /clanaddrank, /clandelrank, /clanaddrankflag, /clandelrankflag, /clanaddmemberflag, /clandelmemberflag`));
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderClanHelp")));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "ClanHelp", 0));
|
||||
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", 3, `{ALTCOLOUR}/clanranks, /clanflags, /clanaddrank, /clandelrank, /clanaddrankflag, /clandelrankflag, /clanaddmemberflag, /clandelmemberflag`));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showRadioHelpMessage(client) {
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderRadioHelp")));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RadioHelp", 0, `{ALTCOLOUR}/radiostation {MAINCOLOUR}`));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RadioHelp", 1, `{ALTCOLOUR}/radiostations {MAINCOLOUR}`));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RadioHelp", 2, `{ALTCOLOUR}/radiovolume {MAINCOLOUR}`));
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderRadioHelp")));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RadioHelp", 0, `{ALTCOLOUR}/radiostation {MAINCOLOUR}`));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RadioHelp", 1, `{ALTCOLOUR}/radiostations {MAINCOLOUR}`));
|
||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "RadioHelp", 2, `{ALTCOLOUR}/radiovolume {MAINCOLOUR}`));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showWealthAndTaxHelpMessage(client) {
|
||||
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 calculated wealth is a total sum based on how many vehicles, houses, and businesses you have.`);
|
||||
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 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}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) {
|
||||
if(!commandName) {
|
||||
messagePlayerSyntax(client, `${getCommandSyntaxText("help")}command <command name>`);
|
||||
return false;
|
||||
}
|
||||
if(!commandName) {
|
||||
messagePlayerSyntax(client, `${getCommandSyntaxText("help")}command <command name>`);
|
||||
return false;
|
||||
}
|
||||
|
||||
commandName = toLowerCase(commandName);
|
||||
commandName = commandName.trim();
|
||||
commandName = toLowerCase(commandName);
|
||||
commandName = commandName.trim();
|
||||
|
||||
if(commandName.slice(0, 1) == "/") {
|
||||
commandName = commandName.slice(1);
|
||||
}
|
||||
if(commandName.slice(0, 1) == "/") {
|
||||
commandName = commandName.slice(1);
|
||||
}
|
||||
|
||||
let command = getCommandData(commandName);
|
||||
let aliases = getCommandAliasesNames(command);
|
||||
let command = getCommandData(commandName);
|
||||
let aliases = getCommandAliasesNames(command);
|
||||
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderCommandInfo", commandName)));
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Description: ${command.description}`);
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderCommandInfo", commandName)));
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Description: ${command.description}`);
|
||||
|
||||
if(aliases.length > 0) {
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Aliases: ${aliases.join(", ")}`);
|
||||
} else {
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Aliases: (None)`);
|
||||
}
|
||||
if(aliases.length > 0) {
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Aliases: ${aliases.join(", ")}`);
|
||||
} else {
|
||||
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"))) {
|
||||
// messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Usable on Discord: ${getYesNoFromBool(command.allowOnDiscord)}`);
|
||||
//}
|
||||
//if(doesPlayerHaveStaffPermission(client, getStaffFlagValue("BasicModeration"))) {
|
||||
// messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Usable on Discord: ${getYesNoFromBool(command.allowOnDiscord)}`);
|
||||
//}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -1436,30 +1436,30 @@ function updateHousePickupLabelData(houseId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let houseData = getHouseData(houseId);
|
||||
let houseData = getHouseData(houseId);
|
||||
|
||||
if(houseData.entrancePickup != null) {
|
||||
setEntityData(houseData.entrancePickup, "vrr.owner.type", VRR_PICKUP_HOUSE_ENTRANCE, false);
|
||||
setEntityData(houseData.entrancePickup, "vrr.owner.id", houseId, false);
|
||||
setEntityData(houseData.entrancePickup, "vrr.label.type", VRR_LABEL_HOUSE, true);
|
||||
//setEntityData(houseData.entrancePickup, "vrr.label.name", houseData.description, true);
|
||||
setEntityData(houseData.entrancePickup, "vrr.label.locked", houseData.locked, true);
|
||||
if(houseData.buyPrice > 0) {
|
||||
setEntityData(houseData.entrancePickup, "vrr.label.price", houseData.buyPrice, true);
|
||||
setEntityData(houseData.entrancePickup, "vrr.label.help", VRR_PROPLABEL_INFO_BUYHOUSE, true);
|
||||
} else {
|
||||
if(houseData.rentPrice > 0) {
|
||||
setEntityData(houseData.entrancePickup, "vrr.label.rentprice", houseData.rentPrice, true);
|
||||
setEntityData(houseData.entrancePickup, "vrr.label.help", VRR_PROPLABEL_INFO_RENTHOUSE, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(houseData.entrancePickup != null) {
|
||||
setEntityData(houseData.entrancePickup, "vrr.owner.type", VRR_PICKUP_HOUSE_ENTRANCE, false);
|
||||
setEntityData(houseData.entrancePickup, "vrr.owner.id", houseId, false);
|
||||
setEntityData(houseData.entrancePickup, "vrr.label.type", VRR_LABEL_HOUSE, true);
|
||||
//setEntityData(houseData.entrancePickup, "vrr.label.name", houseData.description, true);
|
||||
setEntityData(houseData.entrancePickup, "vrr.label.locked", houseData.locked, true);
|
||||
if(houseData.buyPrice > 0) {
|
||||
setEntityData(houseData.entrancePickup, "vrr.label.price", houseData.buyPrice, true);
|
||||
setEntityData(houseData.entrancePickup, "vrr.label.help", VRR_PROPLABEL_INFO_BUYHOUSE, true);
|
||||
} else {
|
||||
if(houseData.rentPrice > 0) {
|
||||
setEntityData(houseData.entrancePickup, "vrr.label.rentprice", houseData.rentPrice, true);
|
||||
setEntityData(houseData.entrancePickup, "vrr.label.help", VRR_PROPLABEL_INFO_RENTHOUSE, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(houseData.exitPickup != null) {
|
||||
setEntityData(houseData.exitPickup, "vrr.owner.type", VRR_PICKUP_HOUSE_EXIT, false);
|
||||
setEntityData(houseData.exitPickup, "vrr.owner.id", houseId, false);
|
||||
setEntityData(houseData.exitPickup, "vrr.label.type", VRR_LABEL_EXIT, true);
|
||||
}
|
||||
if(houseData.exitPickup != null) {
|
||||
setEntityData(houseData.exitPickup, "vrr.owner.type", VRR_PICKUP_HOUSE_EXIT, false);
|
||||
setEntityData(houseData.exitPickup, "vrr.owner.id", houseId, false);
|
||||
setEntityData(houseData.exitPickup, "vrr.label.type", VRR_LABEL_EXIT, true);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1063,16 +1063,16 @@ function playerSwitchItem(client, newHotBarSlot) {
|
||||
setPlayerWeaponDamageEnabled(client, true);
|
||||
setPlayerWeaponDamageEvent(client, VRR_WEAPON_DAMAGE_EVENT_NORMAL);
|
||||
} else {
|
||||
let ammoItemSlot = getPlayerFirstAmmoItemForWeapon(client, getItemTypeData(getItemData(newHotBarItem).itemTypeIndex).useId);
|
||||
if(ammoItemSlot != false) {
|
||||
getItemData(newHotBarItem).value = getItemData(getPlayerData(client).hotBarItems[ammoItemSlot]).value;
|
||||
givePlayerWeapon(client, toInteger(getItemTypeData(getItemData(newHotBarItem).itemTypeIndex).useId), toInteger(getItemData(newHotBarItem).value), true, true);
|
||||
setPlayerWeaponDamageEnabled(client, true);
|
||||
setPlayerWeaponDamageEvent(client, VRR_WEAPON_DAMAGE_EVENT_NORMAL);
|
||||
deleteItem(getPlayerData(client).hotBarItems[ammoItemSlot]);
|
||||
} else {
|
||||
messagePlayerError(client, getLocaleString(client, "ItemUnequippableNoAmmo", getItemName(newHotBarItem), newHotBarSlot));
|
||||
}
|
||||
let ammoItemSlot = getPlayerFirstAmmoItemForWeapon(client, getItemTypeData(getItemData(newHotBarItem).itemTypeIndex).useId);
|
||||
if(ammoItemSlot != false) {
|
||||
getItemData(newHotBarItem).value = getItemData(getPlayerData(client).hotBarItems[ammoItemSlot]).value;
|
||||
givePlayerWeapon(client, toInteger(getItemTypeData(getItemData(newHotBarItem).itemTypeIndex).useId), toInteger(getItemData(newHotBarItem).value), true, true);
|
||||
setPlayerWeaponDamageEnabled(client, true);
|
||||
setPlayerWeaponDamageEvent(client, VRR_WEAPON_DAMAGE_EVENT_NORMAL);
|
||||
deleteItem(getPlayerData(client).hotBarItems[ammoItemSlot]);
|
||||
} else {
|
||||
messagePlayerError(client, getLocaleString(client, "ItemUnequippableNoAmmo", getItemName(newHotBarItem), newHotBarSlot));
|
||||
}
|
||||
}
|
||||
} else if(getItemTypeData(getItemData(newHotBarItem).itemTypeIndex).useType == VRR_ITEM_USETYPE_TAZER) {
|
||||
if(getItemData(newHotBarItem).value > 0) {
|
||||
@@ -1698,7 +1698,7 @@ function playerItemActionDelayComplete(client) {
|
||||
break;
|
||||
}
|
||||
|
||||
clearPlayerItemActionState(client);
|
||||
clearPlayerItemActionState(client);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -2084,19 +2084,19 @@ function getItemTypeFromParams(params) {
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerFirstAmmoItemForWeapon(client, weaponId) {
|
||||
for(let i in getPlayerData(client).hotBarItems) {
|
||||
if(getPlayerData(client).hotBarItems[i] != -1) {
|
||||
if(getItemData(getPlayerData(client).hotBarItems[i]) != false) {
|
||||
if(getItemTypeData(getItemData(getPlayerData(client).hotBarItems[i]).itemTypeIndex).useType == VRR_ITEM_USETYPE_AMMO_CLIP) {
|
||||
if(getItemTypeData(getItemData(getPlayerData(client).hotBarItems[i]).itemTypeIndex).useId == weaponId) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for(let i in getPlayerData(client).hotBarItems) {
|
||||
if(getPlayerData(client).hotBarItems[i] != -1) {
|
||||
if(getItemData(getPlayerData(client).hotBarItems[i]) != false) {
|
||||
if(getItemTypeData(getItemData(getPlayerData(client).hotBarItems[i]).itemTypeIndex).useType == VRR_ITEM_USETYPE_AMMO_CLIP) {
|
||||
if(getItemTypeData(getItemData(getPlayerData(client).hotBarItems[i]).itemTypeIndex).useId == weaponId) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -631,7 +631,7 @@ function stopWorking(client) {
|
||||
deleteJobItems(client);
|
||||
restorePlayerJobLockerItems(client);
|
||||
respawnJobVehicle(client);
|
||||
sendPlayerStopJobRoute(client);
|
||||
sendPlayerStopJobRoute(client);
|
||||
|
||||
let jobId = getPlayerJob(client);
|
||||
switch(getJobType(jobId)) {
|
||||
@@ -665,9 +665,9 @@ function stopWorking(client) {
|
||||
case VRR_JOB_DRUG:
|
||||
break;
|
||||
|
||||
case VRR_JOB_GENERIC:
|
||||
messagePlayerInfo(client, "Your vehicle has been respawned at your job location");
|
||||
break;
|
||||
case VRR_JOB_GENERIC:
|
||||
messagePlayerInfo(client, "Your vehicle has been respawned at your job location");
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
@@ -753,13 +753,13 @@ function jobUniformCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(uniformId == 0) {
|
||||
setPlayerSkin(client, getPlayerCurrentSubAccount(client).skin);
|
||||
meActionToNearbyPlayers(client, `takes off their uniform`);
|
||||
} else {
|
||||
setPlayerSkin(client, jobData.uniforms[uniformId-1].skin);
|
||||
meActionToNearbyPlayers(client, `puts on ${getProperDeterminerForName(jobData.uniforms[uniformId-1].name)} ${jobData.uniforms[uniformId-1].name} uniform`);
|
||||
}
|
||||
if(uniformId == 0) {
|
||||
setPlayerSkin(client, getPlayerCurrentSubAccount(client).skin);
|
||||
meActionToNearbyPlayers(client, `takes off their uniform`);
|
||||
} else {
|
||||
setPlayerSkin(client, jobData.uniforms[uniformId-1].skin);
|
||||
meActionToNearbyPlayers(client, `puts on ${getProperDeterminerForName(jobData.uniforms[uniformId-1].name)} ${jobData.uniforms[uniformId-1].name} uniform`);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -966,8 +966,8 @@ function createJob(name) {
|
||||
tempJobData.pickupModel = getGameConfig().pickupModels[getGame()].job;
|
||||
|
||||
getServerData().jobs.push(tempJobData);
|
||||
saveJobToDatabase(tempJobData);
|
||||
setAllJobDataIndexes();
|
||||
saveJobToDatabase(tempJobData);
|
||||
setAllJobDataIndexes();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1213,17 +1213,17 @@ function setJobRouteAllLocationDelaysCommand(command, params, client) {
|
||||
|
||||
let jobId = getPlayerJob(client);
|
||||
let jobRoute = getPlayerJobRoute(client);
|
||||
let delay = getParam(params, " ", 1);
|
||||
let delay = getParam(params, " ", 1);
|
||||
|
||||
if(isNaN(delay)) {
|
||||
messagePlayerError(client, getLocaleString(client, "TimeNotNumber"))
|
||||
return false;
|
||||
}
|
||||
if(isNaN(delay)) {
|
||||
messagePlayerError(client, getLocaleString(client, "TimeNotNumber"))
|
||||
return false;
|
||||
}
|
||||
|
||||
for(let i in getJobData(jobId).routes[jobRoute].locations) {
|
||||
getJobData(jobId).routes[jobRoute].locations[i].stopDelay = delay;
|
||||
getJobData(jobId).routes[jobRoute].locations[i].needsSaved = true;
|
||||
}
|
||||
getJobData(jobId).routes[jobRoute].locations[i].stopDelay = delay;
|
||||
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`);
|
||||
}
|
||||
@@ -1569,40 +1569,40 @@ function forceAllPlayersToStopWorking() {
|
||||
// ===========================================================================
|
||||
|
||||
function jobStartRouteCommand(command, params, client) {
|
||||
if(!canPlayerUseJobs(client)) {
|
||||
if(!canPlayerUseJobs(client)) {
|
||||
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.");
|
||||
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!");
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!isPlayerInJobVehicle(client)) {
|
||||
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");
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
let forceRoute = -1;
|
||||
if(doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageJobs"))) {
|
||||
if(!areParamsEmpty(params)) {
|
||||
let tempRoute = getJobRouteFromParams(params, getPlayerJob(client));
|
||||
if(tempRoute != false) {
|
||||
forceRoute = tempRoute;
|
||||
}
|
||||
}
|
||||
}
|
||||
let forceRoute = -1;
|
||||
if(doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageJobs"))) {
|
||||
if(!areParamsEmpty(params)) {
|
||||
let tempRoute = getJobRouteFromParams(params, getPlayerJob(client));
|
||||
if(tempRoute != false) {
|
||||
forceRoute = tempRoute;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
startJobRoute(client, forceRoute);
|
||||
return true;
|
||||
@@ -1611,24 +1611,24 @@ function jobStartRouteCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function jobStopRouteCommand(command, params, client) {
|
||||
if(!canPlayerUseJobs(client)) {
|
||||
if(!canPlayerUseJobs(client)) {
|
||||
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.");
|
||||
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!");
|
||||
// return false;
|
||||
// return false;
|
||||
//}
|
||||
|
||||
if(!isPlayerOnJobRoute(client)) {
|
||||
messagePlayerError(client, "You aren't on a job route!");
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
stopJobRoute(client, false, false);
|
||||
@@ -1660,21 +1660,21 @@ function isPlayerWorking(client) {
|
||||
// ===========================================================================
|
||||
|
||||
function startJobRoute(client, forceRoute = -1) {
|
||||
let jobId = getPlayerJob(client);
|
||||
let jobRoute = 0;
|
||||
let jobId = getPlayerJob(client);
|
||||
let jobRoute = 0;
|
||||
|
||||
if(forceRoute == -1) {
|
||||
jobRoute = getRandomJobRouteForLocation(getClosestJobLocationForJob(getPlayerPosition(client), jobId));
|
||||
} else {
|
||||
jobRoute = forceRoute;
|
||||
}
|
||||
if(forceRoute == -1) {
|
||||
jobRoute = getRandomJobRouteForLocation(getClosestJobLocationForJob(getPlayerPosition(client), jobId));
|
||||
} else {
|
||||
jobRoute = forceRoute;
|
||||
}
|
||||
|
||||
if(jobRoute == -1) {
|
||||
messagePlayerError(client, `There are no routes for this location.`);
|
||||
return false;
|
||||
}
|
||||
if(jobRoute == -1) {
|
||||
messagePlayerError(client, `There are no routes for this location.`);
|
||||
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).jobRouteLocation = 0;
|
||||
@@ -1684,26 +1684,26 @@ function startJobRoute(client, forceRoute = -1) {
|
||||
getPlayerVehicle(client).colour2 = getJobRouteData(jobId, jobRoute).vehicleColour2;
|
||||
|
||||
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);
|
||||
} 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) {
|
||||
let jobId = getPlayerJob(client);
|
||||
let jobId = getPlayerJob(client);
|
||||
|
||||
if(alertPlayer) {
|
||||
messagePlayerAlert(client, replaceJobRouteStringsInMessage(getJobRouteData(jobId, getPlayerJobRoute(client)).finishMessage), jobId, getPlayerJobRoute(client));
|
||||
}
|
||||
|
||||
if(successful == true) {
|
||||
finishSuccessfulJobRoute(client);
|
||||
return false;
|
||||
}
|
||||
if(successful == true) {
|
||||
finishSuccessfulJobRoute(client);
|
||||
return false;
|
||||
}
|
||||
|
||||
stopReturnToJobVehicleCountdown(client);
|
||||
sendPlayerStopJobRoute(client);
|
||||
@@ -1797,26 +1797,26 @@ function deleteJobLocation(jobLocationData) {
|
||||
quickDatabaseQuery(`DELETE FROM job_loc WHERE job_loc_id = ${jobLocationData.databaseId}`);
|
||||
}
|
||||
|
||||
deleteJobLocationBlip(tempJob, tempLocation);
|
||||
deleteJobLocationPickup(tempJob, tempLocation);
|
||||
deleteJobLocationBlip(tempJob, tempLocation);
|
||||
deleteJobLocationPickup(tempJob, tempLocation);
|
||||
getJobData(getJobIdFromDatabaseId(tempJob)).locations.splice(tempLocation, 1);
|
||||
setAllJobDataIndexes();
|
||||
setAllJobDataIndexes();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function freezePlayerJobVehicleForRouteLocation(client) {
|
||||
getVehicleData(getPlayerVehicle(client)).engine = false;
|
||||
getVehicleData(getPlayerVehicle(client)).engine = false;
|
||||
setVehicleEngine(getPlayerVehicle(client), getVehicleData(getPlayerVehicle(client)).engine);
|
||||
//setPlayerControlState(client, false);
|
||||
//setPlayerControlState(client, false);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function unFreezePlayerJobVehicleForRouteLocation(client) {
|
||||
getVehicleData(getPlayerVehicle(client)).engine = true;
|
||||
getVehicleData(getPlayerVehicle(client)).engine = true;
|
||||
setVehicleEngine(getPlayerVehicle(client), getVehicleData(getPlayerVehicle(client)).engine);
|
||||
//setPlayerControlState(client, true);
|
||||
//setPlayerControlState(client, true);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -2424,31 +2424,31 @@ function isPlayerOnJobBlackList(client, jobId) {
|
||||
// ===========================================================================
|
||||
|
||||
function playerArrivedAtJobRouteLocation(client) {
|
||||
let jobId = getPlayerJob(client);
|
||||
let jobId = getPlayerJob(client);
|
||||
|
||||
if(!isPlayerOnJobRoute(client)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(isLastLocationOnJobRoute(jobId, getPlayerJobRoute(client), getPlayerJobRouteLocation(client))) {
|
||||
finishSuccessfulJobRoute(client);
|
||||
return false;
|
||||
}
|
||||
if(isLastLocationOnJobRoute(jobId, getPlayerJobRoute(client), getPlayerJobRouteLocation(client))) {
|
||||
finishSuccessfulJobRoute(client);
|
||||
return false;
|
||||
}
|
||||
|
||||
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) {
|
||||
freezePlayerJobVehicleForRouteLocation(client);
|
||||
getPlayerData(client).jobRouteLocation = getNextLocationOnJobRoute(jobId, getPlayerJobRoute(client), getPlayerJobRouteLocation(client));
|
||||
setTimeout(function() {
|
||||
showCurrentJobLocation(client);
|
||||
showGameMessage(client, replaceJobRouteStringsInMessage(removeColoursInMessage(getJobRouteData(jobId, getPlayerJobRoute(client)).locationNextMessage), jobId, getPlayerJobRoute(client)), getJobData(jobId).colour, 3500);
|
||||
unFreezePlayerJobVehicleForRouteLocation(client);
|
||||
}, getJobRouteLocationData(jobId, getPlayerJobRoute(client),getPlayerJobRouteLocation(client)).stopDelay);
|
||||
} else {
|
||||
getPlayerData(client).jobRouteLocation = getNextLocationOnJobRoute(jobId, getPlayerJobRoute(client), getPlayerJobRouteLocation(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)).locationArriveMessage), jobId, getPlayerJobRoute(client)), getJobData(jobId).colour, 3500);
|
||||
if(getJobRouteLocationData(jobId, getPlayerJobRoute(client),getPlayerJobRouteLocation(client)).stopDelay > 0) {
|
||||
freezePlayerJobVehicleForRouteLocation(client);
|
||||
getPlayerData(client).jobRouteLocation = getNextLocationOnJobRoute(jobId, getPlayerJobRoute(client), getPlayerJobRouteLocation(client));
|
||||
setTimeout(function() {
|
||||
showCurrentJobLocation(client);
|
||||
showGameMessage(client, replaceJobRouteStringsInMessage(removeColoursInMessage(getJobRouteData(jobId, getPlayerJobRoute(client)).locationNextMessage), jobId, getPlayerJobRoute(client)), getJobData(jobId).colour, 3500);
|
||||
unFreezePlayerJobVehicleForRouteLocation(client);
|
||||
}, getJobRouteLocationData(jobId, getPlayerJobRoute(client),getPlayerJobRouteLocation(client)).stopDelay);
|
||||
} else {
|
||||
getPlayerData(client).jobRouteLocation = getNextLocationOnJobRoute(jobId, getPlayerJobRoute(client), getPlayerJobRouteLocation(client));
|
||||
showCurrentJobLocation(client);
|
||||
showGameMessage(client, replaceJobRouteStringsInMessage(removeColoursInMessage(getJobRouteData(jobId, getPlayerJobRoute(client)).locationNextMessage), jobId, getPlayerJobRoute(client)), getJobData(jobId).colour, 3500);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -2595,14 +2595,14 @@ function createJobRoute(routeName, closestJobLocation) {
|
||||
tempJobRouteData.vehicleColour1 = 1;
|
||||
tempJobRouteData.vehicleColour2 = 1;
|
||||
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.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.locationNextMessage = `Drive to the next stop.`;
|
||||
|
||||
getJobData(closestJobLocation.jobIndex).routes.push(tempJobRouteData);
|
||||
saveJobRouteToDatabase(tempJobRouteData);
|
||||
saveJobRouteToDatabase(tempJobRouteData);
|
||||
setAllJobDataIndexes();
|
||||
}
|
||||
|
||||
@@ -2615,10 +2615,10 @@ function createJobRouteLocation(routeLocationName, position, jobRouteData) {
|
||||
tempJobRouteLocationData.enabled = true;
|
||||
tempJobRouteLocationData.needsSaved = true;
|
||||
tempJobRouteLocationData.position = position;
|
||||
tempJobRouteLocationData.routeIndex = jobRouteData.index;
|
||||
tempJobRouteLocationData.routeIndex = jobRouteData.index;
|
||||
|
||||
getJobData(jobRouteData.jobIndex).routes[jobRouteData.index].locations.push(tempJobRouteLocationData);
|
||||
saveJobRouteLocationToDatabase(tempJobRouteLocationData);
|
||||
saveJobRouteLocationToDatabase(tempJobRouteLocationData);
|
||||
setAllJobDataIndexes();
|
||||
}
|
||||
|
||||
@@ -2638,7 +2638,7 @@ function deleteJobRouteLocationCommand(command, params, client) {
|
||||
|
||||
getJobData(getJobIdFromDatabaseId(tempJob)).routes[tempJobRoute].locations.splice(tempIndex, 1);
|
||||
setAllJobDataIndexes();
|
||||
collectAllGarbage();
|
||||
collectAllGarbage();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -2647,9 +2647,9 @@ function deleteJobRouteCommand(command, params, client) {
|
||||
let jobId = getPlayerJob(client);
|
||||
let jobRoute = getPlayerData(client).jobRoute;
|
||||
|
||||
if(!areParamsEmpty(client)) {
|
||||
jobRoute = getJobRouteFromParams(params, jobId);
|
||||
}
|
||||
if(!areParamsEmpty(client)) {
|
||||
jobRoute = getJobRouteFromParams(params, jobId);
|
||||
}
|
||||
|
||||
let jobRouteData = getServerData().jobs[jobId].routes[jobRoute];
|
||||
|
||||
@@ -2667,10 +2667,10 @@ 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`);
|
||||
|
||||
if(jobRouteData.databaseId > 0) {
|
||||
quickDatabaseQuery(`DELETE FROM job_route WHERE job_route_id = ${jobRouteData.databaseId}`);
|
||||
quickDatabaseQuery(`DELETE FROM job_route_loc WHERE job_route_loc_route = ${jobRouteData.databaseId}`);
|
||||
}
|
||||
if(jobRouteData.databaseId > 0) {
|
||||
quickDatabaseQuery(`DELETE FROM job_route WHERE job_route_id = ${jobRouteData.databaseId}`);
|
||||
quickDatabaseQuery(`DELETE FROM job_route_loc WHERE job_route_loc_route = ${jobRouteData.databaseId}`);
|
||||
}
|
||||
|
||||
clearArray(getServerData().jobs[jobId].routes[jobRoute].locations);
|
||||
getServerData().jobs[jobId].routes.splice(jobRoute, 1);
|
||||
@@ -2744,7 +2744,7 @@ function getJobPointsInRange(position, distance) {
|
||||
// ===========================================================================
|
||||
|
||||
function respawnJobVehicle(client) {
|
||||
respawnVehicle(getPlayerJobVehicle(client));
|
||||
respawnVehicle(getPlayerJobVehicle(client));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -2756,12 +2756,12 @@ function getPlayerJobVehicle(client) {
|
||||
// ===========================================================================
|
||||
|
||||
function getRandomJobRouteForLocation(closestJobLocation) {
|
||||
if(closestJobLocation.routeCache.length > 0) {
|
||||
let randomRoute = getRandom(0, closestJobLocation.routeCache.length-1);
|
||||
let routeId = closestJobLocation.routeCache[randomRoute];
|
||||
return getJobRouteData(closestJobLocation.jobIndex, routeId).index;
|
||||
}
|
||||
return -1;
|
||||
if(closestJobLocation.routeCache.length > 0) {
|
||||
let randomRoute = getRandom(0, closestJobLocation.routeCache.length-1);
|
||||
let routeId = closestJobLocation.routeCache[randomRoute];
|
||||
return getJobRouteData(closestJobLocation.jobIndex, routeId).index;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -2801,58 +2801,58 @@ function getClosestJobLocationForJob(position, jobId) {
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerJobRoute(client) {
|
||||
return getPlayerData(client).jobRoute;
|
||||
return getPlayerData(client).jobRoute;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerJobRouteLocation(client) {
|
||||
return getPlayerData(client).jobRouteLocation;
|
||||
return getPlayerData(client).jobRouteLocation;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function showCurrentJobLocation(client) {
|
||||
let jobId = getPlayerJob(client);
|
||||
sendJobRouteLocationToPlayer(client, getJobRouteLocationData(jobId, getPlayerJobRoute(client), getPlayerJobRouteLocation(client)).position, getJobData(jobId).colour);
|
||||
let jobId = getPlayerJob(client);
|
||||
sendJobRouteLocationToPlayer(client, getJobRouteLocationData(jobId, getPlayerJobRoute(client), getPlayerJobRouteLocation(client)).position, getJobData(jobId).colour);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function finishSuccessfulJobRoute(client) {
|
||||
let jobId = getPlayerJob(client);
|
||||
let jobRouteData = getJobRouteData(jobId, getPlayerJobRoute(client));
|
||||
let payout = toInteger(applyServerInflationMultiplier(jobRouteData.pay));
|
||||
getPlayerData(client).payDayAmount = getPlayerData(client).payDayAmount + payout;
|
||||
let jobId = getPlayerJob(client);
|
||||
let jobRouteData = getJobRouteData(jobId, getPlayerJobRoute(client));
|
||||
let payout = toInteger(applyServerInflationMultiplier(jobRouteData.pay));
|
||||
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);
|
||||
sendPlayerStopJobRoute(client);
|
||||
respawnVehicle(getPlayerData(client).jobRouteVehicle);
|
||||
stopReturnToJobVehicleCountdown(client);
|
||||
sendPlayerStopJobRoute(client);
|
||||
respawnVehicle(getPlayerData(client).jobRouteVehicle);
|
||||
|
||||
getPlayerData(client).jobRouteVehicle = false;
|
||||
getPlayerData(client).jobRoute = -1;
|
||||
getPlayerData(client).jobRouteLocation = -1;
|
||||
getPlayerData(client).jobRouteVehicle = false;
|
||||
getPlayerData(client).jobRoute = -1;
|
||||
getPlayerData(client).jobRouteLocation = -1;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getNextLocationOnJobRoute(jobId, routeId, currentLocationId) {
|
||||
if(!isLastLocationOnJobRoute(jobId, routeId, currentLocationId)) {
|
||||
return currentLocationId+1;
|
||||
} else {
|
||||
return getJobRouteData(jobId, routeId).locations.length-1;
|
||||
}
|
||||
if(!isLastLocationOnJobRoute(jobId, routeId, currentLocationId)) {
|
||||
return currentLocationId+1;
|
||||
} else {
|
||||
return getJobRouteData(jobId, routeId).locations.length-1;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function isLastLocationOnJobRoute(jobId, routeId, currentLocationId) {
|
||||
if(currentLocationId == getJobRouteData(jobId, routeId).locations.length-1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
if(currentLocationId == getJobRouteData(jobId, routeId).locations.length-1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -2876,21 +2876,21 @@ function getJobRouteFromParams(params, jobId) {
|
||||
// ===========================================================================
|
||||
|
||||
function replaceJobRouteStringsInMessage(messageText, jobId, jobRouteId) {
|
||||
let tempJobRouteData = getJobRouteData(jobId, jobRouteId);
|
||||
let tempJobRouteData = getJobRouteData(jobId, jobRouteId);
|
||||
|
||||
let tempFind = `{JOBROUTENAME}`;
|
||||
let tempRegex = new RegExp(tempFind, 'g');
|
||||
messageText = messageText.replace(tempRegex, tempJobRouteData.name);
|
||||
|
||||
tempFind = `{JOBROUTEPAY}`;
|
||||
tempFind = `{JOBROUTEPAY}`;
|
||||
tempRegex = new RegExp(tempFind, 'g');
|
||||
messageText = messageText.replace(tempRegex, `$${tempJobRouteData.pay}`);
|
||||
|
||||
tempFind = `{JOBNAME}`;
|
||||
tempFind = `{JOBNAME}`;
|
||||
tempRegex = new RegExp(tempFind, 'g');
|
||||
messageText = messageText.replace(tempRegex, getJobData(tempJobRouteData.jobIndex).name);
|
||||
|
||||
return messageText;
|
||||
return messageText;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1,16 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"moduleResolution": "classic"
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"moduleResolution": "classic"
|
||||
},
|
||||
"include": [
|
||||
"*.js",
|
||||
"job/*.js",
|
||||
"business/*.js",
|
||||
"item/*.js",
|
||||
"npc/*.js",
|
||||
"native/*.js",
|
||||
"../shared/*.js"
|
||||
"*.js",
|
||||
"job/*.js",
|
||||
"business/*.js",
|
||||
"item/*.js",
|
||||
"npc/*.js",
|
||||
"native/*.js",
|
||||
"../shared/*.js"
|
||||
]
|
||||
}
|
||||
@@ -10,190 +10,190 @@
|
||||
|
||||
function initKeyBindScript() {
|
||||
logToConsole(LOG_INFO, "[VRR.KeyBind]: Initializing key bind script ...");
|
||||
getGlobalConfig().keyBind = loadKeyBindConfiguration();
|
||||
getGlobalConfig().keyBind = loadKeyBindConfiguration();
|
||||
logToConsole(LOG_INFO, "[VRR.KeyBind]: Key bind script initialized!");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function addKeyBindCommand(command, params, client) {
|
||||
let splitParams = params.split(" ");
|
||||
let splitParams = params.split(" ");
|
||||
|
||||
let keyId = getKeyIdFromParams(getParam(params, " ", 1));
|
||||
let tempCommand = getParam(params, " ", 2);
|
||||
let tempParams = (splitParams.length > 2) ? splitParams.slice(2).join(" ") : "";
|
||||
let keyId = getKeyIdFromParams(getParam(params, " ", 1));
|
||||
let tempCommand = getParam(params, " ", 2);
|
||||
let tempParams = (splitParams.length > 2) ? splitParams.slice(2).join(" ") : "";
|
||||
|
||||
if(!keyId) {
|
||||
messagePlayerError(client, "The key ID or name you input is invalid!");
|
||||
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`);
|
||||
return false;
|
||||
}
|
||||
if(!keyId) {
|
||||
messagePlayerError(client, "The key ID or name you input is invalid!");
|
||||
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`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!keyId) {
|
||||
messagePlayerError(client, "That key name/id is invalid!");
|
||||
return false;
|
||||
}
|
||||
if(!keyId) {
|
||||
messagePlayerError(client, "That key name/id is invalid!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(areParamsEmpty(tempCommand)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
if(areParamsEmpty(tempCommand)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
|
||||
addPlayerKeyBind(client, keyId, tempCommand, tempParams);
|
||||
messagePlayerSuccess(client, `You binded the {ALTCOLOUR}${toUpperCase(getKeyNameFromId(keyId))} {MAINCOLOUR}key to command: {ALTCOLOUR}/${tempCommand} ${tempParams}`);
|
||||
addPlayerKeyBind(client, keyId, tempCommand, tempParams);
|
||||
messagePlayerSuccess(client, `You binded the {ALTCOLOUR}${toUpperCase(getKeyNameFromId(keyId))} {MAINCOLOUR}key to command: {ALTCOLOUR}/${tempCommand} ${tempParams}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
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) {
|
||||
messagePlayerError(client, "The key ID or name you input is invalid!");
|
||||
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`);
|
||||
return false;
|
||||
}
|
||||
if(!keyId) {
|
||||
messagePlayerError(client, "The key ID or name you input is invalid!");
|
||||
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`);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!keyId) {
|
||||
messagePlayerError(client, "That key name/id is invalid!");
|
||||
return false;
|
||||
}
|
||||
if(!keyId) {
|
||||
messagePlayerError(client, "That key name/id is invalid!");
|
||||
return false;
|
||||
}
|
||||
|
||||
removePlayerKeyBind(client, keyId);
|
||||
messagePlayerSuccess(client, `You removed the keybind for the {ALTCOLOUR}${toUpperCase(getKeyNameFromId(keyId))} {MAINCOLOUR}key`);
|
||||
removePlayerKeyBind(client, keyId);
|
||||
messagePlayerSuccess(client, `You removed the keybind for the {ALTCOLOUR}${toUpperCase(getKeyNameFromId(keyId))} {MAINCOLOUR}key`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function addPlayerKeyBind(client, keys, command, params, tempKey = false) {
|
||||
let keyBindData = new KeyBindData(false, keys, `${command} ${params}`);
|
||||
if(tempKey == true) {
|
||||
keyBindData.databaseId = -1;
|
||||
}
|
||||
let keyBindData = new KeyBindData(false, keys, `${command} ${params}`);
|
||||
if(tempKey == true) {
|
||||
keyBindData.databaseId = -1;
|
||||
}
|
||||
|
||||
getPlayerData(client).keyBinds.push(keyBindData);
|
||||
sendAddAccountKeyBindToClient(client, keys, (keys.length > 1) ? VRR_KEYSTATE_COMBO : VRR_KEYSTATE_UP);
|
||||
getPlayerData(client).keyBinds.push(keyBindData);
|
||||
sendAddAccountKeyBindToClient(client, keys, (keys.length > 1) ? VRR_KEYSTATE_COMBO : VRR_KEYSTATE_UP);
|
||||
|
||||
if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(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)}`);
|
||||
sendPlayerEnterPropertyKey(client, keyId.key);
|
||||
} else {
|
||||
sendPlayerEnterPropertyKey(client, false);
|
||||
}
|
||||
if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(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)}`);
|
||||
sendPlayerEnterPropertyKey(client, keyId.key);
|
||||
} else {
|
||||
sendPlayerEnterPropertyKey(client, false);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function removePlayerKeyBind(client, keyId) {
|
||||
if(isPlayerLoggedIn(client)) {
|
||||
quickDatabaseQuery(`DELETE FROM acct_hotkey WHERE acct_hotkey_acct = ${getPlayerData(client).accountData.databaseId} AND acct_hotkey_key = ${keyId}`);
|
||||
}
|
||||
if(isPlayerLoggedIn(client)) {
|
||||
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) {
|
||||
if(getPlayerData(client).keyBinds[i].key == keyId) {
|
||||
getPlayerData(client).keyBinds.splice(i, 1);
|
||||
}
|
||||
}
|
||||
sendRemoveAccountKeyBindToClient(client, keyId);
|
||||
for(let i in getPlayerData(client).keyBinds) {
|
||||
if(getPlayerData(client).keyBinds[i].key == keyId) {
|
||||
getPlayerData(client).keyBinds.splice(i, 1);
|
||||
}
|
||||
}
|
||||
sendRemoveAccountKeyBindToClient(client, keyId);
|
||||
|
||||
if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(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)}`);
|
||||
sendPlayerEnterPropertyKey(client, keyId.key);
|
||||
} else {
|
||||
sendPlayerEnterPropertyKey(client, false);
|
||||
}
|
||||
if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(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)}`);
|
||||
sendPlayerEnterPropertyKey(client, keyId.key);
|
||||
} else {
|
||||
sendPlayerEnterPropertyKey(client, false);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function doesPlayerHaveKeyBindForCommand(client, command) {
|
||||
for(let i in getPlayerData(client).keyBinds) {
|
||||
if(toLowerCase(getPlayerData(client).keyBinds[i].commandString.split(" ")[0]) == toLowerCase(command)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
for(let i in getPlayerData(client).keyBinds) {
|
||||
if(toLowerCase(getPlayerData(client).keyBinds[i].commandString.split(" ")[0]) == toLowerCase(command)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerKeyBindForCommand(client, command) {
|
||||
for(let i in getPlayerData(client).keyBinds) {
|
||||
if(toLowerCase(getPlayerData(client).keyBinds[i].commandString.split(" ")[0]) == toLowerCase(command)) {
|
||||
return getPlayerData(client).keyBinds[i];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
for(let i in getPlayerData(client).keyBinds) {
|
||||
if(toLowerCase(getPlayerData(client).keyBinds[i].commandString.split(" ")[0]) == toLowerCase(command)) {
|
||||
return getPlayerData(client).keyBinds[i];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function doesPlayerHaveKeyBindForKey(client, key) {
|
||||
for(let i in getPlayerData(client).keyBinds) {
|
||||
if(getPlayerData(client).keyBinds[i].key == key) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
for(let i in getPlayerData(client).keyBinds) {
|
||||
if(getPlayerData(client).keyBinds[i].key == key) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function doesPlayerHaveKeyBindsDisabled(client) {
|
||||
return hasBitFlag(getPlayerData(client).accountData.settings, getAccountSettingsFlagValue("NoKeyBinds"));
|
||||
return hasBitFlag(getPlayerData(client).accountData.settings, getAccountSettingsFlagValue("NoKeyBinds"));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerKeyBindForKey(client, key) {
|
||||
for(let i in getPlayerData(client).keyBinds) {
|
||||
if(getPlayerData(client).keyBinds[i].key == key) {
|
||||
return getPlayerData(client).keyBinds[i];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
for(let i in getPlayerData(client).keyBinds) {
|
||||
if(getPlayerData(client).keyBinds[i].key == key) {
|
||||
return getPlayerData(client).keyBinds[i];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function playerUsedKeyBind(client, key) {
|
||||
if(!isPlayerLoggedIn(client)) {
|
||||
return false;
|
||||
}
|
||||
if(!isPlayerLoggedIn(client)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!isPlayerSpawned(client)) {
|
||||
return false;
|
||||
}
|
||||
if(!isPlayerSpawned(client)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.KeyBind] ${getPlayerDisplayForConsole(client)} used keybind ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
||||
if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForKey(client, key)) {
|
||||
let keyBindData = getPlayerKeyBindForKey(client, key);
|
||||
if(keyBindData.enabled) {
|
||||
let splitCommandString = keyBindData.commandString.split(" ");
|
||||
let tempCommand = splitCommandString[0];
|
||||
let tempParams = "";
|
||||
if(splitCommandString.length > 1) {
|
||||
tempParams = splitCommandString.slice(1).join(" ");
|
||||
}
|
||||
getCommand(toLowerCase(tempCommand)).handlerFunction(tempCommand, tempParams, client);
|
||||
//triggerEvent("OnPlayerCommand", null, tempCommand, tempParams, client);
|
||||
}
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[VRR.KeyBind] ${getPlayerDisplayForConsole(client)} used keybind ${toUpperCase(getKeyNameFromId(key))} (${key})`);
|
||||
if(!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForKey(client, key)) {
|
||||
let keyBindData = getPlayerKeyBindForKey(client, key);
|
||||
if(keyBindData.enabled) {
|
||||
let splitCommandString = keyBindData.commandString.split(" ");
|
||||
let tempCommand = splitCommandString[0];
|
||||
let tempParams = "";
|
||||
if(splitCommandString.length > 1) {
|
||||
tempParams = splitCommandString.slice(1).join(" ");
|
||||
}
|
||||
getCommand(toLowerCase(tempCommand)).handlerFunction(tempCommand, tempParams, client);
|
||||
//triggerEvent("OnPlayerCommand", null, tempCommand, tempParams, client);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendAccountKeyBindsToClient(client) {
|
||||
sendClearKeyBindsToClient(client);
|
||||
for(let i in getPlayerData(client).keyBinds) {
|
||||
sendAddAccountKeyBindToClient(client, getPlayerData(client).keyBinds[i].key, getPlayerData(client).keyBinds[i].keyState);
|
||||
}
|
||||
sendClearKeyBindsToClient(client);
|
||||
for(let i in getPlayerData(client).keyBinds) {
|
||||
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() {
|
||||
logToConsole(LOG_INFO, "[VRR.Locale]: Initializing locale script ...");
|
||||
getServerData().localeStrings = loadAllLocaleStrings();
|
||||
logToConsole(LOG_INFO, "[VRR.Locale]: Initializing locale script ...");
|
||||
getServerData().localeStrings = loadAllLocaleStrings();
|
||||
|
||||
// Translation Cache
|
||||
getServerData().cachedTranslations = new Array(getGlobalConfig().locale.locales.length);
|
||||
getServerData().cachedTranslationFrom = new Array(getGlobalConfig().locale.locales.length);
|
||||
getServerData().cachedTranslationFrom.fill([]);
|
||||
getServerData().cachedTranslations.fill(getServerData().cachedTranslationFrom);
|
||||
// Translation Cache
|
||||
getServerData().cachedTranslations = new Array(getGlobalConfig().locale.locales.length);
|
||||
getServerData().cachedTranslationFrom = new Array(getGlobalConfig().locale.locales.length);
|
||||
getServerData().cachedTranslationFrom.fill([]);
|
||||
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!");
|
||||
}
|
||||
@@ -29,68 +29,68 @@ function initLocaleScript() {
|
||||
// ===========================================================================
|
||||
|
||||
function getLocaleString(client, stringName, ...args) {
|
||||
let tempString = getRawLocaleString(stringName, getPlayerData(client).locale);
|
||||
if(tempString == "") {
|
||||
submitBugReport(client, `(AUTOMATED REPORT) Locale string "${stringName}" is missing for "${getPlayerLocaleName(client)}"`);
|
||||
}
|
||||
let tempString = getRawLocaleString(stringName, getPlayerData(client).locale);
|
||||
if(tempString == "") {
|
||||
submitBugReport(client, `(AUTOMATED REPORT) Locale string "${stringName}" is missing for "${getPlayerLocaleName(client)}"`);
|
||||
}
|
||||
|
||||
for(let i = 1; i <= args.length; i++) {
|
||||
tempString = tempString.replace(`{${i}}`, args[i-1]);
|
||||
}
|
||||
for(let i = 1; i <= args.length; i++) {
|
||||
tempString = tempString.replace(`{${i}}`, args[i-1]);
|
||||
}
|
||||
|
||||
return tempString;
|
||||
return tempString;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
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++) {
|
||||
tempString = tempString.replace(`{${i}}`, args[i-1]);
|
||||
}
|
||||
for(let i = 1; i <= args.length; i++) {
|
||||
tempString = tempString.replace(`{${i}}`, args[i-1]);
|
||||
}
|
||||
|
||||
return tempString;
|
||||
return tempString;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getRawLocaleString(stringName, localeName) {
|
||||
return getLocaleStrings()[localeName][stringName];
|
||||
return getLocaleStrings()[localeName][stringName];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getRawGroupedLocaleString(stringName, localeName, index) {
|
||||
return getLocaleStrings()[localeName][stringName][index];
|
||||
return getLocaleStrings()[localeName][stringName][index];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerLocaleName(client) {
|
||||
let localeId = getPlayerData(client).locale;
|
||||
return getLocales()[localeId][0];
|
||||
let localeId = getPlayerData(client).locale;
|
||||
return getLocales()[localeId][0];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadAllLocaleStrings() {
|
||||
let tempLocaleStrings = {};
|
||||
let tempLocaleStrings = {};
|
||||
|
||||
let locales = getGlobalConfig().locale.locales;
|
||||
for(let i in locales) {
|
||||
let localeData = locales[i];
|
||||
let localeFile = JSON.parse(loadTextFile(`locale/${localeData[1]}.json`));
|
||||
tempLocaleStrings[i] = localeFile;
|
||||
}
|
||||
let locales = getGlobalConfig().locale.locales;
|
||||
for(let i in locales) {
|
||||
let localeData = locales[i];
|
||||
let localeFile = JSON.parse(loadTextFile(`locale/${localeData[1]}.json`));
|
||||
tempLocaleStrings[i] = localeFile;
|
||||
}
|
||||
|
||||
return tempLocaleStrings;
|
||||
return tempLocaleStrings;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getLocaleStrings() {
|
||||
return getServerData().localeStrings;
|
||||
return getServerData().localeStrings;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -99,7 +99,7 @@ function getLocaleFromParams(params) {
|
||||
let locales = getLocales();
|
||||
if(isNaN(params)) {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ function getLocaleFromParams(params) {
|
||||
// ===========================================================================
|
||||
|
||||
function getLocales() {
|
||||
return getGlobalConfig().locale.locales;
|
||||
return getGlobalConfig().locale.locales;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -138,41 +138,41 @@ function setLocaleCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let localeId = getLocaleFromParams(params);
|
||||
let localeId = getLocaleFromParams(params);
|
||||
|
||||
if(!getLocaleData(localeId)) {
|
||||
messagePlayerInfo(client, getLocaleString(client, "InvalidLocale"));
|
||||
return false;
|
||||
}
|
||||
if(!getLocaleData(localeId)) {
|
||||
messagePlayerInfo(client, getLocaleString(client, "InvalidLocale"));
|
||||
return false;
|
||||
}
|
||||
|
||||
getPlayerData(client).accountData.locale = localeId;
|
||||
getPlayerData(client).locale = localeId;
|
||||
messagePlayerSuccess(client, getLocaleString(client, "LocaleChanged1"), getLocaleString(client, "LocaleNativeName"));
|
||||
getPlayerData(client).accountData.locale = localeId;
|
||||
getPlayerData(client).locale = localeId;
|
||||
messagePlayerSuccess(client, getLocaleString(client, "LocaleChanged1"), getLocaleString(client, "LocaleNativeName"));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getLocaleData(localeId) {
|
||||
if(typeof getLocales()[localeId] != "undefined") {
|
||||
return getLocales()[localeId];
|
||||
}
|
||||
if(typeof getLocales()[localeId] != "undefined") {
|
||||
return getLocales()[localeId];
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function reloadLocaleConfigurationCommand(command, params, client) {
|
||||
getGlobalConfig().locale = loadLocaleConfig();
|
||||
getServerData().localeStrings = loadAllLocaleStrings();
|
||||
getServerData().localeStrings = loadAllLocaleStrings();
|
||||
|
||||
// Translation Cache
|
||||
getServerData().cachedTranslations = new Array(getGlobalConfig().locale.locales.length);
|
||||
getServerData().cachedTranslationFrom = new Array(getGlobalConfig().locale.locales.length);
|
||||
getServerData().cachedTranslationFrom.fill([]);
|
||||
getServerData().cachedTranslations.fill(getServerData().cachedTranslationFrom);
|
||||
// Translation Cache
|
||||
getServerData().cachedTranslations = new Array(getGlobalConfig().locale.locales.length);
|
||||
getServerData().cachedTranslationFrom = new Array(getGlobalConfig().locale.locales.length);
|
||||
getServerData().cachedTranslationFrom.fill([]);
|
||||
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`);
|
||||
}
|
||||
@@ -181,9 +181,9 @@ function reloadLocaleConfigurationCommand(command, params, client) {
|
||||
|
||||
async function translateMessage(messageText, translateFrom = getGlobalConfig().locale.defaultLanguageId, translateTo = getGlobalConfig().locale.defaultLanguageId) {
|
||||
return new Promise(resolve => {
|
||||
if(translateFrom == translateTo) {
|
||||
resolve(messageText);
|
||||
}
|
||||
if(translateFrom == translateTo) {
|
||||
resolve(messageText);
|
||||
}
|
||||
|
||||
for(let i in cachedTranslations[translateFrom][translateTo]) {
|
||||
if(cachedTranslations[translateFrom][translateTo][i][0] == messageText) {
|
||||
|
||||
@@ -15,10 +15,10 @@ function initMessagingScript() {
|
||||
// ===========================================================================
|
||||
|
||||
function messageAdminAction(messageText) {
|
||||
messagePlayerNormal(null, `⚠️ ${messageText}`, getColourByName("orange"));
|
||||
if(getServerConfig().discordEnabled) {
|
||||
messageDiscord(`:warning: ${messageText}`);
|
||||
}
|
||||
messagePlayerNormal(null, `⚠️ ${messageText}`, getColourByName("orange"));
|
||||
if(getServerConfig().discordEnabled) {
|
||||
messageDiscord(`:warning: ${messageText}`);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -33,196 +33,196 @@ function messageAdminAction(messageText) {
|
||||
*
|
||||
*/
|
||||
function messagePlayerNormal(client, messageText, colour = COLOUR_WHITE) {
|
||||
//if(isConsole(client) || client == null) {
|
||||
// logToConsole(LOG_INFO, `${removeColoursInMessage(messageText)}`);
|
||||
//}
|
||||
//if(isConsole(client) || client == null) {
|
||||
// logToConsole(LOG_INFO, `${removeColoursInMessage(messageText)}`);
|
||||
//}
|
||||
|
||||
messageText = replaceColoursInMessage(messageText);
|
||||
messageText = replaceColoursInMessage(messageText);
|
||||
|
||||
if(client == null) {
|
||||
message(messageText, colour);
|
||||
} else {
|
||||
messageClient(messageText, client, colour);
|
||||
}
|
||||
if(client == null) {
|
||||
message(messageText, colour);
|
||||
} else {
|
||||
messageClient(messageText, client, colour);
|
||||
}
|
||||
|
||||
//sendChatBoxMessageToPlayer(client, messageText, colour);
|
||||
return true;
|
||||
//sendChatBoxMessageToPlayer(client, messageText, colour);
|
||||
return true;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messageAdmins(messageText, colour = getColourByName("softRed")) {
|
||||
//let plainMessage = removeColoursInMessage(messageText);
|
||||
//console.warn(`🛡️ ${plainMessage}`);
|
||||
//let plainMessage = removeColoursInMessage(messageText);
|
||||
//console.warn(`🛡️ ${plainMessage}`);
|
||||
|
||||
let clients = getClients();
|
||||
for(let i in clients) {
|
||||
if(doesPlayerHaveStaffPermission(clients[i], getStaffFlagValue("BasicModeration"))) {
|
||||
messagePlayerNormal(clients[i], `🛡️ ${messageText}`, colour);
|
||||
}
|
||||
}
|
||||
let clients = getClients();
|
||||
for(let i in clients) {
|
||||
if(doesPlayerHaveStaffPermission(clients[i], getStaffFlagValue("BasicModeration"))) {
|
||||
messagePlayerNormal(clients[i], `🛡️ ${messageText}`, colour);
|
||||
}
|
||||
}
|
||||
|
||||
//if(getServerConfig().discordConfig.sendAdminEvents) {
|
||||
// messageDiscordAdminChannel(plainMessage);
|
||||
//}
|
||||
//if(getServerConfig().discordConfig.sendAdminEvents) {
|
||||
// messageDiscordAdminChannel(plainMessage);
|
||||
//}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerError(client, messageText) {
|
||||
if(isConsole(client)) {
|
||||
logToConsole(LOG_INFO, `❌ ${messageText}`);
|
||||
return true;
|
||||
}
|
||||
if(isConsole(client)) {
|
||||
logToConsole(LOG_INFO, `❌ ${messageText}`);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!isClientFromDiscord(client)) {
|
||||
messagePlayerNormal(client, `❌ ${messageText}`, getColourByName("white"));
|
||||
} else {
|
||||
messageDiscordUser(client, `❌ ${messageText}`);
|
||||
}
|
||||
if(!isClientFromDiscord(client)) {
|
||||
messagePlayerNormal(client, `❌ ${messageText}`, getColourByName("white"));
|
||||
} else {
|
||||
messageDiscordUser(client, `❌ ${messageText}`);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerSyntax(client, messageText) {
|
||||
if(isConsole(client)) {
|
||||
logToConsole(LOG_INFO, `⌨️ ${messageText}`);
|
||||
return true;
|
||||
}
|
||||
if(isConsole(client)) {
|
||||
logToConsole(LOG_INFO, `⌨️ ${messageText}`);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!isClientFromDiscord(client)) {
|
||||
messagePlayerNormal(client, `⌨️ USAGE: {MAINCOLOUR} ${messageText}`, getColourByType("syntaxMessage"));
|
||||
} else {
|
||||
messageDiscordUser(client, `⌨️ ${messageText}`);
|
||||
}
|
||||
if(!isClientFromDiscord(client)) {
|
||||
messagePlayerNormal(client, `⌨️ USAGE: {MAINCOLOUR} ${messageText}`, getColourByType("syntaxMessage"));
|
||||
} else {
|
||||
messageDiscordUser(client, `⌨️ ${messageText}`);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerAlert(client, messageText) {
|
||||
if(isConsole(client)) {
|
||||
logToConsole(LOG_INFO, `⚠️ ${messageText}`);
|
||||
return true;
|
||||
}
|
||||
if(isConsole(client)) {
|
||||
logToConsole(LOG_INFO, `⚠️ ${messageText}`);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!isClientFromDiscord(client)) {
|
||||
messagePlayerNormal(client, `⚠️ ${messageText}`, getColourByName("white"));
|
||||
} else {
|
||||
messageDiscordUser(client, `⚠️ ${messageText}`);
|
||||
}
|
||||
if(!isClientFromDiscord(client)) {
|
||||
messagePlayerNormal(client, `⚠️ ${messageText}`, getColourByName("white"));
|
||||
} else {
|
||||
messageDiscordUser(client, `⚠️ ${messageText}`);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerSuccess(client, messageText) {
|
||||
if(isConsole(client)) {
|
||||
logToConsole(LOG_INFO, `✔️ ${messageText}`);
|
||||
return true;
|
||||
}
|
||||
if(isConsole(client)) {
|
||||
logToConsole(LOG_INFO, `✔️ ${messageText}`);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!isClientFromDiscord(client)) {
|
||||
messagePlayerNormal(client, `✔️ ${messageText}`, getColourByName("white"));
|
||||
} else {
|
||||
messageDiscordUser(client, `✔️ ${messageText}`);
|
||||
}
|
||||
if(!isClientFromDiscord(client)) {
|
||||
messagePlayerNormal(client, `✔️ ${messageText}`, getColourByName("white"));
|
||||
} else {
|
||||
messageDiscordUser(client, `✔️ ${messageText}`);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerInfo(client, messageText) {
|
||||
if(isConsole(client)) {
|
||||
logToConsole(LOG_INFO, `ℹ️ ${messageText}`);
|
||||
return true;
|
||||
}
|
||||
if(isConsole(client)) {
|
||||
logToConsole(LOG_INFO, `ℹ️ ${messageText}`);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!isClientFromDiscord(client)) {
|
||||
messagePlayerNormal(client, `ℹ️ ${messageText}`, getColourByName("white"));
|
||||
} else {
|
||||
messageDiscordUser(client, `:information_source: ${messageText}`);
|
||||
}
|
||||
if(!isClientFromDiscord(client)) {
|
||||
messagePlayerNormal(client, `ℹ️ ${messageText}`, getColourByName("white"));
|
||||
} else {
|
||||
messageDiscordUser(client, `:information_source: ${messageText}`);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerTip(client, messageText) {
|
||||
if(isConsole(client)) {
|
||||
logToConsole(LOG_INFO, `ℹ️ ${messageText}`);
|
||||
return true;
|
||||
}
|
||||
if(isConsole(client)) {
|
||||
logToConsole(LOG_INFO, `ℹ️ ${messageText}`);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!isClientFromDiscord(client)) {
|
||||
messagePlayerNormal(client, `ℹ️ ${messageText}`, getColourByName("white"));
|
||||
} else {
|
||||
messageDiscordUser(client, `:information_source: ${messageText}`);
|
||||
}
|
||||
if(!isClientFromDiscord(client)) {
|
||||
messagePlayerNormal(client, `ℹ️ ${messageText}`, getColourByName("white"));
|
||||
} else {
|
||||
messageDiscordUser(client, `:information_source: ${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) {
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
if(!isClientFromDiscord(client)) {
|
||||
messagePlayerNormal(client, `${messageText} * (${getClientSubAccountName(doingActionClient)})`, getColourByType("doActionMessage"));
|
||||
}
|
||||
if(!isClientFromDiscord(client)) {
|
||||
messagePlayerNormal(client, `${messageText} * (${getClientSubAccountName(doingActionClient)})`, getColourByType("doActionMessage"));
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerMeAction(client, doingActionClient, messageText) {
|
||||
messagePlayerNormal(client, `${getClientSubAccountName(doingActionClient)} ${messageText}`, getColourByType("meActionMessage"));
|
||||
messagePlayerNormal(client, `${getClientSubAccountName(doingActionClient)} ${messageText}`, getColourByType("meActionMessage"));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
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) {
|
||||
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) {
|
||||
if(!hasBitFlag(getPlayerData(client).accountData.settings, getAccountSettingsFlagValue("NoActionTips"))) {
|
||||
messagePlayerNormal(client, `💡 ${message}`);
|
||||
}
|
||||
if(!hasBitFlag(getPlayerData(client).accountData.settings, getAccountSettingsFlagValue("NoActionTips"))) {
|
||||
messagePlayerNormal(client, `💡 ${message}`);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerTimedRandomTip(client, message) {
|
||||
if(isPlayerLoggedIn(client) && isPlayerSpawned(client)) {
|
||||
if(!hasBitFlag(getPlayerData(client).accountData.settings, getAccountSettingsFlagValue("NoRandomTips"))) {
|
||||
messagePlayerNormal(client, `💡 ${message}`);
|
||||
}
|
||||
}
|
||||
if(isPlayerLoggedIn(client) && isPlayerSpawned(client)) {
|
||||
if(!hasBitFlag(getPlayerData(client).accountData.settings, getAccountSettingsFlagValue("NoRandomTips"))) {
|
||||
messagePlayerNormal(client, `💡 ${message}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -245,7 +245,7 @@ function clearChatBox(client) {
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerHelpContent(client, messageString) {
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}${messageString}`);
|
||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}${messageString}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -47,7 +47,7 @@ function setNewCharacterSpawnPositionCommand(command, params, client) {
|
||||
getServerConfig().newCharacter.spawnHeading = client.player.heading;
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
messagePlayerNormal(client, `The new character spawn position has been set to ${position.x.toFixed(2)}, ${position.y.toFixed(2)}, ${position.z.toFixed(2)}`)
|
||||
messagePlayerNormal(client, `The new character spawn position has been set to ${position.x.toFixed(2)}, ${position.y.toFixed(2)}, ${position.z.toFixed(2)}`)
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ let amount = toInteger(getParam(params, " ", 1)) || 1000;
|
||||
getServerConfig().newCharacter.cash = amount;
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
messagePlayerNormal(client, `The new character money has been set to $${amount}`);
|
||||
messagePlayerNormal(client, `The new character money has been set to $${amount}`);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ function setNewCharacterSkinCommand(command, params, client) {
|
||||
getServerConfig().newCharacter.skin = skinId;
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
messagePlayerNormal(client, `The new character skin has been set to ${getSkinNameFromModel(skinId)} (Index ${skinId})`);
|
||||
messagePlayerNormal(client, `The new character skin has been set to ${getSkinNameFromModel(skinId)} (Index ${skinId})`);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ function submitIdeaCommand(command, params, client) {
|
||||
|
||||
submitIdea(client, params);
|
||||
|
||||
messagePlayerNormal(client, `Your suggestion/idea has been sent to the developers!`);
|
||||
messagePlayerNormal(client, `Your suggestion/idea has been sent to the developers!`);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ function submitBugReportCommand(command, params, client) {
|
||||
|
||||
submitBugReport(client, params);
|
||||
|
||||
messagePlayerNormal(client, `Your bug report has been sent to the developers!`);
|
||||
messagePlayerNormal(client, `Your bug report has been sent to the developers!`);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -127,47 +127,47 @@ function enterExitPropertyCommand(command, params, client) {
|
||||
|
||||
let ownerType = getEntityData(getPlayerData(client).currentPickup, "vrr.owner.type");
|
||||
let ownerId = getEntityData(getPlayerData(client).currentPickup, "vrr.owner.id");
|
||||
|
||||
|
||||
switch(ownerType) {
|
||||
case VRR_PICKUP_BUSINESS_ENTRANCE:
|
||||
isBusiness = true;
|
||||
isEntrance = true;
|
||||
closestProperty = getServerData().businesses[ownerId];
|
||||
break;
|
||||
|
||||
|
||||
case VRR_PICKUP_BUSINESS_EXIT:
|
||||
isBusiness = true;
|
||||
isEntrance = false;
|
||||
closestProperty = getServerData().businesses[ownerId];
|
||||
break;
|
||||
|
||||
|
||||
case VRR_PICKUP_HOUSE_ENTRANCE:
|
||||
isBusiness = false;
|
||||
isEntrance = true;
|
||||
closestProperty = getServerData().houses[ownerId];
|
||||
break;
|
||||
|
||||
|
||||
case VRR_PICKUP_HOUSE_EXIT:
|
||||
isBusiness = false;
|
||||
isEntrance = false;
|
||||
closestProperty = getServerData().houses[ownerId];
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for(let i in getServerData().businesses) {
|
||||
if(getPlayerDimension(client) == getGameConfig().mainWorldDimension[getGame()] && getPlayerInterior(client) == getGameConfig().mainWorldInterior[getGame()]) {
|
||||
let businessId = getClosestBusinessEntrance(getPlayerPosition(client), getPlayerDimension(client));
|
||||
isBusiness = true;
|
||||
isEntrance = true;
|
||||
closestProperty = getServerData().businesses[businessId];
|
||||
closestProperty = getServerData().businesses[businessId];
|
||||
} else {
|
||||
let businessId = getClosestBusinessExit(getPlayerPosition(client), getPlayerDimension(client));
|
||||
isBusiness = true;
|
||||
isEntrance = false;
|
||||
closestProperty = getServerData().businesses[businessId];
|
||||
closestProperty = getServerData().businesses[businessId];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,12 +176,12 @@ function enterExitPropertyCommand(command, params, client) {
|
||||
let houseId = getClosestHouseEntrance(getPlayerPosition(client), getPlayerDimension(client));
|
||||
isBusiness = false;
|
||||
isEntrance = true;
|
||||
closestProperty = getServerData().businesses[houseId];
|
||||
closestProperty = getServerData().businesses[houseId];
|
||||
} else {
|
||||
let houseId = getClosestHouseExit(getPlayerPosition(client), getPlayerDimension(client));
|
||||
isBusiness = false;
|
||||
isEntrance = false;
|
||||
closestProperty = getServerData().businesses[houseId];
|
||||
closestProperty = getServerData().businesses[houseId];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -213,6 +213,7 @@ function enterExitPropertyCommand(command, params, client) {
|
||||
}
|
||||
|
||||
setTimeout(function() {
|
||||
setPlayerInCutsceneInterior(client, closestProperty.exitCutscene);
|
||||
setPlayerPosition(client, closestProperty.exitPosition);
|
||||
setPlayerHeading(client, closestProperty.exitRotation);
|
||||
setPlayerDimension(client, closestProperty.exitDimension);
|
||||
@@ -221,7 +222,6 @@ function enterExitPropertyCommand(command, params, client) {
|
||||
if(isFadeCameraSupported()) {
|
||||
fadeCamera(client, true, 1.0);
|
||||
}
|
||||
setPlayerInCutsceneInterior(client, closestProperty.exitCutscene);
|
||||
updateInteriorLightsForPlayer(client, closestProperty.interiorLights);
|
||||
}, 1000);
|
||||
//setPlayerInCutsceneInterior(client, closestProperty.exitCutscene);
|
||||
@@ -251,6 +251,7 @@ function enterExitPropertyCommand(command, params, client) {
|
||||
|
||||
disableCityAmbienceForPlayer(client, true);
|
||||
setTimeout(function() {
|
||||
setPlayerInCutsceneInterior(client, closestProperty.entranceCutscene);
|
||||
setPlayerPosition(client, closestProperty.entrancePosition);
|
||||
setPlayerHeading(client, closestProperty.entranceRotation);
|
||||
setPlayerDimension(client, closestProperty.entranceDimension);
|
||||
@@ -259,14 +260,14 @@ function enterExitPropertyCommand(command, params, client) {
|
||||
if(isFadeCameraSupported()) {
|
||||
fadeCamera(client, true, 1.0);
|
||||
}
|
||||
setPlayerInCutsceneInterior(client, closestProperty.entranceCutscene);
|
||||
|
||||
updateInteriorLightsForPlayer(client, true);
|
||||
}, 1000);
|
||||
}, 1100);
|
||||
//setPlayerInCutsceneInterior(client, closestProperty.entranceCutscene);
|
||||
stopRadioStreamForPlayer(client);
|
||||
getPlayerData(client).streamingRadioStation = -1;
|
||||
|
||||
|
||||
//logToConsole(LOG_DEBUG, `[VRR.Misc] ${getPlayerDisplayForConsole(client)} exited business ${inBusiness.name}[${inBusiness.index}/${inBusiness.databaseId}]`);
|
||||
return true;
|
||||
}
|
||||
@@ -306,7 +307,6 @@ function getPlayerInfoCommand(command, params, client) {
|
||||
`{MAINCOLOUR}Skin: {ALTCOLOUR}${getSkinNameFromModel(getPlayerCurrentSubAccount(targetClient).skin)}[${getPlayerCurrentSubAccount(targetClient).skin}]`,
|
||||
`{MAINCOLOUR}Clan: {ALTCOLOUR}${clan}`,
|
||||
`{MAINCOLOUR}Job: {ALTCOLOUR}${job}`,
|
||||
|
||||
]
|
||||
|
||||
let chunkedList = splitArrayIntoChunks(stats, 6);
|
||||
@@ -318,7 +318,7 @@ function getPlayerInfoCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function playerChangeAFKState(client, afkState) {
|
||||
getPlayerData(client).afk = afkState;
|
||||
getPlayerData(client).afk = afkState;
|
||||
updateAllPlayerNameTags();
|
||||
}
|
||||
|
||||
@@ -480,15 +480,15 @@ function gpsCommand(command, params, client) {
|
||||
default: {
|
||||
let itemTypeId = getItemTypeFromParams(params);
|
||||
if(getItemTypeData(itemTypeId) != false) {
|
||||
locationType = VRR_GPS_TYPE_BUSINESS;
|
||||
blipColour = "businessBlue";
|
||||
locationType = VRR_GPS_TYPE_BUSINESS;
|
||||
blipColour = "businessBlue";
|
||||
useType = getItemTypeData(itemTypeId).useType;
|
||||
} else {
|
||||
let gameLocationId = getGameLocationFromParams(params);
|
||||
if(gameLocationId != false) {
|
||||
position = getGameConfig().locations[getServerGame()][gameLocationId][1]
|
||||
}
|
||||
}
|
||||
let gameLocationId = getGameLocationFromParams(params);
|
||||
if(gameLocationId != false) {
|
||||
position = getGameConfig().locations[getServerGame()][gameLocationId][1]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -509,87 +509,98 @@ function gpsCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
hideAllBlipsForPlayerGPS(client);
|
||||
hideAllBlipsForPlayerGPS(client);
|
||||
blinkGenericGPSBlipForPlayer(client, getBusinessData(businessId).entrancePosition, getBusinessData(businessId).entranceBlipModel, getColourByType(blipColour), 10);
|
||||
messagePlayerSuccess(client, "Look for the blinking icon on your mini map");
|
||||
messagePlayerSuccess(client, "Look for the blinking icon on your mini map");
|
||||
}
|
||||
|
||||
if(locationType == VRR_GPS_TYPE_GAMELOC) {
|
||||
hideAllBlipsForPlayerGPS(client);
|
||||
blinkGenericGPSBlipForPlayer(client, position, 0, getColourByType(blipColour), 10);
|
||||
messagePlayerSuccess(client, "Look for the blinking icon on your mini map");
|
||||
return true;
|
||||
}
|
||||
if(locationType == VRR_GPS_TYPE_GAMELOC) {
|
||||
hideAllBlipsForPlayerGPS(client);
|
||||
blinkGenericGPSBlipForPlayer(client, position, 0, getColourByType(blipColour), 10);
|
||||
messagePlayerSuccess(client, "Look for the blinking icon on your mini map");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function stuckPlayerCommand(command, params, client) {
|
||||
if((getCurrentUnixTimestamp()-getPlayerData(client).lastStuckCommand) < getGlobalConfig().stuckCommandInterval) {
|
||||
messagePlayerError(client, "CantUseCommandYet");
|
||||
return false;
|
||||
}
|
||||
if((getCurrentUnixTimestamp()-getPlayerData(client).lastStuckCommand) < getGlobalConfig().stuckCommandInterval) {
|
||||
messagePlayerError(client, "CantUseCommandYet");
|
||||
return false;
|
||||
}
|
||||
|
||||
let dimension = getPlayerDimension(client);
|
||||
let interior = getPlayerInterior(client);
|
||||
let dimension = getPlayerDimension(client);
|
||||
let interior = getPlayerInterior(client);
|
||||
|
||||
messagePlayerAlert(client, getLocaleString(client, "FixingStuck"));
|
||||
messagePlayerAlert(client, getLocaleString(client, "FixingStuck"));
|
||||
|
||||
if(getGameConfig().skinChangePosition[getServerGame()].length > 0) {
|
||||
if(getPlayerData(client).returnToPosition != null && getPlayerData(client).returnToType == VRR_RETURNTO_TYPE_SKINSELECT) {
|
||||
messagePlayerAlert(client, "You canceled the skin change.");
|
||||
restorePlayerCamera(client);
|
||||
if(getGameConfig().skinChangePosition[getServerGame()].length > 0) {
|
||||
if(getPlayerData(client).returnToPosition != null && getPlayerData(client).returnToType == VRR_RETURNTO_TYPE_SKINSELECT) {
|
||||
messagePlayerAlert(client, "You canceled the skin change.");
|
||||
restorePlayerCamera(client);
|
||||
|
||||
setPlayerPosition(client, getPlayerData(client).returnToPosition);
|
||||
setPlayerHeading(client, getPlayerData(client).returnToHeading);
|
||||
setPlayerInterior(client, getPlayerData(client).returnToInterior);
|
||||
setPlayerDimension(client, getPlayerData(client).returnToDimension);
|
||||
setPlayerPosition(client, getPlayerData(client).returnToPosition);
|
||||
setPlayerHeading(client, getPlayerData(client).returnToHeading);
|
||||
setPlayerInterior(client, getPlayerData(client).returnToInterior);
|
||||
setPlayerDimension(client, getPlayerData(client).returnToDimension);
|
||||
|
||||
getPlayerData(client).returnToPosition = null;
|
||||
getPlayerData(client).returnToHeading = null;
|
||||
getPlayerData(client).returnToInterior = null;
|
||||
getPlayerData(client).returnToDimension = null;
|
||||
getPlayerData(client).returnToPosition = null;
|
||||
getPlayerData(client).returnToHeading = null;
|
||||
getPlayerData(client).returnToInterior = null;
|
||||
getPlayerData(client).returnToDimension = null;
|
||||
|
||||
getPlayerData(client).returnToType = VRR_RETURNTO_TYPE_NONE;
|
||||
}
|
||||
}
|
||||
getPlayerData(client).returnToType = VRR_RETURNTO_TYPE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
//if(getPlayerData(client).returnToPosition != null && getPlayerData(client).returnToType == VRR_RETURNTO_TYPE_ADMINGET) {
|
||||
// messagePlayerError(client, `You were teleported by an admin and can't use the stuck command`);
|
||||
// return false;
|
||||
//}
|
||||
//if(getPlayerData(client).returnToPosition != null && getPlayerData(client).returnToType == VRR_RETURNTO_TYPE_ADMINGET) {
|
||||
// messagePlayerError(client, `You were teleported by an admin and can't use the stuck command`);
|
||||
// return false;
|
||||
//}
|
||||
|
||||
if(dimension > 0) {
|
||||
let businesses = getServerData().businesses;
|
||||
for(let i in businesses) {
|
||||
if(businesses[i].exitDimension == dimension) {
|
||||
setPlayerPosition(client, businesses[i].entrancePosition);
|
||||
setPlayerDimension(client, businesses[i].entranceDimension);
|
||||
setPlayerInterior(client, businesses[i].entranceInterior);
|
||||
if(dimension > 0) {
|
||||
let businesses = getServerData().businesses;
|
||||
for(let i in businesses) {
|
||||
if(businesses[i].exitDimension == dimension) {
|
||||
setPlayerPosition(client, businesses[i].entrancePosition);
|
||||
setPlayerDimension(client, businesses[i].entranceDimension);
|
||||
setPlayerInterior(client, businesses[i].entranceInterior);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
let houses = getServerData().houses;
|
||||
for(let i in houses) {
|
||||
if(houses[i].exitDimension == dimension) {
|
||||
setPlayerPosition(client, houses[i].entrancePosition);
|
||||
setPlayerDimension(client, houses[i].entranceDimension);
|
||||
setPlayerInterior(client, houses[i].entranceInterior);
|
||||
let houses = getServerData().houses;
|
||||
for(let i in houses) {
|
||||
if(houses[i].exitDimension == dimension) {
|
||||
setPlayerPosition(client, houses[i].entrancePosition);
|
||||
setPlayerDimension(client, houses[i].entranceDimension);
|
||||
setPlayerInterior(client, houses[i].entranceInterior);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
setPlayerDimension(client, 1);
|
||||
setPlayerDimension(client, getGameConfig().mainWorldDimension[getGame()]);
|
||||
setPlayerInterior(client, getGameConfig().mainWorldInterior[getGame()]);
|
||||
setPlayerPosition(client, getPosAbovePos(getPlayerPosition(client), 2.0));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
setPlayerDimension(client, 1);
|
||||
setPlayerDimension(client, getGameConfig().mainWorldDimension[getGame()]);
|
||||
setPlayerInterior(client, getGameConfig().mainWorldInterior[getGame()]);
|
||||
setPlayerPosition(client, getPosAbovePos(getPlayerPosition(client), 2.0));
|
||||
}
|
||||
|
||||
setPlayerInterior(client, 0);
|
||||
setPlayerDimension(client, 0);
|
||||
setPlayerInterior(client, 0);
|
||||
setPlayerDimension(client, 0);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function playerPedSpeakCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
|
||||
makePlayerPedSpeak(client, params);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -24,7 +24,7 @@ function getNPCData(ped) {
|
||||
if(ped.getData("vrr.dataIndex")) {
|
||||
return ped.getData("vrr.dataIndex");
|
||||
}
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -44,7 +44,7 @@ function createNPCCommand(client, command, params) {
|
||||
|
||||
let position = getPosInFrontOfPos(getPlayerPosition(client), getPlayerHeading(client), 3);
|
||||
|
||||
let tempNPCData = new NPCData(false);
|
||||
let tempNPCData = new NPCData(false);
|
||||
tempNPCData.position = position;
|
||||
tempNPCData.heading = getPlayerHeading(client);
|
||||
tempNPCData.skin = skinId;
|
||||
|
||||
@@ -8,21 +8,21 @@
|
||||
// ===========================================================================
|
||||
|
||||
function attemptToSignalToNearbyTaxi(client) {
|
||||
if(!isPlayerLoggedIn(client)) {
|
||||
return false;
|
||||
}
|
||||
if(!isPlayerLoggedIn(client)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!isPlayerSpawned(client)) {
|
||||
return false;
|
||||
}
|
||||
if(!isPlayerSpawned(client)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let nearbyTaxis = getElementsByType(ELEMENT_VEHICLE).filter((v) > getPlayerPosition(client).distance(v.position) <= 15 && isTaxiVehicle(v));
|
||||
let nearbyTaxis = getElementsByType(ELEMENT_VEHICLE).filter((v) > getPlayerPosition(client).distance(v.position) <= 15 && isTaxiVehicle(v));
|
||||
|
||||
let closestTaxi = nearbyTaxis.reduce((i, j) => (i.position.distance(pos) < j.position.distance(pos)) ? i : j);
|
||||
if(!closestTaxi.getOccupant(0).isType(ELEMENT_PLAYER)) {
|
||||
setVehicleCruiseSpeed(closestTaxi, 0.0);
|
||||
setVehicleLockedState(closestTaxi, false);
|
||||
}
|
||||
let closestTaxi = nearbyTaxis.reduce((i, j) => (i.position.distance(pos) < j.position.distance(pos)) ? i : j);
|
||||
if(!closestTaxi.getOccupant(0).isType(ELEMENT_PLAYER)) {
|
||||
setVehicleCruiseSpeed(closestTaxi, 0.0);
|
||||
setVehicleLocked(closestTaxi, false);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
function initRadioScript() {
|
||||
logToConsole(LOG_INFO, "[VRR.Radio]: Initializing radio script ...");
|
||||
getServerData().radioStations = loadRadioStationsFromDatabase();
|
||||
getServerData().radioStations = loadRadioStationsFromDatabase();
|
||||
setRadioStationIndexes();
|
||||
logToConsole(LOG_INFO, "[VRR.Radio]: Radio script initialized successfully!");
|
||||
return true;
|
||||
|
||||
@@ -20,11 +20,11 @@ function kickClientCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let targetClient = getPlayerFromParams(params);
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
let targetClient = getPlayerFromParams(params);
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Prevent kicking admins with really high permissions
|
||||
if(doesPlayerHaveStaffPermission(targetClient, getStaffFlagValue("ManageServer")) || doesPlayerHaveStaffPermission(targetClient, getStaffFlagValue("Developer"))) {
|
||||
@@ -50,9 +50,9 @@ function setStaffTitleCommand(command, params, client) {
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let staffTitle = splitParams.slice(1).join(" ");
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Prevent setting titles on staff with really high permissions
|
||||
@@ -77,11 +77,11 @@ function muteClientCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let targetClient = getPlayerFromParams(params);
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
let targetClient = getPlayerFromParams(params);
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Prevent muting admins with really high permissions
|
||||
if(doesPlayerHaveStaffPermission(targetClient, getStaffFlagValue("ManageServer")) || doesPlayerHaveStaffPermission(targetClient, getStaffFlagValue("Developer"))) {
|
||||
@@ -104,14 +104,14 @@ function unMuteClientCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let targetClient = getPlayerFromParams(params);
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
let targetClient = getPlayerFromParams(params);
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Prevent unmuting admins with really high permissions
|
||||
if(doesPlayerHaveStaffPermission(targetClient, getStaffFlagValue("ManageServer")) || doesPlayerHaveStaffPermission(targetClient, getStaffFlagValue("Developer"))) {
|
||||
if(doesPlayerHaveStaffPermission(targetClient, getStaffFlagValue("ManageServer")) || doesPlayerHaveStaffPermission(targetClient, getStaffFlagValue("Developer"))) {
|
||||
if(!doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageServer")) && !doesPlayerHaveStaffPermission(client, getStaffFlagValue("Developer"))) {
|
||||
messagePlayerError(client, "You cannot unmute this person!");
|
||||
return false;
|
||||
@@ -130,14 +130,14 @@ function freezeClientCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let targetClient = getPlayerFromParams(params);
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
let targetClient = getPlayerFromParams(params);
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Prevent freeze admins with really high permissions
|
||||
if(doesPlayerHaveStaffPermission(targetClient, getStaffFlagValue("ManageServer")) || doesPlayerHaveStaffPermission(targetClient, getStaffFlagValue("Developer"))) {
|
||||
if(doesPlayerHaveStaffPermission(targetClient, getStaffFlagValue("ManageServer")) || doesPlayerHaveStaffPermission(targetClient, getStaffFlagValue("Developer"))) {
|
||||
if(!doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageServer")) && !doesPlayerHaveStaffPermission(client, getStaffFlagValue("Developer"))) {
|
||||
messagePlayerError(client, "You cannot freeze this person!");
|
||||
return false;
|
||||
@@ -157,14 +157,14 @@ function unFreezeClientCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let targetClient = getPlayerFromParams(params);
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
let targetClient = getPlayerFromParams(params);
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Prevent unfreezing admins with really high permissions
|
||||
if(doesPlayerHaveStaffPermission(targetClient, getStaffFlagValue("ManageServer")) || doesPlayerHaveStaffPermission(targetClient, getStaffFlagValue("Developer"))) {
|
||||
if(doesPlayerHaveStaffPermission(targetClient, getStaffFlagValue("ManageServer")) || doesPlayerHaveStaffPermission(targetClient, getStaffFlagValue("Developer"))) {
|
||||
if(!doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageServer")) && !doesPlayerHaveStaffPermission(client, getStaffFlagValue("Developer"))) {
|
||||
messagePlayerError(client, "You cannot freeze this person!");
|
||||
return false;
|
||||
@@ -184,11 +184,11 @@ function gotoPlayerCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let targetClient = getPlayerFromParams(params);
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
let targetClient = getPlayerFromParams(params);
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
setPlayerVelocity(client, toVector3(0.0, 0.0, 0.0));
|
||||
setPlayerPosition(client, getPosBehindPos(getPlayerPosition(targetClient), getPlayerHeading(targetClient), 2));
|
||||
@@ -216,11 +216,11 @@ function getPlayerGeoIPInformationCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let targetClient = getPlayerFromParams(params);
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
let targetClient = getPlayerFromParams(params);
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
let countryName = module.geoip.getCountryName(getGlobalConfig().geoIPCountryDatabaseFilePath, targetClient.ip);
|
||||
let subDivisionName = module.geoip.getSubdivisionName(getGlobalConfig().geoIPCityDatabaseFilePath, targetClient.ip);
|
||||
@@ -237,11 +237,11 @@ function getPlayerIPInformationCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let targetClient = getPlayerFromParams(params);
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
let targetClient = getPlayerFromParams(params);
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
messagePlayerInfo(client, `{ALTCOLOUR}${targetClient.name}'s{MAINCOLOUR} IP is ${targetClient.ip}`);
|
||||
}
|
||||
@@ -633,10 +633,10 @@ function getPlayerCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let targetClient = getPlayerFromParams(params);
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
let targetClient = getPlayerFromParams(params);
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
removePlayerFromVehicle(targetClient);
|
||||
@@ -673,17 +673,17 @@ function returnPlayerCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let targetClient = getPlayerFromParams(params);
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
let targetClient = getPlayerFromParams(params);
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
removePlayerFromVehicle(targetClient);
|
||||
|
||||
if(getPlayerData(targetClient).returnToPosition == null) {
|
||||
messagePlayerError(client, "There is nowhere to return that player to!");
|
||||
return false;
|
||||
messagePlayerError(client, "There is nowhere to return that player to!");
|
||||
return false;
|
||||
}
|
||||
|
||||
setPlayerPosition(targetClient, getPlayerData(targetClient).returnToPosition);
|
||||
@@ -714,18 +714,18 @@ function addStaffFlagCommand(command, params, client) {
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let flagName = getParam(params, " ", 2) || "None";
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getStaffFlagValue(flagName) == false) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidStaffFlag"));
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Prevent setting flags on admins with really high permissions
|
||||
if(doesPlayerHaveStaffPermission(targetClient, getStaffFlagValue("ManageServer")) || doesPlayerHaveStaffPermission(targetClient, getStaffFlagValue("Developer"))) {
|
||||
if(doesPlayerHaveStaffPermission(targetClient, getStaffFlagValue("ManageServer")) || doesPlayerHaveStaffPermission(targetClient, getStaffFlagValue("Developer"))) {
|
||||
if(!doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageServer")) && !doesPlayerHaveStaffPermission(client, getStaffFlagValue("Developer"))) {
|
||||
messagePlayerError(client, "You cannot give staff flags to this person!");
|
||||
return false;
|
||||
@@ -747,18 +747,18 @@ function takeStaffFlagCommand(command, params, client) {
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let flagName = getParam(params, " ", 2) || "None";
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getStaffFlagValue(flagName) == false) {
|
||||
messagePlayerError(client, "That staff flag doesn't exist!");
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Prevent setting flags on admins with really high permissions
|
||||
if(doesPlayerHaveStaffPermission(targetClient, getStaffFlagValue("ManageServer")) || doesPlayerHaveStaffPermission(targetClient, getStaffFlagValue("Developer"))) {
|
||||
if(doesPlayerHaveStaffPermission(targetClient, getStaffFlagValue("ManageServer")) || doesPlayerHaveStaffPermission(targetClient, getStaffFlagValue("Developer"))) {
|
||||
if(!doesPlayerHaveStaffPermission(client, getStaffFlagValue("ManageServer")) && !doesPlayerHaveStaffPermission(client, getStaffFlagValue("Developer"))) {
|
||||
messagePlayerError(client, "You cannot take staff flags from this person!");
|
||||
return false;
|
||||
@@ -779,10 +779,10 @@ function clearStaffFlagsCommand(command, params, client) {
|
||||
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Prevent setting flags on admins with really high permissions
|
||||
if(doesPlayerHaveStaffPermission(targetClient, getStaffFlagValue("ManageServer")) || doesPlayerHaveStaffPermission(targetClient, getStaffFlagValue("Developer"))) {
|
||||
@@ -818,9 +818,9 @@ function getStaffFlagsCommand(command, params, client) {
|
||||
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
let tempStaffFlags = [];
|
||||
@@ -861,9 +861,9 @@ function allStaffFlagsCommand(command, params, client) {
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let flagName = getParam(params, " ", 2) || "None";
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
let chunkedList = splitArrayIntoChunks(getServerBitFlagKeys().staffFlagKeys, 8);
|
||||
@@ -885,9 +885,9 @@ function givePlayerMoneyCommand(command, params, client) {
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let amount = toInteger(getParam(params, " ", 2));
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
givePlayerCash(targetClient, toInteger(amount));
|
||||
@@ -908,9 +908,9 @@ function forcePlayerAccentCommand(command, params, client) {
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let newAccent = getParam(params, " ", 2) || "None";
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(toLowerCase(newAccent) == "None") {
|
||||
@@ -940,9 +940,9 @@ function forceCharacterNameChangeCommand(command, params, client) {
|
||||
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
getPlayerData(targetClient).changingCharacterName = true;
|
||||
@@ -968,9 +968,9 @@ function forceCharacterNameCommand(command, params, client) {
|
||||
let firstName = getParam(params, " ", 2);
|
||||
let lastName = getParam(params, " ", 3);
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
firstName = fixCharacterName(firstName);
|
||||
@@ -1003,14 +1003,14 @@ function forcePlayerSkinCommand(command, params, client) {
|
||||
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||
let skinIndex = getSkinModelIndexFromParams(splitParams.slice(1).join(" "), getGame());
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!skinIndex) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidSkin"));
|
||||
return false;
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidSkin"));
|
||||
return false;
|
||||
}
|
||||
|
||||
getPlayerCurrentSubAccount(targetClient).skin = skinIndex;
|
||||
@@ -1036,9 +1036,9 @@ function setPlayerHealthCommand(command, params, client) {
|
||||
let targetClient = getParam(params, " ", 1);
|
||||
let health = getParam(params, " ", 2);
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
setPlayerHealth(targetClient, health);
|
||||
@@ -1054,12 +1054,12 @@ function setPlayerArmourCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let targetClient = getParam(params, " ", 1);
|
||||
let targetClient = getParam(params, " ", 1);
|
||||
let armour = getParam(params, " ", 2);
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
setPlayerArmour(targetClient, armour);
|
||||
@@ -1075,20 +1075,20 @@ function setPlayerInfiniteRunCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let targetClient = getParam(params, " ", 1);
|
||||
let targetClient = getParam(params, " ", 1);
|
||||
let state = getParam(params, " ", 2) || 0;
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(isNaN(state)) {
|
||||
messagePlayerError(client, `The infinite run state must be a number!`);
|
||||
return false;
|
||||
}
|
||||
if(isNaN(state)) {
|
||||
messagePlayerError(client, `The infinite run state must be a number!`);
|
||||
return false;
|
||||
}
|
||||
|
||||
state = toInteger(state);
|
||||
state = toInteger(state);
|
||||
setPlayerInfiniteRun(targetClient, intToBool(state));
|
||||
|
||||
messageAdmins(`${getPlayerName(client)}{MAINCOLOUR} ${getBoolRedGreenInlineColour(state)}${(state) ? "enabled" : "disabled"}{MAINCOLOUR} infinite run for {ALTCOLOUR}${getPlayerName(targetClient)}`);
|
||||
@@ -1105,9 +1105,9 @@ function forcePlayerWantedLevelCommand(command, params, client) {
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let wantedLevel = getParam(params, " ", 2);
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
forcePlayerWantedLevel(targetClient, wantedLevel);
|
||||
@@ -1125,9 +1125,9 @@ function getAllVehiclesOwnedByPlayerCommand(command, params, client) {
|
||||
|
||||
let targetClient = getPlayerFromParams(params);
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
let vehicles = getAllVehiclesOwnedByPlayer(targetClient);
|
||||
@@ -1148,9 +1148,9 @@ function getAllBusinessesOwnedByPlayerCommand(command, params, client) {
|
||||
|
||||
let targetClient = getPlayerFromParams(params);
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
let businesses = getAllBusinessesOwnedByPlayer(targetClient);
|
||||
@@ -1171,9 +1171,9 @@ function getAllHousesOwnedByPlayerCommand(command, params, client) {
|
||||
|
||||
let targetClient = getPlayerFromParams(params);
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
let houses = getAllHousesOwnedByPlayer(targetClient);
|
||||
@@ -1194,9 +1194,9 @@ function forceAccountPasswordResetCommand(command, params, client) {
|
||||
|
||||
let targetClient = getPlayerFromParams(params);
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1210,9 +1210,9 @@ function toggleSyncForElementsSpawnedByPlayer(command, params, client) {
|
||||
|
||||
let targetClient = getPlayerFromParams(params);
|
||||
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
if(!targetClient) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidPlayer"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!hasBitFlag(getPlayerData(client).accountData.flags.moderation, getModerationFlagValue("DontSyncClientElements"))) {
|
||||
|
||||
@@ -185,7 +185,7 @@ function saveSubAccountToDatabase(subAccountData) {
|
||||
freeDatabaseQuery(dbQuery);
|
||||
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -251,18 +251,18 @@ function showRandomTipToAllPlayers() {
|
||||
function checkInactiveVehicleRespawns() {
|
||||
let vehicles = getElementsByType(ELEMENT_VEHICLE);
|
||||
for(let i in vehicles) {
|
||||
if(getVehicleData(vehicles[i] != false)) {
|
||||
if(isVehicleUnoccupied(vehicles[i])) {
|
||||
if(getVehicleData(vehicles[i]).lastActiveTime != false) {
|
||||
if(getCurrentUnixTimestamp() - getVehicleData(vehicles[i]).lastActiveTime >= getGlobalConfig().vehicleInactiveRespawnDelay) {
|
||||
respawnVehicle(vehicles[i]);
|
||||
getVehicleData(vehicles[i]).lastActiveTime = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
getVehicleData(vehicles[i]).lastActiveTime = getCurrentUnixTimestamp();
|
||||
}
|
||||
}
|
||||
if(getVehicleData(vehicles[i] != false)) {
|
||||
if(isVehicleUnoccupied(vehicles[i])) {
|
||||
if(getVehicleData(vehicles[i]).lastActiveTime != false) {
|
||||
if(getCurrentUnixTimestamp() - getVehicleData(vehicles[i]).lastActiveTime >= getGlobalConfig().vehicleInactiveRespawnDelay) {
|
||||
respawnVehicle(vehicles[i]);
|
||||
getVehicleData(vehicles[i]).lastActiveTime = false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
getVehicleData(vehicles[i]).lastActiveTime = getCurrentUnixTimestamp();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,44 +8,44 @@
|
||||
// ===========================================================================
|
||||
|
||||
const triggerTypes = [
|
||||
"onBusinessOwnerChange",
|
||||
"onBusinessNameChange",
|
||||
"onBusinessLockChange",
|
||||
"onBusinessPlayerEnter",
|
||||
"onBusinessPlayerExit",
|
||||
"onBusinessBotEnter",
|
||||
"onBusinessBotExit",
|
||||
"onBusinessDamage",
|
||||
"onBusinessRobbed",
|
||||
"onBusinessPlayerPurchase",
|
||||
"onBusinessBotPurchase",
|
||||
"onHouseOwnerChange",
|
||||
"onHouseNameChange",
|
||||
"onHouseLockChange",
|
||||
"onHousePlayerEnter",
|
||||
"onHousePlayerExit",
|
||||
"onHouseBotEnter",
|
||||
"onHouseBotExit",
|
||||
"onHouseDamage",
|
||||
"onHouseRobbed",
|
||||
"onVehicleOwnerChange",
|
||||
"onVehiclePlayerEnter",
|
||||
"onVehiclePlayerExit",
|
||||
"onVehicleBotEnter",
|
||||
"onVehicleBotExit",
|
||||
"onVehicleCollision",
|
||||
"onVehicleDamaged",
|
||||
"onVehicleShot",
|
||||
"onVehicleTrunkChange",
|
||||
"onVehicleItemTaken",
|
||||
"onVehicleItemStored",
|
||||
"onVehicleEngineChange",
|
||||
"onVehicleLightsChange",
|
||||
"onVehicleSirenChange",
|
||||
"onVehicleLockChange",
|
||||
"onVehicleRepaired",
|
||||
"onVehicleColourChange",
|
||||
"onVehicleExtraChange",
|
||||
"onBusinessOwnerChange",
|
||||
"onBusinessNameChange",
|
||||
"onBusinessLockChange",
|
||||
"onBusinessPlayerEnter",
|
||||
"onBusinessPlayerExit",
|
||||
"onBusinessBotEnter",
|
||||
"onBusinessBotExit",
|
||||
"onBusinessDamage",
|
||||
"onBusinessRobbed",
|
||||
"onBusinessPlayerPurchase",
|
||||
"onBusinessBotPurchase",
|
||||
"onHouseOwnerChange",
|
||||
"onHouseNameChange",
|
||||
"onHouseLockChange",
|
||||
"onHousePlayerEnter",
|
||||
"onHousePlayerExit",
|
||||
"onHouseBotEnter",
|
||||
"onHouseBotExit",
|
||||
"onHouseDamage",
|
||||
"onHouseRobbed",
|
||||
"onVehicleOwnerChange",
|
||||
"onVehiclePlayerEnter",
|
||||
"onVehiclePlayerExit",
|
||||
"onVehicleBotEnter",
|
||||
"onVehicleBotExit",
|
||||
"onVehicleCollision",
|
||||
"onVehicleDamaged",
|
||||
"onVehicleShot",
|
||||
"onVehicleTrunkChange",
|
||||
"onVehicleItemTaken",
|
||||
"onVehicleItemStored",
|
||||
"onVehicleEngineChange",
|
||||
"onVehicleLightsChange",
|
||||
"onVehicleSirenChange",
|
||||
"onVehicleLockChange",
|
||||
"onVehicleRepaired",
|
||||
"onVehicleColourChange",
|
||||
"onVehicleExtraChange",
|
||||
];
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
// ===========================================================================
|
||||
|
||||
function startTutorial(client) {
|
||||
getPlayerData(client).tutorialItem = createGroundItem(tutorialItem[0], tutorialItem[1], tutorialItem[3]);
|
||||
getPlayerData(client).tutorialVehicle = 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]);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -82,7 +82,7 @@ function initAllClients() {
|
||||
|
||||
function updateServerRules() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Utilities]: Updating all server rules ...`);
|
||||
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Utilities]: Time support: ${isTimeSupported()}`);
|
||||
if(isTimeSupported()) {
|
||||
if(getServerConfig() != false) {
|
||||
@@ -363,7 +363,7 @@ function updateConnectionLogOnClientInfoReceive(client, clientVersion, screenWid
|
||||
let safeClientVersion = escapeDatabaseString(dbConnection, clientVersion);
|
||||
let safeScreenWidth = escapeDatabaseString(dbConnection, toString(screenWidth));
|
||||
let safeScreenHeight = escapeDatabaseString(dbConnection, toString(screenHeight));
|
||||
quickDatabaseQuery(`UPDATE conn_main SET conn_client_version='${safeClientVersion}', conn_screen_width='${safeScreenWidth}', conn_screen_height='${safeScreenHeight}' WHERE conn_id = ${getPlayerData(client).sessionId}`);
|
||||
quickDatabaseQuery(`UPDATE conn_main SET conn_client_version='${safeClientVersion}', conn_screen_width='${safeScreenWidth}', conn_screen_height='${safeScreenHeight}' WHERE conn_id = ${getPlayerData(client).sessionId}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -445,9 +445,9 @@ function clearTemporaryPeds() {
|
||||
// ===========================================================================
|
||||
|
||||
function kickAllClients() {
|
||||
getClients().forEach((client) => {
|
||||
client.disconnect();
|
||||
})
|
||||
getClients().forEach((client) => {
|
||||
client.disconnect();
|
||||
})
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -560,7 +560,7 @@ function buyVehicleCommand(command, params, client) {
|
||||
getPlayerData(client).buyingVehicle = vehicle;
|
||||
getVehicleData(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;
|
||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_TESTDRIVE, vehicle.id, getVehiclePosition(vehicle));
|
||||
@@ -1081,10 +1081,10 @@ function reloadAllVehiclesCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function respawnVehicleCommand(command, params, client) {
|
||||
if(isPlayerInAnyVehicle(client)) {
|
||||
removeAllOccupantsFromVehicle(getPlayerVehicle(client));
|
||||
respawnVehicle(getPlayerVehicle(client));
|
||||
}
|
||||
if(isPlayerInAnyVehicle(client)) {
|
||||
removeAllOccupantsFromVehicle(getPlayerVehicle(client));
|
||||
respawnVehicle(getPlayerVehicle(client));
|
||||
}
|
||||
|
||||
setAllVehicleIndexes();
|
||||
|
||||
@@ -1135,7 +1135,7 @@ function respawnJobVehiclesCommand(command, params, client) {
|
||||
if(getServerData().vehicles[i].ownerType == VRR_VEHOWNER_JOB) {
|
||||
respawnVehicle(getServerData().vehicles[i].vehicle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
messageAdminAction(`All job vehicles have been respawned by an admin!`);
|
||||
}
|
||||
@@ -1147,7 +1147,7 @@ function respawnClanVehiclesCommand(command, params, client) {
|
||||
if(getServerData().vehicles[i].ownerType == VRR_VEHOWNER_CLAN) {
|
||||
respawnVehicle(getServerData().vehicles[i].vehicle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
messageAdminAction(`All clan vehicles have been respawned by an admin!`);
|
||||
}
|
||||
@@ -1159,7 +1159,7 @@ function respawnPlayerVehiclesCommand(command, params, client) {
|
||||
if(getServerData().vehicles[i].ownerType == VRR_VEHOWNER_PLAYER) {
|
||||
respawnVehicle(getServerData().vehicles[i].vehicle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
messageAdminAction(`All player-owned vehicles have been respawned by an admin!`);
|
||||
}
|
||||
@@ -1171,7 +1171,7 @@ function respawnPublicVehiclesCommand(command, params, client) {
|
||||
if(getServerData().vehicles[i].ownerType == VRR_VEHOWNER_PUBLIC) {
|
||||
respawnVehicle(getServerData().vehicles[i].vehicle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
messageAdminAction(`All public vehicles have been respawned by an admin!`);
|
||||
}
|
||||
@@ -1183,7 +1183,7 @@ function respawnBusinessVehiclesCommand(command, params, client) {
|
||||
if(getServerData().vehicles[i].ownerType == VRR_VEHOWNER_BIZ) {
|
||||
respawnVehicle(getServerData().vehicles[i].vehicle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
messageAdminAction(`All business-owned vehicles have been respawned by an admin!`);
|
||||
}
|
||||
@@ -1417,64 +1417,64 @@ function createPermanentVehicle(modelIndex, position, heading, interior = 0, dim
|
||||
// ===========================================================================
|
||||
|
||||
function processVehiclePurchasing() {
|
||||
if(!getGlobalConfig().useServerSideVehiclePurchaseCheck) {
|
||||
return false;
|
||||
}
|
||||
if(!getGlobalConfig().useServerSideVehiclePurchaseCheck) {
|
||||
return false;
|
||||
}
|
||||
|
||||
getClients().forEach((client) => {
|
||||
if(!isPlayerLoggedIn(client)) {
|
||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||
return false;
|
||||
}
|
||||
getClients().forEach((client) => {
|
||||
if(!isPlayerLoggedIn(client)) {
|
||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!isPlayerSpawned(client)) {
|
||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||
return false;
|
||||
}
|
||||
if(!isPlayerSpawned(client)) {
|
||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!getPlayerData(client)) {
|
||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||
return false;
|
||||
}
|
||||
if(!getPlayerData(client)) {
|
||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!getPlayerData(client).buyingVehicle) {
|
||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||
return false;
|
||||
}
|
||||
if(!getPlayerData(client).buyingVehicle) {
|
||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!isPlayerInAnyVehicle(client)) {
|
||||
if(getPlayerData(client).buyingVehicle != false) {
|
||||
messagePlayerError(client, getLocaleString(client, "DealershipPurchaseExitedVehicle"));
|
||||
respawnVehicle(getPlayerData(client).buyingVehicle);
|
||||
getPlayerData(client).buyingVehicle = false;
|
||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if(!isPlayerInAnyVehicle(client)) {
|
||||
if(getPlayerData(client).buyingVehicle != false) {
|
||||
messagePlayerError(client, getLocaleString(client, "DealershipPurchaseExitedVehicle"));
|
||||
respawnVehicle(getPlayerData(client).buyingVehicle);
|
||||
getPlayerData(client).buyingVehicle = false;
|
||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getDistance(getVehiclePosition(getPlayerData(client).buyingVehicle), getVehicleData(getPlayerData(client).buyingVehicle).spawnPosition) > getGlobalConfig().buyVehicleDriveAwayDistance) {
|
||||
if(getPlayerCurrentSubAccount(client).cash < getVehicleData(getPlayerData(client).buyingVehicle).buyPrice) {
|
||||
messagePlayerError(client, getLocaleString(client, "VehiclePurchaseNotEnoughMoney"));
|
||||
respawnVehicle(getPlayerData(client).buyingVehicle);
|
||||
getPlayerData(client).buyingVehicle = false;
|
||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||
return false;
|
||||
}
|
||||
if(getDistance(getVehiclePosition(getPlayerData(client).buyingVehicle), getVehicleData(getPlayerData(client).buyingVehicle).spawnPosition) > getGlobalConfig().buyVehicleDriveAwayDistance) {
|
||||
if(getPlayerCurrentSubAccount(client).cash < getVehicleData(getPlayerData(client).buyingVehicle).buyPrice) {
|
||||
messagePlayerError(client, getLocaleString(client, "VehiclePurchaseNotEnoughMoney"));
|
||||
respawnVehicle(getPlayerData(client).buyingVehicle);
|
||||
getPlayerData(client).buyingVehicle = false;
|
||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||
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);
|
||||
takePlayerCash(client, getVehicleData(getPlayerData(client).buyingVehicle).buyPrice);
|
||||
updatePlayerCash(client);
|
||||
getVehicleData(getPlayerData(client).buyingVehicle).ownerId = getPlayerCurrentSubAccount(client).databaseId;
|
||||
getVehicleData(getPlayerData(client).buyingVehicle).ownerType = VRR_VEHOWNER_PLAYER;
|
||||
getVehicleData(getPlayerData(client).buyingVehicle).buyPrice = 0;
|
||||
getVehicleData(getPlayerData(client).buyingVehicle).rentPrice = 0;
|
||||
getVehicleData(getPlayerData(client).buyingVehicle).spawnLocked = false;
|
||||
getPlayerData(client).buyingVehicle = false;
|
||||
messagePlayerSuccess(client, getLocaleString(client, "VehiclePurchaseComplete"));
|
||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
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);
|
||||
updatePlayerCash(client);
|
||||
getVehicleData(getPlayerData(client).buyingVehicle).ownerId = getPlayerCurrentSubAccount(client).databaseId;
|
||||
getVehicleData(getPlayerData(client).buyingVehicle).ownerType = VRR_VEHOWNER_PLAYER;
|
||||
getVehicleData(getPlayerData(client).buyingVehicle).buyPrice = 0;
|
||||
getVehicleData(getPlayerData(client).buyingVehicle).rentPrice = 0;
|
||||
getVehicleData(getPlayerData(client).buyingVehicle).spawnLocked = false;
|
||||
getPlayerData(client).buyingVehicle = false;
|
||||
messagePlayerSuccess(client, getLocaleString(client, "VehiclePurchaseComplete"));
|
||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1484,9 +1484,9 @@ function processVehiclePurchasing() {
|
||||
function processVehicleBurning() {
|
||||
let vehicles = getElementsByType(ELEMENT_VEHICLE);
|
||||
for(let i in vehicles) {
|
||||
if(vehicles[i].health <= 250) {
|
||||
return false;
|
||||
}
|
||||
if(vehicles[i].health <= 250) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1524,19 +1524,19 @@ function setAllVehicleIndexes() {
|
||||
// ===========================================================================
|
||||
|
||||
function doesVehicleHaveMegaphone(vehicle) {
|
||||
if(getVehicleData(vehicle).ownerType == VRR_VEHOWNER_JOB) {
|
||||
if(getJobType(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)) == VRR_JOB_POLICE) {
|
||||
return true;
|
||||
}
|
||||
if(getVehicleData(vehicle).ownerType == VRR_VEHOWNER_JOB) {
|
||||
if(getJobType(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)) == VRR_JOB_POLICE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(getJobType(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)) == VRR_JOB_FIRE) {
|
||||
return true;
|
||||
}
|
||||
if(getJobType(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)) == VRR_JOB_FIRE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(getJobType(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)) == VRR_JOB_MEDICAL) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if(getJobType(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)) == VRR_JOB_MEDICAL) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1581,11 +1581,11 @@ function getVehicleTrunkPosition(vehicle) {
|
||||
// ===========================================================================
|
||||
|
||||
function removeAllOccupantsFromVehicle(vehicle) {
|
||||
for(let i = 0 ; i <= 16 ; i++) {
|
||||
if(vehicle.getOccupant(i) != null) {
|
||||
removePlayerFromVehicle(vehicle.getOccupant(i));
|
||||
}
|
||||
}
|
||||
for(let i = 0 ; i <= 16 ; i++) {
|
||||
if(vehicle.getOccupant(i) != null) {
|
||||
removePlayerFromVehicle(vehicle.getOccupant(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
File diff suppressed because it is too large
Load Diff
@@ -8,121 +8,121 @@
|
||||
// ===========================================================================
|
||||
|
||||
let bindableKeys = {
|
||||
8: "backspace",
|
||||
9: "tab",
|
||||
13: "return",
|
||||
27: "escape",
|
||||
32: "space",
|
||||
33: "exclamation",
|
||||
34: "doublequote",
|
||||
35: "hashtag",
|
||||
36: "dollar",
|
||||
37: "percent",
|
||||
38: "ampersand",
|
||||
39: "quote",
|
||||
40: "leftparenthesis",
|
||||
41: "rightparenthesis",
|
||||
42: "asterisk",
|
||||
43: "plus",
|
||||
44: "comma",
|
||||
45: "minus",
|
||||
46: "period",
|
||||
47: "slash",
|
||||
48: "0",
|
||||
49: "1",
|
||||
50: "2",
|
||||
51: "3",
|
||||
52: "4",
|
||||
53: "5",
|
||||
54: "6",
|
||||
55: "7",
|
||||
56: "8",
|
||||
57: "9",
|
||||
58: "colon",
|
||||
59: "semicolon",
|
||||
60: "less",
|
||||
61: "equals",
|
||||
62: "greater",
|
||||
63: "questionmark",
|
||||
64: "at",
|
||||
91: "leftbracket",
|
||||
92: "backslash",
|
||||
93: "rightbracket",
|
||||
95: "underscore",
|
||||
97: "a",
|
||||
98: "b",
|
||||
99: "c",
|
||||
100: "d",
|
||||
101: "e",
|
||||
102: "f",
|
||||
103: "g",
|
||||
104: "h",
|
||||
105: "i",
|
||||
106: "j",
|
||||
107: "k",
|
||||
108: "l",
|
||||
109: "m",
|
||||
110: "n",
|
||||
111: "o",
|
||||
112: "p",
|
||||
113: "q",
|
||||
114: "r",
|
||||
115: "s",
|
||||
116: "t",
|
||||
117: "u",
|
||||
118: "v",
|
||||
119: "w",
|
||||
120: "x",
|
||||
121: "y",
|
||||
122: "z",
|
||||
127: "delete",
|
||||
1073741881: "capslock",
|
||||
1073741882: "f12",
|
||||
1073741883: "f2",
|
||||
1073741884: "f3",
|
||||
1073741885: "f4",
|
||||
1073741886: "f5",
|
||||
1073741887: "f6",
|
||||
1073741888: "f7",
|
||||
1073741889: "f8",
|
||||
1073741890: "f9",
|
||||
1073741891: "f10",
|
||||
1073741892: "f11",
|
||||
1073741893: "f12",
|
||||
1073741894: "printscreen",
|
||||
1073741895: "scrolllock",
|
||||
1073741896: "pause",
|
||||
1073741897: "insert",
|
||||
1073741898: "home",
|
||||
1073741899: "pageup",
|
||||
1073741901: "end",
|
||||
1073741902: "pagedown",
|
||||
1073741903: "right",
|
||||
1073741904: "left",
|
||||
1073741905: "down",
|
||||
1073741906: "up",
|
||||
1073741908: "numdivide",
|
||||
1073741909: "nummultiply",
|
||||
1073741910: "numminus",
|
||||
1073741911: "numplus",
|
||||
1073741912: "numenter",
|
||||
1073741913: "num1",
|
||||
1073741914: "num2",
|
||||
1073741915: "num3",
|
||||
1073741916: "num4",
|
||||
1073741917: "num5",
|
||||
1073741918: "num6",
|
||||
1073741919: "num7",
|
||||
1073741920: "num8",
|
||||
1073741921: "num9",
|
||||
1073741922: "num0",
|
||||
1073741923: "numperiod",
|
||||
1073742048: "leftctrl",
|
||||
1073742049: "leftshift",
|
||||
1073742050: "leftalt",
|
||||
1073742052: "rightctrl",
|
||||
1073742053: "rightshift",
|
||||
1073742054: "rightalt",
|
||||
8: "backspace",
|
||||
9: "tab",
|
||||
13: "return",
|
||||
27: "escape",
|
||||
32: "space",
|
||||
33: "exclamation",
|
||||
34: "doublequote",
|
||||
35: "hashtag",
|
||||
36: "dollar",
|
||||
37: "percent",
|
||||
38: "ampersand",
|
||||
39: "quote",
|
||||
40: "leftparenthesis",
|
||||
41: "rightparenthesis",
|
||||
42: "asterisk",
|
||||
43: "plus",
|
||||
44: "comma",
|
||||
45: "minus",
|
||||
46: "period",
|
||||
47: "slash",
|
||||
48: "0",
|
||||
49: "1",
|
||||
50: "2",
|
||||
51: "3",
|
||||
52: "4",
|
||||
53: "5",
|
||||
54: "6",
|
||||
55: "7",
|
||||
56: "8",
|
||||
57: "9",
|
||||
58: "colon",
|
||||
59: "semicolon",
|
||||
60: "less",
|
||||
61: "equals",
|
||||
62: "greater",
|
||||
63: "questionmark",
|
||||
64: "at",
|
||||
91: "leftbracket",
|
||||
92: "backslash",
|
||||
93: "rightbracket",
|
||||
95: "underscore",
|
||||
97: "a",
|
||||
98: "b",
|
||||
99: "c",
|
||||
100: "d",
|
||||
101: "e",
|
||||
102: "f",
|
||||
103: "g",
|
||||
104: "h",
|
||||
105: "i",
|
||||
106: "j",
|
||||
107: "k",
|
||||
108: "l",
|
||||
109: "m",
|
||||
110: "n",
|
||||
111: "o",
|
||||
112: "p",
|
||||
113: "q",
|
||||
114: "r",
|
||||
115: "s",
|
||||
116: "t",
|
||||
117: "u",
|
||||
118: "v",
|
||||
119: "w",
|
||||
120: "x",
|
||||
121: "y",
|
||||
122: "z",
|
||||
127: "delete",
|
||||
1073741881: "capslock",
|
||||
1073741882: "f12",
|
||||
1073741883: "f2",
|
||||
1073741884: "f3",
|
||||
1073741885: "f4",
|
||||
1073741886: "f5",
|
||||
1073741887: "f6",
|
||||
1073741888: "f7",
|
||||
1073741889: "f8",
|
||||
1073741890: "f9",
|
||||
1073741891: "f10",
|
||||
1073741892: "f11",
|
||||
1073741893: "f12",
|
||||
1073741894: "printscreen",
|
||||
1073741895: "scrolllock",
|
||||
1073741896: "pause",
|
||||
1073741897: "insert",
|
||||
1073741898: "home",
|
||||
1073741899: "pageup",
|
||||
1073741901: "end",
|
||||
1073741902: "pagedown",
|
||||
1073741903: "right",
|
||||
1073741904: "left",
|
||||
1073741905: "down",
|
||||
1073741906: "up",
|
||||
1073741908: "numdivide",
|
||||
1073741909: "nummultiply",
|
||||
1073741910: "numminus",
|
||||
1073741911: "numplus",
|
||||
1073741912: "numenter",
|
||||
1073741913: "num1",
|
||||
1073741914: "num2",
|
||||
1073741915: "num3",
|
||||
1073741916: "num4",
|
||||
1073741917: "num5",
|
||||
1073741918: "num6",
|
||||
1073741919: "num7",
|
||||
1073741920: "num8",
|
||||
1073741921: "num9",
|
||||
1073741922: "num0",
|
||||
1073741923: "numperiod",
|
||||
1073742048: "leftctrl",
|
||||
1073742049: "leftshift",
|
||||
1073742050: "leftalt",
|
||||
1073742052: "rightctrl",
|
||||
1073742053: "rightshift",
|
||||
1073742054: "rightalt",
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1138,24 +1138,24 @@ function makeLargeNumberReadable(num) {
|
||||
// ===========================================================================
|
||||
|
||||
function getKeyIdFromParams(params) {
|
||||
let tempParams = toLowerCase(toString(params));
|
||||
let tempParams = toLowerCase(toString(params));
|
||||
|
||||
//let sdlName = sdl.getKeyFromName(tempParams);
|
||||
//if(sdlName != null) {
|
||||
// return sdlName;
|
||||
//}
|
||||
//let sdlName = sdl.getKeyFromName(tempParams);
|
||||
//if(sdlName != null) {
|
||||
// return sdlName;
|
||||
//}
|
||||
|
||||
for(let i in bindableKeys) {
|
||||
if(toLowerCase(bindableKeys[i]) == toLowerCase(tempParams)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
for(let i in bindableKeys) {
|
||||
if(toLowerCase(bindableKeys[i]) == toLowerCase(tempParams)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getKeyNameFromId(params) {
|
||||
return bindableKeys[toInteger(params)];
|
||||
return bindableKeys[toInteger(params)];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1350,7 +1350,7 @@ function getEntityData(entity, dataName) {
|
||||
return entity.getData(dataName);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1371,7 +1371,7 @@ function removeEntityData(entity, dataName) {
|
||||
if(entity != null) {
|
||||
return entity.removeData(dataName);
|
||||
}
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1389,15 +1389,15 @@ function getDistance(vec1, vec2) {
|
||||
if(isNull(vec1) || isNull(vec2)) {
|
||||
return false;
|
||||
}
|
||||
return vec1.distance(vec2);
|
||||
return vec1.distance(vec2);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function logToConsole(tempLogLevel, text) {
|
||||
if(typeof server != "undefined") {
|
||||
text = removeColoursInMessage(text);
|
||||
}
|
||||
if(typeof server != "undefined") {
|
||||
text = removeColoursInMessage(text);
|
||||
}
|
||||
|
||||
if((logLevel & tempLogLevel) || logLevel == LOG_ALL) {
|
||||
if(tempLogLevel == LOG_ERROR) {
|
||||
@@ -1417,10 +1417,10 @@ function logToConsole(tempLogLevel, text) {
|
||||
// ===========================================================================
|
||||
|
||||
function Enum(constantsList) {
|
||||
let tempTable = {};
|
||||
let tempTable = {};
|
||||
for(let i in constantsList) {
|
||||
tempTable[constantsList[i]] = i;
|
||||
}
|
||||
tempTable[constantsList[i]] = i;
|
||||
}
|
||||
return tempTable;
|
||||
}
|
||||
|
||||
@@ -1499,13 +1499,13 @@ function arePickupsSupported() {
|
||||
// ===========================================================================
|
||||
|
||||
function areBlipsSupported() {
|
||||
return supportedFeatures.blips[getGame()];
|
||||
return supportedFeatures.blips[getGame()];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function areMarkersSupported() {
|
||||
return supportedFeatures.markers[getGame()];
|
||||
return supportedFeatures.markers[getGame()];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1800,7 +1800,7 @@ function getPosInFrontOfPos(pos, angle, distance) {
|
||||
y = (pos.y+((Math.sin(angle+(Math.PI/2)))*distance));
|
||||
} else {
|
||||
while(angle < 0.0)
|
||||
angle += 360.0;
|
||||
angle += 360.0;
|
||||
|
||||
while(angle > 360.0)
|
||||
angle -= 360.0;
|
||||
@@ -2056,23 +2056,23 @@ function removeHexColoursFromString(str) {
|
||||
// ===========================================================================
|
||||
|
||||
async function waitUntil(condition) {
|
||||
return new Promise((resolve) => {
|
||||
let interval = setInterval(() => {
|
||||
if (!condition()) {
|
||||
return
|
||||
}
|
||||
return new Promise((resolve) => {
|
||||
let interval = setInterval(() => {
|
||||
if (!condition()) {
|
||||
return
|
||||
}
|
||||
|
||||
clearInterval(interval);
|
||||
resolve();
|
||||
}, 1);
|
||||
});
|
||||
clearInterval(interval);
|
||||
resolve();
|
||||
}, 1);
|
||||
});
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getGameLocationFromParams(params) {
|
||||
if(isNaN(params)) {
|
||||
let locations = getGameConfig().locations[getGame()];
|
||||
let locations = getGameConfig().locations[getGame()];
|
||||
for(let i in locations) {
|
||||
if(toLowerCase(locations[i][0]).indexOf(toLowerCase(params)) != -1) {
|
||||
return i;
|
||||
@@ -2204,16 +2204,16 @@ function getCardinalDirection(pos1, pos2) {
|
||||
function getTimeDifferenceDisplay(timeStamp2, timeStamp1) {
|
||||
timeStamp1 = timeStamp1 * 1000;
|
||||
timeStamp2 = timeStamp2 * 1000;
|
||||
if(isNaN(timeStamp1) || isNaN(timeStamp2)) {
|
||||
return "Unknown";
|
||||
}
|
||||
if(isNaN(timeStamp1) || isNaN(timeStamp2)) {
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
let millisecondDiff = timeStamp2 - timeStamp1;
|
||||
|
||||
let days = Math.floor(millisecondDiff / 1000 / 60 / (60 * 24));
|
||||
let diffDate = new Date(millisecondDiff);
|
||||
let days = Math.floor(millisecondDiff / 1000 / 60 / (60 * 24));
|
||||
let diffDate = new Date(millisecondDiff);
|
||||
|
||||
return `${days} days, ${diffDate.getHours()} hours, ${diffDate.getMinutes()} minutes`;
|
||||
return `${days} days, ${diffDate.getHours()} hours, ${diffDate.getMinutes()} minutes`;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -2399,12 +2399,24 @@ function isConsole(client) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* Gets the console client (only valid on server)
|
||||
*
|
||||
* @return {Boolean} Whether or not the two clients are the same
|
||||
*
|
||||
*/
|
||||
function isSamePlayer(client1, client2) {
|
||||
return (client1 == client2);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* Gets the console client (only valid on server)
|
||||
*
|
||||
* @return {Client} Console client
|
||||
*
|
||||
*/
|
||||
function getConsoleClient() {
|
||||
let clients = getClients();
|
||||
for(let i in clients) {
|
||||
@@ -2416,24 +2428,51 @@ function getConsoleClient() {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* Gets the entire colours table
|
||||
*
|
||||
* @return {Object} Colours table
|
||||
*
|
||||
*/
|
||||
function getServerColours() {
|
||||
return serverColours;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* Gets an RGB value for a colour type name
|
||||
*
|
||||
* @param {String} typeName - Colour type name (red, blue, etc)
|
||||
* @return {Number} Colour value (same as from toColour)
|
||||
*
|
||||
*/
|
||||
function getColourByType(typeName) {
|
||||
return getServerColours().byType[typeName];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* Gets an RGB value for a colour name
|
||||
*
|
||||
* @param {String} colourName - Colour name (error, businessBlue, etc)
|
||||
* @return {Number} Colour value (same as from toColour)
|
||||
*
|
||||
*/
|
||||
function getColourByName(colourName) {
|
||||
return getServerColours().byName[colourName];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* Gets a hex value for a colour type
|
||||
*
|
||||
* @param {String} colourName - Colour name (red, blue, etc)
|
||||
* @return {String} Hex value as string without brackets (has only the hashtag)
|
||||
*
|
||||
*/
|
||||
function getHexColourByName(colourName) {
|
||||
//let rgbaColour = getServerColours().byName[colourName];
|
||||
//let rgbaArray = rgbaArrayFromToColour(rgbaColour);
|
||||
@@ -2444,7 +2483,14 @@ function getHexColourByName(colourName) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getHexColourByType(colourName) {
|
||||
/**
|
||||
* Gets a hex value for a colour type
|
||||
*
|
||||
* @param {String} typeName - Colour type name (error, businessBlue, etc)
|
||||
* @return {String} Hex value as string without brackets (has only the hashtag)
|
||||
*
|
||||
*/
|
||||
function getHexColourByType(typeName) {
|
||||
//let rgbaColour = getServerColours().byType[colourName];
|
||||
//let rgbaArray = rgbaArrayFromToColour(rgbaColour);
|
||||
//return rgbToHex(rgbaArray[0], rgbaArray[1], rgbaArray[2]);
|
||||
@@ -2585,29 +2631,43 @@ function getInlineChatColourByType(colourName) {
|
||||
*
|
||||
*/
|
||||
function rgbaArrayFromToColour(colour) {
|
||||
//return [
|
||||
// (colour >> 24) & 0xFF, // red
|
||||
// (colour >> 16) & 0xFF,
|
||||
// (colour >> 8) & 0xFF,
|
||||
// colour & 0xFF // alpha
|
||||
//];
|
||||
return [
|
||||
(colour >> 16) & 0xFF, // red
|
||||
(colour >> 8) & 0xFF,
|
||||
colour & 0xFF,
|
||||
(colour >> 24) & 0xFF// alpha
|
||||
];
|
||||
//return [
|
||||
// (colour >> 24) & 0xFF, // red
|
||||
// (colour >> 16) & 0xFF,
|
||||
// (colour >> 8) & 0xFF,
|
||||
// colour & 0xFF // alpha
|
||||
//];
|
||||
return [
|
||||
(colour >> 16) & 0xFF, // red
|
||||
(colour >> 8) & 0xFF,
|
||||
colour & 0xFF,
|
||||
(colour >> 24) & 0xFF// alpha
|
||||
];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* Gets a hex formatting colour by type for use inline in chatbox messages (example: [#FFFFFF]).
|
||||
*
|
||||
* @param {Number} colourValue - Colour value (from toColour)
|
||||
* @return {String} HEX-formatted colour string without brackets (just the hashtag)
|
||||
*
|
||||
*/
|
||||
function hexFromToColour(colour) {
|
||||
let rgba = rgbaArrayFromToColour(colour);
|
||||
return rgbToHex(rgba[0], rgba[1], rgba[2]);
|
||||
return rgbToHex(rgba[0], rgba[1], rgba[2]);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* Replaces colour types with HEX values in a message string
|
||||
*
|
||||
* @param {String} colouredString - String with colours
|
||||
* @return {String} String with replaced colours for inline chatbox usage
|
||||
*
|
||||
*/
|
||||
function replaceColoursInMessage(messageText) {
|
||||
if(messageText == null) {
|
||||
return "";
|
||||
@@ -2642,6 +2702,13 @@ function replaceColoursInMessage(messageText) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* Removes colour types from a message
|
||||
*
|
||||
* @param {String} colouredString - String with colours
|
||||
* @return {String} String without colours
|
||||
*
|
||||
*/
|
||||
function removeColoursInMessage(messageText) {
|
||||
if(messageText == null) {
|
||||
return "";
|
||||
@@ -2676,6 +2743,13 @@ function removeColoursInMessage(messageText) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* Replaces emoji texts with actual emoji
|
||||
*
|
||||
* @param {String} colouredString - String with emoji names
|
||||
* @return {String} String with actual emoji images
|
||||
*
|
||||
*/
|
||||
function replaceEmojiInString(messageString) {
|
||||
for(let i in emojiReplaceString) {
|
||||
while(messageString.indexOf(emojiReplaceString[i][0]) != -1) {
|
||||
|
||||
Reference in New Issue
Block a user