Restricting playermodels

I am sorry if this was already posted somewhere, but I wasn’t able to find anything.

Basically, I am trying to restrict players from using certain playermodels (by switching to a different one). So far I tried this:

function ModelBlock(ply)
	if ply:GetModel() == "models/player/breen.mdl" then
		print("Chosen model: "..ply:GetModel())
		print("Currently set model: "..ply:GetModel())

hook.Add( "PlayerSpawn", "SpawnHook", ModelBlock )

However, this doesn’t work for some reason - even though the script actually prints out

Chosen model: /models/player/breen.mdl
Currently set model: /models/player/kleiner.mdl

I still have the chosen model, and it prints out the same on every respawn. I also tried another approach:

if(ply:GetInfo("cl_playermodel") == "breen") then
	ply:ConCommand("cl_playermodel kleiner")

however that seems “delayed” by one death - I first get the chosen model and I have to die once to actually get switched to the forced one.

So, is there any “right” and working way to do this? Any help will be greatly appreciated.

Bump because of edit.

Your first bit of code, hooking PlayerSpawn, looks right. I would suspect the other hooks running after it are also changing the player model. Try wrapping it in a timer so the model gets set after other spawn hooks have run.

You were right, I haven’t thought of that, adding a simple timer worked, thank you!