Admin Player Model

I tried searching and didnt find anything… Is there any way I can have a serverside script that gives a player an admin specific player model?


[lua]hook.Add(“PlayerSpawn”, “AdminModelThing”, function(ply)
if !ply:IsAdmin() then return end
ply:SetModel(“player/police.mdl”) – or whatever you want

that goes in the server.cfg right?

go to lua/autorun/server/ make a .lua file there and put that code in it and restart your server.

I don’t have a lua folder, i’m putting it in my zombie master server :slight_smile: shall i make one?

You gotta be kidding… :doh:

Am i being a idiot then? can i not change my playermodel in this mod as an admin? It’s all hosted locally so all the folders are easier to access i guess.

Garry Implented Lua to Garrysmod, You cant use Lua on other source games.



Use this hook instead: **[Gamemode.PlayerSetModel](**

Use both:
[lua]local function modelthing(ply)
if !ply:IsAdmin() then return end
ply:SetModel(“models/player/police.mdl”) – or whatever you want

hook.Add(“PlayerSpawn”, “AdminModelThing”, modelthing)
hook.Add(“PlayerSetModel”, “AdminModelThing”, modelthing)[/lua]


thanks a lot, ill try it out this evening

Can I ask why you did…
Instead of…

Just wondering for reference.

! means not.

He did: [lua] if !ply:IsAdmin() then return end [/lua]

That means: If the player is NOT an admin then go back and ignore the following lines in this function.
So if a player is an admin, the player will not return, but will go to the next line which is the line to change the model.