Large post. Many questions.

I don’t expect anyone to answer all of these, but if anyone can answer any of them I’d appreciate it :slight_smile:

Can combine use any SWEPs? The ones that I give to the citizens the combine will not accept (attempting to give them to the combine results is absolutely nothing). How can I make a SWEP combine-friendly?

If I want to give an NPC a SWEP using chat, shouldn’t this work? All it’s doing is the return part, blocking out my chat. Nothing else, no errors. This is in the NPC-SWEP’s init file.

[lua]
function ChatGive(ply,text)

if ((string.sub(text,1,12)=="*giveweapon*")and(ply:GetActiveWeapon():IsValid() and ply:GetActiveWeapon():GetClass()=="weapon_jack_m9")) then  
	
	local trace=(ply:GetEyeTrace())
	if (trace.HitPos:Distance(ply:GetShootPos())<=45) then
		local ent=ply:GetEyeTrace().Entity
		if (ent:IsNPC()) then
			if(ent:GetActiveWeapon():GetClass()=="weapon_jack_npc_m9") then return end
			ent:Give("weapon_jack_npc_m9")
			ply:StripWeapon("weapon_jack_m9")
		end
	end
	return ""
end  

end

hook.Add( “PlayerSay”, “M9ChatGive”, ChatGive )
[/lua]
It’s supposed to go like this:
If you type giveweapon and
if you have a the right weapon and
if you’re looking at an npc and
if the npc doesn’t already have the weapon then
give the npc the npc version of the weapon and
take away the player’s weapon.

What do I do if I have a viewmodel that was supposed to be a reskin and I want to use it as the viewmodel for a SWEP I have?

I downloaded this CSS reskin that changes the USP to a Beretta M9. I have an M9 SWEP whose viewmodel right now is pretty shitty looking. The reskin is much nicer looking. To improve my SWEP, I thought it would be as simple as placing the textures into my addon and replacing the old M9 viewmodel files with the new M9 viewmodel files (of course changing the names from USP to M92 in the process) but when I go to use the weapon there is no viewmodel.

Real quick, how would one go about stopping various reload functions of a SWEP if the player changed weapons before the reload was complete?

And the final question: Is there a surefire way to set a SWEP’s hold type?
It seems like this is a mystery that eludes everyone.

MadCow’s weapons’ holdtypes set properly for third person when a player has them, but they don’t set at all when you give them to an npc. I made a swep that’s not on madcow’s base, but its holdtype fails to set even though I copied his holdtype code down to the letter. All the advice that GmodWiki has to give on the subject has failed me. I had a thread before about this, but it seemed nobody knew how to set the holdtype.

Response to question 2:

Just make a whole new model and SWEP and it will be much easier.

Question 3:

Add debug prints after every if check. So you can see where it’s wrong.

Question 4:

You need to hex the model, ask modeling section for how to do that.