Fix admins & GPS cmds, fix AFK state
This commit is contained in:
@@ -308,11 +308,8 @@ function getPlayerInfoCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function playerChangeAFKState(client, afkState) {
|
function playerChangeAFKState(client, afkState) {
|
||||||
if(afkState) {
|
getPlayerData(client).afk = afkState;
|
||||||
setEntityData(client, "vrr.afk", true, true);
|
updateAllPlayerNameTags();
|
||||||
} else {
|
|
||||||
client.removeData("vrr.afk");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -365,17 +362,19 @@ function updateServerGameTime() {
|
|||||||
|
|
||||||
function listOnlineAdminsCommand(command, params, client) {
|
function listOnlineAdminsCommand(command, params, client) {
|
||||||
//== Admins ===================================
|
//== Admins ===================================
|
||||||
messagePlayerNormal(client, `{clanOrange}== {jobYellow}Admins {clanOrange}===================================`);
|
messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderAdminsList")));
|
||||||
|
|
||||||
let admins = [];
|
let admins = [];
|
||||||
let clients = getClients();
|
let clients = getClients();
|
||||||
for(let i in clients) {
|
for(let i in clients) {
|
||||||
if(getPlayerData(clients[i])) {
|
if(getPlayerData(clients[i])) {
|
||||||
if(getPlayerData(clients[i]).accountData.flags.admin != 0) {
|
if(typeof getPlayerData(clients[i]).accountData.flags.admin != "undefined") {
|
||||||
|
if(getPlayerData(clients[i]).accountData.flags.admin > 0 || getPlayerData(clients[i]).accountData.flags.admin == -1) {
|
||||||
admins.push(`{ALTCOLOUR}[${getPlayerData(clients[i]).accountData.staffTitle}] {MAINCOLOUR}${getCharacterFullName(clients[i])}`);
|
admins.push(`{ALTCOLOUR}[${getPlayerData(clients[i]).accountData.staffTitle}] {MAINCOLOUR}${getCharacterFullName(clients[i])}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let chunkedList = splitArrayIntoChunks(admins, 3);
|
let chunkedList = splitArrayIntoChunks(admins, 3);
|
||||||
for(let i in chunkedList) {
|
for(let i in chunkedList) {
|
||||||
@@ -386,14 +385,34 @@ function listOnlineAdminsCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function gpsCommand(command, params, client) {
|
function gpsCommand(command, params, client) {
|
||||||
//== Businesses ===================================
|
messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderBusinessList")));
|
||||||
messagePlayerNormal(client, `{clanOrange}== {jobYellow}Businesses {clanOrange}================================`);
|
|
||||||
|
let locationType = VRR_GPS_TYPE_NONE;
|
||||||
|
let useType = VRR_ITEM_USETYPE_NONE;
|
||||||
|
let blipColour = "white";
|
||||||
|
|
||||||
switch(toLowerCase(params)) {
|
switch(toLowerCase(params)) {
|
||||||
|
case "police":
|
||||||
|
blipColour = "businessBlue"
|
||||||
|
locationType = VRR_GPS_TYPE_POLICE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "hospital":
|
||||||
|
blipColour = "businessBlue"
|
||||||
|
locationType = VRR_GPS_TYPE_HOSPITAL;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "job":
|
||||||
|
blipColour = "businessBlue"
|
||||||
|
locationType = VRR_GPS_TYPE_JOB;
|
||||||
|
break;
|
||||||
|
|
||||||
case "skin":
|
case "skin":
|
||||||
case "skins":
|
case "skins":
|
||||||
case "clothes":
|
case "clothes":
|
||||||
case "player":
|
case "player":
|
||||||
|
blipColour = "businessBlue"
|
||||||
|
locationType = VRR_GPS_TYPE_BUSINESS;
|
||||||
useType = VRR_ITEM_USETYPE_SKIN;
|
useType = VRR_ITEM_USETYPE_SKIN;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -403,21 +422,29 @@ function gpsCommand(command, params, client) {
|
|||||||
case "weapons":
|
case "weapons":
|
||||||
case "wep":
|
case "wep":
|
||||||
case "weps":
|
case "weps":
|
||||||
|
blipColour = "businessBlue"
|
||||||
|
locationType = VRR_GPS_TYPE_BUSINESS;
|
||||||
useType = VRR_ITEM_USETYPE_WEAPON;
|
useType = VRR_ITEM_USETYPE_WEAPON;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "food":
|
case "food":
|
||||||
case "eat":
|
case "eat":
|
||||||
|
blipColour = "businessBlue"
|
||||||
|
locationType = VRR_GPS_TYPE_BUSINESS;
|
||||||
useType = VRR_ITEM_USETYPE_FOOD;
|
useType = VRR_ITEM_USETYPE_FOOD;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "drink":
|
case "drink":
|
||||||
|
blipColour = "businessBlue"
|
||||||
|
locationType = VRR_GPS_TYPE_BUSINESS;
|
||||||
useType = VRR_ITEM_USETYPE_DRINK;
|
useType = VRR_ITEM_USETYPE_DRINK;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "alcohol":
|
case "alcohol":
|
||||||
case "booze":
|
case "booze":
|
||||||
case "bar":
|
case "bar":
|
||||||
|
blipColour = "businessBlue"
|
||||||
|
locationType = VRR_GPS_TYPE_BUSINESS;
|
||||||
useType = VRR_ITEM_USETYPE_ALCOHOL;
|
useType = VRR_ITEM_USETYPE_ALCOHOL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -426,6 +453,8 @@ function gpsCommand(command, params, client) {
|
|||||||
case "vehrepair":
|
case "vehrepair":
|
||||||
case "spray":
|
case "spray":
|
||||||
case "fix":
|
case "fix":
|
||||||
|
blipColour = "businessBlue"
|
||||||
|
locationType = VRR_GPS_TYPE_BUSINESS;
|
||||||
useType = VRR_ITEM_USETYPE_VEHREPAIR;
|
useType = VRR_ITEM_USETYPE_VEHREPAIR;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -433,10 +462,14 @@ function gpsCommand(command, params, client) {
|
|||||||
case "vehcolour":
|
case "vehcolour":
|
||||||
case "carcolour":
|
case "carcolour":
|
||||||
case "colour":
|
case "colour":
|
||||||
|
blipColour = "businessBlue"
|
||||||
|
locationType = VRR_GPS_TYPE_BUSINESS;
|
||||||
useType = VRR_ITEM_USETYPE_VEHCOLOUR;
|
useType = VRR_ITEM_USETYPE_VEHCOLOUR;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
|
locationType = VRR_GPS_TYPE_BUSINESS;
|
||||||
|
blipColour = "businessBlue";
|
||||||
let itemTypeId = getItemTypeFromParams(params);
|
let itemTypeId = getItemTypeFromParams(params);
|
||||||
if(getItemTypeData(itemTypeId)) {
|
if(getItemTypeData(itemTypeId)) {
|
||||||
useType = getItemTypeData(itemTypeId).useType;
|
useType = getItemTypeData(itemTypeId).useType;
|
||||||
@@ -444,6 +477,12 @@ function gpsCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(locationType == VRR_GPS_TYPE_NONE) {
|
||||||
|
messagePlayerError(client, getLocaleString(client, "InvalidGPSLocation"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(locationType == VRR_GPS_TYPE_BUSINESS) {
|
||||||
let businessId = getClosestBusinessWithBuyableItemOfUseType(useType);
|
let businessId = getClosestBusinessWithBuyableItemOfUseType(useType);
|
||||||
if(!businessId) {
|
if(!businessId) {
|
||||||
messagePlayerError(client, getLocaleString(client, "NoBusinessWithItemType"));
|
messagePlayerError(client, getLocaleString(client, "NoBusinessWithItemType"));
|
||||||
@@ -455,5 +494,6 @@ function gpsCommand(command, params, client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
blinkGenericGPSBlipForPlayer(client, getColourByType("businessBlue"), 10);
|
blinkGenericGPSBlipForPlayer(client, getColourByType(blipColour), 10);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user