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

@@ -9,13 +9,6 @@
function initJobScript() {
logToConsole(LOG_INFO, "[VRR.Job]: Initializing job script ...");
getServerData().jobs = loadJobsFromDatabase();
createAllJobPickups();
createAllJobBlips();
setAllJobDataIndexes();
logToConsole(LOG_INFO, "[VRR.Job]: Job script initialized successfully!");
return true;
}
@@ -39,7 +32,7 @@ function loadJobsFromDatabase() {
tempJobData.locations = loadJobLocationsFromDatabase(tempJobData.databaseId);
tempJobData.equipment = loadJobEquipmentsFromDatabase(tempJobData.databaseId);
tempJobData.uniforms = loadJobUniformsFromDatabase(tempJobData.databaseId);
tempJobData.routes = loadJobRoutesFromDatabase(tempJobData.databaseId);
//tempJobData.routes = loadJobRoutesFromDatabase(tempJobData.databaseId);
tempJobs.push(tempJobData);
logToConsole(LOG_DEBUG, `[VRR.Job]: Job '${tempJobData.name}' loaded from database successfully!`);
}
@@ -617,9 +610,9 @@ function stopWorking(client) {
let jobVehicle = getPlayerData(client).lastJobVehicle;
if(jobVehicle) {
if(client.player.vehicle) {
if(getPlayerVehicle(client) == jobVehicle) {
removePlayerFromVehicle(client);
//client.player.removeFromVehicle();
//getPlayerPed(client).removeFromVehicle();
}
respawnVehicle(jobVehicle);
@@ -631,7 +624,7 @@ function stopWorking(client) {
deleteJobItems(client);
restorePlayerJobLockerItems(client);
respawnJobVehicle(client);
sendPlayerStopJobRoute(client);
sendPlayerStopJobRoute(client);
let jobId = getPlayerJob(client);
switch(getJobType(jobId)) {
@@ -665,9 +658,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 +746,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`);
}
}
// ===========================================================================
@@ -942,7 +935,7 @@ function reloadAllJobsCommand(command, params, client) {
}
}
messageAdminAction(`All server jobs have been reloaded by an admin!`);
announceAdminAction("AllJobsReloaded");
}
// ===========================================================================
@@ -966,8 +959,8 @@ function createJob(name) {
tempJobData.pickupModel = getGameConfig().pickupModels[getGame()].job;
getServerData().jobs.push(tempJobData);
saveJobToDatabase(tempJobData);
setAllJobDataIndexes();
saveJobToDatabase(tempJobData);
setAllJobDataIndexes();
}
// ===========================================================================
@@ -986,7 +979,7 @@ function createJobLocationCommand(command, params, 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;
}
@@ -995,7 +988,7 @@ function createJobLocationCommand(command, params, client) {
function deleteJobLocationCommand(command, params, 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);
@@ -1012,7 +1005,7 @@ function toggleJobLocationEnabledCommand(command, params, client) {
let closestJobLocation = getClosestJobLocation(getPlayerPosition(client));
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;
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).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
updateAllPlayerNameTags();
@@ -1096,7 +1089,7 @@ function setJobBlipCommand(command, params, client) {
getJobData(jobId).blipModel = blipId;
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();
}
@@ -1141,7 +1134,7 @@ function setJobPickupCommand(command, params, client) {
getJobData(jobId).pickupModel = pickupId;
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();
}
@@ -1164,7 +1157,7 @@ function toggleJobRouteEnabledCommand(command, params, client) {
}
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;
getJobData(jobId).routes[jobRoute].name = params;
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}${getEnabledDisabledFromBool(getJobData(jobId).enabled)}{MAINCOLOUR} set route {ALTCOLOUR}${oldName}{MAINCOLOUR} to {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} for the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} set route {ALTCOLOUR}${oldName}{MAINCOLOUR} to {ALTCOLOUR}${getJobRouteData(jobId, jobRoute).name}{MAINCOLOUR} for the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
}
// ===========================================================================
@@ -1213,19 +1206,19 @@ function setJobRouteAllLocationDelaysCommand(command, params, client) {
let jobId = getPlayerJob(client);
let 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`);
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].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].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].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].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].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;
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;
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);
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);
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);
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);
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)} {MAINCOLOUR}removed ${getCharacterFullName(targetClient)} {MAINCOLOUR}from the whitelist for the {ALTCOLOUR}${jobData.name} {MAINCOLOUR}job`);
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} removed {ALTCOLOUR}${getCharacterFullName(targetClient)}{MAINCOLOUR} from the whitelist for the {jobYellow}${jobData.name}{MAINCOLOUR} job`);
}
// ===========================================================================
@@ -1569,40 +1562,40 @@ function forceAllPlayersToStopWorking() {
// ===========================================================================
function jobStartRouteCommand(command, params, client) {
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 +1604,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 +1653,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 +1677,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 +1790,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);
}
// ===========================================================================
@@ -2291,24 +2284,33 @@ function createJobLocationPickup(jobId, locationId) {
return false;
}
if(getJobData(jobId).pickupModel != -1) {
let tempJobData = getJobData(jobId);
if(tempJobData.pickupModel != -1) {
let pickupModelId = getGameConfig().pickupModels[getServerGame()].Job;
if(getJobData(jobId).pickupModel != 0) {
pickupModelId = getJobData(jobId).pickupModel;
if(tempJobData.pickupModel != 0) {
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);
setElementDimension(getJobData(jobId).locations[locationId].pickup, getJobData(jobId).locations[locationId].dimension);
setElementOnAllDimensions(getJobData(jobId).locations[locationId].pickup, false);
setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "vrr.owner.type", VRR_PICKUP_JOB, false);
setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "vrr.owner.id", locationId, false);
setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "vrr.label.type", VRR_LABEL_JOB, true);
setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "vrr.label.name", getJobData(jobId).name, true);
setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "vrr.label.jobType", getJobData(jobId).databaseId, true);
addToWorld(getJobData(jobId).locations[locationId].pickup);
if(areServerElementsSupported()) {
let pickup = createGamePickup(pickupModelId, tempJobData.locations[locationId].position, getGameConfig().pickupTypes[getServerGame()].job);
if(pickup != false) {
tempJobData.locations[locationId].pickup = pickup;
setElementDimension(pickup, tempJobData.locations[locationId].dimension);
setElementOnAllDimensions(pickup, false);
setEntityData(pickup, "vrr.owner.type", VRR_PICKUP_JOB, false);
setEntityData(pickup, "vrr.owner.id", locationId, false);
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;
}
let tempJobData = getJobData(jobId);
if(getJobData(jobId).blipModel != -1) {
let blipModelId = getGameConfig().blipSprites[getServerGame()].Job;
@@ -2326,12 +2330,17 @@ function createJobLocationBlip(jobId, locationId) {
blipModelId = getJobData(jobId).blipModel;
}
getJobData(jobId).locations[locationId].blip = createGameBlip(getJobData(jobId).locations[locationId].position, blipModelId, getColourByType("job"));
//setElementStreamInDistance(getServerData().jobs[i].locations[j].blip, 30);
//setElementStreamOutDistance(getServerData().jobs[i].locations[j].blip, 40);
setElementOnAllDimensions(getJobData(jobId).locations[locationId].blip, false);
setElementDimension(getJobData(jobId).locations[locationId].blip, getJobData(jobId).locations[locationId].dimension);
addToWorld(getJobData(jobId).locations[locationId].blip);
if(areServerElementsSupported()) {
let blip = createGameBlip(tempJobData.locations[locationId].position, blipModelId, getColourByType("job"));
if(blip != false) {
tempJobData.locations[locationId].blip = blip;
}
setElementOnAllDimensions(blip, false);
setElementDimension(blip, tempJobData.locations[locationId].dimension);
addToWorld(blip);
} else {
sendJobToPlayer(null, jobId, tempJobData.name, tempJobData.locations[locationId].position, blipModelId);
}
}
}
@@ -2408,31 +2417,31 @@ function isPlayerOnJobBlackList(client, jobId) {
// ===========================================================================
function playerArrivedAtJobRouteLocation(client) {
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);
}
}
// ===========================================================================
@@ -2529,7 +2538,7 @@ function createJobRouteCommand(command, params, client) {
}
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;
}
@@ -2563,7 +2572,7 @@ function createJobRouteLocationCommand(command, params, client) {
let routeLocationName = params;
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;
}
@@ -2579,14 +2588,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();
}
@@ -2599,10 +2608,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();
}
@@ -2611,7 +2620,7 @@ function createJobRouteLocation(routeLocationName, position, jobRouteData) {
function deleteJobRouteLocationCommand(command, params, 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) {
quickDatabaseQuery(`DELETE FROM job_route_loc WHERE job_route_loc_id = ${closestJobRouteLocation.databaseId}`);
@@ -2622,7 +2631,7 @@ function deleteJobRouteLocationCommand(command, params, client) {
getJobData(getJobIdFromDatabaseId(tempJob)).routes[tempJobRoute].locations.splice(tempIndex, 1);
setAllJobDataIndexes();
collectAllGarbage();
collectAllGarbage();
}
// ===========================================================================
@@ -2631,9 +2640,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];
@@ -2649,12 +2658,12 @@ function deleteJobRouteCommand(command, params, client) {
}
}
messageAdmins(`{ALTCOLOUR}${getPlayerName(client)}{MAINCOLOUR} deleted route {ALTCOLOUR}${jobRouteData.name} (DB ID ${jobRouteData.databaseId}) {MAINCOLOUR}for the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
messageAdmins(`{adminRed}${getPlayerName(client)}{MAINCOLOUR} deleted route {ALTCOLOUR}${jobRouteData.name} (DB ID ${jobRouteData.databaseId}){MAINCOLOUR} for the {jobYellow}${getJobData(jobId).name}{MAINCOLOUR} job`);
if(jobRouteData.databaseId > 0) {
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);
@@ -2728,7 +2737,7 @@ function getJobPointsInRange(position, distance) {
// ===========================================================================
function respawnJobVehicle(client) {
respawnVehicle(getPlayerJobVehicle(client));
respawnVehicle(getPlayerJobVehicle(client));
}
// ===========================================================================
@@ -2740,12 +2749,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;
}
// ===========================================================================
@@ -2785,58 +2794,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;
}
// ===========================================================================
@@ -2860,21 +2869,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;
}
// ===========================================================================