Use create job location blip util
This commit is contained in:
@@ -264,16 +264,7 @@ function createAllJobBlips() {
|
|||||||
logToConsole(LOG_DEBUG, `[VRR.Job] Spawning all job location blips ...`);
|
logToConsole(LOG_DEBUG, `[VRR.Job] Spawning all job location blips ...`);
|
||||||
for(let i in getServerData().jobs) {
|
for(let i in getServerData().jobs) {
|
||||||
for(let j in getServerData().jobs[i].locations) {
|
for(let j in getServerData().jobs[i].locations) {
|
||||||
getServerData().jobs[i].locations[j].blip = game.createBlip((getServerData().jobs[i].blipModel!=0) ? getServerData().jobs[i].blipModel : 0, getServerData().jobs[i].locations[j].position, 2, getColourByName("yellow"));
|
createJobLocationBlip(i, j);
|
||||||
if(getGlobalConfig().jobBlipStreamInDistance == -1 || getGlobalConfig().jobBlipStreamOutDistance == -1) {
|
|
||||||
getServerData().jobs[i].locations[j].blip.netFlags.distanceStreaming = false;
|
|
||||||
} else {
|
|
||||||
setElementStreamInDistance(getServerData().jobs[i].locations[j].blip, getGlobalConfig().jobBlipStreamInDistance);
|
|
||||||
setElementStreamOutDistance(getServerData().jobs[i].locations[j].blip, getGlobalConfig().jobBlipStreamOutDistance);
|
|
||||||
}
|
|
||||||
|
|
||||||
//addToWorld(getServerData().jobs[i].locations[j].blip);
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Job] Job '${getServerData().jobs[i].name}' location blip ${j} spawned!`);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Job] All job location blips spawned!`);
|
logToConsole(LOG_DEBUG, `[VRR.Job] All job location blips spawned!`);
|
||||||
@@ -936,6 +927,7 @@ function quitJob(client) {
|
|||||||
stopWorking(client);
|
stopWorking(client);
|
||||||
getPlayerCurrentSubAccount(client).job = 0;
|
getPlayerCurrentSubAccount(client).job = 0;
|
||||||
sendPlayerJobType(client, 0);
|
sendPlayerJobType(client, 0);
|
||||||
|
updateJobBlipsForPlayer(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -943,6 +935,7 @@ function quitJob(client) {
|
|||||||
function takeJob(client, jobId) {
|
function takeJob(client, jobId) {
|
||||||
getPlayerCurrentSubAccount(client).job = getJobData(jobId).databaseId;
|
getPlayerCurrentSubAccount(client).job = getJobData(jobId).databaseId;
|
||||||
sendPlayerJobType(client, getJobData(jobId).databaseId);
|
sendPlayerJobType(client, getJobData(jobId).databaseId);
|
||||||
|
updateJobBlipsForPlayer(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -2426,24 +2419,46 @@ function createJobLocationBlip(jobId, locationId) {
|
|||||||
|
|
||||||
let tempJobData = getJobData(jobId);
|
let tempJobData = getJobData(jobId);
|
||||||
|
|
||||||
if(getJobData(jobId).blipModel != -1) {
|
if(getJobData(jobId).blipModel == -1) {
|
||||||
let blipModelId = getGameConfig().blipSprites[getGame()].Job;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if(getJobData(jobId).blipModel != 0) {
|
let blipModelId = getGameConfig().blipSprites[getGame()].Job;
|
||||||
blipModelId = getJobData(jobId).blipModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(areServerElementsSupported()) {
|
if(getJobData(jobId).blipModel != 0) {
|
||||||
let blip = createGameBlip(tempJobData.locations[locationId].position, blipModelId, getColourByType("jobYellow"));
|
blipModelId = getJobData(jobId).blipModel;
|
||||||
if(blip != false) {
|
}
|
||||||
tempJobData.locations[locationId].blip = blip;
|
|
||||||
|
if(areServerElementsSupported()) {
|
||||||
|
let blip = createGameBlip(tempJobData.locations[locationId].position, blipModelId, 1, getColourByName("yellow"));
|
||||||
|
if(blip != false) {
|
||||||
|
tempJobData.locations[locationId].blip = blip;
|
||||||
|
|
||||||
|
if(getGlobalConfig().jobBlipStreamInDistance == -1 || getGlobalConfig().jobBlipStreamOutDistance == -1) {
|
||||||
|
blip.netFlags.distanceStreaming = false;
|
||||||
|
} else {
|
||||||
|
setElementStreamInDistance(getServerData().jobs[i].locations[j].blip, getGlobalConfig().jobBlipStreamInDistance);
|
||||||
|
setElementStreamOutDistance(getServerData().jobs[i].locations[j].blip, getGlobalConfig().jobBlipStreamOutDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
setElementOnAllDimensions(blip, false);
|
setElementOnAllDimensions(blip, false);
|
||||||
setElementDimension(blip, tempJobData.locations[locationId].dimension);
|
setElementDimension(blip, tempJobData.locations[locationId].dimension);
|
||||||
addToWorld(blip);
|
|
||||||
} else {
|
let clients = getClients();
|
||||||
sendJobToPlayer(null, jobId, tempJobData.name, tempJobData.locations[locationId].position, blipModelId);
|
for(let i in clients) {
|
||||||
|
if(getPlayerJob(client) == false) {
|
||||||
|
showElementForPlayer(blip, clients[i]);
|
||||||
|
} else {
|
||||||
|
if(getPlayerJob(clients[i]) == getServerData().jobs[i].databaseId) {
|
||||||
|
showElementForPlayer(blip, clients[i]);
|
||||||
|
} else {
|
||||||
|
hideElementForPlayer(blip, clients[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
sendJobToPlayer(null, jobId, tempJobData.name, tempJobData.locations[locationId].position, blipModelId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3079,4 +3094,18 @@ function replaceJobRouteStringsInMessage(messageText, jobId, jobRouteId) {
|
|||||||
return messageText;
|
return messageText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
|
function updateJobBlipsForPlayer(client) {
|
||||||
|
for(let i in getServerData().jobs) {
|
||||||
|
for(let j in getServerData().jobs[i].locations) {
|
||||||
|
if(getPlayerJob(client) == 0 || getPlayerJob(client) == i) {
|
||||||
|
showElementForPlayer(getServerData().jobs[i].locations[j].blip, client);
|
||||||
|
} else {
|
||||||
|
hideElementForPlayer(getServerData().jobs[i].locations[j].blip, client);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
Reference in New Issue
Block a user