AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   AWP -X hp on every shot (https://forums.alliedmods.net/showthread.php?t=331416)

nguyenbaodanh 03-20-2021 10:02

AWP -X hp on every shot
 
Hello!
It's me again, can someone make a quick plugin that will -X hp on every shot a player use AWP ?
Thanks alot

iFusion 03-20-2021 11:48

Re: AWP -X hp on every shot
 
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);
    }



nguyenbaodanh 03-21-2021 02:40

Re: AWP -X hp on every shot
 
Quote:

Originally Posted by iFusion (Post 2741051)
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 03-21-2021 07:47

Re: AWP -X hp on every shot
 
not work! plugin not take apwers hp on shot

iFusion 03-21-2021 11:29

Re: AWP -X hp on every shot
 
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);
    }



Teamkiller324 03-23-2021 10:35

Re: AWP -X hp on every shot
 
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);
    }



nguyenbaodanh 03-24-2021 12:25

Re: AWP -X hp on every shot
 
thanks its working good now.
but I set 6hp, plugin only took 4hp . idk why ::)) whatever ! it work !

iFusion 03-24-2021 13:41

Re: AWP -X hp on every shot
 
make sure line 8 looks like this:

PHP Code:

#define DamagePlayer 6.0 



All times are GMT -4. The time now is 06:08.

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