|
如果要在这段插件中添加一个排名如何改?
之前用过好多显示地址的插件,就觉得你这个插件稳定,其他的显示地址插件时不时的服务器要挂几次。谢谢啊。
[PHP]/* Show Client Address Info */
#include <amxmodx>
#include <amxmisc>
#include <ipseeker>
new const PLUGIN_NAME[] = "Show Client Address Info"
new const PLUGIN_VERSION[] = "1.0"
new const PLUGIN_AUTHOR[] = "KinSprite"
new g_infoType
new g_left_sync
new g_saytext
public plugin_init() {
register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)
register_dictionary("clientaddrinfo.txt")
g_infoType = register_cvar("amx_showclinfo", "abc") // 'a' - show to all players, 'b' - show to admins. 'c' - user hudmessage "d" - user green text message
g_left_sync = CreateHudSyncObj()
g_saytext = get_user_msgid("SayText")
}
public get_infotype() {
new str[8]
get_pcvar_string(g_infoType, str, 7)
new type
if (containi(str, "a") != -1)
type |= 1
if (containi(str, "b") != -1)
type |= 2
if (containi(str, "c") != -1)
type |= 4
if (containi(str, "d") != -1)
type |= 8
return type
}
public client_putinserver(id) {
if (!is_user_bot(id)) {
set_task(5.6, "show_client_info", id)
}
return PLUGIN_CONTINUE
}
public client_disconnect(id) {
if (task_exists(id))
remove_task(id)
return PLUGIN_CONTINUE
}
public show_client_info(id) {
new type = get_infotype()
if (type & 3 == 0)
return
new plName[32]
get_user_name(id, plName, 31)
new NetAddr[32], clregion[128]
get_user_ip(id, NetAddr, 31, 1)
ipseeker(NetAddr, ipseek_all, clregion, 127, 1);
new temp[128]
new players[32], plNum
get_players(players, plNum, "c")
for(new i = 0; i < plNum; ++i) {
if (type & 1 == 0 && type & 2 && !is_user_admin(players))
continue
if (type & 4) {
format(temp, 127, "%L", players, "INFOR", plName, clregion, NetAddr)
replace_all(temp, 127, "\n", "^n")
set_hudmessage(0, 255, 0, 0.03, 0.35, 0, 6.0, 6.0, 0.5, 0.15, -1)
ShowSyncHudMsg(players, g_left_sync, temp)
}
if (type & 8) {
format(temp[1], 126, "%L", players, "INFOR2", plName, clregion, NetAddr)
temp[0] = 4 // 4 - green color
message_begin(MSG_ONE, g_saytext, {0,0,0}, players)
write_byte(players)
write_string(temp)
message_end()
}
}
}
[/PHP] |
|