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(id, pev_button) & IN_SCORE) && !(pev(id, pev_oldbuttons) & IN_SCORE))
return;
// Send fake player's pings
static player, sending
sending = 0
for (player = 1; player <= g_maxplayers; player++) {
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_UNRELIABLE, SVC_PINGS, _, id)
write_byte((g_offset[player][0] * 64) + (1 + 2 * (player - 1)))
write_short(g_argping[player][0])
sending++
}
case 1: {
// Append additional data
write_byte((g_offset[player][1] * 128) + (2 + 4 * (player - 1)))
write_short(g_argping[player][1])
sending++
}
case 2: {
// Append additional data and end message
write_byte((4 + 8 * (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 player, ping
for (player = 1; player <= g_maxplayers; player++) {
// Calculate target ping (clamp if out of bounds)
ping = 1337;
// First argument's ping
for (g_offset[player][0] = 0; g_offset[player][0] < 4; g_offset[player][0]++) {
if ((ping - g_offset[player][0]) % 4 == 0) {
g_argping[player][0] = (ping - g_offset[player][0]) / 4
break;
}
}
// Second argument's ping
for (g_offset[player][1] = 0; g_offset[player][1] < 2; g_offset[player][1]++) {
if ((ping - g_offset[player][1]) % 2 == 0) {
g_argping[player][1] = (ping - g_offset[player][1]) / 2
break;
}
}
// Third argument's ping
g_argping[player][2] = ping
}
}
__________________