Not allowing model change

well I’ve just added a custom model to the shop although its kinda pointless if you can just switch to it after you die…
I was wondering if it was possible to dis activate this option. Thanks for taking the time to help.

PS: Im speaking about the option you get by opening the context menu.

what are you saying?

[editline]16th January 2014[/editline]

like when you die you switch to the original model?

You know when you push your C key and the context menu opens?
Theres this option where you can change your player models. I’m wondering if i can disable that on my server.

Ok ill try to help you

[editline]16th January 2014[/editline]

are you on sandbox

Yes i am.

Why do you not want it?

I dont want to get rid of all of it just the model part… I want custom models that players can buy in the point store.

so you have a point shop?

[editline]16th January 2014[/editline]

im pretty sure you can’t get rid of player models in the context in sandbox

Removing it from that menu won’t help as all that menu does is set cl_playermodel for you; people will still be able to set it themselves via console. You could check their model right after they spawn and if they haven’t bought it then remove it.

I’m going to write an example here, untested, and I have no idea how you check if someone has bought something via pointshop.

[lua]hook.Add(“PlayerSpawn”, “Limit players from certain models”, function(ply)
–Do it all in a timer 0.1 seconds later so any other hooks that set their model can run first. Can probably lower this number even further
timer.Simple(0.1, function()
–Make sure they are still valid
if not IsValid(ply) then return end
–Check their model
if ply:GetModel() == “models/whatever/you/are/blocking.mdl” then
–Check if they bought it via pointshop
if not ply:PS_HasBoughtModel(“themodelyouareblocking”) then
–if they havent bought it, return now
return
end
–Reset their model
ply:SetModel(“models/some/default/model.mdl”)
–Kill them?
ply:Kill()
end
end)
end)[/lua]

You’d need to figure out what the HasBoughtModel should actually be called, I’ve never used point shop.

SOLVED