Pointshop Taunts

Yeah I know a lot of people asked me not to post this but I want to help people that actually want this. Its just simple pointshop taunts I whipped up in a minute. I’m trying to fix it so it has a delay but for some reason cannot figure it out. So yeah, here it is.
A spam delay will be implemented shortly once I cna figure it out. Friend me on steam if you have any questions. The taunt system may also have a derma panel where you can adjust the volume of you sound and other things like that. Hope you enjoy!

Open to ideas! Post in the comment section!

use “local function” to define your function, as for adding a delay you need to track when the taunt was last used and compare time against that:

if (lastUsedTime + 30) <= CurTime() then
PlayTaunt()
lastUsedTime = CurTime()
end

Ohhhh okay I was doing it the wrong way. Thanks!

Shouldn’t you make the hook name unique too? If more than one person buys it, its not going to work for everyone. I suggest doing:

[Lua]
hook.Add(“KeyPress”, ply:UniqueID()…"_"…self.NAME, KeyPress)
[/Lua]

What do you mean exactly?

Either that or use



if ply:PS_HasItemEquipped("filename") then


The second parameter of hook.add is the unique name, which as the name implies, must be unique. So because you’re creating a new hook for every player that buys the item, its overwriting the old hook.

If you need a better explanation, run your code on a server with another player. You buy the item first and do the taunt. If your code actually works, get the other player to buy the item, then you try to do the taunt again.

Going off what Niandra said, I would suggest moving the hook outside of the buy item and having 1 hook do it all and just ensure that they don’t have any other taunts active.

Edit

Maybe something like this. Its untested but it should in theory work better.

[lua]
//sv_taunts.lua

hook.Add(“KeyPress”, “taunts_handler”, function( ply, key )
//Check if the key pressed was the reload key
if key == IN_RELOAD then
//Check what taunt the player has active
if ply.Taunt != nil then
//Check the time since the last taunt
if ply.TauntTime == nil then ply.TauntTime = CurTime() end
if CurTime() > ply.TauntTime then
//Do the taunt stuff for the item
ply.TauntTime = CurTime() + 30
end
end
end
end)

//item lua

ITEM.Name = ‘This is Sparta!’
ITEM.Price = 30000
ITEM.Model = ‘models/props_junk/garbage_glassbottle003a.mdl’
ITEM.NoPreview = true

function ITEM:OnEquip( ply, modifications )
ply.Taunt = self.Name
end

function ITEM:OnHolster(ply)
ply.Taunt = nil
end
[/lua]

Wow thanks! You don’t know how much this has helped me!

Also just to note, pointshop items support having hooks http://pointshop.burt0n.net/items/hooks

Ah thanks for this info aswell. :slight_smile:

I did not know you could do that with pointshop. The more you know. You should use what Adam has suggested.

Yeah, working on the Derma right now. It will be a nice little menu that has taunt settings.

If I may suggest another improvement, use

sound.Play instead.

This allows you set a vector that it will play from, so you can only hear the taunt if you are close to the person that used the taunt.

I personally like it playing globally but yeah, I’ll add another version that plays locally for people that want that.

You may also want to use the Item:OnModify function in your items, which will show a ‘Modify’ action when right clicking the item, which you can then use to show your menu. Take a look at the Trail items colour modification for more info https://github.com/adamdburton/pointshop/blob/master/lua/pointshop/items/trails/electric.lua#L14 https://github.com/adamdburton/pointshop/blob/master/lua/pointshop/cl_init.lua#L58

yeah I was using that. Thanks though!

Taunts don’t work on TTT, do they? This would be really cool if they do.

They should; it’s not the same thing as “Prop Hunt taunts.”

Yes they do. If you need any help feel free to contact me. I’m putting development on this on hold atm because I’m busy with school / another project.