hlmod.hu
https://hlmod.hu/

Jelenlévő adminok, idő dátum HUD.
https://hlmod.hu/viewtopic.php?f=29&t=22747
Oldal: 1 / 1

Szerző:  XefHosy [2015.11.24. 16:27 ]
Hozzászólás témája:  Jelenlévő adminok, idő dátum HUD.

helló, valaki összeírná ezt a két plugint?

SMA Forráskód: [ Mindet kijelol ]
  1. /* Plugin generated by AMXX-Studio */
  2.  
  3. #include <amxmodx>
  4. #include <engine>
  5.  
  6. #define PLUGIN "Show Admins Online"
  7. #define VERSION "1.1"
  8. #define AUTHOR "vato loco [GE-S] & Alka"
  9.  
  10. new bool:g_bAdminNick
  11. new bool:is_admin_connected[33]
  12. new g_msg[512]
  13.  
  14. new g_admin_enable
  15. new g_online_color
  16. new g_offline_color
  17. new g_msg_xypos
  18.  
  19. new g_SyncAdmin
  20. new g_iAdminCount
  21. new g_iMaxPlayers
  22.  
  23. new g_ClassName[] = "admin_msg"
  24.  
  25. public plugin_init()
  26. {
  27. register_plugin( PLUGIN, VERSION, AUTHOR )
  28.  
  29. register_think(g_ClassName,"ForwardThink")
  30.  
  31. g_admin_enable = register_cvar("sa_plugin_on","1")
  32. g_online_color = register_cvar("sa_online_color","0 130 0")
  33. g_offline_color = register_cvar("sa_offline_color","255 0 0")
  34. g_msg_xypos = register_cvar("sa_msg_xypos","0.02 0.2")
  35.  
  36. g_SyncAdmin = CreateHudSyncObj()
  37. g_iMaxPlayers = get_maxplayers()
  38.  
  39. new iEnt = create_entity("info_target")
  40. entity_set_string(iEnt, EV_SZ_classname, g_ClassName)
  41. entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + 2.0)
  42. }
  43.  
  44. public client_putinserver(id)
  45. {
  46. if(get_user_flags(id) & ADMIN_KICK)
  47. {
  48. is_admin_connected[id] = true
  49. g_iAdminCount++
  50. set_admin_msg()
  51. }
  52. if(g_iAdminCount == 0)
  53. set_admin_msg()
  54. }
  55.  
  56. public client_disconnect(id)
  57. {
  58. if(is_admin_connected[id])
  59. {
  60. is_admin_connected[id] = false
  61. g_iAdminCount--
  62. set_admin_msg()
  63. }
  64. }
  65.  
  66. public client_infochanged(id)
  67. {
  68. if(is_admin_connected[id])
  69. {
  70. static NewName[32], OldName[32]
  71. get_user_info(id, "name", NewName, 31)
  72. get_user_name(id, OldName, 31)
  73.  
  74. if(!equal(OldName, NewName))
  75. {
  76. g_bAdminNick = true
  77. }
  78. }
  79. }
  80.  
  81. public set_admin_msg()
  82. {
  83. static g_iAdminName[32], pos, i
  84. pos = 0
  85. pos += formatex(g_msg[pos], 511-pos, "Jelenlevo Adminok: %d", g_iAdminCount)
  86.  
  87. for(i = 1 ; i <= g_iMaxPlayers ; i++)
  88. {
  89. if(is_admin_connected[i])
  90. {
  91. get_user_name(i, g_iAdminName, 31)
  92. pos += formatex(g_msg[pos], 511-pos, "^n%s", g_iAdminName)
  93. }
  94. }
  95. }
  96.  
  97. public admins_online()
  98. {
  99. if(get_pcvar_num(g_admin_enable))
  100. {
  101. static r, g, b, Float:x,Float:y
  102. HudMsgPos(x,y)
  103.  
  104. if (g_iAdminCount > 0)
  105. {
  106. HudMsgColor(g_online_color, r, g, b)
  107. set_hudmessage(r, g, b, x, y, _, _, 4.0, _, _, 4)
  108. ShowSyncHudMsg(0, g_SyncAdmin, "%s", g_msg)
  109. }
  110. else
  111. {
  112. HudMsgColor(g_offline_color, r, g, b)
  113. set_hudmessage(r, g, b, x, y, _, _, 4.0, _, _, 4)
  114. ShowSyncHudMsg(0, g_SyncAdmin, "%s", g_msg)
  115. }
  116. }
  117. return PLUGIN_HANDLED
  118. }
  119.  
  120. public ForwardThink(iEnt)
  121. {
  122. admins_online()
  123.  
  124. if(g_bAdminNick)
  125. {
  126. set_admin_msg()
  127. g_bAdminNick = false
  128. }
  129. entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + 2.0)
  130. }
  131.  
  132. public HudMsgColor(cvar, &r, &g, &b)
  133. {
  134. static color[16], piece[5]
  135. get_pcvar_string(cvar, color, 15)
  136.  
  137. strbreak( color, piece, 4, color, 15)
  138. r = str_to_num(piece)
  139.  
  140. strbreak( color, piece, 4, color, 15)
  141. g = str_to_num(piece)
  142. b = str_to_num(color)
  143. }
  144.  
  145. public HudMsgPos(&Float:x, &Float:y)
  146. {
  147. static coords[16], piece[10]
  148. get_pcvar_string(g_msg_xypos, coords, 15)
  149.  
  150. strbreak(coords, piece, 9, coords, 15)
  151. x = str_to_float(piece)
  152. y = str_to_float(coords)
  153. }
  154.  




