Hello all ,
i have some custom peds ( player models ) on my server , mostly for police , ambulance ,etc .
Now i want when u go on duty with Police or Ambulance that u spawn as the custom player model instead of taking the cloths only.
because it will take the normal police clothes instead of the new custom models .
only for swat it Will take the custom player model …
I am using ESX_Policejob , and after reading in the codes i found this in client/main.lua :
--Taken from SuperCoolNinja
if data.current.value == 'citizen_wear' then
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
local model = nil
if skin.sex == 0 then
model = GetHashKey("mp_m_freemode_01")
else
model = GetHashKey("mp_f_freemode_01")
end
RequestModel(model)
while not HasModelLoaded(model) do
RequestModel(model)
Citizen.Wait(1)
end
SetPlayerModel(PlayerId(), model)
SetModelAsNoLongerNeeded(model)
TriggerEvent('skinchanger:loadSkin', skin)
TriggerEvent('esx:restoreLoadout')
end)
end
if data.current.value == 'police_wear' then
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
if skin.sex == 0 then
TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_male)
else
TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_female)
end
end)
end
if data.current.value == 'veste_wear' then
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function()
SetPedComponentVariation(GetPlayerPed(-1), 9, 10, 1, 2)--Gilet
local playerPed = GetPlayerPed(-1)
SetPedArmour(playerPed, 100)
ClearPedBloodDamage(playerPed)
ResetPedVisibleDamage(playerPed)
ClearPedLastWeaponDamage(playerPed)
end)
end
if data.current.value == 'veste_wear' then
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function()
SetPedComponentVariation(GetPlayerPed(-1), 9, 10, 1, 2)--Gilet
end)
end
if data.current.value == 'gilet_wear' then
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function()
SetPedComponentVariation(GetPlayerPed(-1), 9, 14, 1, 2)--Sans Gilet
local playerPed = GetPlayerPed(-1)
SetPedArmour(playerPed, 0)
ClearPedBloodDamage(playerPed)
ResetPedVisibleDamage(playerPed)
ClearPedLastWeaponDamage(playerPed)
end)
end
if data.current.value == 'sheriff_wear' then
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
if skin.sex == 0 then
local model = GetHashKey("s_m_y_sheriff_01")
RequestModel(model)
while not HasModelLoaded(model) do
RequestModel(model)
Citizen.Wait(0)
end
SetPlayerModel(PlayerId(), model)
SetModelAsNoLongerNeeded(model)
else
local model = GetHashKey("s_f_y_sheriff_01")
RequestModel(model)
while not HasModelLoaded(model) do
RequestModel(model)
Citizen.Wait(0)
end
SetPlayerModel(PlayerId(), model)
SetModelAsNoLongerNeeded(model)
end
end)
end
if data.current.value == 'lieutenant_wear' then
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
if skin.sex == 0 then
local model = GetHashKey("s_m_y_swat_01")
RequestModel(model)
while not HasModelLoaded(model) do
RequestModel(model)
Citizen.Wait(0)
end
SetPlayerModel(PlayerId(), model)
SetModelAsNoLongerNeeded(model)
else
local model = GetHashKey("s_m_y_swat_01")
RequestModel(model)
while not HasModelLoaded(model) do
RequestModel(model)
Citizen.Wait(0)
end
SetPlayerModel(PlayerId(), model)
SetModelAsNoLongerNeeded(model)
end
end)
end
if data.current.value == 'commandant_wear' then
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
if skin.sex == 0 then
local model = GetHashKey("s_m_y_swat_01")
RequestModel(model)
while not HasModelLoaded(model) do
RequestModel(model)
Citizen.Wait(0)
end
SetPlayerModel(PlayerId(), model)
SetModelAsNoLongerNeeded(model)
else
local model = GetHashKey("s_m_y_swat_01")
RequestModel(model)
while not HasModelLoaded(model) do
RequestModel(model)
Citizen.Wait(0)
end
SetPlayerModel(PlayerId(), model)
SetModelAsNoLongerNeeded(model)
end
end)
end
CurrentAction = 'menu_cloakroom'
CurrentActionMsg = _U('open_cloackroom')
CurrentActionData = {}
end,
function(data, menu)
menu.close()
CurrentAction = 'menu_cloakroom'
CurrentActionMsg = _U('open_cloackroom')
CurrentActionData = {}
end
)
end
Is it possible to change these codes so u will spawn as the model instead of your personal skin ?,
i appreciate the help