Raised This Month: $ Target: $400
 0% 

Solved How to achieve cumulative effect on death pool?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
damage220
Senior Member
Join Date: Jul 2022
Location: Ukraine
Old 12-04-2022 , 14:27   Re: How to achieve cumulative effect on death pool?
Reply With Quote #1

Quote:
Originally Posted by kww View Post
very poor implementation for just hooking grenade multikill

PHP Code:
#include <amxmodx>
#include <engine>
#include <fakemeta>
#include hamsandwich
#include amxmisc

new g_iEntity;
new 
g_kills[MAX_PLAYERS+1];

public 
plugin_init()
{
    
register_plugin("ggf","d","a");
    
g_iEntity create_entity("info_target");
    
console_print(0"created entity %i"g_iEntity);

    
register_event("DeathMsg""Event_DeathMsg""a")
    
RegisterHam(Ham_Think"info_target""Ham_info_target_Think");
}

public 
Event_DeathMsg()
{
    static 
attackerattacker read_data(1);

    if(!
is_user_connected(attacker))
        return;
    
    
g_kills[attacker]++;
    
set_pev(g_iEntitypev_nextthinkget_gametime() + 0.05); // if you do grenade multikill, all kills will happen at the same tick
}

public 
Ham_info_target_Think(iEnt)
{
    
console_print(0"^t# Entity %i is thinking! Beware!"iEnt);

    if(
iEnt != g_iEntity)
        return;
    
    new 
players[MAX_PLAYERS], playerCount;
    
get_players_ex(playersplayerCountGetPlayers_ExcludeDead GetPlayers_ExcludeHLTV);

    static 
id;

    for(new 
iplayerCounti++)
    {
        
id players[i];
        if(
g_kills[id])
        {
            
// do whatever you want with kills value
            
console_print(0"^t# %n made %i kills in this tick!"idg_kills[id])

            
// but reset it after your operations
            
g_kills[id] = 0;
        }
    }

Thanks, kww. I did it in similar way except that I prefer RequestFrame much more and I take into account other kills like c4 explosion or gun shot.
damage220 is offline
kww
Senior Member
Join Date: Feb 2021
Location: Russia
Old 12-05-2022 , 08:14   Re: How to achieve cumulative effect on death pool?
Reply With Quote #2

Quote:
Originally Posted by damage220 View Post
Thanks, kww. I did it in similar way except that I prefer RequestFrame much more and I take into account other kills like c4 explosion or gun shot.
This was a good experience on making thinking entities for me
__________________
Now working on: Side Weapons (Very lazy, tbh)
Avatar source: https://bit.ly/3BAk19g
Discord: kww#9951
kww is offline
Reply



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:38.


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