View Single Post
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 10-06-2022 , 21:32   Re: Show Damage Plus
Reply With Quote #3

You don't need set_task for this.
Use get_gametime and check if the time is larger than current time or not

PHP Code:
/*
| =============================
| Generated by Berk
| Made in Turkey
| Keep It Ready
| =============================
*/

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Show Damage Plus"
#define VERSION "1.0"
#define AUTHOR "Berk"

#define TIMEOUT 2.0 //How long will the combo reset

new iCombo[33] , iHits[33]
new 
Float:fTimeout[33]
new 
g_Maxplayers

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_event("Damage","event_damage","b","2!0","3=0","4!0")
    
register_event("HLTV""event_new_round""a""1=0""2=0"
}

public 
event_damage(id)
{
    new 
attacker get_user_attacker(id)
    new 
iDamage read_data(2)
    
    
//Check to reset combo
    
if(fTimeout[attacker] >= get_gametime())
       
iCombo[attacker] = 0

    fTimeout
[attacker] = get_gametime() + TIMEOUT //Set next timeout
    
iCombo[attacker]++
    
iHits[attacker]++
    
    
set_hudmessage(0255255, -1.00.7004.01.0__, -1)
    
show_hudmessage(attacker"%i^n(Combo %dx) (Hit's %d)"iDamageiCombo[attacker], iHits[attacker])
    
}

public 
event_new_round()
{
    for(new 
player;player<g_Maxplayers;player++)
        
iHits[32]= 0;

__________________
My plugin:

Last edited by Celena Luna; 10-09-2022 at 02:01.
Celena Luna is offline