Asimple few questions

Hi all I have had these few simplish issues for a while but I wanted to try and google them. But I haven’t had any luck for a while. So I wondered if anyone here would hold any of the answers.

1: I have a custom kill icon I wish to use when a player kills another player. How would I do this? In the weapon SWEP, or in the init. If so what method would I use?
‘I have tried and read the kill icon on the gmod wiki but I need more information.’

2: Kill noise. Does anyone know how to remove the anoyying bleep noise from hl2 when someone dies? Also could I add my own custom sound somehow?

3: Re-spawn time. Is there a way to make a player re-spawn instant? Atm by default it is set for a few seconds which is kinda annoying.

4: I have a shop, I want to add a hat item to it. These items in the shop atm use simple code such as.



ITEM.Name = 'Bucket Hat'
ITEM.Price = 100
ITEM.Model = 'models/props_junk/MetalBucket01a.mdl'
ITEM.Attachment = 'eyes'

function ITEM:OnEquip(ply)
	ply:PS_AddClientsideModel(self.ID)
end

function ITEM:OnHolster(ply)
	ply:PS_RemoveClientsideModel(self.ID)
end

function ITEM:ModifyClientsideModel(ply, model, pos, ang)
	model:SetModelScale(0.7, 0)
	pos = pos + (ang:Forward() * -5) + (ang:Up() * 5)
	ang:RotateAroundAxis(ang:Right(), 200)
	
	return model, pos, ang
end



I want to add something which I made in SCK as a shop item. For example the code bellow.
Can anyone help or explain how I would add this, if you can that is.





SWEP.WElements = {

["hat2"] = { type = "Model", model = "models/food/burger.mdl", bone = "ValveBiped.Bip01_Head1", rel = "", pos = Vector(2.273, -1.364, 11.364), angle = Angle(-180, 17.385, -1.024), size = Vector(0.5, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} },
["hat1"] = { type = "Model", model = "models/food/burger.mdl", bone = "ValveBiped.Bip01_Head1", rel = "", pos = Vector(2.273, -1.364, -10.455), angle = Angle(0, 17.385, -1.024), size = Vector(0.5, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} },

}



I hope someone can help me with these small issues. Many thanks.

-Duby

  1. http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index98d4.html


hook.Add("PlayerDeathSound", "DeFlatline", function() return true end)
local noise = Sound("sound.wav") -- Directory relative to sound/
hook.Add("PlayerDeath", "NewSound", function(vic,unused1,unused2) vic:EmitSound(noise) end)

For spawning instantly, look into:

[lua]function GM:PlayerDeathThink( Player )
if ( !Player:CanRespawn( ) ) then
return false;
else
Player:Spawn( );
return true;
end
end[/lua]

where CanRespawn is a custom function which just returns true/false if they can respawn yet.

I didn’t think returning did anything, I thought you had to actually call player:Spawn() ?

It’s supposed to “allow” spawning, but I haven’t found code implemented for it to do anything just yet, but I kept returns in-case I found a better-use for it.

Oh I’ve never noticed that. It’s possible the wiki is wrong though, the base gamemode doesn’t return anything and neither does TTT.

I see thank you everyone for your help. I will try these techniques and see if they work out!

Does anyone have any idea about the last question? :open_mouth: