HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /* Spectator Banner(PICTURE) Ads
  2.   Have you ever seen the banner pictuer(left up corner) when watching HLTV?
  3.   We can see it ingame now when you are death or become spectator.
  4.   Should it using by Valve Ads? Who know! Enjoy it!
  5. */
  6.  
  7. /* Description::
  8.   Ramdon select one tga file when map was loaded.
  9.   Tested on CS/CZ, may works on other MOD.
  10. */
  11.  
  12. /* Install Instructions::
  13.   Put the tga files in (cstrike\gfx) folder
  14.   Put the banner_ads.amxx in (cstrike\addons\amxmodx\plugins) folder
  15. */
  16.  
  17. /* Console Commands::
  18.   spec_banner_ads 1/0 // Enable & Disable Function
  19. */
  20.  
  21. /* Change Log::
  22.   v0.1 First released
  23. */
  24.  
  25. /* Notice::
  26.   The tga file only support 24b color format.
  27.   The zip file contain tga only fit 800*600 display resolution of client.
  28.   Change the size if most client used difference resolution.
  29. */
  30.  
  31. /* Screenshots::
  32. */
  33.  
  34.  
  35. #define PLUGIN "Spectator Banner Ads"
  36. #define VERSION "0.1.16"
  37. #define AUTHOR "iG_os"
  38. #define COMPILER "voga955 - HLMOD.hu"
  39.  
  40. #include <amxmodx>
  41.  
  42. #define SVC_DIRECTOR 51 // come from util.h
  43. #define DRC_CMD_BANNER 9 // come from hltv.h
  44.  
  45. // sum of tga files
  46. #define TGASUM 2
  47.  
  48. // tga of banners
  49. new szTga[TGASUM][] ={
  50. "gfx/friends.tga",
  51. "gfx/amxx.tga"
  52. }
  53.  
  54. new pCVAR_Tga
  55. new g_SendOnce[33]
  56.  
  57. public plugin_precache()
  58. {
  59. register_plugin(PLUGIN, VERSION, AUTHOR)
  60. register_logevent("joined_team", 3, "1=joined team")
  61.  
  62. pCVAR_Tga = register_cvar("spec_banner_ads", "1")
  63.  
  64. if (get_pcvar_num(pCVAR_Tga))
  65. {
  66. for (new i=0; i<TGASUM; i++)
  67. precache_generic(szTga[i])
  68. }
  69. }
  70.  
  71.  
  72. public client_putinserver(id)
  73. {
  74. g_SendOnce[id] = true
  75. }
  76.  
  77.  
  78. public joined_team()
  79. {
  80. new loguser[80], name[32]
  81. read_logargv(0, loguser, 79)
  82. parse_loguser(loguser, name, 31)
  83. new id = get_user_index(name)
  84.  
  85. if ( get_pcvar_num(pCVAR_Tga) && g_SendOnce[id] && is_user_connected(id) )
  86. {
  87. // random select one tga
  88. new index = random_num( 0, TGASUM - 1)
  89. g_SendOnce[id] = false
  90.  
  91. // send show tga command to client
  92. message_begin( MSG_ONE, SVC_DIRECTOR, _, id )
  93. write_byte( strlen( szTga[index]) + 2 ) // command length in bytes
  94. write_byte( DRC_CMD_BANNER )
  95. write_string( szTga[index] ) // banner file
  96. message_end()
  97. }
  98. }
  99.  
  100.  
  101.