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

[TF2] Removing Sandman stun effect


Post New Thread Reply   
 
Thread Tools Display Modes
DarkEnergy
SourceMod Donor
Join Date: Apr 2008
Location: Georgia Tech, MSECE
Old 03-09-2009 , 18:50   Re: [TF2] Removing Sandman stun effect
Reply With Quote #21

Quote:
Originally Posted by MikeJS View Post
PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <tf2_stocks>
new Handle:gameConf;
new 
Handle:giveNamedItem;
new 
Handle:weaponEquip;
new 
Handle:g_hEnabled INVALID_HANDLE;
new 
bool:g_bEnabled true;
public 
OnPluginStart() {
    
gameConf LoadGameConfigFile("sandman.games");
    
StartPrepSDKCall(SDKCall_Player);
    
PrepSDKCall_SetFromConf(gameConfSDKConf_Virtual"GiveNamedItem");
    
PrepSDKCall_AddParameter(SDKType_StringSDKPass_Pointer);
    
PrepSDKCall_AddParameter(SDKType_PlainOldDataSDKPass_Plain);
    
PrepSDKCall_AddParameter(SDKType_PlainOldDataSDKPass_Plain);
    
PrepSDKCall_SetReturnInfo(SDKType_CBaseEntitySDKPass_Plain);
    
giveNamedItem EndPrepSDKCall();
    
StartPrepSDKCall(SDKCall_Player);
    
PrepSDKCall_SetFromConf(gameConfSDKConf_Virtual"WeaponEquip");
    
PrepSDKCall_AddParameter(SDKType_CBaseEntitySDKPass_Pointer);
    
weaponEquip EndPrepSDKCall();
    
g_hEnabled CreateConVar("sm_nosandman""1""Enable no sandman"FCVAR_PLUGIN|FCVAR_NOTIFY);
    
HookConVarChange(g_hEnabledCvar_enabled);
}
public 
OnMapStart() {
    
CreateTimer(5.0WpnCheck);
}
public 
OnConfigsEiecuted() {
    
g_bEnabled GetConVarBool(g_hEnabled);
}
public 
Cvar_enabled(Handle:convar, const String:oldValue[], const String:newValue[]) {
    
g_bEnabled GetConVarBool(g_hEnabled);
    if(
g_bEnabled) {
        
WpnCheck(INVALID_HANDLE);
    }
}
public 
Action:WpnCheck(Handle:timer) {
    new 
ent;
    
decl String:wpn[64];
    for(new 
i=1;i<=MaxClients;i++) {
        if(
IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i)) {
            if((
ent GetPlayerWeaponSlot(i2))!=-1) {
                
GetEdictClassname(entwpnsizeof(wpn));
                if(
StrEqual(wpn"tf_weapon_bat_wood")) {
                    
TF2_RemoveWeaponSlot(i2);
                    new 
entity SDKCall(giveNamedItemi"tf_weapon_bat"00);
                    
SDKCall(weaponEquipientity);
                    
PrintToChat(i"Your sandman has been removed.");
                }
            }
        }
    }
    if(
g_bEnabled) {
        
CreateTimer(5.0WpnCheck);
    }

Replaces a player's sandman with a normal bat.
how come when i use this it just removes the bat, doesnt give one back
DarkEnergy is offline
MikeJS
Senior Member
Join Date: Nov 2008
Old 03-09-2009 , 18:53   Re: [TF2] Removing Sandman stun effect
Reply With Quote #22

Quote:
Originally Posted by DarkEnergy View Post
how come when i use this it just removes the bat, doesnt give one back
Download sandman.games.txt and put it in sourcemod/gamedata.
__________________
MikeJS is offline
atmuh
Member
Join Date: Nov 2008
Old 03-10-2009 , 13:32   Re: [TF2] Removing Sandman stun effect
Reply With Quote #23

i know this sounds like a joke but im not joking is there a way to write a thing that allows people to use the sandman completely and whatnot but as soon as they stun someone the scout using the sandman explodes MAN THAT WOULD BE THE BEST

Last edited by atmuh; 03-10-2009 at 14:28.
atmuh is offline
DarkEnergy
SourceMod Donor
Join Date: Apr 2008
Location: Georgia Tech, MSECE
Old 03-10-2009 , 21:12   Re: [TF2] Removing Sandman stun effect
Reply With Quote #24

Quote:
Originally Posted by MikeJS View Post
Download sandman.games.txt and put it in sourcemod/gamedata.
i did
DarkEnergy is offline
MikeJS
Senior Member
Join Date: Nov 2008
Old 03-11-2009 , 13:13   Re: [TF2] Removing Sandman stun effect
Reply With Quote #25

Try downloading the .sp and compiling it against your version of sourcemod.
__________________
MikeJS is offline
panchoman
Senior Member
Join Date: Jan 2009
Old 03-13-2009 , 16:30   Re: [TF2] Removing Sandman stun effect
Reply With Quote #26

