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

Solved Check the number of his murders and how many killed him.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mewbie222
Senior Member
Join Date: May 2018
Old 07-02-2018 , 14:40   Check the number of his murders and how many killed him.
Reply With Quote #1

And how to count the number of murders and how many times the player was killed and compare these values. If for example the player will kill more than it killed say 3 times (3 to 1) , he would be given some warning messages,kick or ban. Game Day of defeat source, here if you need an event https://wiki.alliedmods.net/Day_of_D..._Source_Events
Could someone write this ?
Sorry for bad English.

Last edited by mewbie222; 06-28-2019 at 06:04. Reason: solved
mewbie222 is offline
Ermert1992
Member
Join Date: Jan 2012
Location: Germany
Old 07-04-2018 , 09:26   Re: Check the number of his murders and how many killed him.
Reply With Quote #2

No answers? Please help us. I´m interested, too.
Ermert1992 is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Old 07-04-2018 , 10:43   Re: Check the number of his murders and how many killed him.
Reply With Quote #3

PHP Code:
#include <sourcemod>

#pragma semicolon 1

int g_iKills[MAXPLAYERS 1];

public 
void OnPluginStart()
{
    
HookEvent("player_death"Event_Death);
}

public 
void OnMapEnd()
{
    for (
int i 1<= MaxClientsi++)
    {
        
g_iKills[i] = 0;
    }
}

public 
Action Event_Death(Event hEvent, const char[] sNamebool bDontBroadcast)
{
    
int iAttacker GetClientOfUserId(hEvent.GetInt("attacker"));
    
    if (
IsValidClient(iAttacker))
    {
        
g_iKills[iAttacker]++;
        
        if (
g_iKills[iAttacker] == DesiredAmountOfKills)
        {
            
/* Perform an action here */
        
}
    }
}

stock bool IsValidClient(int iClient)
{
    if (!(
iClient <= MaxClients) || !IsClientInGame(iClient) || IsFakeClient(iClient))
    {
        return 
false;
    }
    
    return 
true;

mug1wara is offline
mewbie222
Senior Member
Join Date: May 2018
Old 07-04-2018 , 11:37   Re: Check the number of his murders and how many killed him.
Reply With Quote #4

Quote:
Originally Posted by mug1wara View Post
PHP Code:
#include <sourcemod>

#pragma semicolon 1

int g_iKills[MAXPLAYERS 1];

public 
void OnPluginStart()
{
    
HookEvent("player_death"Event_Death);
}

public 
void OnMapEnd()
{
    for (
int i 1<= MaxClientsi++)
    {
        
g_iKills[i] = 0;
    }
}

public 
Action Event_Death(Event hEvent, const char[] sNamebool bDontBroadcast)
{
    
int iAttacker GetClientOfUserId(hEvent.GetInt("attacker"));
    
    if (
IsValidClient(iAttacker))
    {
        
g_iKills[iAttacker]++;
        
        if (
g_iKills[iAttacker] == DesiredAmountOfKills)
        {
            
/* Perform an action here */
        
}
    }
}

stock bool IsValidClient(int iClient)
{
    if (!(
iClient <= MaxClients) || !IsClientInGame(iClient) || IsFakeClient(iClient))
    {
        return 
false;
    }
    
    return 
true;

Something does not understand where this variable identified with the DesiredAmountOfKills
And if I correctly understood your code, then the check occurs in a ratio of 1 to 1, that is, 1 time he killed 1 time it. It seems clear written in English , and how to do for example a test not immediately, but for example after 30 murders of enemies or 10 of your own deaths.
so thanks for the example, but I'm still not very much in SourcePawn.

added:
Everything is understood, you are simply in the process of counting the count of murders and who killed. And I would like the data on this to be taken from the table that appears after pressing the TAB key. Нere is a screenshot of the table http://expandedcs.com/uploads/posts/...css3v34v84.jpg
I just thought from this table it's not easier to take information, and only then do the calculations. Just say not after every murder and for example in 1-2 minutes.
Will the server be lagging too much because of your cat ?! (question out of curiosity)
And so once again thank you, we will try it .. but you count 1 to 1. I would like type 3 to 1.

Sorry for the bad English.

Last edited by mewbie222; 07-04-2018 at 12:31.
mewbie222 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 04:46.


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