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?

Thanks

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

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.

-facepalm-

Troll.

Use this hook instead: **[Gamemode.PlayerSetModel

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=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
end

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

:wtc:

thanks a lot, ill try it out this evening

Can I ask why you did…
[lua]!ply:IsAdmin()[/lua]
Instead of…
[lua]ply:IsAdmin()[/lua]

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.