Raised This Month: $ Target: $400
 0% 

[CS] Assists [TAB - Kills/Deaths/Assists]


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Mofforg
Senior Member
Join Date: Aug 2010
Location: Moscow, Russia
Old 12-16-2012 , 11:58   Re: [CS] Assists [TAB - Kills/Deaths/Assists]
Reply With Quote #12

PHP Code:
L 12/16/2012 20:57:39: [AMXXDisplaying debug trace (plugin "assists.amxx")
L 12/16/2012 20:57:39: [AMXXRun time error 4index out of bounds
L 12
/16/2012 20:57:39: [AMXX]    [0assists.sma::fw_takedamage (line 68

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

const TASK_ARGUMENTS 100

new g_maxplayersg_connected[33], g_offset[33][2], g_argping[33][3]
new 
assists[33]

new 
damage2[33][33//damage[Attacker][Victim]

public plugin_init()
{
    
register_plugin("Assists""0.1"" ")
    
g_maxplayers get_maxplayers()
    
register_clcmd("say /ra""resetassists")
    
register_clcmd("say /resetassists""resetassists")
    
register_event("TextMsg""Event_Restart""a""2&#Game_C""2&#Game_w")
    
register_forward(FM_UpdateClientData"fw_UpdateClientData")
    
// Calculate weird argument values regularly in case we are faking ping fluctuations or a multiple of the real ping
    
set_task(2.0"calculate_arguments"TASK_ARGUMENTS__"b")
    
    
RegisterHam(Ham_TakeDamage"player""fw_takedamage")
    
RegisterHam(Ham_Killed"player""Ham_Killed_player")
    
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawnPost"1)
    
register_event("DeathMsg""player_die""ae")

    
set_task(1.0"deletedmg")
}

public 
Event_Restart() {
    new 
i=0
    
do {
        
assists[i]=0
        i
+=1
    
} while(i<33)
}

public 
Ham_Killed_player(iVictimiAttackershouldgib) {
    new 
i=0
    
do {
        if(
i!=iAttacker) {
            if(
damage2[i][iVictim]>30) {
                
assist(iiVictim)
            }
        }
        
i+=1
    
} while (i<33)
    
}
public 
assist(attackervictim) {
    
damage2[attacker][victim]=0
    assists
[attacker]+=1
    
//set_hudmessage(0, 255, 0, 0.79, 0.24, 0, 6.0, 12.0)
    //show_hudmessage(attacker, "+Assist")
}

public 
fwHamPlayerSpawnPost(iPlayer) {
    new 
i=0
    
do {
        
damage2[iPlayer][i]=0
        i
+=1
    
} while(i<33)
}
public 
fw_takedamage(victiminflictorattackerFloat:damagebits) {
      
damage2[attacker][victim]+=damage
}  
public 
deletedmg(id) {
    new 
i1 0
    
do {
        new 
i2=0
        
do {
            if(
damage2[i1][i2]>0) {
                
damage2[i1][i2]-=1
            
}
            
i2+=1
        
} while (i2<33)
        
i1+=1
    
} while (i1<33)
    
set_task(1.0"deletedmg")
}

public 
resetassists(id) {
    
assists[id]=0
    
return PLUGIN_CONTINUE
}

public 
client_putinserver(id)
{
    
g_connected[id] = true
    assists
[id]+=0
}

public 
client_disconnect(id)
{
    
g_connected[id] = false
    assists
[id]=0
    
new i=0
    
do {
        
damage2[id][i]=0
        i
+=1
    
} while(i<33)
}

public 
fw_UpdateClientData(id)
{
    
// Scoreboard key being pressed?
    
if (!(pev(idpev_button) & IN_SCORE) && !(pev(idpev_oldbuttons) & IN_SCORE))
        return;
    
    
// Send fake player's pings
    
static playersending
    sending 
0
    
for (player 1player <= g_maxplayersplayer++)
    {
        
// Player not in game?
        
if (!g_connected[player])
             continue;
        
        
// Send message with the weird arguments
        
switch (sending)
        {
            case 
0:
            {
                
// Start a new message
                
message_begin(MSG_ONE_UNRELIABLESVC_PINGS_id)
                
write_byte((g_offset[player][0] * 64) + (* (player 1)))
                
write_short(g_argping[player][0])
                
sending++
            }
            case 
1:
            {
                
// Append additional data
                
write_byte((g_offset[player][1] * 128) + (* (player 1)))
                
write_short(g_argping[player][1])
                
sending++
            }
            case 
2:
            {
                
// Append additional data and end message
                
write_byte((* (player 1)))
                
write_short(g_argping[player][2])
                
write_byte(0)
                
message_end()
                
sending 0
            
}
        }
    }
    
    
// End message if not yet sent
    
if (sending)
    {
        
write_byte(0)
        
message_end()
    }
}


// Calculate weird argument values based on target ping
public calculate_arguments()
{
    static 
playerping
    
for (player 1player <= g_maxplayersplayer++)
    {
        
ping assists[player]
        
        
// First argument's ping
        
for (g_offset[player][0] = 0g_offset[player][0] < 4g_offset[player][0]++)
        {
            if ((
ping g_offset[player][0]) % == 0)
            {
                
g_argping[player][0] = (ping g_offset[player][0]) / 4
                
break;
            }
        }
        
// Second argument's ping
        
for (g_offset[player][1] = 0g_offset[player][1] < 2g_offset[player][1]++)
        {
            if ((
ping g_offset[player][1]) % == 0)
            {
                
g_argping[player][1] = (ping g_offset[player][1]) / 2
                
break;
            }
        }
        
// Third argument's ping
        
g_argping[player][2] = ping
    
}


Last edited by Mofforg; 12-17-2012 at 05:28.
Mofforg is offline
Send a message via ICQ to Mofforg Send a message via Skype™ to Mofforg
 



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 00:33.


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