Raised This Month: $32 Target: $400
 8% 

Solved [L4D & L4D2] No Friendly Fire Issue


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 10-07-2017 , 19:58   [L4D & L4D2] No Friendly Fire Issue
Reply With Quote #1

I need help with this:

PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdkhooks>
#define PLUGIN_VERSION "1.0"

public Plugin:myinfo =
{
    
name "[L4D & L4D2] No Friendly Fire",
    
author "Psykotik",
    
description "Disables friendly fire.",
    
version PLUGIN_VERSION,
    
url "www.sourcemod.net"
}

new 
Handle:pFF;
new 
Handle:pFFF;

public 
OnPluginStart()
{
    
CreateConVar("l4d_friendlyfire_version"PLUGIN_VERSION"Plugin version");
    
pFF CreateConVar("l4d_friendlyfire""0""Enable friendly fire? 0 = Off, 1 = On");
    
pFFF CreateConVar("l4d_friendlyfire_from_fire""0""Enable friendly fire from fire sources? 0 = Off, 1 = On");
    
AutoExecConfig(true"l4d_nofriendlyfire");
}

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

public 
OnClientDisconnect(client)
{
    if (
client && IsClientInGame(client)) SDKUnhook(clientSDKHook_OnTakeDamageOnTakeDamage);
}

public 
Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
{
    if (
victim && attacker && GetClientTeam(attacker) == && GetClientTeam(victim) == 2)
    {
        if (
GetConVarInt(pFF) == || GetConVarInt(pFFF) == && (damagetype == || damagetype == 2056 || damagetype == 268435464))
        {
            
damage 0.0;
            return 
Plugin_Changed;
        }
    }

    return 
Plugin_Continue;

It functions as intended but I get these errors in my logs whenever I throw a molotov on the ground around the survivor bots:
Spoiler



I don't know if I would get the same errors if I throw a molotov at other human players though.
__________________

Last edited by Psyk0tik; 10-22-2017 at 11:23. Reason: Removed attachment and marked thread as [Solved].
Psyk0tik is offline
 


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 03:22.


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