Raised This Month: $51 Target: $400
 12% 

[TF2] Request:- Stun Wrench


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
max42
Member
Join Date: Nov 2009
Old 11-19-2010 , 17:44   [TF2] Request:- Stun Wrench
Reply With Quote #1

Hi guys

i have a idea i would like for my server

a script
if you are a admin with the custom p tag when u hit some1 with the standard engi wrench it frezzes them for 1 second

im guessing using the sm_frezze cmd with a timmer would do it but dont know enough about scripting to make it

anyone able to help with this ?
max42 is offline
Swixel
Senior Member
Join Date: Jul 2010
Location: Sydney, Australia
Old 11-20-2010 , 16:36   Re: [TF2] Request:- Stun Wrench
Reply With Quote #2

I'll drop this here for anyone who wants a similar thing (bit too busy with several other issues atm).

You could use SDKHooks to hook OnTakeDamage, check the weapon is whatever you want (or one of whatever is appropriate), then use AddCond to stun, like the scout ball does. That way you can randomly roll it or do it each time.
Swixel is offline
max42
Member
Join Date: Nov 2009
Old 11-22-2010 , 07:31   Re: [TF2] Request:- Stun Wrench
Reply With Quote #3

well i dont know enough about sourcemod to understand that

anyone know how to make this ?
max42 is offline
danmon
Member
Join Date: Oct 2010
Old 11-26-2010 , 12:18   Re: [TF2] Request:- Stun Wrench
Reply With Quote #4

nvm folow below and i will test it

Last edited by danmon; 11-27-2010 at 13:03.
danmon is offline
psychonic

BAFFLED
Join Date: May 2008
Old 11-26-2010 , 12:37   Re: [TF2] Request:- Stun Wrench
Reply With Quote #5

This would be a very simple plugin to make.

Here's a fully commented copy so you can see how it's done.

Code:
#include <sourcemod> #include <tf2> public OnPluginStart() {     // Hook players taking damage     HookEvent("player_hurt", OnPlayerHurtEvent); } public OnPlayerHurtEvent(Handle:event, const String:name[], bool:dontBroadcast) {     // Check that attacker is valid     new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));     if (attacker == 0 || !IsClientInGame(attacker))         return;         // Check that attacker has access to stun with wrench.     // Default 'p' flag, use admin_overrides to override. Command is "wrench_stun".     if (!CheckCommandAccess(attacker, "wrench_stun", ADMFLAG_CUSTOM2))         return;         // Now let's make sure the victim is valid     new victim = GetClientOfUserId(GetEventInt(event, "userid"));     if (victim == 0 || !IsClientInGame(victim))         return;         // Let's also make sure the damage wasn't enough to kill them     if (GetClientHealth(victim) <= 0)         return;         decl String:weapon[64];     GetEventString(event, "weapon_logclassname", weapon, sizeof(weapon));         // Check that the weapon is a wrench.     // We'll look at the log name as it will be different for SH or Golden Wrench     if (!StrEqual(weapon, "wrench"))         return;         // If we made it through all of the checks, set phasers to STUN     TF2_StunPlayer(victim, 1.0, _, TF_STUNFLAGS_BIGBONK, attacker); }
psychonic is offline
max42
Member
Join Date: Nov 2009
Old 11-26-2010 , 15:19   Re: [TF2] Request:- Stun Wrench
Reply With Quote #6

wow psychonic that awsome

this will help me understand scripting as well cheers

just tried it on my server does not seem to work
have you tested it?

thanks for taking the time to make this thou

Last edited by max42; 11-26-2010 at 15:37.
max42 is offline
danmon
Member
Join Date: Oct 2010
Old 11-27-2010 , 14:13   Re: [TF2] Request:- Stun Wrench
Reply With Quote #7

Quote:
Originally Posted by psychonic View Post
This would be a very simple plugin to make.

Here's a fully commented copy so you can see how it's done.

Code:
#include <sourcemod> #include <tf2> public OnPluginStart() {     // Hook players taking damage     HookEvent("player_hurt", OnPlayerHurtEvent); } public OnPlayerHurtEvent(Handle:event, const String:name[], bool:dontBroadcast) {     // Check that attacker is valid     new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));     if (attacker == 0 || !IsClientInGame(attacker))         return;         // Check that attacker has access to stun with wrench.     // Default 'p' flag, use admin_overrides to override. Command is "wrench_stun".     if (!CheckCommandAccess(attacker, "wrench_stun", ADMFLAG_CUSTOM2))         return;         // Now let's make sure the victim is valid     new victim = GetClientOfUserId(GetEventInt(event, "userid"));     if (victim == 0 || !IsClientInGame(victim))         return;         // Let's also make sure the damage wasn't enough to kill them     if (GetClientHealth(victim) <= 0)         return;         decl String:weapon[64];     GetEventString(event, "weapon_logclassname", weapon, sizeof(weapon));         // Check that the weapon is a wrench.     // We'll look at the log name as it will be different for SH or Golden Wrench     if (!StrEqual(weapon, "wrench"))         return;         // If we made it through all of the checks, set phasers to STUN     TF2_StunPlayer(victim, 1.0, _, TF_STUNFLAGS_BIGBONK, attacker); }
Unknown command: wrench_stun
danmon is offline
psychonic

BAFFLED
Join Date: May 2008
Old 11-27-2010 , 15:02   Re: [TF2] Request:- Stun Wrench
Reply With Quote #8

Quote:
Originally Posted by danmon View Post
Unknown command: wrench_stun
It's not an actual command. It is just the command name that you would use in the admin_overrides if you wanted to assign it to a different admin flag.
psychonic is offline
max42
Member
Join Date: Nov 2009
Old 11-28-2010 , 12:16   Re: [TF2] Request:- Stun Wrench
Reply With Quote #9

this still does not work for me anyone got it working ?
max42 is offline
Tylerst
Veteran Member
Join Date: Oct 2010
Old 11-30-2010 , 13:58   Re: [TF2] Request:- Stun Wrench
Reply With Quote #10

Try this. I edited psychonics code a bit and added a cvar, sm_stunwrench_duration, to change the duration of the stun in seconds (default 1 second).
Attached Files
File Type: sp Get Plugin or Get Source (stunwrench.sp - 342 views - 1.2 KB)

Last edited by Tylerst; 11-30-2010 at 14:11.
Tylerst is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:18.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode