As the tittle says
Thanks
As the tittle says
Thanks
Anyone know?
20Characters
Yeah learn Lua. https://wiki.fivem.net/wiki/Main_Page
Use this as a reference - [Release] Disable Player Blips & Overhead Names
im asking like what natives cause thats what i cant figure out
Like how do i hide it and show it at the same time
Look, into that script, I’m sure there is an easier way. Look around the forums for other scripts.
Depends on what permission you use, if is steamid, modelskin, esx or vrp.
local blips = {
-- Example {title="", colour=, id=, x=, y=, z=},
{title="name", colour=29, blip=60, x=1853.1070556641, y=3687.4230957031, z=34.267078399658},
}
Citizen.CreateThread(function()
if Player == ? then
for _, info in pairs(blips) do
info.blip = AddBlipForCoord(info.x, info.y, info.z)
SetBlipSprite(info.blip, info.id)
SetBlipDisplay(info.blip, 4)
SetBlipScale(info.blip, 0.9)
SetBlipColour(info.blip, info.colour)
SetBlipAsShortRange(info.blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString(info.title)
EndTextCommandSetBlipName(info.blip)
end
end
end)
Change this to your permissions
if Player == ? then
yeah im using esx and im trying to make it so cops can see eachother
thanks
This in the top of the client
ESX = nil
local PlayerData = {}
Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
Citizen.Wait(0)
end
end)
RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(xPlayer)
PlayerData = xPlayer
end)
RegisterNetEvent('esx:setJob')
AddEventHandler('esx:setJob', function(job)
PlayerData.job = job
end)
Change
if Player == ? then
to
if PlayerData.job.name == 'police'
and just change the add blip to add it to the player right?
local blipspolice = {
-- Example {title="", colour=, id=, x=, y=, z=},
{title="name", colour=29, blip=60, x=1853.1070556641, y=3687.4230957031, z=34.267078399658},
}
local blipsambulance = {
-- Example {title="", colour=, id=, x=, y=, z=},
{title="name", colour=29, blip=60, x=1853.1070556641, y=3687.4230957031, z=34.267078399658},
}
Citizen.CreateThread(function()
if PlayerData.job.name == 'police' then
for _, info in pairs(blipspolice) do
info.blip = AddBlipForCoord(info.x, info.y, info.z)
SetBlipSprite(info.blip, info.id)
SetBlipDisplay(info.blip, 4)
SetBlipScale(info.blip, 0.9)
SetBlipColour(info.blip, info.colour)
SetBlipAsShortRange(info.blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString(info.title)
EndTextCommandSetBlipName(info.blip)
end
end
if PlayerData.job.name == 'ambulance' then
for _, info in pairs(blipsambulance) do
info.blip = AddBlipForCoord(info.x, info.y, info.z)
SetBlipSprite(info.blip, info.id)
SetBlipDisplay(info.blip, 4)
SetBlipScale(info.blip, 0.9)
SetBlipColour(info.blip, info.colour)
SetBlipAsShortRange(info.blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString(info.title)
EndTextCommandSetBlipName(info.blip)
end
end
end)
well i want it like on the police players not the police station
so other cops can see eachother
Hello, I’am trying to achieve something really similar and was told to move my topic here for help.
I’am having trouble with making some blips invisible to the police job.
The troublesome code for client/main.lua
ESX = nil
local PlayerData = {}
Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
Citizen.Wait(0)
end
end)
RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(xPlayer)
PlayerData = xPlayer
end)
RegisterNetEvent('esx:setJob')
AddEventHandler('esx:setJob', function(job)
PlayerData.job = job
end)
Citizen.CreateThread(function() --Blips
if PlayerData.job.name == "police" then
Citizen.Wait(0)
else
for i=1, #Config.Map, 1 do
local crimblip = AddBlipForCoord(Config.Map[i].x, Config.Map[i].y, Config.Map[i].z)
SetBlipSprite (crimblip, Config.Map[i].id)
SetBlipScale (crimblip, 0.9)
SetBlipDisplay(crimblip, 4)
SetBlipColour (crimblip, Config.Map[i].color)
SetBlipAsShortRange(crimblip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString(Config.Map[i].name)
EndTextCommandSetBlipName(crimblip)
end
end
end)
but nothing happens, nothing is showing for everyone including cops.
This is the config.lua:
Config = {}
Config.Map = {
{name="Yacht",color=15, id=410, x=-2045.800, y=-1031.200, z=11.900},
{name="Coke Picking",color=4, id=501, x=2448.92, y=-1836.80, z=51.95},
{name="Coke Processing",color=4, id=475, x=-458.13, y=-2278.61, z=7.51},
{name="Coke Resell",color=4, id=434, x=-1756.19, y=427.31, z=126.68},
{name="Meth Pickup",color=4, id=501, x=1525.29, y=1710.02, z=109.01},
{name="Meth Processing",color=4, id=499, x=-1001.41, y=4848.01, z=274.01},
{name="Meth Resell",color=4, id=434, x=-63.59, y=-1224.07, z=27.77},
{name="Weed Picking",color=2, id=496, x=1609.125, y=6663.59, z=20.96},
{name="Weed Processing",color=2, id=514, x=91.06, y=3750.03, z=39.77},
{name="Weed Dropoff",color=2, id=434, x=-54.24, y=-1443.36, z=31.06},
{name="Opium Pickup",color=7, id=501, x=1971.26, y=3823.17, z=32.36},
{name="Opium Processing",color=7, id=514, x=971.86,y=-2157.61, z=28.47},
{name="Opium Dropoff",color=7, id=434, x=2331.08, y=2570.22, z=46.68}
}
Everything works fine as:
Citizen.CreateThread(function()
for i=1, #Config.Map, 1 do
local blip = AddBlipForCoord(Config.Map[i].x, Config.Map[i].y, Config.Map[i].z)
SetBlipSprite (blip, Config.Map[i].id)
SetBlipDisplay(blip, 4)
SetBlipColour (blip, Config.Map[i].color)
SetBlipAsShortRange(blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString(Config.Map[i].name)
EndTextCommandSetBlipName(blip)
end
end)
Topic with stuff I have tried: Original post I made
Anyways,
your help is much appreciated, thanks for your time.
do you know how to have like a hide admin blip?
and i also need help to hide blip on the map so u dont see them tell ur in the job
i use vrp
local PlayerData = {}
ESX = nil
Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
Citizen.Wait(0)
end
while ESX.GetPlayerData().job == nil do
Citizen.Wait(10)
end
PlayerData = ESX.GetPlayerData()
end)
RegisterNetEvent('esx:setJob')
AddEventHandler('esx:setJob', function(job)
PlayerData.job = job
end)
Citizen.CreateThread(function()
for i=1, #Config.Map, 1 do
if PlayerData.job ~= nil and PlayerData.job.name ~= 'police' then
local blip = AddBlipForCoord(Config.Map[i].x, Config.Map[i].y, Config.Map[i].z)
SetBlipSprite (blip, Config.Map[i].id)
SetBlipDisplay(blip, 4)
SetBlipColour (blip, Config.Map[i].color)
SetBlipAsShortRange(blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString(Config.Map[i].name)
EndTextCommandSetBlipName(blip)
end
end
end)
Hello, Did you get it to work? I want to do the same and then when I got it to work I want to change so only mafia can see the black weapon shop. But when I did a test resource for only blip I didn’t get it to work. Have tested everything that is in this thread
Here’s how my client looks:
local Blips = {
{ name="Mafia", color=20, id=78,x=1399.2149658203, y=1145.3737792969, z=140.33},
{ name="The Lost MC", color=20, id=229,x=980.55590820313, y=-98.454368591309, z=73.94},
}
local PlayerData = {}
ESX = nil
Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
Citizen.Wait(0)
end
while ESX.GetPlayerData().job == nil do
Citizen.Wait(10)
end
PlayerData = ESX.GetPlayerData()
end)
RegisterNetEvent('esx:setJob')
AddEventHandler('esx:setJob', function(job)
PlayerData.job = job
end)
Citizen.CreateThread(function()
if PlayerData.job ~= nil and PlayerData.job.name ~= 'mafia' then
for _, item in pairs(Blips) do
item.blip = AddBlipForCoord(item.x, item.y, item.z)
SetBlipSprite(item.blip, item.id)
SetBlipAsShortRange(item.blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString(item.name)
EndTextCommandSetBlipName(item.blip)
end
end
end)
I have also tried this :
local Blips = {
{ name="Mafia", color=20, id=78,x=1399.2149658203, y=1145.3737792969, z=140.33},
{ name="The Lost MC", color=20, id=229,x=980.55590820313, y=-98.454368591309, z=73.94},
}
ESX = nil
local PlayerData = {}
Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
Citizen.Wait(0)
end
end)
RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(xPlayer)
PlayerData = xPlayer
end)
RegisterNetEvent('esx:setJob')
AddEventHandler('esx:setJob', function(job)
PlayerData.job = job
end)
Citizen.CreateThread(function()
if PlayerData.job.name == 'mafia' then
for _, item in pairs(Blips) do
item.blip = AddBlipForCoord(item.x, item.y, item.z)
SetBlipSprite(item.blip, item.id)
SetBlipAsShortRange(item.blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString(item.name)
EndTextCommandSetBlipName(item.blip)
end
end)
Both work if I do not use:
But as soon as I enter that code, the script does not work.
How i make it so if the player was from mafia and then he left the job, how do i hide the blip again.