Add CS job script

This commit is contained in:
Vortrex
2021-03-30 21:43:37 -05:00
parent 66230b33fb
commit 6643f10855

76
scripts/client/job.js Normal file
View File

@@ -0,0 +1,76 @@
// ===========================================================================
// Asshat-Gaming Roleplay
// https://github.com/VortrexFTW/gtac_asshat_rp
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
// ===========================================================================
// FILE: job.js
// DESC: Provides job functions and usage
// TYPE: Client (JavaScript)
// ===========================================================================
let localPlayerJobType = 0;
let localPlayerWorking = false;
let jobRouteStopBlip = null;
let jobRouteStopSphere = null;
// ===========================================================================
function initJobScript() {
logToConsole(LOG_DEBUG, "[Asshat.Job]: Initializing job script ...");
logToConsole(LOG_DEBUG, "[Asshat.Job]: Job script initialized!");
}
// ===========================================================================
function setLocalPlayerJobType() {
logToConsole(LOG_DEBUG, `[Asshat.Main] Set local player job type to ${tempJobType}`);
localPlayerJobType = tempJobType;
}
// ===========================================================================
function setLocalPlayerWorkingState(tempWorking) {
logToConsole(LOG_DEBUG, `[Asshat.Main] Setting working state to ${tempWorking}`);
localPlayerWorking = tempWorking;
}
// ===========================================================================
function showJobRouteStop() {
logToConsole(LOG_DEBUG, `[Asshat.Job] Showing route stop`);
if(gta.game == GAME_GTA_SA) {
jobRouteStopSphere = gta.createPickup(1318, position, 1);
} else {
jobRouteStopSphere = gta.createSphere(position, 3);
jobRouteStopSphere.colour = colour;
}
jobRouteStopBlip = gta.createBlip(position, 0, 2, colour);
}
// ===========================================================================
function showJobRouteStop(position, colour) {
logToConsole(LOG_DEBUG, `[Asshat.Job] Showing route stop`);
if(gta.game == GAME_GTA_SA) {
jobRouteStopSphere = gta.createPickup(1318, position, 1);
} else {
jobRouteStopSphere = gta.createSphere(position, 3);
jobRouteStopSphere.colour = colour;
}
jobRouteStopBlip = gta.createBlip(position, 0, 2, colour);
}
// ===========================================================================
function enteredJobRouteSphere() {
logToConsole(LOG_DEBUG, `[Asshat.Job] Entered job route sphere`);
tellServerPlayerArrivedAtJobRouteStop();
destroyElement(jobRouteStopSphere);
destroyElement(jobRouteStopBlip);
jobRouteStopSphere = null;
jobRouteStopBlip = null;
}
// ===========================================================================