Mass convert to tabs + fix veh buy ownership

This commit is contained in:
Vortrex
2022-04-24 08:18:01 -05:00
parent 429da67b7d
commit 4e86118475
41 changed files with 7535 additions and 7526 deletions

View File

@@ -297,4 +297,3 @@ function isIpAddressBanned(ipAddress) {
} }
// =========================================================================== // ===========================================================================

View File

@@ -9,13 +9,6 @@
function initJobScript() { function initJobScript() {
logToConsole(LOG_INFO, "[VRR.Job]: Initializing job script ..."); logToConsole(LOG_INFO, "[VRR.Job]: Initializing job script ...");
getServerData().jobs = loadJobsFromDatabase();
createAllJobPickups();
createAllJobBlips();
setAllJobDataIndexes();
logToConsole(LOG_INFO, "[VRR.Job]: Job script initialized successfully!"); logToConsole(LOG_INFO, "[VRR.Job]: Job script initialized successfully!");
return true; return true;
} }
@@ -39,7 +32,7 @@ function loadJobsFromDatabase() {
tempJobData.locations = loadJobLocationsFromDatabase(tempJobData.databaseId); tempJobData.locations = loadJobLocationsFromDatabase(tempJobData.databaseId);
tempJobData.equipment = loadJobEquipmentsFromDatabase(tempJobData.databaseId); tempJobData.equipment = loadJobEquipmentsFromDatabase(tempJobData.databaseId);
tempJobData.uniforms = loadJobUniformsFromDatabase(tempJobData.databaseId); tempJobData.uniforms = loadJobUniformsFromDatabase(tempJobData.databaseId);
tempJobData.routes = loadJobRoutesFromDatabase(tempJobData.databaseId); //tempJobData.routes = loadJobRoutesFromDatabase(tempJobData.databaseId);
tempJobs.push(tempJobData); tempJobs.push(tempJobData);
logToConsole(LOG_DEBUG, `[VRR.Job]: Job '${tempJobData.name}' loaded from database successfully!`); logToConsole(LOG_DEBUG, `[VRR.Job]: Job '${tempJobData.name}' loaded from database successfully!`);
} }
@@ -617,9 +610,9 @@ function stopWorking(client) {
let jobVehicle = getPlayerData(client).lastJobVehicle; let jobVehicle = getPlayerData(client).lastJobVehicle;
if(jobVehicle) { if(jobVehicle) {
if(client.player.vehicle) { if(getPlayerVehicle(client) == jobVehicle) {
removePlayerFromVehicle(client); removePlayerFromVehicle(client);
//client.player.removeFromVehicle(); //getPlayerPed(client).removeFromVehicle();
} }
respawnVehicle(jobVehicle); respawnVehicle(jobVehicle);
@@ -942,7 +935,7 @@ function reloadAllJobsCommand(command, params, client) {
} }
} }
messageAdminAction(`All server jobs have been reloaded by an admin!`); announceAdminAction("AllJobsReloaded");
} }
// =========================================================================== // ===========================================================================
@@ -986,7 +979,7 @@ function createJobLocationCommand(command, params, client) {
} }
createJobLocation(jobId, getPlayerPosition(client), getPlayerInterior(client), getPlayerDimension(client)); createJobLocation(jobId, getPlayerPosition(client), getPlayerInterior(client), getPlayerDimension(client));
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}created a location for the {jobYellow}${getJobData(jobId).name} {MAINCOLOUR}job`); messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} created a location for the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
return true; return true;
} }
@@ -995,7 +988,7 @@ function createJobLocationCommand(command, params, client) {
function deleteJobLocationCommand(command, params, client) { function deleteJobLocationCommand(command, params, client) {
let closestJobLocation = getClosestJobLocation(getPlayerPosition(client)); let closestJobLocation = getClosestJobLocation(getPlayerPosition(client));
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}deleted location {ALTCOLOUR}${closestJobLocation.index} (DB ID ${closestJobLocation.databaseId}) {MAINCOLOUR}for the {jobYellow}${getJobData(closestJobLocation.jobIndex).name} {MAINCOLOUR}job`); messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} deleted location {ALTCOLOUR}${closestJobLocation.index} (DB ID ${closestJobLocation.databaseId}){MAINCOLOUR} for the {jobYellow}${getJobData(closestJobLocation.jobIndex).name}{MAINCOLOUR} job`);
deleteJobLocation(closestJobLocation); deleteJobLocation(closestJobLocation);
@@ -1012,7 +1005,7 @@ function toggleJobLocationEnabledCommand(command, params, client) {
let closestJobLocation = getClosestJobLocation(getPlayerPosition(client)); let closestJobLocation = getClosestJobLocation(getPlayerPosition(client));
closestJobLocation.enabled = !closestJobLocation.enabled; closestJobLocation.enabled = !closestJobLocation.enabled;
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(closestJobLocation.enabled)} location {ALTCOLOUR}${closestJobLocation.databaseId} {MAINCOLOUR}for the {jobYellow}${getJobData(closestJobLocation.jobIndex).name} {MAINCOLOUR}job`); messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} ${getEnabledDisabledFromBool(closestJobLocation.enabled)} location {ALTCOLOUR}${closestJobLocation.databaseId} {MAINCOLOUR}for the {jobYellow}${getJobData(closestJobLocation.jobIndex).name}{MAINCOLOUR} job`);
} }
// =========================================================================== // ===========================================================================
@@ -1026,7 +1019,7 @@ function toggleJobEnabledCommand(command, params, client) {
let jobId = getJobFromParams(params) || getClosestJobLocation(getPlayerPosition(client)).jobIndex; let jobId = getJobFromParams(params) || getClosestJobLocation(getPlayerPosition(client)).jobIndex;
getJobData(jobId).enabled = !getJobData(jobId).enabled; getJobData(jobId).enabled = !getJobData(jobId).enabled;
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} the {jobYellow}${getJobData(jobId).name} {MAINCOLOUR}job`); messageAdmins(`{adminRed}${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} the {jobYellow}${getJobData(jobId).name} {MAINCOLOUR}job`);
} }
// =========================================================================== // ===========================================================================
@@ -1049,7 +1042,7 @@ function setJobColourCommand(command, params, client) {
getJobData(jobId).colour = toColour(toInteger(red), toInteger(green), toInteger(blue), 255); getJobData(jobId).colour = toColour(toInteger(red), toInteger(green), toInteger(blue), 255);
getJobData(jobId).needsSaved = true; getJobData(jobId).needsSaved = true;
messageAdmins(`${getPlayerName(client)}{MAINCOLOUR} set job {jobYellow}${getJobData(jobId).name}'s{MAINCOLOUR} colour to ${red}, ${green}, ${blue}`); messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} set job {jobYellow}${getJobData(jobId).name}'s{MAINCOLOUR} colour to ${red}, ${green}, ${blue}`);
// Force nametag update in case somebody is using this job // Force nametag update in case somebody is using this job
updateAllPlayerNameTags(); updateAllPlayerNameTags();
@@ -1096,7 +1089,7 @@ function setJobBlipCommand(command, params, client) {
getJobData(jobId).blipModel = blipId; getJobData(jobId).blipModel = blipId;
getJobData(jobId).needsSaved = true; getJobData(jobId).needsSaved = true;
messageAdmins(`${getPlayerName(client)}{MAINCOLOUR} set job {jobYellow}${getJobData(jobId).name}'s{MAINCOLOUR} blip model to ${blipString}`); messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} set job {jobYellow}${getJobData(jobId).name}'s{MAINCOLOUR} blip model to ${blipString}`);
resetAllJobBlips(); resetAllJobBlips();
} }
@@ -1141,7 +1134,7 @@ function setJobPickupCommand(command, params, client) {
getJobData(jobId).pickupModel = pickupId; getJobData(jobId).pickupModel = pickupId;
getJobData(jobId).needsSaved = true; getJobData(jobId).needsSaved = true;
messageAdmins(`${getPlayerName(client)}{MAINCOLOUR} set job {jobYellow}${getJobData(jobId).name}'s{MAINCOLOUR} pickup to ${pickupString}`); messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} set job {jobYellow}${getJobData(jobId).name}'s{MAINCOLOUR} pickup to ${pickupString}`);
resetAllJobPickups(); resetAllJobPickups();
} }
@@ -1164,7 +1157,7 @@ function toggleJobRouteEnabledCommand(command, params, client) {
} }
getJobData(jobId).routes[jobRoute].enabled = !getJobData(jobId).routes[jobRoute].enabled; getJobData(jobId).routes[jobRoute].enabled = !getJobData(jobId).routes[jobRoute].enabled;
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} for the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`); messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} ${getEnabledDisabledFromBool(getJobRouteData(jobId, jobRoute).enabled)} route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} for the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
} }
// =========================================================================== // ===========================================================================
@@ -1190,7 +1183,7 @@ function setJobRouteNameCommand(command, params, client) {
let oldName = getJobData(jobId).routes[jobRoute].name; let oldName = getJobData(jobId).routes[jobRoute].name;
getJobData(jobId).routes[jobRoute].name = params; getJobData(jobId).routes[jobRoute].name = params;
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} set route {ALTCOLOUR}${oldName}{MAINCOLOUR} to {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} for the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`); messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} set route {ALTCOLOUR}${oldName}{MAINCOLOUR} to {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} for the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
} }
// =========================================================================== // ===========================================================================
@@ -1225,7 +1218,7 @@ function setJobRouteAllLocationDelaysCommand(command, params, client) {
getJobData(jobId).routes[jobRoute].locations[i].needsSaved = true; getJobData(jobId).routes[jobRoute].locations[i].needsSaved = true;
} }
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} set route {ALTCOLOUR}${oldName}{MAINCOLOUR} location's stop delays to {ALTCOLOUR}${delay/1000}{MAINCOLOUR} seconds for the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`); messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} set route {ALTCOLOUR}${oldName}{MAINCOLOUR} location's stop delays to {ALTCOLOUR}${delay/1000}{MAINCOLOUR} seconds for the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
} }
// =========================================================================== // ===========================================================================
@@ -1269,7 +1262,7 @@ function setJobRouteVehicleColoursCommand(command, params, client) {
} }
} }
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} set the vehicle colours to {ALTCOLOUR}${colour1}, ${colour2}{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`); messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} set the vehicle colours to {ALTCOLOUR}${colour1}, ${colour2}{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
} }
// =========================================================================== // ===========================================================================
@@ -1295,7 +1288,7 @@ function setJobRouteFinishMessageCommand(command, params, client) {
getJobData(jobId).routes[jobRoute].finishMessage = params; getJobData(jobId).routes[jobRoute].finishMessage = params;
getJobData(jobId).routes[jobRoute].needsSaved = true; getJobData(jobId).routes[jobRoute].needsSaved = true;
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} set the finish message to {ALTCOLOUR}"${params}"{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`); messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} set the finish message to {ALTCOLOUR}"${params}"{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
} }
// =========================================================================== // ===========================================================================
@@ -1321,7 +1314,7 @@ function setJobRouteStartMessageCommand(command, params, client) {
getJobData(jobId).routes[jobRoute].startMessage = params; getJobData(jobId).routes[jobRoute].startMessage = params;
getJobData(jobId).routes[jobRoute].needsSaved = true; getJobData(jobId).routes[jobRoute].needsSaved = true;
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} set the start message to {ALTCOLOUR}"${params}"{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`); messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} set the start message to {ALTCOLOUR}"${params}"{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
} }
// =========================================================================== // ===========================================================================
@@ -1347,7 +1340,7 @@ function setJobRouteLocationArriveMessageCommand(command, params, client) {
getJobData(jobId).routes[jobRoute].locationArriveMessage = params; getJobData(jobId).routes[jobRoute].locationArriveMessage = params;
getJobData(jobId).routes[jobRoute].needsSaved = true; getJobData(jobId).routes[jobRoute].needsSaved = true;
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} set the location arrival message to {ALTCOLOUR}"${params}"{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`); messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} ${getEnabledDisabledFromBool(getJobData(jobId).enabled)} set the location arrival message to {ALTCOLOUR}"${params}"{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
} }
// =========================================================================== // ===========================================================================
@@ -1373,7 +1366,7 @@ function setJobRouteLocationNextMessageCommand(command, params, client) {
getJobData(jobId).routes[jobRoute].locationNextMessage = params; getJobData(jobId).routes[jobRoute].locationNextMessage = params;
getJobData(jobId).routes[jobRoute].needsSaved = true; getJobData(jobId).routes[jobRoute].needsSaved = true;
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} set the location next message to {ALTCOLOUR}"${params}"{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`); messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} ${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} set the location next message to {ALTCOLOUR}"${params}"{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
} }
// =========================================================================== // ===========================================================================
@@ -1405,7 +1398,7 @@ function setJobRoutePayCommand(command, params, client) {
getJobData(jobId).routes[jobRoute].pay = amount; getJobData(jobId).routes[jobRoute].pay = amount;
getJobData(jobId).routes[jobRoute].needsSaved = true; getJobData(jobId).routes[jobRoute].needsSaved = true;
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} set the start message to {ALTCOLOUR}"${params}"{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`); messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} set the start message to {ALTCOLOUR}"${params}"{MAINCOLOUR} for route {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} of the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
} }
// =========================================================================== // ===========================================================================
@@ -1419,7 +1412,7 @@ function toggleJobWhiteListCommand(command, params, client) {
let jobId = getJobFromParams(params) || getClosestJobLocation(getPlayerPosition(client)).jobIndex; let jobId = getJobFromParams(params) || getClosestJobLocation(getPlayerPosition(client)).jobIndex;
getJobData(jobId).whiteListEnabled = !getJobData(jobId).whiteListEnabled; getJobData(jobId).whiteListEnabled = !getJobData(jobId).whiteListEnabled;
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).whiteListEnabled)} {MAINCOLOUR}the whitelist for the {ALTCOLOUR}${getJobData(jobId).name} {MAINCOLOUR}job`); messageAdmins(`{adminRed}${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).whiteListEnabled)} {MAINCOLOUR}the whitelist for the {ALTCOLOUR}${getJobData(jobId).name} {MAINCOLOUR}job`);
} }
// =========================================================================== // ===========================================================================
@@ -1433,7 +1426,7 @@ function toggleJobBlackListCommand(command, params, client) {
let jobId = getJobFromParams(params) || getClosestJobLocation(getPlayerPosition(client)).jobIndex; let jobId = getJobFromParams(params) || getClosestJobLocation(getPlayerPosition(client)).jobIndex;
getJobData(jobId).blackListEnabled = !getJobData(jobId).blackListEnabled; getJobData(jobId).blackListEnabled = !getJobData(jobId).blackListEnabled;
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).blackListEnabled)} {MAINCOLOUR}the blacklist for the {ALTCOLOUR}${getJobData(jobId).name} {MAINCOLOUR}job`); messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} ${getEnabledDisabledFromBool(getJobData(jobId).blackListEnabled)} the blacklist for the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
} }
// =========================================================================== // ===========================================================================
@@ -1463,7 +1456,7 @@ function addPlayerToJobBlackListCommand(command, params, client) {
} }
addPlayerToJobBlackList(targetClient, jobId); addPlayerToJobBlackList(targetClient, jobId);
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}added ${getCharacterFullName(targetClient)} {MAINCOLOUR}to the blacklist for the {ALTCOLOUR}${jobData.name} {MAINCOLOUR}job`); messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} added {ALTCOLOUR}${getCharacterFullName(targetClient)}{MAINCOLOUR} to the blacklist for the {jobYellow}${jobData.name}{MAINCOLOUR} job`);
} }
// =========================================================================== // ===========================================================================
@@ -1493,7 +1486,7 @@ function removePlayerFromJobBlackListCommand(command, params, client) {
} }
removePlayerFromJobBlackList(targetClient, jobId); removePlayerFromJobBlackList(targetClient, jobId);
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}removed ${getCharacterFullName(targetClient)} {MAINCOLOUR}from the blacklist for the {ALTCOLOUR}${jobData.name} {MAINCOLOUR}job`); messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} removed {ALTCOLOUR}${getCharacterFullName(targetClient)}{MAINCOLOUR} from the blacklist for the {jobYellow}${jobData.name}{MAINCOLOUR} job`);
} }
// =========================================================================== // ===========================================================================
@@ -1523,7 +1516,7 @@ function addPlayerToJobWhiteListCommand(command, params, client) {
} }
addPlayerToJobWhiteList(targetClient, jobId); addPlayerToJobWhiteList(targetClient, jobId);
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}added ${getCharacterFullName(targetClient)} {MAINCOLOUR}to the whitelist for the {ALTCOLOUR}${jobData.name} {MAINCOLOUR}job`); messageAdmins(`{adminRed}${getPlayerName(client)} {MAINCOLOUR}added {ALTCOLOUR}${getCharacterFullName(targetClient)}{MAINCOLOUR} to the whitelist for the {jobYellow}${jobData.name}{MAINCOLOUR} job`);
} }
// =========================================================================== // ===========================================================================
@@ -1553,7 +1546,7 @@ function removePlayerFromJobWhiteListCommand(command, params, client) {
} }
removePlayerFromJobWhiteList(targetClient, jobId); removePlayerFromJobWhiteList(targetClient, jobId);
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}removed ${getCharacterFullName(targetClient)} {MAINCOLOUR}from the whitelist for the {ALTCOLOUR}${jobData.name} {MAINCOLOUR}job`); messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} removed {ALTCOLOUR}${getCharacterFullName(targetClient)}{MAINCOLOUR} from the whitelist for the {jobYellow}${jobData.name}{MAINCOLOUR} job`);
} }
// =========================================================================== // ===========================================================================
@@ -2291,24 +2284,33 @@ function createJobLocationPickup(jobId, locationId) {
return false; return false;
} }
if(getJobData(jobId).pickupModel != -1) { let tempJobData = getJobData(jobId);
if(tempJobData.pickupModel != -1) {
let pickupModelId = getGameConfig().pickupModels[getServerGame()].Job; let pickupModelId = getGameConfig().pickupModels[getServerGame()].Job;
if(getJobData(jobId).pickupModel != 0) { if(tempJobData.pickupModel != 0) {
pickupModelId = getJobData(jobId).pickupModel; pickupModelId = tempJobData.pickupModel;
} }
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating pickup for location ${locationId} of the ${getServerData().jobs[jobId].name} job`); logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating pickup for location ${locationId} of the ${tempJobData.name} job`);
getJobData(jobId).locations[locationId].pickup = createGamePickup(pickupModelId, getJobData(jobId).locations[locationId].position, getGameConfig().pickupTypes[getServerGame()].job); if(areServerElementsSupported()) {
setElementDimension(getJobData(jobId).locations[locationId].pickup, getJobData(jobId).locations[locationId].dimension); let pickup = createGamePickup(pickupModelId, tempJobData.locations[locationId].position, getGameConfig().pickupTypes[getServerGame()].job);
setElementOnAllDimensions(getJobData(jobId).locations[locationId].pickup, false); if(pickup != false) {
setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "vrr.owner.type", VRR_PICKUP_JOB, false); tempJobData.locations[locationId].pickup = pickup;
setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "vrr.owner.id", locationId, false); setElementDimension(pickup, tempJobData.locations[locationId].dimension);
setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "vrr.label.type", VRR_LABEL_JOB, true); setElementOnAllDimensions(pickup, false);
setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "vrr.label.name", getJobData(jobId).name, true); setEntityData(pickup, "vrr.owner.type", VRR_PICKUP_JOB, false);
setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "vrr.label.jobType", getJobData(jobId).databaseId, true); setEntityData(pickup, "vrr.owner.id", locationId, false);
addToWorld(getJobData(jobId).locations[locationId].pickup); setEntityData(pickup, "vrr.label.type", VRR_LABEL_JOB, true);
setEntityData(pickup, "vrr.label.name", tempJobData.name, true);
setEntityData(pickup, "vrr.label.jobType", tempJobData.databaseId, true);
addToWorld(pickup);
}
} else {
// sendJobToPlayer(null, jobId, tempJobData.name, tempJobData.locations[locationId].position, pickupModel);
}
} }
} }
@@ -2319,6 +2321,8 @@ function createJobLocationBlip(jobId, locationId) {
return false; return false;
} }
let tempJobData = getJobData(jobId);
if(getJobData(jobId).blipModel != -1) { if(getJobData(jobId).blipModel != -1) {
let blipModelId = getGameConfig().blipSprites[getServerGame()].Job; let blipModelId = getGameConfig().blipSprites[getServerGame()].Job;
@@ -2326,12 +2330,17 @@ function createJobLocationBlip(jobId, locationId) {
blipModelId = getJobData(jobId).blipModel; blipModelId = getJobData(jobId).blipModel;
} }
getJobData(jobId).locations[locationId].blip = createGameBlip(getJobData(jobId).locations[locationId].position, blipModelId, getColourByType("job")); if(areServerElementsSupported()) {
//setElementStreamInDistance(getServerData().jobs[i].locations[j].blip, 30); let blip = createGameBlip(tempJobData.locations[locationId].position, blipModelId, getColourByType("job"));
//setElementStreamOutDistance(getServerData().jobs[i].locations[j].blip, 40); if(blip != false) {
setElementOnAllDimensions(getJobData(jobId).locations[locationId].blip, false); tempJobData.locations[locationId].blip = blip;
setElementDimension(getJobData(jobId).locations[locationId].blip, getJobData(jobId).locations[locationId].dimension); }
addToWorld(getJobData(jobId).locations[locationId].blip); setElementOnAllDimensions(blip, false);
setElementDimension(blip, tempJobData.locations[locationId].dimension);
addToWorld(blip);
} else {
sendJobToPlayer(null, jobId, tempJobData.name, tempJobData.locations[locationId].position, blipModelId);
}
} }
} }
@@ -2529,7 +2538,7 @@ function createJobRouteCommand(command, params, client) {
} }
createJobRoute(params, closestJobLocation); createJobRoute(params, closestJobLocation);
messageAdmins(`${getPlayerName(client)}{MAINCOLOUR} created route {ALTCOLOUR}${params}{MAINCOLOUR} for job {jobYellow}${getJobData(jobId).name}`); messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} created route {ALTCOLOUR}${params}{MAINCOLOUR} for job {jobYellow}${getJobData(jobId).name}`);
return true; return true;
} }
@@ -2563,7 +2572,7 @@ function createJobRouteLocationCommand(command, params, client) {
let routeLocationName = params; let routeLocationName = params;
createJobRouteLocation(routeLocationName, getPlayerPosition(client), jobRouteData); createJobRouteLocation(routeLocationName, getPlayerPosition(client), jobRouteData);
messageAdmins(`${getPlayerName(client)}{MAINCOLOUR} created location {ALTCOLOUR}${routeLocationName}{MAINCOLOUR} for route {ALTCOLOUR}${jobRouteData.name}{MAINCOLOUR} for job {jobYellow}${getJobData(jobId).name}`); messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} created location {ALTCOLOUR}${routeLocationName}{MAINCOLOUR} for route {ALTCOLOUR}${jobRouteData.name}{MAINCOLOUR} for job {jobYellow}${getJobData(jobId).name}`);
return true; return true;
} }
@@ -2611,7 +2620,7 @@ function createJobRouteLocation(routeLocationName, position, jobRouteData) {
function deleteJobRouteLocationCommand(command, params, client) { function deleteJobRouteLocationCommand(command, params, client) {
let closestJobRouteLocation = getClosestJobRouteLocation(getPlayerPosition(client)); let closestJobRouteLocation = getClosestJobRouteLocation(getPlayerPosition(client));
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)}{MAINCOLOUR} deleted route location {ALTCOLOUR}${closestJobRouteLocation.index} (DB ID ${closestJobRouteLocation.databaseId}){MAINCOLOUR} for the {ALTCOLOUR}${closestJobRouteLocation.name}{jobYellow} route of the {jobYellow}${getJobData(closestJobLocation.jobIndex).name}{MAINCOLOUR} job`); messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} deleted route location {ALTCOLOUR}${closestJobRouteLocation.index} (DB ID ${closestJobRouteLocation.databaseId}){MAINCOLOUR} for the {ALTCOLOUR}${closestJobRouteLocation.name}{jobYellow} route of the {jobYellow}${getJobData(closestJobLocation.jobIndex).name}{MAINCOLOUR} job`);
if(closestJobRouteLocation.databaseId > 0) { if(closestJobRouteLocation.databaseId > 0) {
quickDatabaseQuery(`DELETE FROM job_route_loc WHERE job_route_loc_id = ${closestJobRouteLocation.databaseId}`); quickDatabaseQuery(`DELETE FROM job_route_loc WHERE job_route_loc_id = ${closestJobRouteLocation.databaseId}`);
@@ -2649,7 +2658,7 @@ function deleteJobRouteCommand(command, params, client) {
} }
} }
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)}{MAINCOLOUR} deleted route {ALTCOLOUR}${jobRouteData.name} (DB ID ${jobRouteData.databaseId}) {MAINCOLOUR}for the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`); messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} deleted route {ALTCOLOUR}${jobRouteData.name} (DB ID ${jobRouteData.databaseId}){MAINCOLOUR} for the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
if(jobRouteData.databaseId > 0) { if(jobRouteData.databaseId > 0) {
quickDatabaseQuery(`DELETE FROM job_route WHERE job_route_id = ${jobRouteData.databaseId}`); quickDatabaseQuery(`DELETE FROM job_route WHERE job_route_id = ${jobRouteData.databaseId}`);

View File

@@ -1463,6 +1463,7 @@ function processVehiclePurchasing() {
getVehicleData(getPlayerData(client).buyingVehicle).buyPrice = 0; getVehicleData(getPlayerData(client).buyingVehicle).buyPrice = 0;
getVehicleData(getPlayerData(client).buyingVehicle).rentPrice = 0; getVehicleData(getPlayerData(client).buyingVehicle).rentPrice = 0;
getVehicleData(getPlayerData(client).buyingVehicle).spawnLocked = false; getVehicleData(getPlayerData(client).buyingVehicle).spawnLocked = false;
getVehicleData(getPlayerData(client).buyingVehicle).needsSaved = true;
getPlayerData(client).buyingVehicle = false; getPlayerData(client).buyingVehicle = false;
messagePlayerSuccess(client, getLocaleString(client, "VehiclePurchaseComplete")); messagePlayerSuccess(client, getLocaleString(client, "VehiclePurchaseComplete"));
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null); setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);