Raised This Month: $ Target: $400
 0% 

Kills per second/ friendly mode


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
PointlessFish
Junior Member
Join Date: Feb 2016
Old 02-16-2016 , 06:47   Kills per second/ friendly mode
Reply With Quote #1

Hello!

I am trying to combine Dreamy's kBans plugin with the Friendly Mode plugin.
The source of the kBans plugin https://forums.alliedmods.net/showthread.php?t=180217 has this
PHP Code:
#pragma semicolon 1
#include <sourcemod>

#undef REQUIRE_PLUGIN
#include <sourcebans>

#define PLUGIN_VERSION            "1.4"
#define PLUGIN_DESCRIPTION        "Bans a player if he does [n] amount of kills in [n] seconds"

new bool:k_SBans;
new 
kCount[MAXPLAYERS+1];
new 
kFirstKill[MAXPLAYERS+1];

new    
Handle:kvar_Kills INVALID_HANDLE,
    
Handle:kvar_Time INVALID_HANDLE,
    
Handle:kvar_Ban INVALID_HANDLE,
    
Handle:kvar_Text INVALID_HANDLE,
    
Handle:kvar_Bots INVALID_HANDLE;

public 
Plugin:myinfo =
{
    
name         =    "kBans",
    
author        =    "Dreamy",
    
description    =    PLUGIN_DESCRIPTION,
    
version        =    PLUGIN_VERSION,
    
url            =    "http://SourceMod.net"
};

public 
OnPluginStart()
{
    
CreateConVar("kBans_version"PLUGIN_VERSION"kBans Version"FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD);
    
kvar_Kills CreateConVar("kBans_kills""12""Amount of kills players are not allowed to do in [n] seconds"FCVAR_PLUGINtrue1.0);
    
kvar_Time CreateConVar("kBans_interval""40""In which interval players are not allowed to do [n] kills"FCVAR_PLUGINtrue0.0);
    
kvar_Ban CreateConVar("kBans_bantime""0""0 = Permban, >0 = Time in minutes"FCVAR_PLUGINtrue0.0);
    
kvar_Text CreateConVar("kBans_reason""[kBans]: Suspicion of Cheating""If you are/are not using sourcebans = Log Reason in your database/ Kick Message showed to player"FCVAR_PLUGIN);
    
kvar_Bots CreateConVar("kBans_bots""0""1/0 = Bots are treated/not treated as human players"FCVAR_PLUGINtrue0.0true1.0);
    
AutoExecConfig();
    
    
HookEvent("player_death"Event_PlayerDeath);
}

public 
Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    
decl String:weapon[16];
    
GetEventString(event"weapon"weaponsizeof(weapon));
    new 
victim GetClientOfUserId(GetEventInt(event"userid"));
    new 
client GetClientOfUserId(GetEventInt(event"attacker"));
    if (!
client || (client == victim) || StrEqual(weapon"hegrenade") || IsFakeClient(client))
        return;
    
    if (!
GetConVarBool(kvar_Bots) && IsFakeClient(victim))
        return;
    
    new 
time GetTime();
    
    if ((
kFirstKill[client]+GetConVarInt(kvar_Time)) >= time)
    {
        if (++
kCount[client] == GetConVarInt(kvar_Kills))
        {        
            
decl String:auth[32];
            
GetClientAuthString(clientauthsizeof(auth));

            
decl String:reason[128];
            
GetConVarString(kvar_Textreasonsizeof(reason));
            
            if (
k_SBans)
                
SBBanPlayer(0clientGetConVarInt(kvar_Ban), reason);
            else
            {
                
LogMessage("The player %N (%s) was banned for suspicion of cheating."clientauth);
                
BanClient(clientGetConVarInt(kvar_Ban), BANFLAG_AUTHID"kBans"reason"kBan"client);
            }
        }
    }
    else
    {
        
kCount[client] = 1;
        
kFirstKill[client] = time;
    }
}

public 
OnLibraryAdded(const String:name[])
    if (
StrEqual(name"sourcebans"))
        
k_SBans true;

public 
OnAllPluginsLoaded()
    if (
LibraryExists("sourcebans"))
        
k_SBans true;
    
public 
OnLibraryRemoved(const String:name[])
    if (
StrEqual(name"sourcebans"))
        
k_SBans false;
    
public 
OnClientDisconnect(client)
{
    
kCount[client] = 0;
    
kFirstKill[client] = 0;

I am wondering how to, instead, make the player not banned but friendly for a certain amount of time. Does anyone know how to do this? Using the sm_friendly and sm_friendly_lock commands.

Thanks!

Last edited by PointlessFish; 02-16-2016 at 07:06.
PointlessFish 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 01:22.


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