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

Modify Weapon Damage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
HeZ
Junior Member
Join Date: Aug 2010
Old 08-14-2010 , 14:09   Modify Weapon Damage
Reply With Quote #1

Hi
I am new to the sourcepawn scene, i have a pretty strong c/cpp background so i'm picking the language up pretty quick.
But i am trying to write a code to modify the base damage of the knife (or any weapon for that matter) and I am absolutely stumped i have no idea what to do
Can any1 help put me in the right direction please?

Thanks in advance
HeZ
HeZ is offline
Monkeys
Veteran Member
Join Date: Jan 2010
Old 08-14-2010 , 14:12   Re: Modify Weapon Damage
Reply With Quote #2

There are convars for that, I believe. No need to write a plugin at all.
__________________
Get a lid on that zombie,
he's never gonna be alri-i-ight.
Oooh get a lid on that zombie,
or he's gonna feed all night.
Monkeys is offline
HeZ
Junior Member
Join Date: Aug 2010
Old 08-14-2010 , 14:15   Re: Modify Weapon Damage
Reply With Quote #3

Ooh how convenient
Would you happen to know where i can find a list of such convars?
HeZ is offline
Monkeys
Veteran Member
Join Date: Jan 2010
Old 08-14-2010 , 14:25   Re: Modify Weapon Damage
Reply With Quote #4

Not sure where to find the list for CSS exclusively.
The command will most likely be in lines of
sk_plr_dmg_knife
Just look around in your console
__________________
Get a lid on that zombie,
he's never gonna be alri-i-ight.
Oooh get a lid on that zombie,
or he's gonna feed all night.
Monkeys is offline
thetwistedpanda
Good Little Panda
Join Date: Sep 2008
Old 08-14-2010 , 14:40   Re: Modify Weapon Damage
Reply With Quote #5

To change damage in CS:S you'll need to modify the damage on player_hurt or use SDKHooks OnTakeDamage, there are no cvars.
__________________
thetwistedpanda is offline
Monkeys
Veteran Member
Join Date: Jan 2010
Old 08-14-2010 , 14:47   Re: Modify Weapon Damage
Reply With Quote #6

Quote:
Originally Posted by thetwistedpanda View Post
To change damage in CS:S you'll need to modify the damage on player_hurt or use SDKHooks OnTakeDamage, there are no cvars.
Wow, CSS sucks. :p

Well, if what he says is true, you'll need to learn to work with SDKHooks.
__________________
Get a lid on that zombie,
he's never gonna be alri-i-ight.
Oooh get a lid on that zombie,
or he's gonna feed all night.
Monkeys is offline
atom0s
Senior Member
Join Date: Jul 2009
Old 08-14-2010 , 15:26   Re: Modify Weapon Damage
Reply With Quote #7

I did this for instant kills for an achimevent server I setup a while back to get them done fast lol. This makes all guns 1 hit kill, but you can modify it to only effect knives based on client info and event info:

PHP Code:
/**
 * Instant Kills.sp - (c) 2010 atom0s
 * SourceMod plugin for SourceMod v1.3.1 or higher.
 * This plugin requires SDKHooks.
 */
#pragma semicolon 1

#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

/**
 * Plugin Version
 */
#define PLUGIN_VERSION "1.0.0"

/**
 * Plugin Infomation Struct
 */
public Plugin:myinfo = {
    
name         "Instant Kills,
    author         = "
atom0s",
    description = "
Implements one hit kills for non-bot players.",
    version     = PLUGIN_VERSION,
    url         = "
N/A"
};

/**
 * Plugin Start Event
 */
public OnPluginStart( )
{
    // Create Version Cvar
    CreateConVar( "
doubledamage_version", PLUGIN_VERSION, "Double Damage Bullets (by atom0sversion.", FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD );
}

/**
 * Player Load Event
 */
public OnClientPutInServer(client)
{
    if( IsFakeClient( client ) )
    {
        SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
    }
}

/**
 * Player Hurt Event
 */
public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
{
    damage = 255.0;
    return Plugin_Changed;

atom0s is offline
HeZ
Junior Member
Join Date: Aug 2010
Old 08-16-2010 , 23:37   Re: Modify Weapon Damage
Reply With Quote #8

Cool that helps heaps how would i find what weapon and what attack style the damage is done with?
Say i want terrorists to have a one hit kill knife slash

public Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
{
if (GetClientTeam(attacker) == 2 && <weapon is knife left click>)
{
damage = 255.0;
}
return Plugin_Changed;
}

This has something to do with &inflictor and &damagetype?

also sorry for the noob questions, i have only just started learning.. but what does the & mean in front of the parameters??
HeZ is offline
Leonardo
Veteran Member
Join Date: Feb 2010
Location: 90's
Old 08-17-2010 , 03:22   Re: Modify Weapon Damage
Reply With Quote #9

<weapon is knife left click>? lol
__________________
Leonardo is offline
HeZ
Junior Member
Join Date: Aug 2010
Old 08-17-2010 , 05:20   Re: Modify Weapon Damage
Reply With Quote #10

yea.. what doesnt make sense with that? i guess knife slash is dependant on how you set your controls but left click is default so yeah.

if the two conditions of attacker team is terrorist and the weapon used is the knife slash then execute the if block..
now that i look at it i see the plugin_changed should be within the if block and i then need an else block with something that returns default damage for whatever wepon was used.. plugin_handled will block damage done will it?

but anywhay what my actual question was was how do i find what weapon and what attack style was used?

thanks
HeZ
HeZ 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 16:49.


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