SMA Forráskód: [ Mindet kijelol ]
  1. #include <amxmodx>
  2. #include <engine>
  3.  
  4. public plugin_init()
  5. {
  6. register_plugin("Idő/Dátum", "1.0", "Golo")
  7. }
  8.  
  9. public client_PreThink()
  10. {
  11. new ido[64], datum[64]
  12. get_time("%H:%M:%S", ido, 63)
  13. get_time("%d.%m.%Y", datum, 63)
  14. set_hudmessage(0, 200, 0, 0.83, 0.01,0, 1.0, 1.0, 0.1, 0.2, 13)
  15. show_hudmessage(0, "Idő: %s^nDátum: %s", ido, datum)
  16. }

Szerző:  mforce [2015.11.24. 16:39 ]
Hozzászólás témája:  Re: Jelenlévő adminok, idő dátum HUD.

prethink milliomod másodpercenként lekérődik. Van értelme?
Amúgy azt a részt kimásolod, azt belevágod bárhova.

Szerző:  rolika95 [2015.11.24. 17:16 ]
Hozzászólás témája:  Re: Jelenlévő adminok, idő dátum HUD.

Tessék.
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2013 ITB CompuPhase, AMX Mod X Team

Header size: 856 bytes
Code size: 3496 bytes
Data size: 3776 bytes
Stack/heap size: 16384 bytes; estimated max. usage=147 cells (588 bytes)
Total requirements: 24512 bytes
Done.

