AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Stopping sticky damage plugin failing to work (https://forums.alliedmods.net/showthread.php?t=141507)

iSimon 10-24-2010 19:50

Stopping sticky damage plugin failing to work
 
The plugin has no errors when compiling, but fails once tested. Damage doesnt change.

The plugin is to make it so stickybombs do not do damage. (for jumping im guessing)

Can you guys spot anything wrong?

Requires sdkhooks

PHP Code:

#include <sourcemod>
#include <sdkhooks>
 
public Plugin:myinfo =
{
    
name "Stickybomb Damage Blocker",
    
author "iSimon",
    
description "Stop's Demoman Stickybomb Damage",
    
version "1.0.0.0",
    
url "http://www.sourcemod.net/"
};

new 
Handle:sm_stopsticky_damage INVALID_HANDLE

public OnPluginStart()
{
    
sm_stopsticky_damage CreateConVar("sm_stopsticky_damage""0""No sticky damage")
    
AutoExecConfig(true"plugin_stopsticky")
}

public 
OnClientPutInServer(client)
{
    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage);
}

public 
Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
{
    if (
GetConVarBool(sm_stopsticky_damage))
    {
        return 
Plugin_Continue;
    }
    
decl String:sWeapon[32];
    
GetEdictClassname(inflictorsWeaponsizeof(sWeapon));
    
    if(
StrEqual(sWeapon"tf_weapon_pipebomblauncher"))
    {
        
damage 0.0;
        return 
Plugin_Changed;
    }
    
    return 
Plugin_Continue;



iSimon 10-24-2010 19:55

Re: Stopping sticky damage plugin failing to work
 
If someone could please move this out of the AMX section, i'd appreciate it

DarthNinja 10-24-2010 19:55

Re: Stopping sticky damage plugin failing to work
 
PHP Code:

#include <sourcemod>
#include <sdkhooks>
 
public Plugin:myinfo =
{
    
name "Stickybomb Damage Blocker",
    
author "iSimon",
    
description "Prevents Demoman Stickybomb Damage",
    
version "1.0.0.0",
    
url "http://www.sourcemod.net/"
};

new 
Handle:vEnable INVALID_HANDLE

public OnPluginStart()
{
    
vEnable CreateConVar("sm_stopsticky_damage""0""No sticky damage")
}

public 
OnClientPutInServer(client)
{
    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage);
}

public 
Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
{
    if (!
GetConVarBool(vEnable))
    {
        return 
Plugin_Continue;
    }
    
decl String:sWeapon[32];
    
GetEdictClassname(inflictorsWeaponsizeof(sWeapon));
    
    if(
StrEqual(sWeapon"tf_weapon_pipebomblauncher"))
    {
        
//damage = 0.0;
        
return Plugin_Handled;
    }
    
    return 
Plugin_Continue;


Also:
Code:

[21:27] <@psychonic> inflictor would be the sticky
[21:27] <@psychonic> not the sticky launcher


iSimon 10-25-2010 07:02

Re: Stopping sticky damage plugin failing to work
 
Ahh so it's the wrong weapon, I see.

I'll try when I get home from school

tigerox 10-25-2010 14:49

Re: Stopping sticky damage plugin failing to work
 
Instead of hooking OnTakeDamage for each client, just look at the sticky bombs.

This should work.

PHP Code:

#include <sourcemod>
#include <sdkhooks>
 
public Plugin:myinfo =
{
    
name "Stickybomb Damage Blocker",
    
author "iSimon",
    
description "Prevents Demoman Stickybomb Damage",
    
version "1.0.0.0",
    
url "http://www.sourcemod.net/"
};

new 
Handle:vEnable INVALID_HANDLE

public OnPluginStart()
{
    
vEnable CreateConVar("sm_stopsticky_damage""0""No sticky damage")
}

public 
OnEntityCreated(iSticky, const String:classname[])
{
    if(
GetConVarBool(vEnable) && StrEqual(classname"tf_projectile_pipe_remote"))
    {
        
SDKHook(iStickySDKHook_StartTouchStickyTouch);
    }
    
}

public 
StickyTouch(iSticky)
{
    
SetEntPropFloat(iStickyProp_Send"m_flDamage"0.0);



iSimon 10-26-2010 22:43

Re: Stopping sticky damage plugin failing to work
 
Thank you for the assistance, ive fixed things up


All times are GMT -4. The time now is 13:36.

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