• Admin only player models
    6 replies, posted
Any way to make player models admin only?
[url]http://wiki.garrysmod.com/page/GM/PlayerSpawn[/url] [code] local function checkPlayerModel(ply) if ply:GetModel() == "insert admin model here" and not ply:IsAdmin() then ply:SetModel("insert default model here") end end hook.Add("CheckPlayerModel", "UniqueIdentifier", checkPlayerModel) [/code]
Yes. Which game-mode are you referring to? What have you tried coding so far? I recommend looking into the PlayerSpawn hook which calls Loadout and the PlayerSetModel hooks. Primarily, you're looking at the [B]PlayerSetModel[/B] hook, and you should then assign a model based on group in there.
[code]local function checkGroup( ply ) if ply:IsUserGroup( 'admin' ) then ply:SetModel( 'MODEL PATH' ) end end hook.Add("CheckGroup", "UniqueIdentifier", checkGroup)[/code] I think you can do it this way as long as your using ULX admin.
[QUOTE=Velocity;42220107][code]local function checkGroup( ply ) if ply:IsUserGroup( 'admin' ) then ply:SetModel( 'MODEL PATH' ) end end hook.Add("CheckGroup", "UniqueIdentifier", checkGroup)[/code] I think you can do it this way as long as your using ULX admin.[/QUOTE] That just forces admins to a model and doesn't stop players from using it.
[QUOTE=Ott;42220140]That just forces admins to a model and doesn't stop players from using it.[/QUOTE] But won't it check if they are the certain group before setting their model?
[QUOTE=Velocity;42220151]But won't it check if they are the certain group before setting their model?[/QUOTE] Not if you're running sandbox or some other gamemode that allows you to manually change your playermodel. Also, your snippets of code won't even do anything (neither of you) because neither "CheckPlayerModel" nor "CheckGroup" are valid hooks (unless defined by a gamemode.)
Sorry, you need to Log In to post a reply to this thread.