TTT Jihad Sound Pointshop

I was wondering if there was a way to make it so that you can buy Jihad Sounds from the Pointshop, and it will override the default “lalala”. What would I add to the Pointshop lua file and to the Jihad lua? Thanks in advance!
Also please note that I am very new to lua.

On purchase set a variable equal to the items sound path, and just replace that in the jihad.

do you mean as a taunt ?

How would I do that?

On Equip set the variable == to the sound path.

So for example…

[lua]function ITEM:OnEquip(ply)
ply.JihadTaunt = “taunts/taunt1.wav”;
end[/lua]

Then, in the jihad file find where the sound is played and do a check like so…

[lua]if ply.JihadTaunt then
self.Owner:EmitSound(ply.JihadTaunt);
else
self.Owner:EmitSound(regularjihadsoundpath);
end[/lua]

Also, make sure to set it to nil on holster, so like so.

[lua]function ITEM:OnHolster(ply, mods)
ply.JihadTaunt = nil;
end[/lua]

sorry now i know what you mean ;0

Okay, I did all that but know I can’t buy the item since there’s no icon, and usually the icon is generated when you can see the item. How would I add the icon?

Look at the other Pointshop items to see how they do; basically grab a model or material filepath and use ITEM.Material = or ITEM.Model =

Yeah, I did try using the code for the Player Models and Materials, but those all move, and I want the icon to just be a picture. Like if I had a Turn Down for What .wav or something like that, I would want a picture of the Lil Jon.

Just use the radio model, that’s what I use.

Okay, I tried doing what you told me to but that just brought up a bunch of errors. But, I was wondering if this would work:
[lua]
if (SERVER) then
timer.Simple(2, function() self:Asplode() end )
self.Owner:EmitSound( “siege/jihad.wav” )
end
[/lua]
and turn that into something that uses ITEM:IsOwned
[lua]
if (SERVER) then
if ITEM:IsOwned(“sparta”) then
timer.Simple(2, function() self:Asplode() end )
self.Owner:EmitSound( “siege.sparta.wav” )
else
timer.Simple(2, function() self:Asplode() end )
self.Owner:EmitSound( “siege/jihad.wav” )
end
end
[/lua]
This is just how I want it to end up like, and obviously there errors but I don’t know how to fix this.

[lua]if (SERVER) then
timer.Simple(2, function() self:Asplode() end )
if self.Owner:PS_HasItemEquipped(“sparta”) then
self.Owner:EmitSound(“siege.sparta.wav”)
else
self.Owner:EmitSound(“siege/jihad,wav”)
end
end
[/lua]
It’s PS_HAsItemEquipped, not ITEM.

Please just look at pointshops functions first :slight_smile: http://pointshop.burt0n.net/player-meta-functions/items#has-item-equipped and btw its PS_HasItemEquipped(‘item’)

I just precached a table of sounds and networked the default sound that when you equip the jihad taunt via pointshop it’ll replace the default sound with the one you just bought. (Thanks you Baby Weiner)

When I get home I can help you.

Edit: I lied.

So in the jihad file where it was calling the sound I did:


if (SERVER) then
    timer.Simple(2, function() self:Asplode() end )
	local expsound = self.Owner:GetNetworkedVar("esound", "siege/jihad.wav")
    self.Owner:EmitSound( expsound )
  end 
end

Then in the pointshop sounds I did:



function ITEM:OnEquip(ply)
ply:SetNetworkedVar("esound", "taunts/daddy.mp3")
end


Why would you set a network var? That’s a terrible idea. Just do what I suggested…

I’m not saying he should do this. I’m just saying that that was how I did it.

Then why even give him the example? It’s just going to confuse him.

The example is for learning purposes. I’d rather have many different ways of doing something rather than just one way because it could benefit me in a future project.

I agree with helping with other projects, I constantly go back to stuff I made in the past to remember how to do it. The more code you have, the more knowledge in your files :smiley:

Why is there no video on how to do this yet??? there are like 8 post’s about this. but no one who nknows how to do this has made a video yet.