Add player blips
This commit is contained in:
@@ -118,6 +118,7 @@ class ServerConfigData {
|
||||
this.createJobBlips = intToBool(toInteger(dbAssoc["svr_job_blips"]));
|
||||
this.createBusinessBlips = intToBool(toInteger(dbAssoc["svr_biz_blips"]));
|
||||
this.createHouseBlips = intToBool(toInteger(dbAssoc["svr_house_blips"]));
|
||||
this.createPlayerBlips = intToBool(toInteger(dbAssoc["svr_player_blips"]));
|
||||
this.guiColourPrimary = [toInteger(dbAssoc["svr_gui_col1_r"]), toInteger(dbAssoc["svr_gui_col1_g"]), toInteger(dbAssoc["svr_gui_col1_b"])];
|
||||
this.guiColourSecondary = [toInteger(dbAssoc["svr_gui_col2_r"]), toInteger(dbAssoc["svr_gui_col2_g"]), toInteger(dbAssoc["svr_gui_col2_b"])];
|
||||
this.guiTextColourPrimary = [toInteger(dbAssoc["svr_gui_textcol1_r"]), toInteger(dbAssoc["svr_gui_textcol1_g"]), toInteger(dbAssoc["svr_gui_textcol1_b"])];
|
||||
|
||||
@@ -839,3 +839,50 @@ function lockCommand(command, params, client) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function resetPlayerBlip(client) {
|
||||
deletePlayerBlip(client);
|
||||
createPlayerBlip(client);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function createPlayerBlip(client) {
|
||||
if (!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isGameFeatureSupported("attachedBlips")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (getServerConfig().createPlayerBlips) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let blip = createAttachedGameBlip(getPlayerPed(client), 0, 1, getPlayerColour(client));
|
||||
if (blip) {
|
||||
if (getGlobalConfig().playerBlipStreamInDistance == -1 || getGlobalConfig().playerBlipStreamOutDistance == -1) {
|
||||
blip.netFlags.distanceStreaming = false;
|
||||
} else {
|
||||
setElementStreamInDistance(blip, getGlobalConfig().playerBlipStreamInDistance);
|
||||
setElementStreamOutDistance(blip, getGlobalConfig().playerBlipStreamOutDistance);
|
||||
}
|
||||
getPlayerData(client).playerBlip = blip;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function deletePlayerBlip(client) {
|
||||
if (!isGameFeatureSupported("attachedBlips")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (getPlayerData(client).playerBlip != false) {
|
||||
destroyElement(getPlayerData(client).playerBlip);
|
||||
getPlayerData(client).playerBlip = false;
|
||||
}
|
||||
}
|
||||
@@ -1375,3 +1375,11 @@ function setElementShownByDefault(element, state) {
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function createAttachedGameBlip(element, type, size, colour = toColour(255, 255, 255, 255)) {
|
||||
if (isGameFeatureSupported("attachedBlips")) {
|
||||
return game.createBlipAttachedTo(element, type, size, colour, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
Reference in New Issue
Block a user