SMA Forráskód: [ Mindet kijelol ]
  1. /* Plugin generated by AMXX-Studio */
  2.  
  3. #include <amxmodx>
  4. #include <engine>
  5.  
  6. #define PLUGIN "Show Admins Online"
  7. #define VERSION "1.1"
  8. #define AUTHOR "vato loco [GE-S] & Alka"
  9.  
  10. new bool:g_bAdminNick
  11. new bool:is_admin_connected[33]
  12. new g_msg[512]
  13.  
  14. new g_admin_enable
  15. new g_online_color
  16. new g_offline_color
  17. new g_msg_xypos
  18.  
  19. new g_SyncAdmin
  20. new g_iAdminCount
  21. new g_iMaxPlayers
  22.  
  23. new g_ClassName[] = "admin_msg"
  24.  
  25. public plugin_init()
  26. {
  27. register_plugin( PLUGIN, VERSION, AUTHOR )
  28. register_think(g_ClassName,"ForwardThink")
  29.  
  30. g_admin_enable = register_cvar("sa_plugin_on","1")
  31. g_online_color = register_cvar("sa_online_color","0 130 0")
  32. g_offline_color = register_cvar("sa_offline_color","255 0 0")
  33. g_msg_xypos = register_cvar("sa_msg_xypos","0.02 0.2")
  34.  
  35. g_SyncAdmin = CreateHudSyncObj()
  36. g_iMaxPlayers = get_maxplayers()
  37.  
  38. new iEnt = create_entity("info_target")
  39. entity_set_string(iEnt, EV_SZ_classname, g_ClassName)
  40. entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + 2.0)
  41. }
  42.  
  43. public client_putinserver(id)
  44. {
  45. if(get_user_flags(id) & ADMIN_KICK)
  46. {
  47. is_admin_connected[id] = true
  48. g_iAdminCount++
  49. set_admin_msg()
  50. }
  51. if(g_iAdminCount == 0)
  52. set_admin_msg()
  53. }
  54.  
  55. public client_disconnect(id)
  56. {
  57. if(is_admin_connected[id])
  58. {
  59. is_admin_connected[id] = false
  60. g_iAdminCount--
  61. set_admin_msg()
  62. }
  63. }
  64.  
  65. public client_infochanged(id)
  66. {
  67. if(is_admin_connected[id])
  68. {
  69. static NewName[32], OldName[32]
  70. get_user_info(id, "name", NewName, 31)
  71. get_user_name(id, OldName, 31)
  72.  
  73. if(!equal(OldName, NewName))
  74. {
  75. g_bAdminNick = true
  76. }
  77. }
  78. }
  79.  
  80. public set_admin_msg()
  81. {
  82. static g_iAdminName[32], pos, i
  83. pos = 0
  84. pos += formatex(g_msg[pos], 511-pos, "Jelenlevo Adminok: %d", g_iAdminCount)
  85.  
  86. for(i = 1 ; i <= g_iMaxPlayers ; i++)
  87. {
  88. if(is_admin_connected[i])
  89. {
  90. get_user_name(i, g_iAdminName, 31)
  91. pos += formatex(g_msg[pos], 511-pos, "^n%s", g_iAdminName)
  92. }
  93. }
  94. }
  95.  
  96. public admins_online()
  97. {
  98. if(get_pcvar_num(g_admin_enable))
  99. {
  100. static r, g, b, Float:x,Float:y
  101. HudMsgPos(x,y)
  102.  
  103. if (g_iAdminCount > 0)
  104. {
  105. HudMsgColor(g_online_color, r, g, b)
  106. set_hudmessage(r, g, b, x, y, _, _, 4.0, _, _, 4)
  107. ShowSyncHudMsg(0, g_SyncAdmin, "%s", g_msg)
  108. }
  109. else
  110. {
  111. HudMsgColor(g_offline_color, r, g, b)
  112. set_hudmessage(r, g, b, x, y, _, _, 4.0, _, _, 4)
  113. ShowSyncHudMsg(0, g_SyncAdmin, "%s", g_msg)
  114. }
  115. }
  116. return PLUGIN_HANDLED
  117. }
  118.  
  119. public ForwardThink(iEnt)
  120. {
  121. admins_online()
  122.  
  123. if(g_bAdminNick)
  124. {
  125. set_admin_msg()
  126. g_bAdminNick = false
  127. }
  128. entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + 2.0)
  129. }
  130.  
  131. public HudMsgColor(cvar, &r, &g, &b)
  132. {
  133. static color[16], piece[5]
  134. get_pcvar_string(cvar, color, 15)
  135.  
  136. strbreak( color, piece, 4, color, 15)
  137. r = str_to_num(piece)
  138.  
  139. strbreak( color, piece, 4, color, 15)
  140. g = str_to_num(piece)
  141. b = str_to_num(color)
  142. }
  143.  
  144. public HudMsgPos(&Float:x, &Float:y)
  145. {
  146. static coords[16], piece[10]
  147. get_pcvar_string(g_msg_xypos, coords, 15)
  148.  
  149. strbreak(coords, piece, 9, coords, 15)
  150. x = str_to_float(piece)
  151. y = str_to_float(coords)
  152. }
  153.  
  154.  
  155. public client_PreThink()
  156. {
  157. new ido[64], datum[64]
  158. get_time("%H:%M:%S", ido, 63)
  159. get_time("%d.%m.%Y", datum, 63)
  160. set_hudmessage(0, 200, 0, 0.83, 0.01,0, 1.0, 1.0, 0.1, 0.2, 13)
  161. show_hudmessage(0, "Idő: %s^nDátum: %s", ido, datum)
  162. }

