AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [CS:GO] Blocking Friendly Fire, Enable Molotov/Ince damage for Retakes/5v5 (https://forums.alliedmods.net/showthread.php?t=320656)

abhishek_deshkar 01-02-2020 04:18

[CS:GO] Blocking Friendly Fire, Enable Molotov/Ince damage for Retakes/5v5
 
1 Attachment(s)
This plugin blocks Friendlyfire but enables incendiary/molotove damage to teammates. You might want to use this plugin for retakes.

NOTE: You don't need to change/set cvars to enable this plugin.

Installation
  1. Download and compile the latest source.
  2. Place .smx in addons/sourcemod/plugins

After installation, teammates will take only molotov/incendiary damage.

pandd 01-02-2020 06:07

Re: [CS:GO] Blocking Friendly Fire, Enable Molotov/Ince damage for Retakes/5v5
 
C4 is harmless and unbalanced

abhishek_deshkar 01-02-2020 08:41

Re: [CS:GO] Blocking Friendly Fire, Enable Molotov/Ince damage for Retakes/5v5
 
Quote:

Originally Posted by pandd (Post 2678742)
C4 is harmless and unbalanced

Fixed C4 damage. Please let me know if you find any bug.

Ilusion9 01-02-2020 12:03

Re: [CS:GO] Blocking Friendly Fire, Enable Molotov/Ince damage for Retakes/5v5
 
Never send a command in OnPluginStart function.

PHP Code:


#include <sourcemod>
#include <sdkhooks>

public Plugin myinfo = {
    
name "Enable FF Molotov/Inc only Damage",
    
author "Abhishek Deshkar",
    
description "This plugin blocks Friendlyfire but enables incendiary/molotove damage to teammates.",
    
version "1.6",
    
url "https://www.facebook.com/abhi.pro"
};

ConVar g_Cvar_FriendlyFire;

public 
void OnPluginStart()
{
    
g_Cvar_FriendlyFire FindConVar("mp_friendlyfire");
}

public 
void OnConfigsExecured()
{
    
g_Cvar_FriendlyFire.SetInt(1);
}

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

public 
Action OnTakeDamage(int victimint &attackerint &inflictorfloat &damageint &damagetypeint &weaponfloat damageForce[3], float damagePosition[3])
{
    if (
attacker || attacker MaxClients || attacker == victim || attacker == inflictor || weapon 1)
    {
        return 
Plugin_Continue;
    }
    
    if (
GetClientTeam(victim) == GetClientTeam(attacker))
    {
        return 
Plugin_Handled;
    }
    
    return 
Plugin_Continue;


Try this, I've simplified your code.

abhishek_deshkar 01-02-2020 23:19

Re: [CS:GO] Blocking Friendly Fire, Enable Molotov/Ince damage for Retakes/5v5
 
Quote:

Originally Posted by Ilusion9 (Post 2678782)
Never send a command in OnPluginStart function.

PHP Code:


#include <sourcemod>
#include <sdkhooks>

public Plugin myinfo = {
    
name "Enable FF Molotov/Inc only Damage",
    
author "Abhishek Deshkar",
    
description "This plugin blocks Friendlyfire but enables incendiary/molotove damage to teammates.",
    
version "1.6",
    
url "https://www.facebook.com/abhi.pro"
};

ConVar g_Cvar_FriendlyFire;

public 
void OnPluginStart()
{
    
g_Cvar_FriendlyFire FindConVar("mp_friendlyfire");
}

public 
void OnConfigsExecured()
{
    
g_Cvar_FriendlyFire.SetInt(1);
}

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

public 
Action OnTakeDamage(int victimint &attackerint &inflictorfloat &damageint &damagetypeint &weaponfloat damageForce[3], float damagePosition[3])
{
    if (
attacker || attacker MaxClients || attacker == victim || attacker == inflictor || weapon 1)
    {
        return 
Plugin_Continue;
    }
    
    if (
GetClientTeam(victim) == GetClientTeam(attacker))
    {
        return 
Plugin_Handled;
    }
    
    return 
Plugin_Continue;


Try this, I've simplified your code.


Thanks for the optimizing plugin. I've updated it.

GTAmama16 01-04-2020 04:10

Re: [CS:GO] Blocking Friendly Fire, Enable Molotov/Ince damage for Retakes/5v5
 
weird, im still not taking dmg from a friendly molotov, do i need to set the mp_friendlyfire to 1 in the server.cfg?

Ilusion9 01-04-2020 06:50

Re: [CS:GO] Blocking Friendly Fire, Enable Molotov/Ince damage for Retakes/5v5
 
Quote:

Originally Posted by GTAmama16 (Post 2678918)
weird, im still not taking dmg from a friendly molotov, do i need to set the mp_friendlyfire to 1 in the server.cfg?

No.
I haven't tested this plugin, but maybe the condition (attacker == inflictor) it's not enough to check if the damage was done by a molotov.

GTAmama16 01-04-2020 08:43

Re: [CS:GO] Blocking Friendly Fire, Enable Molotov/Ince damage for Retakes/5v5
 
Quote:

Originally Posted by Ilusion9 (Post 2678926)
No.
I haven't tested this plugin, but maybe the condition (attacker == inflictor) it's not enough to check if the damage was done by a molotov.

yeah i have tried both FF on 1 and 0, the plugin is not working, no error msg showed either

Ejziponken 01-04-2020 21:05

Re: [CS:GO] Blocking Friendly Fire, Enable Molotov/Ince damage for Retakes/5v5
 
Gah, this is the 3rd plugin I test for this and none of them working (I havent confirmed the one in this thread tho, just reading the comments).

Ilusion9 01-05-2020 09:04

Re: [CS:GO] Blocking Friendly Fire, Enable Molotov/Ince damage for Retakes/5v5
 
Even with friendlyfire on 1, you must set ff_ cvars right:

PHP Code:


mp_friendlyfire 1
ff_damage_reduction_bullets 0.33
ff_damage_reduction_grenade 0.85
ff_damage_reduction_grenade_self 1
ff_damage_reduction_other 0.4 

Plugin tested and works correctly:
PHP Code:

#include <sourcemod>
#include <sdkhooks>

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

public 
Action OnTakeDamage(int victimint &attackerint &inflictorfloat &damageint &damagetypeint &weaponfloat damageForce[3], float damagePosition[3])
{
    
// Invalid attacker or self damage
    
if (attacker || attacker MaxClients || attacker == victim || inflictor 1)
    {
        return 
Plugin_Continue;
    }
    
    
// Frienly fire
    
if (GetClientTeam(attacker) == GetClientTeam(victim))
    {
        
char inflictorClass[64];
        if (
GetEdictClassname(inflictorinflictorClasssizeof(inflictorClass)))
        {
            
// C4 damage
            
if (StrEqual(inflictorClass"planted_c4"))
            {
                return 
Plugin_Continue;
            }
            
            
// Incendiary damage
            
if (StrEqual(inflictorClass"inferno"))
            {
                return 
Plugin_Continue;
            }
        }
        
        return 
Plugin_Handled;
    }
    
    return 
Plugin_Continue;


Also, you should check mp_tkpunish and mp_autokick cvars.


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

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