const Natives = { SET_BLIP_CATEGORY: RageEnums.Natives.Ui.SET_BLIP_CATEGORY, SHOW_HEADING_INDICATOR_ON_BLIP: RageEnums.Natives.Ui.SHOW_HEADING_INDICATOR_ON_BLIP, SET_BLIP_AS_SHORT_RANGE: RageEnums.Natives.Ui.SET_BLIP_AS_SHORT_RANGE, SET_BLIP_DISPLAY: RageEnums.Natives.Ui.SET_BLIP_DISPLAY }; export default function playerBlips() { var playerBlipMap: Map; var ready = false; setInterval(() => { if (!ready) return; if (!playerBlipMap) playerBlipMap = new Map(); mp.players.forEachInStreamRange( (player) => { if (mp.players.local == player) return; if (!playerBlipMap.has(player)) { let pBlip = mp.blips.new(1, player.position, { shortRange: true, dimension: mp.players.local.dimension, drawDistance: 300 }); pBlip.setCategory(7); pBlip.setDisplay(8); playerBlipMap.set(player, pBlip); } let pBlip = playerBlipMap.get(player); let color = player.getVariable("blipColor"); pBlip.setColour(isNaN(color) ? 0 : color); pBlip.setPosition(player.position.x, player.position.y, player.position.z); //pBlip.setRotation(player.heading); }); }, 50); mp.events.add("playerReady", () => { ready = true; }); mp.events.add("entityStreamOut", (entity) => { if (playerBlipMap && entity.type === "player") { if (playerBlipMap.has(entity)) { var pBlip = playerBlipMap.get(entity); pBlip.destroy(); playerBlipMap.delete(entity); } } }); /* mp.events.add("entityStreamIn", async (entity) => { await mp.game.waitAsync(100); if (entity.type === "player") { let color = parseInt(entity.getVariable("blipColor")); if (entity.blip == 0) entity.createBlip(1); entity.setBlipColor(isNaN(color) ? 0 : color); mp.game.invoke(Natives.SET_BLIP_CATEGORY, entity.blip, 7); mp.game.invoke(Natives.SHOW_HEADING_INDICATOR_ON_BLIP, entity.blip, true); mp.game.invoke(Natives.SET_BLIP_AS_SHORT_RANGE, entity.blip, true); mp.game.invoke(Natives.SET_BLIP_DISPLAY, entity.blip, 8); } }); */ mp.events.addDataHandler("blipColor", (entity, value) => { if (entity.type === "player") { let color = parseInt(value); entity.setBlipColor(isNaN(color) ? 0 : color); } }); }