Raised This Month: $32 Target: $400
 8% 

[tf2] disable weapon damage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Neon123
Senior Member
Join Date: Jan 2016
Old 09-24-2017 , 21:49   [tf2] disable weapon damage
Reply With Quote #1

hi , i need to disable damage for all weapons in the "pipeball_" maps tf2 , only weapon damage , not entity or another damage please i need this

Last edited by Neon123; 09-24-2017 at 23:27.
Neon123 is offline
ThatKidWhoGames
Veteran Member
Join Date: Jun 2013
Location: IsValidClient()
Old 09-29-2017 , 10:30   Re: [tf2] disable weapon damage
Reply With Quote #2

PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdkhooks>

#define PLUGIN_VERSION "1.0"

ConVar cv_Enabled;
bool bEnabled;

public 
Plugin myinfo 
{
    
name        "Disable Weapon Damage",
    
author      "Sgt. Gremulock",
    
description "Look at the title.",
    
version     PLUGIN_VERSION,
    
url         "sourcemod.net"
};

public 
void OnPluginStart()
{
    
CreateConVar("sm_nowepdamage_version"PLUGIN_VERSION"Plugin's version."FCVAR_REPLICATED|FCVAR_NOTIFY);
    
cv_Enabled CreateConVar("sm_nowepdamage_enabled""1""Enable/disable the plugin."_true0.0true1.0);
    
    
bEnabled cv_Enabled.BoolValue;
    
    
HookConVarChange(cv_EnabledCvarUpdate);
    
    
AutoExecConfig(true);
}

public 
void CvarUpdate(ConVar cvar, const char[] oldValue, const char[] newValue)
{
    
bEnabled cv_Enabled.BoolValue;
}

public 
void OnClientPostAdminCheck(int client)
{
    if (
bEnabled)
    {
        
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage);
    }
}

public 
Action OnTakeDamage(int victimint &attackerint &inflictorfloat &damageint &damagetype)
{
    if (
bEnabled)
    {
        if (
IsValidClient(victim) && IsValidClient(attacker))
        {
            
char name[MAX_NAME_LENGTH];
            new 
weapon GetEntProp(attackerProp_Send"m_hActiveWeapon");
            
GetEntityClassname(weaponnamesizeof(name));
            
            if (
StrContains(name"weapon"))
            {
                
damage 0.0;
                
                return 
Plugin_Changed;
            }
        }
    }
    
    return 
Plugin_Continue;
}

bool IsValidClient(int clientbool nobots true)
{
    if (
client <= || client MaxClients || !IsClientConnected(client) || (nobots && IsFakeClient(client)))
    {
        return 
false
    }
    
    return 
IsClientInGame(client); 

ThatKidWhoGames is offline
Neon123
Senior Member
Join Date: Jan 2016
Old 10-02-2017 , 18:15   Re: [tf2] disable weapon damage
Reply With Quote #3

thanks
Neon123 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 20:10.


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