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

AWP -X hp on every shot


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
nguyenbaodanh
AlliedModders Donor
Join Date: Jun 2007
Location: HCMC, Vietnam
Old 03-20-2021 , 10:02   AWP -X hp on every shot
Reply With Quote #1

Hello!
It's me again, can someone make a quick plugin that will -X hp on every shot a player use AWP ?
Thanks alot
__________________
nguyenbaodanh is offline
iFusion
Junior Member
Join Date: Oct 2018
Old 03-20-2021 , 11:48   Re: AWP -X hp on every shot
Reply With Quote #2

not tested, but it should work.

you can set the damage on line 8
PHP Code:
#define DamagePlayer 10.0 
PHP Code:
#include <sourcemod>
#include <sdkhooks>
#include <cstrike>

#pragma semicolon 1
#pragma newdecls required

#define DamagePlayer 10.0

public void OnPluginStart()
{
    
HookEvent("weapon_fire"weapon_fire);
}

public 
Action weapon_fire(Handle event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(GetEventInt(event"userid"));
    
char weapon[32];
    
GetEventString(event"weapon"weaponsizeof(weapon));
    
    if(
StrEqual(weapon"weapon_awp"))
    {
        
SDKHooks_TakeDamage(clientclientclientDamagePlayer);
    }


Last edited by iFusion; 03-21-2021 at 11:34.
iFusion is offline
nguyenbaodanh
AlliedModders Donor
Join Date: Jun 2007
Location: HCMC, Vietnam
Old 03-21-2021 , 02:40   Re: AWP -X hp on every shot
Reply With Quote #3

Quote:
Originally Posted by iFusion View Post
not tested, but it should work.

you can set the damage on line 8
PHP Code:
#define DamagePlayer 10.0 
PHP Code:
#include <sourcemod>
#include <sdkhooks>
#include <cstrike>

#pragma semicolon 1
#pragma newdecls required

#define DamagePlayer 10.0

public void OnPluginStart()
{
    
HookEvent("weapon_fire"weapon_fire);
}

public 
Action weapon_fire(Handle event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(GetEventInt(event"userid"));
    
char weapon[32];
    
GetEventString(event"weapon"weaponsizeof(weapon));
    
    if(
StrEqual(weapon"awp"))
    {
        
SDKHooks_TakeDamage(clientclientclientDamagePlayer);
    }

thank you alot! will try this soon when I'm online
__________________
nguyenbaodanh is offline
nguyenbaodanh
AlliedModders Donor
Join Date: Jun 2007
Location: HCMC, Vietnam
Old 03-21-2021 , 07:47   Re: AWP -X hp on every shot
Reply With Quote #4

not work! plugin not take apwers hp on shot
__________________
nguyenbaodanh is offline
iFusion
Junior Member
Join Date: Oct 2018
Old 03-21-2021 , 11:29   Re: AWP -X hp on every shot
Reply With Quote #5

Fixed and tested.

Its working.

PHP Code:
#include <sourcemod>
#include <sdkhooks>
#include <cstrike>

#pragma semicolon 1
#pragma newdecls required

#define DamagePlayer 10.0

public void OnPluginStart()
{
    
HookEvent("weapon_fire"weapon_fire);
}

public 
Action weapon_fire(Handle event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(GetEventInt(event"userid"));
    
char weapon[32];
    
GetEventString(event"weapon"weaponsizeof(weapon));
    
    if(
StrEqual(weapon"weapon_awp"))
    {
        
SDKHooks_TakeDamage(clientclientclientDamagePlayer);
    }

iFusion is offline
Teamkiller324
Senior Member
Join Date: Feb 2014
Location: Earth
Old 03-23-2021 , 10:35   Re: AWP -X hp on every shot
Reply With Quote #6

PHP Code:

public Action weapon_fire(Handle event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(GetEventInt(event"userid"));
    
char weapon[32];
    
GetEventString(event"weapon"weaponsizeof(weapon));
    
    if(
StrEqual(weapon"weapon_awp"))
    {
        
SDKHooks_TakeDamage(clientclientclientDamagePlayer);
    }

could be in newer syntax although :

PHP Code:

Action weapon_fire
(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(event.GetInt("userid"));
    
char weapon[32];
    
event.GetString("weapon"weaponsizeof(weapon));
    
    if(
StrEqual(weapon"weapon_awp"))
    {
        
SDKHooks_TakeDamage(clientclientclientDamagePlayer);
    }

__________________
Teamkiller324 is offline
nguyenbaodanh
AlliedModders Donor
Join Date: Jun 2007
Location: HCMC, Vietnam
Old 03-24-2021 , 12:25   Re: AWP -X hp on every shot
Reply With Quote #7

thanks its working good now.
but I set 6hp, plugin only took 4hp . idk why :) whatever ! it work !
__________________
nguyenbaodanh is offline
iFusion
Junior Member
Join Date: Oct 2018
Old 03-24-2021 , 13:41   Re: AWP -X hp on every shot
Reply With Quote #8

make sure line 8 looks like this:

PHP Code:
#define DamagePlayer 6.0 
iFusion is offline
Reply


Thread Tools
Display Modes

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:04.


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