搜索
查看: 3221|回复: 6

[AMXX 带源码] 显示当前OP

[复制链接]
发表于 2009-6-4 05:54:14 | 显示全部楼层 |阅读模式 来自 中国–上海–上海–闵行区


Description:
This Plugin Shows How Many Admins Are Online And Their Names
Via Hud Msg.
The Position Of Hud Msg Can Be Changed Via Cvars Also
The Colors Can Be Changed For Online Msg And Offline Msg.


Cvars:
sa_plugin_on "1" -> Turn Admin Show On/Off
sa_online_color "0 130 0" -> When Admin Online Is Default Color Green
sa_offline_color "255 0 0" -> When No Admin On Server Default Color Red
sa_msg_xypos "0.02 0.2" -> Hud Msg Position Currently On Left Side

If You Want To Have The Hud Msg On Right Side Set Cvar sa_msg_xypos "0.8 0.2"

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注个册吧

×
发表于 2009-6-8 12:53:13 | 显示全部楼层 来自 中国–辽宁–铁岭
???????????????????????????
回复

使用道具 举报

发表于 2009-6-8 12:56:05 | 显示全部楼层 来自 中国–福建–莆田
。。。论坛里很多了。
回复

使用道具 举报

发表于 2009-6-9 13:24:24 | 显示全部楼层 来自 中国–广东–广州
这个还要点通币,LZ你也太@#¥了吧!!
  1. #include <amxmodx>
  2. #include <engine>

  3. #define PLUGIN  "Show Admins Online"
  4. #define VERSION "1.1"
  5. #define AUTHOR  "vato loco [GE-S] & Alka"

  6. new bool:g_bAdminNick
  7. new bool:is_admin_connected[33]
  8. new g_msg[512]

  9. new g_admin_enable
  10. new g_online_color
  11. new g_offline_color
  12. new g_msg_xypos

  13. new g_SyncAdmin
  14. new g_iAdminCount
  15. new g_iMaxPlayers

  16. new g_ClassName[] = "admin_msg"

  17. public plugin_init()
  18. {
  19.         register_plugin( PLUGIN, VERSION, AUTHOR )
  20.        
  21.         register_think(g_ClassName,"ForwardThink")
  22.        
  23.         g_admin_enable = register_cvar("sa_plugin_on","1")
  24.         g_online_color = register_cvar("sa_online_color","0 130 0")
  25.         g_offline_color = register_cvar("sa_offline_color","255 0 0")
  26.         g_msg_xypos = register_cvar("sa_msg_xypos","0.02 0.2")
  27.        
  28.         g_SyncAdmin = CreateHudSyncObj()
  29.         g_iMaxPlayers = get_maxplayers()
  30.        
  31.         new iEnt = create_entity("info_target")
  32.         entity_set_string(iEnt, EV_SZ_classname, g_ClassName)
  33.         entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + 2.0)
  34. }

  35. public client_putinserver(id)
  36. {
  37.         if(get_user_flags(id) & ADMIN_KICK)
  38.         {
  39.                 is_admin_connected[id] = true
  40.                 g_iAdminCount++
  41.                 set_admin_msg()
  42.         }
  43.         if(g_iAdminCount == 0)
  44.                 set_admin_msg()
  45. }

  46. public client_disconnect(id)
  47. {
  48.         if(is_admin_connected[id])
  49.         {
  50.                 is_admin_connected[id] = false
  51.                 g_iAdminCount--
  52.                 set_admin_msg()
  53.         }
  54. }

  55. public client_infochanged(id)
  56. {
  57.         if(is_admin_connected[id])
  58.         {
  59.                 static NewName[32], OldName[32]
  60.                 get_user_info(id, "name", NewName, 31)
  61.                 get_user_name(id, OldName, 31)
  62.                
  63.                 if(!equal(OldName, NewName))
  64.                 {
  65.                         g_bAdminNick = true
  66.                 }
  67.         }
  68. }

  69. public set_admin_msg()
  70. {
  71.         static g_iAdminName[32], pos, i
  72.         pos = 0
  73.         pos += formatex(g_msg[pos], 511-pos, "Admins Online: %d", g_iAdminCount)
  74.        
  75.         for(i = 1 ; i <= g_iMaxPlayers ; i++)
  76.         {       
  77.                 if(is_admin_connected[i])
  78.                 {
  79.                         get_user_name(i, g_iAdminName, 31)
  80.                         pos += formatex(g_msg[pos], 511-pos, "^n%s", g_iAdminName)
  81.                 }
  82.         }
  83. }

  84. public admins_online()
  85. {
  86.         if(get_pcvar_num(g_admin_enable))
  87.         {
  88.                 static r, g, b, Float:x,Float:y
  89.                 HudMsgPos(x,y)
  90.                
  91.                 if (g_iAdminCount > 0)
  92.                 {
  93.                         HudMsgColor(g_online_color, r, g, b)
  94.                         set_hudmessage(r, g, b, x, y, _, _, 4.0, _, _, 4)
  95.                         ShowSyncHudMsg(0, g_SyncAdmin, "%s", g_msg)
  96.                 }
  97.                 else
  98.                 {
  99.                         HudMsgColor(g_offline_color, r, g, b)
  100.                         set_hudmessage(r, g, b, x, y, _, _, 4.0, _, _, 4)
  101.                         ShowSyncHudMsg(0, g_SyncAdmin, "%s", g_msg)
  102.                 }
  103.         }
  104.         return PLUGIN_HANDLED
  105. }

  106. public ForwardThink(iEnt)
  107. {
  108.         admins_online()
  109.        
  110.         if(g_bAdminNick)
  111.         {
  112.                 set_admin_msg()
  113.                 g_bAdminNick = false
  114.         }
  115.         entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + 2.0)
  116. }

  117. public HudMsgColor(cvar, &r, &g, &b)
  118. {
  119.         static color[16], piece[5]
  120.         get_pcvar_string(cvar, color, 15)
  121.        
  122.         strbreak( color, piece, 4, color, 15)
  123.         r = str_to_num(piece)
  124.        
  125.         strbreak( color, piece, 4, color, 15)
  126.         g = str_to_num(piece)
  127.         b = str_to_num(color)
  128. }

  129. public HudMsgPos(&Float:x, &Float:y)
  130. {
  131.         static coords[16], piece[10]
  132.         get_pcvar_string(g_msg_xypos, coords, 15)
  133.        
  134.         strbreak(coords, piece, 9, coords, 15)
  135.         x = str_to_float(piece)
  136.         y = str_to_float(coords)
  137. }
复制代码
回复

使用道具 举报

 楼主| 发表于 2009-6-10 07:52:57 | 显示全部楼层 来自 中国–上海–上海–闵行区
这个还要点通币,LZ你也太@#¥了吧!!#include  
#include

#define PLUGIN  "Show Admins Online"
#define VERSION "1.1"
#define AUTHOR  "vato loco [GE-S] & Alka"

new bool:g_bAdminNick
new bool:is_adm ...
kk阿朗 发表于 2009-6-9 13:24

学别人哈哈
回复

使用道具 举报

发表于 2009-8-21 12:32:14 | 显示全部楼层 来自 中国–湖北–武汉
晕........这个插件还收.
回复

使用道具 举报

发表于 2009-8-23 01:35:54 | 显示全部楼层 来自 中国–河南–南阳
顶你```````
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表