Szerző:  XefHosy [2015.11.24. 17:31 ]
Hozzászólás témája:  Re: Jelenlévő adminok, idő dátum HUD.

Csak annyi a problémám, hogy nem írja ki az online adminokat, csak így néha bejön 1mp-re és eltünik bugolgat, de más hudos plugin nincs is bent a szerveren.

És a dátumot is visszafele írja : 24.11.2015


Esetleg ha nem összeírni akkor valami működőképes plugint csinálna valaki aminek az a lényege, hogy az időt a dátumot és az online adminokat kiírja?

Szerző:  rolika95 [2015.11.24. 17:35 ]
Hozzászólás témája:  Re: Jelenlévő adminok, idő dátum HUD.

Bocsi.
Pillanat javitom :)

Szerző:  rolika95 [2015.11.24. 17:38 ]
Hozzászólás témája:  Re: Jelenlévő adminok, idő dátum HUD.

SMA Forráskód: [ Mindet kijelol ]
  1. /* Plugin generated by AMXX-Studio */
  2.  
  3. #include <amxmodx>
  4. #include <engine>
  5.  
  6. #define PLUGIN "Show Admins Online"
  7. #define VERSION "1.1"
  8. #define AUTHOR "vato loco [GE-S] & Alka"
  9.  
  10. new bool:g_bAdminNick
  11. new bool:is_admin_connected[33]
  12. new g_msg[512]
  13.  
  14. new g_admin_enable
  15. new g_online_color
  16. new g_offline_color
  17. new g_msg_xypos
  18.  
  19. new g_SyncAdmin
  20. new g_iAdminCount
  21. new g_iMaxPlayers
  22.  
  23. new g_ClassName[] = "admin_msg"
  24.  
  25. public plugin_init()
  26. {
  27. register_plugin( PLUGIN, VERSION, AUTHOR )
  28. register_think(g_ClassName,"ForwardThink")
  29.  
  30. g_admin_enable = register_cvar("sa_plugin_on","1")
  31. g_online_color = register_cvar("sa_online_color","0 130 0")
  32. g_offline_color = register_cvar("sa_offline_color","255 0 0")
  33. g_msg_xypos = register_cvar("sa_msg_xypos","0.02 0.2")
  34.  
  35. g_SyncAdmin = CreateHudSyncObj()
  36. g_iMaxPlayers = get_maxplayers()
  37.  
  38. new iEnt = create_entity("info_target")
  39. entity_set_string(iEnt, EV_SZ_classname, g_ClassName)
  40. entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + 2.0)
  41. }
  42.  
  43. public client_putinserver(id)
  44. {
  45. if(get_user_flags(id) & ADMIN_KICK)
  46. {
  47. is_admin_connected[id] = true
  48. g_iAdminCount++
  49. set_admin_msg()
  50. }
  51. if(g_iAdminCount == 0)
  52. set_admin_msg()
  53. }
  54.  
  55. public client_disconnect(id)
  56. {
  57. if(is_admin_connected[id])
  58. {
  59. is_admin_connected[id] = false
  60. g_iAdminCount--
  61. set_admin_msg()
  62. }
  63. }
  64.  
  65. public client_infochanged(id)
  66. {
  67. if(is_admin_connected[id])
  68. {
  69. static NewName[32], OldName[32]
  70. get_user_info(id, "name", NewName, 31)
  71. get_user_name(id, OldName, 31)
  72.  
  73. if(!equal(OldName, NewName))
  74. {
  75. g_bAdminNick = true
  76. }
  77. }
  78. }
  79.  
  80. public set_admin_msg()
  81. {
  82. static g_iAdminName[32], pos, i
  83. pos = 0
  84. pos += formatex(g_msg[pos], 511-pos, "Jelenlevo Adminok: %d", g_iAdminCount)
  85.  
  86. for(i = 1 ; i <= g_iMaxPlayers ; i++)
  87. {
  88. if(is_admin_connected[i])
  89. {
  90. get_user_name(i, g_iAdminName, 31)
  91. pos += formatex(g_msg[pos], 511-pos, "^n%s", g_iAdminName)
  92. }
  93. }
  94. }
  95.  
  96. public admins_online()
  97. {
  98. if(get_pcvar_num(g_admin_enable))
  99. {
  100. static r, g, b, Float:x,Float:y
  101. HudMsgPos(x,y)
  102.  
  103. if (g_iAdminCount > 0)
  104. {
  105. HudMsgColor(g_online_color, r, g, b)
  106.  
  107. set_hudmessage(255, 0, 0, 0.22, 0.83, 0, 6.0, 12.0)
  108. ShowSyncHudMsg(0, g_SyncAdmin, "%s", g_msg)
  109. }
  110. else
  111. {
  112. HudMsgColor(g_offline_color, r, g, b)
  113.  
  114. set_hudmessage(255, 0, 0, 0.22, 0.83, 0, 6.0, 12.0)
  115. ShowSyncHudMsg(0, g_SyncAdmin, "%s", g_msg)
  116. }
  117. }
  118. return PLUGIN_HANDLED
  119. }
  120.  
  121. public ForwardThink(iEnt)
  122. {
  123. admins_online()
  124.  
  125. if(g_bAdminNick)
  126. {
  127. set_admin_msg()
  128. g_bAdminNick = false
  129. }
  130. entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + 2.0)
  131. }
  132.  
  133. public HudMsgColor(cvar, &r, &g, &b)
  134. {
  135. static color[16], piece[5]
  136. get_pcvar_string(cvar, color, 15)
  137.  
  138. strbreak( color, piece, 4, color, 15)
  139. r = str_to_num(piece)
  140.  
  141. strbreak( color, piece, 4, color, 15)
  142. g = str_to_num(piece)
  143. b = str_to_num(color)
  144. }
  145.  
  146. public HudMsgPos(&Float:x, &Float:y)
  147. {
  148. static coords[16], piece[10]
  149. get_pcvar_string(g_msg_xypos, coords, 15)
  150.  
  151. strbreak(coords, piece, 9, coords, 15)
  152. x = str_to_float(piece)
  153. y = str_to_float(coords)
  154. }
  155.  
  156.  
  157. public client_PreThink()
  158. {
  159. new ido[64], datum[64]
  160. get_time("%S:%M:%H", ido, 63)
  161. get_time("%Y.%m.%d", datum, 63)
  162. set_hudmessage(0, 200, 0, 0.83, 0.01,0, 1.0, 1.0, 0.1, 0.2, 13)
  163. show_hudmessage(0, "Idő: %s^nDátum: %s", ido, datum)
  164. }
  165.  
  166.  
  167.  
  168.  

Szerző:  XefHosy [2015.11.24. 17:43 ]
Hozzászólás témája:  Re: Jelenlévő adminok, idő dátum HUD.

A dátum most jó, de most az időt írja forditva és az adminokat továbbra is csak bugosan írja ki.


Mint az előbb mondtam, ha valaki nem összeírná hanem sajátot csinála vagy egy meglévőt küldene el az is jó lenne, csak az a lényeg, hogy menjen az idő a dátum és az admin.

Oldal: 1 / 1 Minden időpont UTC+02:00 időzóna szerinti
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/