I need help with my code. I don’t know how I can change my ped so that it has the same number of things as I did before the command. When I give the command it has the pedo I want and when I go back it has the good thing but not the right clothes and when I go to the store and change something it has everything as it was before. So somehow I don’t have to load it and change something
code :
currentModel = nil
RegisterCommand("ad2", function(source, args, rawCommand)
if currentModel == nil or currentModel ~= "csb_mp_agent14" then
SetModel("csb_mp_agent14")
currentModel = "csb_mp_agent14"
TriggerEvent("chatMessage", "[Server]", {255, 0, 0}, "Du bist jetzt als csb_mp_agent14.")
else
SetModel("mp_m_freemode_01") -- Setze das Ped auf den Standardspieler zurück
currentModel = nil
TriggerEvent("chatMessage", "[Server]", {255, 0, 0}, "Du bist nicht mehr als csb_mp_agent14.")
end
end, false)
function SetModel(model)
local modelHash = GetHashKey(model)
RequestModel(modelHash)
while not HasModelLoaded(modelHash) do
Wait(500)
end
SetPlayerModel(PlayerId(), modelHash)
SetPedDefaultComponentVariation(PlayerPedId())
end