RegisterCommand('npc', function(source, args)
local ped = PlayerPedId()
local model = GetHashKey(args[1])
SetEntityInvincible(ped, true)
if IsModelInCdimage(model) and IsModelValid(model) then
LoadPlayerModel(model)
SetPlayerModel(PlayerId(), model)
if isPedAllowedRandom(args[1]) then
SetPedRandomComponentVariation(ped, true)
end
SetModelAsNoLongerNeeded(model)
end
SetEntityInvincible(ped, false)
end)
I have this little code and it works fine it changes me into a Ped model i wish and if i relog i change back again so my question is
is it possible to make this Command just für authorized person Like admin or gods and how can i do it
--NPC--
QBCore.Commands.Add('npc','change npc model', {}, false, function(source)
RegisterCommand('npc', function(source, args)
local ped = PlayerPedId()
local model = GetHashKey(args[1])
SetEntityInvincible(ped, true)
if IsModelInCdimage(model) and IsModelValid(model) then
LoadPlayerModel(model)
SetPlayerModel(PlayerId(), model)
if isPedAllowedRandom(args[1]) then
SetPedRandomComponentVariation(ped, true)
end
SetModelAsNoLongerNeeded(model)
end
SetEntityInvincible(ped, false)
end)
end, 'wl')