Quote:
Originally Posted by MikeJS View Post
PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <tf2_stocks>
new Handle:gameConf;
new 
Handle:giveNamedItem;
new 
Handle:weaponEquip;
new 
Handle:g_hEnabled INVALID_HANDLE;
new 
bool:g_bEnabled true;
public 
OnPluginStart() {
    
gameConf LoadGameConfigFile("sandman.games");
    
StartPrepSDKCall(SDKCall_Player);
    
PrepSDKCall_SetFromConf(gameConfSDKConf_Virtual"GiveNamedItem");
    
PrepSDKCall_AddParameter(SDKType_StringSDKPass_Pointer);
    
PrepSDKCall_AddParameter(SDKType_PlainOldDataSDKPass_Plain);
    
PrepSDKCall_AddParameter(SDKType_PlainOldDataSDKPass_Plain);
    
PrepSDKCall_SetReturnInfo(SDKType_CBaseEntitySDKPass_Plain);
    
giveNamedItem EndPrepSDKCall();
    
StartPrepSDKCall(SDKCall_Player);
    
PrepSDKCall_SetFromConf(gameConfSDKConf_Virtual"WeaponEquip");
    
PrepSDKCall_AddParameter(SDKType_CBaseEntitySDKPass_Pointer);
    
weaponEquip EndPrepSDKCall();
    
g_hEnabled CreateConVar("sm_nosandman""1""Enable no sandman"FCVAR_PLUGIN|FCVAR_NOTIFY);
    
HookConVarChange(g_hEnabledCvar_enabled);
}
public 
OnMapStart() {
    
CreateTimer(5.0WpnCheck);
}
public 
OnConfigsEiecuted() {
    
g_bEnabled GetConVarBool(g_hEnabled);
}
public 
Cvar_enabled(Handle:convar, const String:oldValue[], const String:newValue[]) {
    
g_bEnabled GetConVarBool(g_hEnabled);
    if(
g_bEnabled) {
        
WpnCheck(INVALID_HANDLE);
    }
}
public 
Action:WpnCheck(Handle:timer) {
    new 
ent;
    
decl String:wpn[64];
    for(new 
i=1;i<=MaxClients;i++) {
        if(
IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i)) {
            if((
ent GetPlayerWeaponSlot(i2))!=-1) {
                
GetEdictClassname(entwpnsizeof(wpn));
                if(
StrEqual(wpn"tf_weapon_bat_wood")) {
                    
TF2_RemoveWeaponSlot(i2);
                    new 
entity SDKCall(giveNamedItemi"tf_weapon_bat"00);
                    
SDKCall(weaponEquipientity);
                    
PrintToChat(i"Your sandman has been removed.");
                }
            }
        }
    }
    if(
g_bEnabled) {
        
CreateTimer(5.0WpnCheck);
    }

Replaces a player's sandman with a normal bat.
is sm_nosandman (0/1) suppossed to enable/disable the plugin? if so, it doesn't work
panchoman is offline
MikeJS
Senior Member
Join Date: Nov 2008
Old 03-13-2009 , 16:51   Re: [TF2] Removing Sandman stun effect
Reply With Quote #27

Quote:
Originally Posted by panchoman View Post
is sm_nosandman (0/1) suppossed to enable/disable the plugin? if so, it doesn't work
Could be to do with how I can't spell Executed
Updated my post
__________________
MikeJS is offline
mardur
Junior Member
Join Date: Mar 2009
Old 03-23-2009 , 19:51   Re: [TF2] Removing Sandman stun effect
Reply With Quote #28

You Updated the correct spelling in your post, but not in the script file to be downloaded.

Anyway, this plugin is great. I use it on my public server.

There still is a small thing. Due to the unlockable handling since the scout update, the unlockable weapons are always equipped when the player touches the resupply. On maps (like dm_store) where the resupply is close to the spawn doors, the scout has up to 5 seconds to throw a ball, before the script removes the weapon again. Then the scout touches the resupply again, ...

Setting the timer shorter than 5 seconds will increase cpu load on the server (maybe not that much if you set it to 1 second). Is there a possibility to check (hook an event) when a player is resupplied?

This plugin could also be generalized by adding a list of weapons that are removed and another list of weapons which will be replaced by their counter part, like this:

sm_weapon_restrict_replace scout_melee_unlock (replaces the scout unlockable bat with the regular one)
sm_weapon_restrict_replace scout_melee (replaces the scouts regular bat with the unlockable bat)
sm_weapon_restrict_remove medic_primary
sm_weapon_restrict_remove medic_primary_unlock (removes the syringe/bloodsucker without giving another weapon back)

Where scout_melee, etc is an alias for the real weapon name (for easier config files). One just needs to implement a list/array for all weapons, figure out all the internal weapon names (can surely be found somewhere in this forum) and a little alias system for the console command parameters. You could then provide a melee only config file by removing all non-melee weapons (and replacing the unlockable melee weapons with the regular ones). Or you make this an extra convar (sm_weapon_restrict_melee_mode 1).

Such a plugin should also make it into the list of approved plugins, as it is not just a fix for a certain issue but provides a general set of features.

btw: is it possible to give someone an unlockable weapon, if that player did not achieve it yet?
mardur is offline
DeviusCreed
Junior Member
Join Date: Dec 2006
Old 03-25-2009 , 14:10   Re: [TF2] Removing Sandman stun effect
Reply With Quote #29

This removes the stun instantly
Code:
#include <sourcemod>

public OnPluginStart()
{
    HookEvent("player_hurt",  Event_PlayerHurt);
}

public Action:Event_PlayerHurt(Handle:event,  const String:name[], bool:dontBroadcast)
{
    new target = GetClientOfUserId(GetEventInt(event, "userid"))
    new playerstate = GetEntProp(target, Prop_Send, "m_nPlayerCond")
    if ((playerstate & 32768) != 0)
        SetEntProp(target, Prop_Send, "m_nPlayerCond", (playerstate & (~32768)))
}
DeviusCreed is offline
Darkimmortal
Senior Member
Join Date: Aug 2008
Old 03-25-2009 , 14:29   Re: [TF2] Removing Sandman stun effect
Reply With Quote #30

That's exactly what I was looking for - thanks!

+K
__________________
Darkimmortal 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 11:20.


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