PDA

View Full Version : Looking for a 'No High Five Taunt' Extension/plugin


Professor Chaos
01-08-2012, 13:41
Anyone know of one of these?

I'd rather not have to re-edit my map to stop my players from using the taunt to glitch into the opposing team's base. Having a way to stop the taunt from working would be simpler.

I'm just curious to see if anyone is actually working on one, or if they know of one that's already been made before i look into making my own.

pheadxdll
01-08-2012, 13:48
You can block it with the TF2Items extension:
#include <tf2items>

#define DEF_HIGHFIVE 167

public Action:TF2Items_OnGiveNamedItem(client, String:classname[], itemDefinitionIndex, &Handle:hItem)
{
if(itemDefinitionIndex == DEF_HIGHFIVE)
{
return Plugin_Handled;
}

return Plugin_Continue;
}

404UserNotFound
01-08-2012, 14:02
You can block it with the TF2Items extension:
#include <tf2items>

#define DEF_HIGHFIVE 167

public Action:TF2Items_OnGiveNamedItem(client, String:classname[], itemDefinitionIndex, &Handle:hItem)
{
if(itemDefinitionIndex == DEF_HIGHFIVE)
{
return Plugin_Handled;
}

return Plugin_Continue;
}


I just had to pop in and say thank you for this little snippet. It'll come in quite handy :)

Professor Chaos
01-08-2012, 14:34
Well, i appreciate your help, but tf2items seems to do nothing but crash my server.

I had the script compiled and loaded with no problem, but within moments of starting the server, it crashed repeatedly.

I guess i'll have to wait til i can load tf2items without crushing my server.

404UserNotFound
01-08-2012, 15:51
Quick query. If I was to want to add more items to this to block, would I use "else if"? For example


#include <tf2items>

#define DEF_HIGHFIVE 167
#define DEF_EXAMPLE 169

public Action:TF2Items_OnGiveNamedItem(client, String:classname[], itemDefinitionIndex, &Handle:hItem)
{
if(itemDefinitionIndex == DEF_HIGHFIVE)
{
return Plugin_Handled;
}

else if(itemDefinitionIndex == DEF_EXAMPLE)
{
return Plugin_Handled;
}

return Plugin_Continue;
}


Or would I just go with continual "if"s like so?:


#include <tf2items>

#define DEF_HIGHFIVE 167
#define DEF_EXAMPLE 169

public Action:TF2Items_OnGiveNamedItem(client, String:classname[], itemDefinitionIndex, &Handle:hItem)
{
if(itemDefinitionIndex == DEF_HIGHFIVE)
{
return Plugin_Handled;
}

if(itemDefinitionIndex == DEF_EXAMPLE)
{
return Plugin_Handled;
}

return Plugin_Continue;
}

pheadxdll
01-08-2012, 16:57
In this example, it doesn't matter because it returns right after but I would go with else if because the first statement excludes the second.
You could also do these but they are essentially the same. Do whatever you like best:

switch(itemDefinitionIndex)
{
case DEF_HIGHFIVE, DEF_EXAMPLE:
{
return Plugin_Handled;
}
}
...
if(iItemDefinitionIndex == DEF_HIGHFIVE || iItemDefinitionIndex == DEF_EXAMPLE)
{
return Plugin_Handled;
}

404UserNotFound
01-08-2012, 17:09
In this example, it doesn't matter because it returns right after but I would go with else if because the first statement excludes the second.
You could also do these but they are essentially the same. Do whatever you like best:

switch(itemDefinitionIndex)
{
case DEF_HIGHFIVE, DEF_EXAMPLE:
{
return Plugin_Handled;
}
}
...
if(iItemDefinitionIndex == DEF_HIGHFIVE || iItemDefinitionIndex == DEF_EXAMPLE)
{
return Plugin_Handled;
}


Beauty! Thanks for the additional info, pheadxdll! I was actually trying to remember if the proper way to code in what you did above was:
"if(iItemDefinitionIndex == DEF_HIGHFIVE || iItemDefinitionIndex == DEF_EXAMPLE)"
- or -
"if(iItemDefinitionIndex == DEF_HIGHFIVE | iItemDefinitionIndex == DEF_EXAMPLE)".

Turns out it's the one that has || .

The reason this is going to come in handy for me is because I'm working on a plugin similar to UnlockBlock/whatever other "Vanilla server" plugins are on here. But with mine, I'm creating it with the XBOX 360 "Orange Box" version of TF2 in mind. I've got a bunch of things to figure out, such as:

1. How to prevent Engineers from upgrading teleporters & dispensers (No clue how to do this...)

2. How to prevent players from using "action items" (You pretty much just showed me how to do this, phea :))

3. How to prevent unlockable weapons from being used (VS Saxton Hale uses a "weapon replacement" method to replace certain weapons with nerfed versions of those weapons, so I'm going to use the method VSH uses for removing unlockables, unless UnlockBlock ever gets updated...)

3a. Add in coding to give Pyro's a stock Flamethrower that can't airblast (Airblasting isn't in the XBOX 360 version of TF2), and Demomen a Stickybomb launcher that can lay a max of 6 stickies (I think the max # is 6 on the XBOX 360 version of TF2).

And many other things.

napalm00
01-08-2012, 17:10
Use the switch that is more efficient, too :3

404UserNotFound
01-08-2012, 17:18
Nevermind, I'm an idiot and figured this out on my own (I hope I did, anyway)

PrepareItemHandle(weaponclassname, weaponidnumber, "attributes");

I think that's correct. Now I can get a move on on my own custom Vanilla server/no unlockable weapon plugin.

Zephyrus
01-08-2012, 20:16
Use the switch that is more efficient, too :3

and slower...:down:

napalm00
01-09-2012, 01:00
and slower...:down:

Depends from the compiler, generally in C it's faster :crab: