View Single Post
zXCaptainXz
Member
Join Date: May 2017
Old 10-06-2022 , 16:20   Re: Show Damage Plus
Reply With Quote #2

PHP Code:
public client_connected(idattacker)
{
    
set_task(1.0"ComboControl"attacker__"b")

->
PHP Code:
public client_putinserver(id)
{
    
set_task(1.0"ComboControl"id__"b")

client_connected doesn't even exist, client_connect (would recommend client_putinserver since it makes sure the client is "connected" not "connecting") is the correct function and it only takes one argument, which is the id of the connecting player.

PHP Code:
public ComboControl(idattacker)
{
    if(
iTimeout[attacker] >= 0)
    {
        
iTimeout[attacker] -= 1
    
}
    
    if(
iTimeout[attacker] == 0)
    {
        
iCombo[attacker] = 0
    
}

->
PHP Code:
public ComboControl(id)
{
    if(
iTimeout[id] >= 0)
    {
        
iTimeout[id] -= 1
    
}
    
    if(
iTimeout[id] == 0)
    {
        
iCombo[id] = 0
    
}

When you set the task with the id, the first argument is the one that's used as ID, not the second like you did.

In all cases, that's not what I would do, since it would not guarantee that 2 seconds would pass between combo resets, it could take between 1 and 2 seconds inconsistently. I would do this instead:
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"

new iCombo[33] , iHits[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)
    
    
remove_task(attacker// Remove the task if it already exists to reset after 2 seconds
    
set_task(2.0attacker"reset_damage"//Set a task after 2 seconds to reset
    
iCombo[attacker]++
    
iHits[attacker]++
    
    
set_hudmessage(0255255, -1.00.704.01.02.0__, -1)
    
show_hudmessage(attacker"%i^n(Combo %dx) (Hit's %d)"iDamageiCombo[attacker], iHits[attacker])
    
}

public 
reset_damage(id)
{
    
iCombo[id] = 0
}

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


Last edited by zXCaptainXz; 10-06-2022 at 16:29. Reason: Forgot to delete unnecessary code
zXCaptainXz is offline