Editing TTT SWEP variables in game

I want to change the damage value of ALL TTT weapons to 50 on the round prep but I’ve run into an issue. It only works once per map! I tried using InitPostEntity which loaded it once per map at the very beginning and then now I tried TTTPrepareRound which only works on the first round and none after that. I even went as far as to try having PrepareRound call InitPostEntity to see if I could change the values more than once, but it hasnt worked either…




local function MyFunction()
	--timer.Simple(2, function()
	for k, v in pairs( ents.GetAll() ) do
		local class = string.lower(v:GetClass())
		if string.sub( class, 1, 10 ) == "weapon_ttt" or "weapon_zm" then
			--print("Inserted weapon into the TTT table  "..v:GetClass())
			table.insert(Guns, v)
		end
	end
	
	for k, wep in pairs(Guns) do
		if wep.Primary then
			print("YUUUP ITS A WEAPON    "..wep:GetClass())
			print(tostring(wep.Primary.Damage))
			wep.Primary.Damage = 50
			print(tostring(wep.Primary.Damage))
			print("CHANGED DAMAGE")
		end
	end
	--end)
end
hook.Add( "TTTPrepareRound", "Thing2", MyFunction ) 


You should try OnEntityCreated, check if the entity is a weapon and then modify its values as necessary.
And do it server side, of course. Only the server uses bullet damage variables.

Thats the hook I was looking for!! Thank you very much