diff --git a/ReallifeGamemode.Client/Gui/blips.ts b/ReallifeGamemode.Client/Gui/blips.ts new file mode 100644 index 00000000..ce684bb4 --- /dev/null +++ b/ReallifeGamemode.Client/Gui/blips.ts @@ -0,0 +1,26 @@ +const Natives = { + SET_BLIP_CATEGORY: "0x234CDD44D996FD9A", + SHOW_HEADING_INDICATOR_ON_BLIP: "0x5FBCA48327B914DF", + SET_BLIP_AS_SHORT_RANGE: "0xBE8BE4FE60E27B72" +}; + +export default function playerBlips() { + mp.events.add("entityStreamIn", (entity) => { + 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.events.addDataHandler("blipColor", (entity, value) => { + if (entity.type === "player") { + let color = parseInt(value); + entity.setBlipColor(isNaN(color) ? 0 : color); + } + }); +} \ No newline at end of file diff --git a/ReallifeGamemode.Client/index.ts b/ReallifeGamemode.Client/index.ts index 6cf88738..937805b8 100644 --- a/ReallifeGamemode.Client/index.ts +++ b/ReallifeGamemode.Client/index.ts @@ -25,6 +25,9 @@ var inMenu = false; mp.game.vehicle.defaultEngineBehaviour = false; +import playerBlips from './Gui/blips'; +playerBlips(); + import jobMain from './Jobs/main'; jobMain(globalData);