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

[TF2] Disable Atomizer


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MaxOldPanda
SourceMod Donor
Join Date: Sep 2012
Location: Shambhala
Old 04-16-2013 , 21:09   [TF2] Disable Atomizer
Reply With Quote #1

As title says, i need The Atomizer disabled, dunno if i need plugin for that, or it can be done with other methods...
__________________
MaxOldPanda is offline
Drixevel
AlliedModders Donor
Join Date: Sep 2009
Location: Somewhere headbangin'
Old 04-16-2013 , 23:58   Re: [TF2] Disable Atomizer
Reply With Quote #2

Quote:
Originally Posted by MaxOldPanda View Post
As title says, i need The Atomizer disabled, dunno if i need plugin for that, or it can be done with other methods...
Code:
#include <sourcemod>
#include <sdktools>
#include <tf2>
#include <tf2_stocks>

public OnPluginStart()
{
    CreateTimer(0.1, Atomizer, 0, TIMER_REPEAT);
}


public Action:Atomizer(Handle:timer, any:derp)
{
    for(new client=1; client <= MaxClients; client++)
    {        
        if(IsClientInGame(client) && IsPlayerAlive(client))
        {        
            new slot0 = GetPlayerWeaponSlot(client, 2);
                        
            if(TF2_GetPlayerClass(client) == TFClass_Scout)
            {
                if(slot0 > MaxClients && IsValidEntity(slot0) && GetEntProp(slot0, Prop_Send, "m_iItemDefinitionIndex") == 450)
                {
                    TF2_RemoveWeaponSlot(client, 2);
                    PrintToChat(client, "The Atomizer is blocked on this server.");
                }
            }
        }    
    }
}
I don't remember where I found this but I use this on my servers.

- Jack

edit: Found it!

https://forums.alliedmods.net/showthread.php?p=1594559 <-- Got the code from there, changed it up.

Last edited by Drixevel; 04-17-2013 at 00:01.
Drixevel is offline
MaxOldPanda
SourceMod Donor
Join Date: Sep 2012
Location: Shambhala
Old 04-17-2013 , 00:49   Re: [TF2] Disable Atomizer
Reply With Quote #3

Awesome, thank you.
__________________
MaxOldPanda is offline
psychonic

BAFFLED
Join Date: May 2008
Old 04-17-2013 , 07:49   Re: [TF2] Disable Atomizer
Reply With Quote #4

Quote:
Originally Posted by r3dw3r3w0lf View Post
Code:
#include <sourcemod>
#include <sdktools>
#include <tf2>
#include <tf2_stocks>

public OnPluginStart()
{
    CreateTimer(0.1, Atomizer, 0, TIMER_REPEAT);
}


public Action:Atomizer(Handle:timer, any:derp)
{
    for(new client=1; client <= MaxClients; client++)
    {        
        if(IsClientInGame(client) && IsPlayerAlive(client))
        {        
            new slot0 = GetPlayerWeaponSlot(client, 2);
                        
            if(TF2_GetPlayerClass(client) == TFClass_Scout)
            {
                if(slot0 > MaxClients && IsValidEntity(slot0) && GetEntProp(slot0, Prop_Send, "m_iItemDefinitionIndex") == 450)
                {
                    TF2_RemoveWeaponSlot(client, 2);
                    PrintToChat(client, "The Atomizer is blocked on this server.");
                }
            }
        }    
    }
}
I don't remember where I found this but I use this on my servers.

- Jack

edit: Found it!

https://forums.alliedmods.net/showthread.php?p=1594559 <-- Got the code from there, changed it up.
Rather than constantly checking in a short, repeating timer callback, I believe that the post_inventory_application event fires for any case where the player is given weapons.

Code:
#include <sourcemod> #include <sdktools> #include <tf2_stocks> new const DEFIDX_ATOMIZER = 450; public OnPluginStart() {     HookEvent("post_inventory_application", OnPostInventoryApplication); } public OnPostInventoryApplication(Handle:hEvent, const String:szName[], bool:bDontBroadcast) {     new client = GetClientOfUserId(GetEventInt(hEvent, "userid"));     new weaponMelee = GetPlayerWeaponSlot(client, TFWeaponSlot_Melee);                           if (weaponMelee != INVALID_ENT_REFERENCE && GetEntProp(weaponMelee, Prop_Send, "m_iItemDefinitionIndex") == DEFIDX_ATOMIZER)     {         TF2_RemoveWeaponSlot(client, TFWeaponSlot_Melee);         PrintToChat(client, "The Atomizer is blocked on this server.");     } }
psychonic is offline
Drixevel
AlliedModders Donor
Join Date: Sep 2009
Location: Somewhere headbangin'
Old 04-17-2013 , 11:30   Re: [TF2] Disable Atomizer
Reply With Quote #5

Quote:
Originally Posted by psychonic View Post
Rather than constantly checking in a short, repeating timer callback, I believe that the post_inventory_application event fires for any case where the player is given weapons.

Code:
#include <sourcemod> #include <sdktools> #include <tf2_stocks> new const DEFIDX_ATOMIZER = 450; public OnPluginStart() { HookEvent("post_inventory_application", OnPostInventoryApplication); } public OnPostInventoryApplication(Handle:hEvent, const String:szName[], bool:bDontBroadcast) { new client = GetClientOfUserId(GetEventInt(hEvent, "userid")); new weaponMelee = GetPlayerWeaponSlot(client, TFWeaponSlot_Melee); if (weaponMelee != INVALID_ENT_REFERENCE && GetEntProp(weaponMelee, Prop_Send, "m_iItemDefinitionIndex") == DEFIDX_ATOMIZER) { TF2_RemoveWeaponSlot(client, TFWeaponSlot_Melee); PrintToChat(client, "The Atomizer is blocked on this server."); } }
That's useful. Thanks for the tip.

- Jack
Drixevel 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:11.


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