Davidchecker Posted August 24, 2020 Share Posted August 24, 2020 I want to create a zone on the map. Like this https://i.imgur.com/CCMpX8h.png This zone should be fixed and in color. How do the settings for this look like and how do I determine the size? How do I determine the xy coordinates for each corner? I use javascript function blipsss() { let policeBlip = mp.blips.new(5, new mp.Vector3(427.95, -981.05, 0), { name: 'Los Santos Police Station', color: 3, shortRange: true, }); policeBlip.scale = 2; } blipsss(); Link to comment Share on other sites More sharing options...
brosiden Posted August 24, 2020 Share Posted August 24, 2020 This is part of the code I use to create this types of zones. Client-side: mp.events.add('war_showZones', (obj) => { obj = JSON.parse(obj); let color = factionColors(obj.factOwnId); /*let turfblip = mp.blips.new(5, new mp.Vector3(obj.pos.x, obj.pos.y), { name: obj.turfName, color: color, alpha: 70, sprite: 5, radius: 5 });*/ let turfBlip = mp.game.ui.addBlipForRadius(obj.pos.x, obj.pos.y, 1, 50); natives.SET_BLIP_SPRITE(turfBlip, 5); natives.SET_BLIP_ALPHA(turfBlip, 70); natives.SET_BLIP_COLOUR(turfBlip, color); natives.SET_BLIP_ROTATION(turfBlip, obj.rotation); obj.colShape = mp.colshapes.newSphere(obj.pos.x, obj.pos.y, obj.pos.z, 50, 0); }); var natives = {}; mp.game.graphics.clearDrawOrigin = () => mp.game.invoke('0xFF0B610F6BE0D7AF'); // 26.07.2018 // GTA 1.44 natives.START_PLAYER_TELEPORT = (player, x, y, z, heading, p5, p6, p7) => mp.game.invoke("0xAD15F075A4DA0FDE", player, x, y, z, heading, p5, p6, p7); natives.CHANGE_PLAYER_PED = (ped,p1,p2) => mp.game.invoke("0x048189FAC643DEEE", ped,p1,p2); natives.SET_PED_CURRENT_WEAPON_VISIBLE = (ped, visible, deselectWeapon, p3, p4) => mp.game.invoke("0x0725A4CCFDED9A70", ped, visible, deselectWeapon, p3, p4); natives.SET_BLIP_SPRITE = (blip, sprite) => mp.game.invoke("0xDF735600A4696DAF", blip, sprite); // SET_BLIP_SPRITE natives.SET_BLIP_ALPHA = (blip, a) => mp.game.invoke("0x45FF974EEE1C8734", blip, a); // SET_BLIP_ALPHA natives.SET_BLIP_COLOUR = (blip, c) => mp.game.invoke("0x03D7FB09E75D6B7E", blip, c); // SET_BLIP_COLOUR natives.SET_BLIP_ROTATION = (blip, r) => mp.game.invoke("0xF87683CDF73C3F6E", blip, r); // SET_BLIP_ROTATION natives.SET_BLIP_FLASHES = (blip, f) => mp.game.invoke("0xB14552383D39CE3E", blip, f); // SET_BLIP_FLASHES natives.SET_BLIP_FLASH_TIMER = (blip, t) => mp.game.invoke("0xD3CD6FD297AE87CC", blip, t); // SET_BLIP_FLASH_TIMER natives.SET_BLIP_COORDS = (blip, x, y, z) => mp.game.invoke("0xAE2AF67E9D9AF65D", blip, x, y, z); // SET_BLIP_COORDS natives.SET_CURSOR_LOCATION = (x, y) => mp.game.invoke("0xFC695459D4D0E219", x, y); // SET_CURSOR_LOCATION natives.SET_THIS_SCRIPT_CAN_REMOVE_BLIPS_CREATED_BY_ANY_SCRIPT = (toggle) => mp.game.invoke("0xB98236CAAECEF897", toggle); // SET_THIS_SCRIPT_CAN_REMOVE_BLIPS_CREATED_BY_ANY_SCRIPT natives.GET_FIRST_BLIP_INFO_ID = (i) => mp.game.invoke("0x1BEDE233E6CD2A1F", i); // GET_FIRST_BLIP_INFO_ID natives.GET_NEXT_BLIP_INFO_ID = (i) => mp.game.invoke("0x14F96AA50D6FBEA7", i); // GET_NEXT_BLIP_INFO_ID natives.DOES_BLIP_EXIST = (blip) => mp.game.invoke("0xA6DB27D19ECBB7DA", blip); // DOES_BLIP_EXIST natives.GET_NUMBER_OF_ACTIVE_BLIPS = () => mp.game.invoke("0x9A3FF3DE163034E8"); // GET_NUMBER_OF_ACTIVE_BLIPS natives.SET_BLIP_SCALE = (blip,scale) => mp.game.invoke("0xD38744167B2FA257",blip,scale); // SET_BLIP_SCALE natives.SET_ENTITY_NO_COLLISION_ENTITY = (entity1, entity2, collision) => mp.game.invoke("0xA53ED5520C07654A", entity1.handle, entity2.handle, collision); // SET_ENTITY_NO_COLLISION_ENTITY function clearBlips() { natives.SET_THIS_SCRIPT_CAN_REMOVE_BLIPS_CREATED_BY_ANY_SCRIPT(true) let last_blip = natives.GET_FIRST_BLIP_INFO_ID(5) while (natives.DOES_BLIP_EXIST(last_blip)) { mp.game.ui.removeBlip(last_blip) last_blip = natives.GET_NEXT_BLIP_INFO_ID(5) } mp.game.wait(50) } mp.events.add('removeTurfs', (player) => { clearBlips(); }); Server-Side: mp.events.addCommand("createturf", (player, fullText, name, factionid) => { if(player.info.admin < 1337) return player.pushError(`You are not authorized to use that command.`); if(factionid == undefined || name == undefined) return player.pushExample(`/createturf [name] [faction id]`); let turf = { turfName: name, pos: player.position, factOwnId: factionid, rotation: player.heading }; //let ln = Turfs.length; player.call('war_showZones', [JSON.stringify(turf)]); mp.events.call('createTurf', [JSON.stringify(turf)]); player.pushChat(`Turf added.`); player.sendMessageToAdmins(`[Staff] ${player.name} created a turf (ID: ${Turfs.length}).`, null, 'admin-message'); }); You have to create your own sql saving method but I guess you already know how to do that. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now