Skip to content

ESX.Game.GetPedMugshot

1
local mugshot, mugshotStr = ESX.Game.GetPedMugshot(ped)

This function generates a Mugshot of the current player usable in various applications.

ESX.Game.GetPedMugshot Example

Warning

Be sure to use UnregisterPedheadshot(mugshot) after using it, because the game only allows you 34 mugshots, and you won't be allowed to use mugshot once this limit is reached if you don't unregister it.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
ESX = nil

Citizen.CreateThread(function()

  while ESX == nil do

    TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)

    Citizen.Wait(0)

  end

  while true do

    Citizen.Wait(10)

    if IsControlJustReleased(0, 22) then -- Spacebar Key

      notification('Hello')

    end

  end

end)

function notification(msg)

  local mugshot, mugshotStr = ESX.Game.GetPedMugshot(GetPlayerPed(-1))

  ESX.ShowAdvancedNotification('Test', 'Testing!', msg, mugshotStr, 1)

  UnregisterPedheadshot(mugshot)

end
Result

Mugshot Example

ESX.ShowAdvancedNotification