Changing playermodel to a prop.

[This was an experiment to see what I could do - turns out I can’t do it] ^^

I’m very new to Lua, so obviously, this will have some obvious failures which I cannot spot (guess all of it D:)

I want to make it so admins can change their playermodel to a prop, I thought it would be pretty simple, I had a very quick go (using the Wiki for almost all of it) and I made a small piece of Lua. I also have no idea on how to make the command itself. - Also some reconstruction would be nice.

[lua]function PlayerModel(ply)

 if ply:IsAdmin() then
       self.Entity:SetModel("models/props_c17/oildrum001.mdl")
	   ply:ChatPrint("Player model changed!")
 else
      ply:ChatPrint("You are not an admin on this server!")
 end

end
concommand.Add(“playermodel”, ChangeModel)[/lua]

I tried to in single player, and it comes up with no errors, however, I cannot check if it works. Any help would be welcome, tips etc would be very appreciated!

An explanation on what the code I put together actually does would also be appreciated.

[lua]function PlayerModel(ply)

 if ply:IsAdmin() then
       ply:SetModel("models/props_c17/oildrum001.mdl")
       ply:ChatPrint("Player model changed!")
 else
      ply:ChatPrint("You are not an admin on this server!")
 end

end
concommand.Add(“playermodel”, PlayerModel)[/lua]

Oh, I didn’t do too badly ^^
Would you know how to make it so a admin can choose which model they would like?

[lua]function PlayerModel(ply, cmd, args)

 if ply:IsAdmin() then
    if args[1] then
       ply:SetModel(args[1])
       ply:ChatPrint("Player model changed!")
    else
       ply:ChatPrint("Error!")
    end
 else
      ply:ChatPrint("You are not an admin on this server!")
 end

end
concommand.Add(“playermodel”, PlayerModel)[/lua]

Something like that. Type in the console playermodel modelnamehere

Thanks! I’ll refer back to this if I ever do anything like this again, your help is very appreciated.