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

dmg molotov


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
szogun
Senior Member
Join Date: Apr 2016
Old 02-12-2019 , 12: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 online now
Ilusion9
Senior Member
Join Date: Jun 2018
Location: Romania
Old 02-12-2019 , 12: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 online now
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 15:39.


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