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

dmg molotov


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
szogun
Senior Member
Join Date: Apr 2016
Old 02-12-2019 , 11:22   dmg molotov
Reply With Quote #1

I have a little problem with the plugin that asks dmg after entering molotova from his team

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

#define PLUGIN_AUTHOR "f0re4ch"
#define PLUGIN_VERSION "1.0"

public Plugin:myinfo =
{
    
name "Competitive Anti-FF",
    
author PLUGIN_AUTHOR,
    
description "Protects Players from Friendly-Fire but enable molotov damage",
    
version PLUGIN_VERSION,
    
url "http://kpservidores.com"
};

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

public 
Action OnTakeDamage(int victimint &attackerint &inflictorfloat &damageint &damagetypeint &weaponfloat damageForce[3], float damagePosition[3]&#65279;)
{
    
int attackerUserId attacker;
    
int victimUserId victim;

    
char WeaponCallBack[32];
    
GetEdictClassname(inflictorWeaponCallBacksizeof(WeaponCallBack));

    if ((!
IsValidEntity(victimUserId)) || (!IsValidEntity(attackerUserId)))
        return 
Plugin_Continue;

    if ((
strlen(WeaponCallBack) <= 0) || (attackerUserId == victimUserId) || (GetClientTeam(victimUserId) != GetClientTeam(attackerUserId)) )
        return 
Plugin_Continue;

    if (
StrEqual(WeaponCallBack"inferno"false))
        return 
Plugin_Continue;

    return 
Plugin_Handled;

Quote:
[SM] Exception reported: Client index 306 is invalid
[SM] Blaming: no_ff_molotov.smx
[SM] Call stack trace:
[SM] [0] GetClientTeam
[SM] [1] Line 21, no_ff_molotov.sp::OnTakeDamage
[SM] Exception reported: Client index 306 is invalid
szogun is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 02-12-2019 , 11:53   Re: dmg molotov
Reply With Quote #2

PHP Code:

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

public OnClientPutInServer(int client

    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage); 


public 
Action OnTakeDamage(int victimint &attackerint &inflictorfloat &damageint &damagetypeint &weaponfloat damageForce[3], float damagePosition[3]) 
{
    if (
attacker == victim)
    {
        return 
Plugin_Continue// do self damage
    
}
    
    if (
inflictor != -1// if there are no inflictors, this should be -1, you can remove it if the damage in molotov doesnt work
    
{
        
char weaponName[32]; 
        
GetEdictClassname(inflictorweaponNamesizeof(weaponName)); 
        
        if (
StrEqual(weaponName"inferno"false))
        {
            return 
Plugin_Continue// do damage in molotov
        
}
    }
    
    if (
IsValidClient(victim))
    {
        if (
IsValidClient(attacker))
        {
            if (
GetClientTeam(attacker) == GetClientTeam(victim))
            {
                return 
Plugin_Handled// stop friendly fire, except molotovs
            
}
        }
    }
    
    return 
Plugin_Continue
}

bool IsValidClient(int client)
{
    if (
client || client MaxClients)
    {
        return 
false;
    }
    
    return 
IsClientInGame(client);

__________________
Ilusion9 is offline
Ejziponken
AlliedModders Donor
Join Date: Apr 2008
Old 11-14-2019 , 15:38   Re: dmg molotov
Reply With Quote #3

Quote:
Originally Posted by Ilusion9 View Post
PHP Code:

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

public OnClientPutInServer(int client

    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage); 


public 
Action OnTakeDamage(int victimint &attackerint &inflictorfloat &damageint &damagetypeint &weaponfloat damageForce[3], float damagePosition[3]) 
{
    if (
attacker == victim)
    {
        return 
Plugin_Continue// do self damage
    
}
    
    if (
inflictor != -1// if there are no inflictors, this should be -1, you can remove it if the damage in molotov doesnt work
    
{
        
char weaponName[32]; 
        
GetEdictClassname(inflictorweaponNamesizeof(weaponName)); 
        
        if (
StrEqual(weaponName"inferno"false))
        {
            return 
Plugin_Continue// do damage in molotov
        
}
    }
    
    if (
IsValidClient(victim))
    {
        if (
IsValidClient(attacker))
        {
            if (
GetClientTeam(attacker) == GetClientTeam(victim))
            {
                return 
Plugin_Handled// stop friendly fire, except molotovs
            
}
        }
    }
    
    return 
Plugin_Continue
}

bool IsValidClient(int client)
{
    if (
client || client MaxClients)
    {
        return 
false;
    }
    
    return 
IsClientInGame(client);

Cant make this work. If I sett FF on, then team can kill eachother and if I set it off, then molotovs dont do damage.
Ejziponken is offline
paulo_crash
AlliedModders Donor
Join Date: May 2016
Location: Brazil
Old 02-06-2020 , 09:17   Re: dmg molotov
Reply With Quote #4

Quote:
Originally Posted by Ilusion9 View Post
PHP Code:

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

public OnClientPutInServer(int client

    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage); 


public 
Action OnTakeDamage(int victimint &attackerint &inflictorfloat &damageint &damagetypeint &weaponfloat damageForce[3], float damagePosition[3]) 
{
    if (
attacker == victim)
    {
        return 
Plugin_Continue// do self damage
    
}
    
    if (
inflictor != -1// if there are no inflictors, this should be -1, you can remove it if the damage in molotov doesnt work
    
{
        
char weaponName[32]; 
        
GetEdictClassname(inflictorweaponNamesizeof(weaponName)); 
        
        if (
StrEqual(weaponName"inferno"false))
        {
            return 
Plugin_Continue// do damage in molotov
        
}
    }
    
    if (
IsValidClient(victim))
    {
        if (
IsValidClient(attacker))
        {
            if (
GetClientTeam(attacker) == GetClientTeam(victim))
            {
                return 
Plugin_Handled// stop friendly fire, except molotovs
            
}
        }
    }
    
    return 
Plugin_Continue
}

bool IsValidClient(int client)
{
    if (
client || client MaxClients)
    {
        return 
false;
    }
    
    return 
IsClientInGame(client);

I will be doing the test with this version, but from what I could see it is only with molotovs.

Someone would have one that does damage with all the grenades in the game, except the shot.

I tried this, but same problem, except that apparently I realized that the explosion of the C4 is not keeping players...

https://forums.alliedmods.net/showthread.php?t=301081
paulo_crash 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 17:15.


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