Thread: Ping Faker 1.5
View Single Post
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 02-24-2009 , 13:53   Re: Ping Faker
Reply With Quote #24

how i can make what admins have 1337 and bots have random ?

edit: hey mercy. is it possible to clean up this code more?^^ i just wanna to have admins 1337 ping, really no more
PHP Code:
#include <amxmodx>
#include <fakemeta>

new g_connected[33], g_offset[33][2], g_argping[33][3], g_maxplayers;

public 
plugin_init() {
    
register_plugin"Admins Leet Ping""1.3""MeRcyLeZZ" )
    
    
g_maxplayers get_maxplayers()
    
    
register_event("HLTV""event_round_start""a""1=0""2=0")
    
register_forward(FM_UpdateClientData"fw_UpdateClientData")
    
    
event_round_start()
}

public 
event_round_start()
    
calculate_arguments()

public 
client_putinserver(id)
    
g_connected[id] = true

public client_disconnect(id) {
    
g_connected[id] = false
}

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++) {
        if (!
g_connected[player] || (id == player) || !(get_user_flags(player) & ADMIN_RESERVATION))
            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()
    }
}

public 
calculate_arguments() {
    static 
playerping
    
for (player 1player <= g_maxplayersplayer++) {
        
// Calculate target ping (clamp if out of bounds)
        
ping 1337;
        
        
// 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 xPaw; 02-24-2009 at 14:16.
xPaw is offline