HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1.  
  2. /* AMX Mod script.
  3. *
  4. * (c) Copyright 2002, OLO
  5. * This file is provided as is (no warranties).
  6. * 2003/09/27 thomastj Altered to work with Steam
  7. */
  8.  
  9. #include <amxmodx>
  10. #include <amxmisc>
  11.  
  12. /*****************************************************************
  13.  
  14.  Protect your clan tag on your server!
  15.  
  16.  1. Create a file named clan.cfg and place it in your /addons/amxmodx/configs folder
  17.  
  18.  2. Then add each members Steamid and the Clan Tag you want protected. One per line
  19.  
  20.   Example of your clan.cfg: (replace these STEAMID's with yours)
  21.  
  22. amx_protclantag "mytag" "STEAM_0:0:123142"
  23. amx_protclantag "mytag" "STEAM_0:0:654645"
  24. amx_protclantag "mytag" "STEAM_0:0:457457"
  25. amx_protclantag "anothertag" "STEAM_0:0:9988989"
  26. amx_protclantag "anothertag" "STEAM_0:0:23432"
  27. amx_protclantag "anothertag" "STEAM_0:0:120032"
  28.  
  29.  3. Now add the following to your server.cfg:
  30.  
  31.   exec /addons/amxmodx/configs/clan.cfg // Clan.cfg
  32.  
  33. ********************************************************************
  34. */
  35.  
  36. #define CLANTAGD
  37.  
  38. /* Max. number of entries */
  39. #define MAX_CLANTAGS 200
  40.  
  41. new clantaglist[MAX_CLANTAGS][32]
  42. new authids[MAX_CLANTAGS][32]
  43. new num_clantags
  44. new bool:cancheck[33]
  45.  
  46. public add_clantag(id,level,cid){
  47. if (!cmd_access(id,level,cid,3))
  48. return PLUGIN_HANDLED
  49. if (num_clantags >= MAX_CLANTAGS){
  50. console_print(id,"Maximum létszám %d elérve. Ne adj több klántagot hozzá!",MAX_CLANTAGS)
  51. return PLUGIN_HANDLED
  52. }
  53. read_argv(1,clantaglist[num_clantags],31)
  54. read_argv(2,authids[num_clantags],31)
  55. console_print(id,"Klán tag védelem ^"%s^" SteamID beállitva! ^"%s^" ",clantaglist[num_clantags],authids[num_clantags])
  56. num_clantags++
  57. return PLUGIN_HANDLED
  58. }
  59.  
  60. // check authid with given clantag
  61. cant_use_tag(id,clantag[]){
  62. new authid[32]
  63. get_user_authid(id,authid,31)
  64. #if defined CLANTAGD
  65. log_message("[Tag] Tag hitelesítve: ^"%s^" steamID: ^"%s^"",clantag,authid)
  66. #endif
  67. // If steam id still not assigned then redrive the client entered code and exit here
  68.  
  69. if ( (equal(authid,"STEAM_ID_PENDING")) || (equal(authid,"")) )
  70. {
  71. set_task(0.5,"client_entered",id)
  72. return false
  73. }
  74. for (new i=0; i<num_clantags; ++i){
  75. if ( equal(clantag,clantaglist[i]) && equal(authid,authids[i]) )
  76. return false
  77. }
  78. #if defined CLANTAGD
  79. log_message("[TAG] Hitelesítési hiba: ^"%s^" steamID: ^"%s^"",clantag,authid)
  80. #endif
  81. return true
  82. }
  83.  
  84. check_name(id,name[]) {
  85. for (new i=0; i<num_clantags; ++i){
  86. if (containi(name,clantaglist[i]) != -1){
  87. if (cant_use_tag(id,clantaglist[i])){
  88. client_cmd(id,"echo ^"* '%s' Védve van a szerveren!, Ne használd!!!^";disconnect",clantaglist[i])
  89. client_print(0,print_chat,"* %s Ki lett rúgva, Ez a név '%s' védett", name,clantaglist[i])
  90. #if defined CLANTAGD
  91. log_message("[TAG védelem] %s ki lett rúgva, neve '%s' ", name,clantaglist[i])
  92. #endif
  93. cancheck[id] = false
  94. return PLUGIN_HANDLED
  95. }
  96. break
  97. }
  98. }
  99. return PLUGIN_CONTINUE
  100. }
  101.  
  102. /* catch clients connecting and check names & clan tags */
  103. public client_putinserver(id)
  104. set_task(0.5,"client_entered",id)
  105.  
  106. public client_entered(id){
  107. cancheck[id] = true
  108. new name[32]
  109. get_user_name(id,name,31)
  110. #if defined CLANTAGD
  111. log_message("[TAG] Csatlakozott ^"%s^"",name)
  112. #endif
  113. return check_name(id,name)
  114. }
  115.  
  116. /* detect name change against protected list */
  117. public client_infochanged(id){
  118. if (cancheck[id]){ /* to exclude double checking when player is dead and name is switched back by CS */
  119. new name[32]
  120. get_user_info(id,"name",name,31)
  121. #if defined CLANTAGD
  122. log_message("[TAG] Átirta a nevét ^"%s^"",name)
  123. #endif
  124. return check_name(id,name)
  125. }
  126. return PLUGIN_CONTINUE
  127. }
  128.  
  129. public plugin_init() {
  130. register_plugin("Clan Tag Protection","0.8.5","default")
  131. register_concmd("amx_protclantag","add_clantag",ADMIN_LEVEL_A,"<clan tag> <authid>")
  132. return PLUGIN_CONTINUE
  133. }
  134.  
  135.