I’ve finally got my script working, only thing I need it to do is rotate the blip when the player rotates, also I cant get the name on the pause menu map to show the numberplate of the vehicle the player is currently in. I got the blip name to show the player’s name or a string. Is there any thing I could do to make it more efficient? I seem to crash a lot with it enabled… Thanks for any help.
Code:
function GetPlayers()
local players = {}
for i = 0, 31 do
if NetworkIsPlayerActive(i) then
table.insert(players, i)
end
end
return players
end
Citizen.CreateThread(function()
local blips = {}
local currentPlayer = PlayerId()
while true do
Wait(100)
local players = GetPlayers()
for player = 0, 64 do
if player ~= currentPlayer and NetworkIsPlayerActive(player) then
local playerPed = GetPlayerPed(player)
local playerName = GetPlayerName(player)
local veh = GetVehiclePedIsIn(ped, false)
RemoveBlip(blips[player])
local new_blip = AddBlipForEntity(playerPed)
SetBlipNameToPlayerName(new_blip, player)
SetBlipSprite(new_blip, 423)
SetBlipColour(new_blip, 0)
BeginTextCommandSetBlipName("string")
AddTextComponentSubstringPlayerName("NUMBERPLATE")
EndTextCommandSetBlipName(new_blip)
ShowHeadingIndicatorOnBlip(new_blip, true)
SetBlipRotation(new_blip, math.ceil( GetEntityHeading(ped)))
SetBlipScale(new_blip, 0.9)
SetBlipDisplay(new_blip, 2)
CreateFakeMpGamerTag(playerPed, playerName.." - "..GetVehicleNumberPlateText(veh), false, false, '', false)
blips[player] = new_blip
end
end
end
end)