Disable pointshop model when you turn into a zombie

I was just wondering if this code would work for this because I use it on my Murder server and I want to do it on my ZS server.


function ITEM:CanPlayerEquip(ply)
    return ply:TEAM_UNDEAD() 
end

You could make a “PlayerSpawn” hook to test if the player has another model than the zombie model. If case they do have another model, then set the model with ply:SetModel(“model path”)

But there are different zombie models like headcrabs and a shade.

I am not entirely sure how ZS works in depth. But if the different zombies are divided into different teams, then simply test for what team they are with “ply:Team() == index”
Eg:

[lua]

function spawny( ply )
– assuming that team 1 is zombie and team 2 is something else and so on…
if ply:Team() == 1 then
ply:SetModel(“zombie model”)
elseif ply:Team() == 2 then
ply:SetModel(“headcrap model”)
elseif ply:Team() == 3 then
– bla bla bla so on
end

end
hook.Add(“PlayerSpawn”, “spawny”, spawny)
[/lua]

You could add a timer so that the players model is set half a second after spawning or so. This ensure that no other functions sets the players model.

OBS!: this is a very clunky way of fixing this. If you can, then find a proper way of doing this.

Kind of an issue with ZS really. They’re doing hook.Run(“PlayerSetModel”, …) when a zombie spawns which tells PS to set the model, change it to a gamemode specific call when they spawn as a zombie or return a value when setting the zombie models and you’ll be good.

Yeah, this is probably the non-clunky way of doing this. Go with this if you can :wink:

So you are saying that the code I have won’t work?

That doesn’t look right
[lua]function ITEM:CanPlayerEquip(ply)
return ply:Team() ~= TEAM_UNDEAD
end[/lua]

What do you think I need to do?

[editline]15th August 2014[/editline]

Maybe this?


if ( ply:Team( ) == TEAM_HUMAN ) then
	return true;
else
	if ( ply:Team( ) == TEAM_ZOMBIE ) then
		return false;
	else
		return true;
	end
end

Look at my post, you are literally doing this
[lua]local bool = ply:Team() == TEAM_HUMAN
if bool then
return true
else
if not bool then
return false
else
return true
end
end[/lua]
When you can just do
[lua]return ply:Team() == TEAM_HUMAN[/lua]

So like this?


ITEM.Name = 'Kleiner'
ITEM.Price = 250
ITEM.Model = 'models/player/kleiner.mdl'

local bool = ply:Team() == TEAM_HUMAN
return bool

function ITEM:OnEquip(ply, modifications)
	if not ply._OldModel then
		ply._OldModel = ply:GetModel()
	end
	
	timer.Simple(1, function() ply:SetModel(self.Model) end)
end

function ITEM:OnHolster(ply)
	if ply._OldModel then
		ply:SetModel(ply._OldModel)
	end
end

function ITEM:PlayerSetModel(ply)
	ply:SetModel(self.Model)
end

What are you doing? You’ve got to do that in a function. Look at my first post in this thread

Can you please post what code I need please.

I already did.

Oh I am sorry about that, I thought you reposted my code. Now I feel stupid. Thank you very much.

This code doesn’t seem to work, players can still use the model as zombie. It seems if you manually equip it will reject it. If someone could help that would be awesome!