Fix job uniform and equip cmd to work near job veh

This commit is contained in:
Vortrex
2022-05-03 14:53:09 -05:00
parent 70cd4a0408
commit bc237a5edb

View File

@@ -691,18 +691,18 @@ function jobUniformCommand(command, params, client) {
if(closestJobLocation.position.distance(getPlayerPosition(client)) > getGlobalConfig().startWorkingDistance) { if(closestJobLocation.position.distance(getPlayerPosition(client)) > getGlobalConfig().startWorkingDistance) {
let closestVehicle = getClosestVehicle(getPlayerPosition(client)); let closestVehicle = getClosestVehicle(getPlayerPosition(client));
if(getDistance(getVehiclePosition(closestVehicle), getPlayerPosition(client)) < getGlobalConfig().startWorkingDistance) { if(getDistance(getVehiclePosition(closestVehicle), getPlayerPosition(client)) > getGlobalConfig().startWorkingDistance) {
messagePlayerError(client, "You need to be near your job site or vehicle that belongs to your job!"); messagePlayerError(client, "You need to be near your job site or vehicle that belongs to your job!");
return false; return false;
} }
if(getVehicleData(closestVehicle).ownerType == VRR_VEHOWNER_JOB) { if(getVehicleData(closestVehicle).ownerType != VRR_VEHOWNER_JOB) {
messagePlayerError(client, "This is not a job vehicle!"); messagePlayerError(client, getLocaleString(client, "NotAJobVehicle"));
return false; return false;
} }
if(getPlayerCurrentSubAccount(client).job != getVehicleData(closestVehicle).ownerId) { if(getPlayerCurrentSubAccount(client).job != getVehicleData(closestVehicle).ownerId) {
messagePlayerError(client, getLocaleString(client, "NotYourJob")); messagePlayerError(client, getLocaleString(client, "NotYourJobVehicle"));
return false; return false;
} }
@@ -774,28 +774,28 @@ function jobEquipmentCommand(command, params, client) {
let closestJobLocation = getClosestJobLocation(getPlayerPosition(client)); let closestJobLocation = getClosestJobLocation(getPlayerPosition(client));
let jobData = false; let jobData = false;
if(getDistance(closestJobLocation.position, getPlayerPosition(client)) > getGlobalConfig().startWorkingDistance) { if(closestJobLocation.position.distance(getPlayerPosition(client)) > getGlobalConfig().startWorkingDistance) {
let closestVehicle = getClosestVehicle(getPlayerPosition(client)); let closestVehicle = getClosestVehicle(getPlayerPosition(client));
if(getDistance(getVehiclePosition(closestVehicle), getPlayerPosition(client)) > getGlobalConfig().startWorkingDistance) { if(getDistance(getVehiclePosition(closestVehicle), getPlayerPosition(client)) > getGlobalConfig().startWorkingDistance) {
messagePlayerError(client, "You need to be near your job site or vehicle that belongs to your job!"); messagePlayerError(client, "You need to be near your job site or vehicle that belongs to your job!");
return false; return false;
} }
if(getVehicleData(closestVehicle).ownerType == VRR_VEHOWNER_JOB) { if(getVehicleData(closestVehicle).ownerType != VRR_VEHOWNER_JOB) {
messagePlayerError(client, "This is not a job vehicle!"); messagePlayerError(client, getLocaleString(client, "NotAJobVehicle"));
return false; return false;
} }
if(getPlayerCurrentSubAccount(client).job != getVehicleData(closestVehicle).ownerId) { if(getPlayerCurrentSubAccount(client).job != getVehicleData(closestVehicle).ownerId) {
messagePlayerError(client, "This is not your job vehicle!"); messagePlayerError(client, getLocaleString(client, "NotYourJobVehicle"));
return false; return false;
} }
jobData = getJobData(getJobIdFromDatabaseId(getVehicleData(closestVehicle).ownerId)); jobData = getJobData(getJobIdFromDatabaseId(getVehicleData(closestVehicle).ownerId));
} else { } else {
if(getPlayerCurrentSubAccount(client).job == VRR_JOB_NONE) { if(getPlayerCurrentSubAccount(client).job == VRR_JOB_NONE) {
messagePlayerError(client, "You don't have a job!"); messagePlayerError(client, getLocaleString(client, "NotYourJob"));
messagePlayerInfo(client, "You can get a job by going the yellow points on the map."); messagePlayerInfo(client, getLocaleString(client, "JobPoints"));
return false; return false;
} }