Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local pedPool = {}
- local searchRadius = 120.0
- local enabled = false
- local limitScene = 0
- local GAME_NAME = GetGameName()
- local IS_GTA5 = GAME_NAME == "fivem"
- local IS_RDR3 = GAME_NAME == "redm"
- local GAME_COLORS = {
- fivem = {
- green = '~g~',
- red = '~r~',
- blue = '~b~',
- white = '~w~',
- },
- redm = {
- green = '~t6~',
- red = '~e~',
- blue = '~d~',
- white = '~q~',
- }
- }
- local function GetColourCode(color)
- return GAME_COLORS[GAME_NAME][color]
- end
- local function DrawInfoScreen(entity, text, pos, scale)
- if not IsSphereVisible(pos, 1.0) then
- return
- end
- if IS_GTA5 then
- local retval, screenX, screenY = GetScreenCoordFromWorldCoord(pos.x, pos.y, pos.z)
- if not retval then
- return
- end
- SetTextScale(scale, scale)
- SetTextCentre(true)
- SetTextDropshadow(3, 0, 0, 0, 200)
- SetTextColour(255, 255, 255, 220)
- local entry = "ENTOWNER_" .. entity
- AddTextEntry(entry, text)
- BeginTextCommandDisplayText(entry)
- EndTextCommandDisplayText(screenX, screenY)
- end
- if IS_RDR3 then
- local retval, screenX, screenY = Citizen.InvokeNative(
- 0xCB50D7AFCC8B0EC6,
- pos.x, pos.y, pos.z,
- Citizen.PointerValueFloat(),
- Citizen.PointerValueFloat(),
- Citizen.ReturnResultAnyway()
- )
- if not retval then
- return
- end
- SetTextScale(scale, scale)
- SetTextCentre(true)
- SetTextDropshadow(3, 0, 0, 0, 200)
- SetTextColor(255, 255, 255, 220)
- SetTextFontForCurrentCommand(1)
- DisplayText(CreateVarString(10, 'LITERAL_STRING', text), screenX, screenY)
- end
- end
- local function DrawInfoOrigin(text, pos, scale)
- if not IsSphereVisible(pos, 1.0) then
- return
- end
- if limitScene >= 10 then
- return
- end
- SetTextScale(scale, scale)
- SetTextCentre(true)
- SetTextDropshadow(3, 0, 0, 0, 200)
- SetTextColor(255, 255, 255, 220)
- SetTextFontForCurrentCommand(1)
- Citizen.InvokeNative(GetHashKey("SET_DRAW_ORIGIN") & 0xFFFFFFFF, pos.x, pos.y, pos.z, 0)
- DisplayText(CreateVarString(10, 'LITERAL_STRING', text), 0.0, 0.0)
- Citizen.InvokeNative(GetHashKey("CLEAR_DRAW_ORIGIN") & 0xFFFFFFFF, 0)
- limitScene = limitScene + 1
- end
- Citizen.CreateThread(function()
- while true do
- Wait(1)
- if enabled then
- pedPool = GetGamePool('CPed')
- Wait(1000)
- end
- end
- end)
- Citizen.CreateThread(function()
- local localId = PlayerId()
- while true do
- Wait(1)
- if enabled then
- limitScene = 0
- local localPos = GetEntityCoords(PlayerPedId())
- for _, entity in ipairs(pedPool) do
- if DoesEntityExist(entity) then
- local networked = NetworkGetEntityIsNetworked(entity)
- local owner = (not networked) and localId or Citizen.InvokeNative(GetHashKey('NETWORK_GET_ENTITY_OWNER') & 0xFFFFFFFF, entity)
- local name = GetPlayerName(owner)
- local position = GetEntityCoords(entity)
- local color = (not networked) and GetColourCode('white') or (owner == localId) and GetColourCode('green') or GetColourCode('red')
- local netId = (not networked) and entity or PedToNet(entity)
- local label = 'ped ~u~'.. netId ..'~q~ | '.. color .. name
- position = (IsPedInAnyVehicle(entity, true) or IsPedOnMount(entity)) and position + vector3(0.0, 0.0, 1.0) or position
- local scale = math.max(math.min((1 - (#(localPos - position) / 100.0)) * 0.35, 0.7), 0.0)
- DrawInfoScreen(entity, label, position, scale)
- end
- end
- end
- end
- end)
- RegisterCommand('entityOwner', function()
- enabled = not enabled
- print('Entity owner is ' .. (enabled and 'enabled' or 'disabled'))
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement