CS伪造ping插件(带说明)
本帖最后由 381828358 于 2011-5-15 12:43 编辑**** Hidden Message *****说明自己慢慢看吧。不多说了 先给自己顶下。赚点通币。+1 如果不会可以加我QQ381828358 1.6可以用吗? 可以的。
通用的 这个有人在求。 这个插件有什么意义么?改Ping的值? 我發源碼
/*================================================================================
----------------------
-*- Ping Faker 1.0 -*-
----------------------
~~~~~~~~~~~~~~~
- Description -
~~~~~~~~~~~~~~~
This plugin can fake the display of a player's latency (ping) shown on
the scoreboard. Unlike the "fakelag" command, it does not affect the
player's real latency in any way.
You can have all players report the same ping, or only fake it for those
who have a specific admin flag. This last feature is especially useful
when running a dedicated server from your own computer, when you don't
want people to guess you're an admin/owner by looking at your low ping.
~~~~~~~~~
- CVARS -
~~~~~~~~~
* pingfake_enable - Enable/disable ping faking
* pingfake_ping - The ping you want displayed (min: 0 // max: 4095)
* pingfake_flags [""] - Affect players with these flags only (empty = all)
* pingfake_target - Whether to display fake ping to its target too
Note: changes to these will take effect after a new round.
~~~~~~~~
- ToDo -
~~~~~~~~
* Find out exactly what the arguments for the SVC_PINGS message mean, so
as to send a single message with all pings on it and reduce bandwidth
usage (does the HLSDK say anything about those?)
~~~~~~~~~~~~~~~~~~~
- Developer Notes -
~~~~~~~~~~~~~~~~~~~
The SVC_PINGS message can't be intercepted by Metamod/AMXX (it is purely
handled by the engine) so the only way to supercede it is to send our own
custom message right after the original is fired. This works as long as
the custom message is parsed AFTER the original. To achieve this here, we
send it as an unreliable message (cl_messages 1 helps see arrival order).
The next difficulty is in figuring out what the message arguments are.
For this I did some trial and error until I finally got it working, though
in a really odd way. I also can't seem to send more than one ping on the
same message without getting weird results or triggering heaps of message
parsing errors (namely svc_bad).
A final consideration is bandwidth usage. I found out (with cl_shownet 1)
the packet size increases by 102 bytes when the original SVC_PINGS message
is sent for 32 players. Sending our own message right after means the size
will grow even larger, so we should only send the message when absolutely
needed. In this case that's once every client data update (any less often
than that and the ping wasn't properly overridden sometimes).
~~~~~~~~~~~~~
- Changelog -
~~~~~~~~~~~~~
* v1.0: (Feb 23, 2009)
- Public release
=================================================================================*/
#include <amxmodx>
#include <fakemeta>
new cvar_enable, cvar_ping, cvar_flags, cvar_target
new g_enable, g_offset, g_ping, g_flags, g_target
new g_maxplayers, g_connected
public plugin_init()
{
register_plugin("Ping Faker", "1.0", "MeRcyLeZZ")
cvar_enable = register_cvar("pingfake_enable", "1")
cvar_ping = register_cvar("pingfake_ping", "1")
cvar_flags = register_cvar("pingfake_flags", "")
cvar_target = register_cvar("pingfake_target", "1")
g_maxplayers = get_maxplayers()
register_event("HLTV", "event_round_start", "a", "1=0", "2=0")
register_forward(FM_UpdateClientData, "fw_UpdateClientData")
set_task(1.0, "event_round_start")
}
public event_round_start()
{
// Cache CVAR values
g_enable = get_pcvar_num(cvar_enable)
g_ping = clamp(get_pcvar_num(cvar_ping), 0, 4095)
g_target = get_pcvar_num(cvar_target)
// Calculate weird argument values based on target ping
for (g_offset = 0; g_offset <= 3; g_offset++)
{
if ((g_ping - g_offset) % 4 == 0)
{
g_ping = (g_ping - g_offset) / 4
break;
}
}
// Cache flags
new flags
get_pcvar_string(cvar_flags, flags, sizeof flags - 1)
g_flags = read_flags(flags)
}
public client_putinserver(id)
{
g_connected = true
}
public client_disconnect(id)
{
g_connected = false
}
public fw_UpdateClientData(id)
{
// Ping faking disabled?
if (!g_enable) return;
// 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
for (player = 1; player <= g_maxplayers; player++)
{
// Player not in game?
if (!g_connected)
continue;
// Fake latency for its target too?
if (!g_target && id == player)
continue;
// Need to have specific flags?
if (g_flags && !(get_user_flags(player) & g_flags))
continue;
// Send message with the weird arguments
message_begin(MSG_ONE_UNRELIABLE, SVC_PINGS, _, id)
write_byte((g_offset*64) + (2*player-1))
write_short(g_ping)
write_byte(0)
message_end()
}
} 看看。。。。。。。。。。 这东西好像很多人在找!高手现在都消失了