hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.04.28. 08:32



Jelenlévő felhasználók

Jelenleg 523 felhasználó van jelen :: 0 regisztrált, 0 rejtett és 523 vendég

A legtöbb felhasználó (1565 fő) 2020.11.21. 11:26-kor tartózkodott itt.

Regisztrált felhasználók: nincs regisztrált felhasználó az elmúlt 5 percben aktív felhasználók alapján

Utoljára aktív
Ahhoz hogy lásd ki volt utoljára aktív, be kell jelentkezned.



Az oldal teljeskörű
használatához regisztrálj.

Regisztráció

Kereső


Új téma nyitása  Hozzászólás a témához  [ 2 hozzászólás ] 
Szerző Üzenet
HozzászólásElküldve: 2016.07.03. 11:53 
Offline
Beavatott
Avatar

Csatlakozott: 2015.12.27. 11:47
Hozzászólások: 88
Megköszönt másnak: 9 alkalommal
Sziasztok!
Valaki segitene össze irni ezt a 2 plugint?:D
  1. /* Plugin generated by AMXX-Studio */
  2.  
  3. #include <amxmodx>
  4. #include <amxmisc>
  5. #include <cstrike>
  6. #include <colorchat>
  7.  
  8. #define PLUGIN ""
  9. #define VERSION "1.0"
  10. #define AUTHOR "Pista"
  11.  
  12.  
  13. public plugin_init() {
  14.     register_plugin(PLUGIN, VERSION, AUTHOR)
  15.    
  16.     register_clcmd("say", "handlesay")
  17.     // Add your code here...
  18. }
  19. public handlesay(id) {
  20.     new message[192], Name[32], chat[192], none[2][32], alive[11]
  21.     read_args(message, 191)
  22.     remove_quotes(message)
  23.    
  24.     if(is_user_alive(id)) {
  25.         alive = ""
  26.     }
  27.     else {
  28.         alive = "*DEAD*"
  29.     }
  30.     if(!equali(message, none[0]) && !equali(message, none[1])) {
  31.         get_user_name(id, Name, 31);
  32.         new CsTeams:userTeam = cs_get_user_team(id)
  33.         if(userTeam == CS_TEAM_CT)
  34.             formatex(chat, 191, "^1%s^4[^3Elháritó^4]^3%s^1 :^1 %s", alive,Name, message)
  35.         else if(userTeam == CS_TEAM_T)
  36.             formatex(chat, 191, "^1%s^4[^3Terrorista^4]^3%s^1 :^1 %s", alive, Name, message)
  37.         switch(cs_get_user_team(id)) {
  38.             case 1: ColorChat(0, RED, chat)
  39.             case 2: ColorChat(0, BLUE, chat)
  40.         }
  41.         if(cs_get_user_team(id) == CS_TEAM_SPECTATOR)
  42.             ColorChat(0, GREY, chat)
  43.         return PLUGIN_HANDLED  
  44.     }
  45.     return PLUGIN_CONTINUE
  46. }

AND
  1. /*  AMX Mod X script
  2. *                               ______                       __                    __          __                              ________
  3. *                      / ____ \                      \ \                  / /         /  |                            |______  |
  4. *                     / /    \ \                      \ \                / /         /   |                        __         | |
  5. *                    | /      \ |                      \ \              / /         / /| |                       |__|        | |
  6. *                    | |      | |    ______     _    __ \ \            / /  _      / / | |       ______                      | |
  7. *        _   _____   _____   | |      | |   / ____ \   | |  / /  \ \          / /  |_|    / /  | |      / ____ \                     | |
  8. *   | | / __  | / __  |  | |      | |  | /    \_\  | | / /    \ \        / /    _    / /   | |     /_/    \ \                    | |
  9. *   | |/ /  | |/ /  | |  | |      | |  | \_____    | |/ /      \ \      / /    | |  / /____| |__     ______| |                   | |
  10. *   | | /   | | /   | |  | |      | |   \_____ \   | | /        \ \    / /     | | /_______  |__|   / _____  |                   | |
  11. *   | |/    | |/    | |  | |      | |         \ |  | |/\         \ \  / /      | |         | |     / /     | |        __         | |
  12. *   | |     | |     | |  | \      / |  __     | |  | |\ \         \ \/ /       | |         | |    | |     /| |       |  |        | |
  13. *   | |     | |     | |   \ \____/ /   \ \____/ |  | | \ \         \  /        | |         | |     \ \___/ /\ \      / /    _____| |
  14. *   |_|     |_|     |_|    \______/     \______/   |_|  \_\         \/         |_|         |_|      \_____/  \_\    /_/    |_______|
  15. *
  16. *
  17. *
  18. *   Fordította: BBk
  19. *
  20. *** Copyright 2011 - 2013, m0skVi4a ;]
  21. *** Plugin created in Rousse, Bulgaria
  22. *
  23. *
  24. *** Plugin thread 1:
  25. *   https://forums.alliedmods.net/showthread.php?t=183491
  26. *
  27. *** Plugin thread 2:
  28. *   http://amxmodxbg.org/forum/viewtopic.php?t=38972
  29. *
  30. *
  31. *** Description:
  32. *
  33. *   With this plugin you can set prefixes to Admins with special flags. Also Admins can put custom prefixes to them or to other players if they want, but only if they have the required flag.
  34. *
  35. *
  36. *** Commands:
  37. *
  38. *   ap_reload_prefixes
  39. *   Reloads Prefixes' file from console without restarting the server.
  40. *
  41. *   ap_reload_badprefixes
  42. *   Reloads Bad Prefixes' file from console without restarting the server.
  43. *
  44. *   ap_put_player "name" "prefix"
  45. *   Puts prefix to the name you type if you have the special flag. Or if there is no prefix typed, removes the prefix which the player has.
  46. *
  47. *
  48. *** CVARS:
  49. *
  50. *   "ap_bad_prefixes"    -  Is the Bad Prefixes option on(1) or off(0).   Default: 1
  51. *   "ap_listen"      -  Is the Admin Listen option on(1) or off(0).   Default: 1
  52. *   "ap_listen_flag"     -  The flag, needed for Listen option.   Default: a
  53. *   "ap_custom"      -  Is the Custom Prefix option for each Admin is on(1) or off(0).   Default: 1
  54. *   "ap_custom_flag"     -  The flag, needed for setting custom prefix.   Default: b
  55. *   "ap_say_characters"  -  Is the Start Say Characters option on(1) or off(0).   Default: 1
  56. *   "ap_prefix_characters"   -  Is the Checker for Characters in Custom Prefixes' Options on(1) or off(0).   Default: 1
  57. *
  58. *   All CVARS are without quotes!
  59. *
  60. *
  61. *** Credits:
  62. *
  63. *   m0skVi4a ;]     -   for the idea, making and testing the plugin
  64. *   SpeeDeeR        -   for little help with the plugin
  65. *   Ant1Lamer       -   for testing the plugin
  66. *   Vasilii-Zaicev  -   for testing the plugin
  67. *
  68. *
  69. *** Changelog:
  70. *
  71. *   April 22, 2012   -  V1.0:
  72. *       -  First Release
  73. *
  74. *   May 19, 2012   -  V2.0:
  75. *       -  Full optimization
  76. *       -  Added Bad Prefixes' file
  77. *       -  Added Multi-Lingual file
  78. *       -  Added IP and Name support in ap_prefixes.ini
  79. *       -  Added Forbidden Say characters
  80. *       -  New CVARS for setting the flags for each of the options
  81. *  
  82. *   May 29, 2012   -  V2.1:
  83. *       -  Fixed bug with some say or say_team commands are not executed
  84. *
  85. *   January 17, 2013   -  V3.0:
  86. *       -  Full optimization
  87. *       -  Fixed bug when typing spaces and in tha chat is showing an empty message
  88. *       -  SteamID support
  89. *       -  Removed nvault
  90. *       -  Removed ap_put_player command
  91. *       -  ap_put_player command is combined with ap_put command
  92. *       -  Removed some CVARs
  93. *
  94. *   August 18, 2013   -  V4.0:
  95. *       -  Small code changes and little bug fixes
  96. *       -  Added Prefux Toggle command
  97. *       -  Fixed bug with the supporting of the plugin on AMXX 1.8.2
  98. *       -  AMXX 1.8.2 Supprot!
  99. *       -  SQL Version!
  100. *
  101. *
  102. *** Contact me on:
  103. *   E-MAIL: pvldimitrov@gmail.com
  104. *   SKYPE: pa7ohin
  105. */
  106.  
  107.  
  108. #include <amxmodx>
  109. #include <amxmisc>
  110. #include <celltrie>
  111. #include <cstrike>
  112.  
  113. #define VERSION "4.0"
  114. #define FLAG_LOAD ADMIN_CFG
  115. #define MAX_PREFIXES 33
  116. #define MAX_BAD_PREFIXES 100
  117.  
  118. new g_bad_prefix, g_listen, g_listen_flag, g_custom, g_custom_flag, g_say_characters, g_prefix_characters;
  119. new pre_ips_count = 0, pre_names_count = 0, pre_steamids_count, pre_flags_count = 0, bad_prefix_count = 0, i, temp_cvar[2];
  120. new configs_dir[64], file_prefixes[128], file_bad_prefixes[128], text[128], prefix[32], type[2], key[32], length, line = 0, error[256];
  121. new g_saytxt, g_maxplayers, CsTeams:g_team;
  122. new g_typed[192], g_message[192], g_name[32];
  123. new Trie:pre_ips_collect, Trie:pre_names_collect, Trie:pre_steamids_collect, Trie:pre_flags_collect, Trie:bad_prefixes_collect, Trie:client_prefix;
  124. new str_id[16], temp_key[35], temp_prefix[32], temp_value;
  125. new bool:g_toggle[33];
  126.  
  127. new const say_team_info[2][CsTeams][] =
  128. {
  129.     {"*SPEC* ", "*DEAD* ", "*DEAD* ", "*SPEC* "},
  130.     {"", "", "", ""}
  131. }
  132.  
  133. new const sayteam_team_info[2][CsTeams][] =
  134. {
  135.     {"(Spectator) ", "*DEAD*(Terrorist) ", "*DEAD*(Counter-Terrorist) ", "(Spectator) "},
  136.     {"(Spectator) ", "(Terrorist) ", "(Counter-Terrorist) ", "(Spectator) "}
  137. }
  138.  
  139. new const forbidden_say_symbols[] = {
  140.     "/",
  141.     "!",
  142.     "%",
  143.     "$"
  144. }
  145.  
  146. new const forbidden_prefixes_symbols[] = {
  147.     "/",
  148.     "\",
  149.     "%",
  150.     "$",
  151.     ".",
  152.     ":",
  153.     "?",
  154.     "!",
  155.     "@",
  156.     "#",
  157.     "%"
  158. }
  159.  
  160. new const separator[] = "************************************************"
  161. new const in_prefix[] = "[AdminPrefixes]"
  162.  
  163. public plugin_init()
  164. {
  165.     register_plugin("Admin Prefixes", VERSION, "m0skVi4a ;]")
  166.  
  167.     g_bad_prefix = register_cvar("ap_bad_prefixes", "1")
  168.     g_listen = register_cvar("ap_listen", "1")
  169.     g_listen_flag = register_cvar("ap_listen_flag", "a")
  170.     g_custom = register_cvar("ap_custom_current", "1")
  171.     g_custom_flag = register_cvar("ap_custom_current_flag", "b")
  172.     g_say_characters = register_cvar("ap_say_characters", "1")
  173.     g_prefix_characters = register_cvar("ap_prefix_characters", "1")
  174.  
  175.     g_saytxt = get_user_msgid ("SayText")
  176.     g_maxplayers = get_maxplayers()
  177.  
  178.     register_concmd("ap_reload_prefixes", "LoadPrefixes")
  179.     register_concmd("ap_reload_badprefixes", "LoadBadPrefixes")
  180.     register_concmd("ap_put", "SetPlayerPrefix")
  181.     register_clcmd("say", "HookSay")
  182.     register_clcmd("say_team", "HookSayTeam")
  183.  
  184.     pre_ips_collect = TrieCreate()
  185.     pre_names_collect = TrieCreate()
  186.     pre_steamids_collect = TrieCreate()
  187.     pre_flags_collect = TrieCreate()
  188.     bad_prefixes_collect = TrieCreate()
  189.     client_prefix = TrieCreate()
  190.  
  191.     register_dictionary("admin_prefixes.txt")
  192.  
  193.     get_configsdir(configs_dir, charsmax(configs_dir))
  194.     formatex(file_prefixes, charsmax(file_prefixes), "%s/ap_prefixes.ini", configs_dir)
  195.     formatex(file_bad_prefixes, charsmax(file_bad_prefixes), "%s/ap_bad_prefixes.ini", configs_dir)
  196.  
  197.     LoadPrefixes(0)
  198.     LoadBadPrefixes(0)
  199. }
  200.    
  201. public LoadPrefixes(id)
  202. {
  203.     if(!(get_user_flags(id) & FLAG_LOAD))
  204.     {
  205.         console_print(id, "%L", LANG_SERVER, "PREFIX_PERMISSION", in_prefix)
  206.         return PLUGIN_HANDLED
  207.     }
  208.  
  209.     TrieClear(pre_ips_collect)
  210.     TrieClear(pre_names_collect)
  211.     TrieClear(pre_steamids_collect)
  212.     TrieClear(pre_flags_collect)
  213.  
  214.     line = 0, length = 0, pre_flags_count = 0, pre_ips_count = 0, pre_names_count = 0;
  215.  
  216.     if(!file_exists(file_prefixes))
  217.     {
  218.         formatex(error, charsmax(error), "%L", LANG_SERVER, "PREFIX_NOT_FOUND", in_prefix, file_prefixes)
  219.         set_fail_state(error)
  220.     }
  221.  
  222.     server_print(separator)
  223.  
  224.     while(read_file(file_prefixes, line++ , text, charsmax(text), length) && (pre_ips_count + pre_names_count + pre_steamids_count + pre_flags_count) <= MAX_PREFIXES)
  225.     {
  226.         if(!text[0] || text[0] == '^n' || text[0] == ';' || (text[0] == '/' && text[1] == '/'))
  227.             continue
  228.  
  229.         parse(text, type, charsmax(type), key, charsmax(key), prefix, charsmax(prefix))
  230.         trim(prefix)
  231.  
  232.         if(!type[0] || !prefix[0] || !key[0])
  233.             continue
  234.  
  235.         replace_all(prefix, charsmax(prefix), "!g", "^x04")
  236.         replace_all(prefix, charsmax(prefix), "!t", "^x03")
  237.         replace_all(prefix, charsmax(prefix), "!n", "^x01")
  238.  
  239.         switch(type[0])
  240.         {
  241.             case 'f':
  242.             {
  243.                 pre_flags_count++
  244.                 TrieSetString(pre_flags_collect, key, prefix)
  245.                 server_print("%L", LANG_SERVER, "PREFIX_LOAD_FLAG", in_prefix, prefix, key[0])
  246.             }
  247.             case 'i':
  248.             {
  249.                 pre_ips_count++
  250.                 TrieSetString(pre_ips_collect, key, prefix)
  251.                 server_print("%L", LANG_SERVER, "PREFIX_LOAD_IP", in_prefix, prefix, key)
  252.             }
  253.             case 's':
  254.             {
  255.                 pre_steamids_count++
  256.                 TrieSetString(pre_steamids_collect, key, prefix)
  257.                 server_print("%L", LANG_SERVER, "PREFIX_LOAD_STEAMID", in_prefix, prefix, key)
  258.             }
  259.             case 'n':
  260.             {
  261.                 pre_names_count++
  262.                 TrieSetString(pre_names_collect, key, prefix)
  263.                 server_print("%L", LANG_SERVER, "PREFIX_LOAD_NAME", in_prefix, prefix, key)
  264.             }
  265.             default:
  266.             {
  267.                 continue
  268.             }
  269.         }
  270.     }
  271.  
  272.     if(pre_flags_count <= 0 && pre_ips_count <= 0 && pre_steamids_count <= 0 && pre_names_count <= 0)
  273.     {
  274.         server_print("%L", LANG_SERVER, "PREFIX_NO", in_prefix)
  275.     }
  276.  
  277.     get_user_name(id, g_name, charsmax(g_name))
  278.     server_print("%L", LANG_SERVER, "PREFIX_LOADED_BY", in_prefix, g_name)
  279.     console_print(id, "%L", LANG_SERVER, "PREFIX_LOADED", in_prefix)
  280.  
  281.     server_print(separator)
  282.  
  283.     for(new i = 1; i <= g_maxplayers; i++)
  284.     {
  285.         num_to_str(i, str_id, charsmax(str_id))
  286.         TrieDeleteKey(client_prefix, str_id)
  287.         PutPrefix(i)
  288.     }
  289.  
  290.     return PLUGIN_HANDLED
  291. }
  292.  
  293. public LoadBadPrefixes(id)
  294. {
  295.     if(!get_pcvar_num(g_bad_prefix))
  296.     {
  297.         console_print(id, "%L", LANG_SERVER, "BADP_OFF", in_prefix)
  298.         return PLUGIN_HANDLED
  299.     }
  300.  
  301.     if(!(get_user_flags(id) & FLAG_LOAD))
  302.     {
  303.         console_print(id, "%L", LANG_SERVER, "BADP_PERMISSION", in_prefix)
  304.         return PLUGIN_HANDLED
  305.     }
  306.  
  307.     TrieClear(bad_prefixes_collect)
  308.  
  309.     line = 0, length = 0, bad_prefix_count = 0;
  310.  
  311.     if(!file_exists(file_bad_prefixes))
  312.     {
  313.         console_print(id, "%L", LANG_SERVER, "BADP_NOT_FOUND", in_prefix, file_bad_prefixes)
  314.         return PLUGIN_HANDLED      
  315.     }
  316.  
  317.     server_print(separator)
  318.  
  319.     while(read_file(file_bad_prefixes, line++ , text, charsmax(text), length) && bad_prefix_count <= MAX_BAD_PREFIXES)
  320.     {
  321.         if(!text[0] || text[0] == '^n' || text[0] == ';' || (text[0] == '/' && text[1] == '/'))
  322.             continue
  323.  
  324.         parse(text, prefix, charsmax(prefix))
  325.  
  326.         if(!prefix[0])
  327.             continue
  328.  
  329.         bad_prefix_count++
  330.         TrieSetCell(bad_prefixes_collect, prefix, 1)
  331.         server_print("%L", LANG_SERVER, "BADP_LOAD", in_prefix, prefix)
  332.     }
  333.  
  334.     if(bad_prefix_count <= 0)
  335.     {
  336.         server_print("%L", LANG_SERVER, "BADP_NO", in_prefix)
  337.     }
  338.  
  339.     get_user_name(id, g_name, charsmax(g_name))
  340.     server_print("%L", LANG_SERVER, "BADP_LOADED_BY", in_prefix, g_name)
  341.     console_print(id, "%L", LANG_SERVER, "BADP_LOADED", in_prefix)
  342.  
  343.     server_print(separator)
  344.  
  345.     return PLUGIN_HANDLED
  346. }
  347.  
  348. public client_putinserver(id)
  349. {
  350.     g_toggle[id] = true
  351.     num_to_str(id, str_id, charsmax(str_id))
  352.     TrieSetString(client_prefix, str_id, "")
  353.     PutPrefix(id)
  354. }
  355.  
  356. public HookSay(id)
  357. {
  358.     read_args(g_typed, charsmax(g_typed))
  359.     remove_quotes(g_typed)
  360.  
  361.     trim(g_typed)
  362.  
  363.     if(equal(g_typed, "") || !is_user_connected(id))
  364.         return PLUGIN_HANDLED_MAIN
  365.  
  366.     if(equal(g_typed, "/prefix"))
  367.     {
  368.         if(g_toggle[id])
  369.         {
  370.             g_toggle[id] = false
  371.             client_print(id, print_chat, "%L", LANG_SERVER, "PREFIX_OFF", in_prefix)
  372.         }
  373.         else
  374.         {
  375.             g_toggle[id] = true
  376.             client_print(id, print_chat, "%L", LANG_SERVER, "PREFIX_ON", in_prefix)
  377.         }
  378.  
  379.         return PLUGIN_HANDLED_MAIN
  380.     }
  381.  
  382.     if(!g_toggle[id])
  383.         return PLUGIN_CONTINUE
  384.  
  385.     num_to_str(id, str_id, charsmax(str_id))
  386.  
  387.     if((TrieGetString(client_prefix, str_id, temp_prefix, charsmax(temp_prefix)) && get_pcvar_num(g_say_characters) == 1) || (!TrieGetString(client_prefix, str_id, temp_prefix, charsmax(temp_prefix)) && get_pcvar_num(g_say_characters) == 2) || get_pcvar_num(g_say_characters) == 3)
  388.     {
  389.         if(check_say_characters(g_typed))
  390.             return PLUGIN_HANDLED_MAIN
  391.     }
  392.  
  393.     get_user_name(id, g_name, charsmax(g_name))
  394.  
  395.     g_team = cs_get_user_team(id)
  396.  
  397.     if(temp_prefix[0])
  398.     {
  399.         formatex(g_message, charsmax(g_message), "^1%s^4%s^3 %s :^4 %s", say_team_info[is_user_alive(id)][g_team], temp_prefix, g_name, g_typed)
  400.     }
  401.     else
  402.     {
  403.         formatex(g_message, charsmax(g_message), "^1%s^3%s :^1 %s", say_team_info[is_user_alive(id)][g_team], g_name, g_typed)
  404.     }
  405.  
  406.     get_pcvar_string(g_listen_flag, temp_cvar, charsmax(temp_cvar))
  407.  
  408.     for(new i = 1; i <= g_maxplayers; i++)
  409.     {
  410.         if(!is_user_connected(i))
  411.             continue
  412.  
  413.         if(is_user_alive(id) && is_user_alive(i) || !is_user_alive(id) && !is_user_alive(i) || get_pcvar_num(g_listen) && get_user_flags(i) & read_flags(temp_cvar))
  414.         {
  415.             send_message(g_message, id, i)
  416.         }
  417.     }
  418.  
  419.     return PLUGIN_HANDLED_MAIN
  420. }
  421.  
  422. public HookSayTeam(id)
  423. {
  424.     read_args(g_typed, charsmax(g_typed))
  425.     remove_quotes(g_typed)
  426.  
  427.     trim(g_typed)
  428.  
  429.     if(equal(g_typed, "") || !is_user_connected(id))
  430.         return PLUGIN_HANDLED_MAIN
  431.  
  432.     if(equal(g_typed, "/prefix"))
  433.     {
  434.         if(g_toggle[id])
  435.         {
  436.             g_toggle[id] = false
  437.             client_print(id, print_chat, "%L", LANG_SERVER, "PREFIX_OFF", in_prefix)
  438.         }
  439.         else
  440.         {
  441.             g_toggle[id] = true
  442.             client_print(id, print_chat, "%L", LANG_SERVER, "PREFIX_ON", in_prefix)
  443.         }
  444.  
  445.         return PLUGIN_HANDLED_MAIN
  446.     }
  447.  
  448.     if(!g_toggle[id])
  449.         return PLUGIN_CONTINUE
  450.  
  451.     num_to_str(id, str_id, charsmax(str_id))
  452.  
  453.     if((TrieGetString(client_prefix, str_id, temp_prefix, charsmax(temp_prefix)) && get_pcvar_num(g_say_characters) == 1) || (!TrieGetString(client_prefix, str_id, temp_prefix, charsmax(temp_prefix)) && get_pcvar_num(g_say_characters) == 2) || get_pcvar_num(g_say_characters) == 3)
  454.     {
  455.         if(check_say_characters(g_typed))
  456.             return PLUGIN_HANDLED_MAIN
  457.     }
  458.  
  459.     get_user_name(id, g_name, charsmax(g_name))
  460.  
  461.     g_team = cs_get_user_team(id)
  462.  
  463.     if(temp_prefix[0])
  464.     {
  465.         formatex(g_message, charsmax(g_message), "^1%s^4%s^3 %s :^4 %s", sayteam_team_info[is_user_alive(id)][g_team], temp_prefix, g_name, g_typed)
  466.     }
  467.     else
  468.     {
  469.         formatex(g_message, charsmax(g_message), "^1%s^3%s :^1 %s", sayteam_team_info[is_user_alive(id)][g_team], g_name, g_typed)
  470.     }
  471.  
  472.     get_pcvar_string(g_listen_flag, temp_cvar, charsmax(temp_cvar))
  473.  
  474.     for(new i = 1; i <= g_maxplayers; i++)
  475.     {
  476.         if(!is_user_connected(i))
  477.             continue
  478.  
  479.         if(get_user_team(id) == get_user_team(i) || get_pcvar_num(g_listen) && get_user_flags(i) & read_flags(temp_cvar))
  480.         {
  481.             if(is_user_alive(id) && is_user_alive(i) || !is_user_alive(id) && !is_user_alive(i) || get_pcvar_num(g_listen) && get_user_flags(i) & read_flags(temp_cvar))
  482.             {
  483.                 send_message(g_message, id, i)
  484.             }
  485.         }
  486.     }
  487.  
  488.     return PLUGIN_HANDLED_MAIN
  489. }
  490.  
  491. public SetPlayerPrefix(id)
  492. {
  493.     if(!get_pcvar_num(g_custom) || !get_pcvar_string(g_custom_flag, temp_cvar, charsmax(temp_cvar)))
  494.     {
  495.         console_print(id, "%L", LANG_SERVER, "CUSTOM_OFF", in_prefix)
  496.         return PLUGIN_HANDLED
  497.     }
  498.  
  499.     if(!(get_user_flags(id) & read_flags(temp_cvar)))
  500.     {
  501.         console_print(id, "%L", LANG_SERVER, "CUSTOM_PERMISSION", in_prefix)
  502.         return PLUGIN_HANDLED
  503.     }
  504.  
  505.     new input[128], target;
  506.     new arg_type[2], arg_prefix[32], arg_key[35];
  507.     new temp_str[16];
  508.  
  509.     read_args(input, charsmax(input))
  510.     remove_quotes(input)
  511.     parse(input, arg_type, charsmax(arg_type), arg_key, charsmax(arg_key), arg_prefix, charsmax(arg_prefix))
  512.     trim(arg_prefix)
  513.  
  514.     if(get_pcvar_num(g_bad_prefix) && is_bad_prefix(arg_prefix) && !equali(arg_prefix, ""))
  515.     {
  516.         console_print(id, "%L", LANG_SERVER, "CUSTOM_FORBIDDEN", in_prefix, arg_prefix)
  517.         return PLUGIN_HANDLED
  518.     }
  519.  
  520.     if(get_pcvar_num(g_prefix_characters) && check_prefix_characters(arg_prefix))
  521.     {
  522.         console_print(id, "%L", LANG_SERVER, "CUSTOM_SYMBOL", in_prefix, arg_prefix, forbidden_prefixes_symbols[i])
  523.         return PLUGIN_HANDLED
  524.     }
  525.  
  526.     switch(arg_type[0])
  527.     {
  528.         case 'f':
  529.         {
  530.             target = 0
  531.             temp_str = "Flag"
  532.         }
  533.         case 'i':
  534.         {
  535.             target = find_player("d", arg_key)
  536.             temp_str = "IP"
  537.         }
  538.         case 's':
  539.         {
  540.             target = find_player("c", arg_key)
  541.             temp_str = "SteamID"
  542.         }
  543.         case 'n':
  544.         {
  545.             target = find_player("a", arg_key)
  546.             temp_str = "Name"
  547.         }
  548.         default:
  549.         {
  550.             console_print(id, "%L", LANG_SERVER, "CUSTOM_INVALID", in_prefix, arg_type)
  551.             return PLUGIN_HANDLED
  552.         }
  553.     }
  554.  
  555.     get_user_name(id, g_name, charsmax(g_name))
  556.  
  557.     if(equali(arg_prefix, ""))
  558.     {
  559.         find_and_delete(arg_type, arg_key)
  560.  
  561.         if(target)
  562.         {
  563.             PutPrefix(target)
  564.         }
  565.        
  566.         console_print(id, "%L", LANG_SERVER, "CUSTOM_REMOVE", in_prefix, temp_str, arg_key)
  567.         server_print("%L", LANG_SERVER, "CUSTOM_REMOVE_INFO", in_prefix, g_name, temp_str, arg_key)
  568.         return PLUGIN_HANDLED
  569.     }
  570.  
  571.     find_and_delete(arg_type, arg_key)
  572.  
  573.     formatex(text, charsmax(text), "^"%s^" ^"%s^" ^"%s^"", arg_type, arg_key, arg_prefix)
  574.     write_file(file_prefixes, text, -1)
  575.  
  576.     switch(arg_type[0])
  577.     {
  578.         case 'f':
  579.         {
  580.             TrieSetString(pre_flags_collect, arg_key, arg_prefix)
  581.         }
  582.         case 'i':
  583.         {
  584.             TrieSetString(pre_ips_collect, arg_key, arg_prefix)
  585.         }
  586.         case 's':
  587.         {
  588.             TrieSetString(pre_steamids_collect, arg_key, arg_prefix)
  589.         }
  590.         case 'n':
  591.         {
  592.             TrieSetString(pre_names_collect, arg_key, arg_prefix)
  593.         }
  594.     }
  595.  
  596.     if(target)
  597.     {
  598.         num_to_str(target, str_id, charsmax(str_id))
  599.         TrieSetString(client_prefix, str_id, arg_prefix)
  600.     }
  601.  
  602.     console_print(id, "%L", LANG_SERVER, "CUSTOM_CHANGE", in_prefix, temp_str, arg_key, arg_prefix)
  603.     server_print("%L", LANG_SERVER, "CUSTOM_CHANGE_INFO", in_prefix, g_name, temp_str, arg_key, arg_prefix)
  604.  
  605.     return PLUGIN_HANDLED
  606. }
  607.  
  608. public client_infochanged(id)
  609. {
  610.     if(!is_user_connected(id))
  611.         return PLUGIN_CONTINUE
  612.  
  613.     new g_old_name[32];
  614.  
  615.     get_user_info(id, "name", g_name, charsmax(g_name))
  616.     get_user_name(id, g_old_name, charsmax(g_old_name))
  617.  
  618.     if(!equal(g_name, g_old_name))
  619.     {
  620.         num_to_str(id, str_id, charsmax(str_id))
  621.         TrieSetString(client_prefix, str_id, "")
  622.         set_task(0.5, "PutPrefix", id)
  623.         return PLUGIN_HANDLED
  624.     }
  625.  
  626.     return PLUGIN_CONTINUE
  627. }
  628.  
  629. public PutPrefix(id)
  630. {
  631.     num_to_str(id, str_id, charsmax(str_id))
  632.     TrieSetString(client_prefix, str_id, "")
  633.  
  634.     new sflags[32], temp_flag[2];
  635.     get_flags(get_user_flags(id), sflags, charsmax(sflags))
  636.  
  637.     for(new i = 0; i <= charsmax(sflags); i++)
  638.     {
  639.         formatex(temp_flag, charsmax(temp_flag), "%c", sflags[i])
  640.  
  641.         if(TrieGetString(pre_flags_collect, temp_flag, temp_prefix, charsmax(temp_prefix)))
  642.         {
  643.             TrieSetString(client_prefix, str_id, temp_prefix)
  644.         }
  645.     }
  646.  
  647.     get_user_ip(id, temp_key, charsmax(temp_key), 1)
  648.  
  649.     if(TrieGetString(pre_ips_collect, temp_key, temp_prefix, charsmax(temp_prefix)))
  650.     {
  651.         TrieSetString(client_prefix, str_id, temp_prefix)
  652.     }
  653.  
  654.     get_user_authid(id, temp_key, charsmax(temp_key))
  655.  
  656.     if(TrieGetString(pre_steamids_collect, temp_key, temp_prefix, charsmax(temp_prefix)))
  657.     {
  658.         TrieSetString(client_prefix, str_id, temp_prefix)
  659.     }
  660.  
  661.     get_user_name(id, temp_key, charsmax(temp_key))
  662.  
  663.     if(TrieGetString(pre_names_collect, temp_key, temp_prefix, charsmax(temp_prefix)))
  664.     {
  665.         TrieSetString(client_prefix, str_id, temp_prefix)
  666.     }
  667.  
  668.     return PLUGIN_HANDLED
  669. }
  670.  
  671. send_message(const message[], const id, const i)
  672. {
  673.     message_begin(MSG_ONE, g_saytxt, {0, 0, 0}, i)
  674.     write_byte(id)
  675.     write_string(message)
  676.     message_end()
  677. }
  678.  
  679. bool:check_say_characters(const check_message[])
  680. {
  681.     for(new i = 0; i < charsmax(forbidden_say_symbols); i++)
  682.     {
  683.         if(check_message[0] == forbidden_say_symbols[i])
  684.         {
  685.             return true
  686.         }
  687.     }
  688.     return false
  689. }
  690.  
  691. bool:check_prefix_characters(const check_prefix[])
  692. {
  693.     for(i = 0; i < charsmax(forbidden_prefixes_symbols); i++)
  694.     {
  695.         if(containi(check_prefix, forbidden_prefixes_symbols[i]) != -1)
  696.         {
  697.             return true
  698.         }
  699.     }
  700.     return false
  701. }
  702.  
  703. bool:is_bad_prefix(const check_prefix[])
  704. {
  705.     if(TrieGetCell(bad_prefixes_collect, check_prefix, temp_value))
  706.     {
  707.         return true
  708.     }
  709.     return false
  710. }
  711.  
  712. find_and_delete(const arg_type[], const arg_key[])
  713. {
  714.     line = 0, length = 0;
  715.  
  716.     while(read_file(file_prefixes, line++ , text, charsmax(text), length))
  717.     {
  718.         if(!text[0] || text[0] == '^n' || text[0] == ';' || (text[0] == '/' && text[1] == '/'))
  719.             continue
  720.  
  721.         parse(text, type, charsmax(type), key, charsmax(key), prefix, charsmax(prefix))
  722.         trim(prefix)
  723.  
  724.         if(!type[0] || !prefix[0] || !key[0])
  725.             continue
  726.            
  727.         if(!equal(arg_type, type) || !equal(arg_key, key))
  728.             continue
  729.            
  730.         write_file(file_prefixes, "", line - 1)
  731.     }
  732.    
  733.     switch(arg_type[0])
  734.     {
  735.         case 'f':
  736.         {
  737.             TrieDeleteKey(pre_flags_collect, arg_key)
  738.         }
  739.         case 'i':
  740.         {
  741.             TrieDeleteKey(pre_ips_collect, arg_key)
  742.         }
  743.         case 's':
  744.         {
  745.             TrieDeleteKey(pre_steamids_collect, arg_key)
  746.         }
  747.         case 'n':
  748.         {
  749.             TrieDeleteKey(pre_names_collect, arg_key)
  750.         }
  751.     }
  752. }


Csatolmányok:
amxmodx-17756-AdminPrefixes.sma [20.73 KiB]
Letöltve 17 alkalommal.
Teamprefix.sma [1.1 KiB]
Letöltve 22 alkalommal.

_________________
Gyertek fel!!
Kép
Hozzászólás jelentése
Vissza a tetejére
   
HozzászólásElküldve: 2016.07.05. 01:09 
Offline
Őstag
Avatar

Csatlakozott: 2015.07.27. 22:56
Hozzászólások: 1367
Megköszönt másnak: 28 alkalommal
Megköszönték neki: 351 alkalommal
Muszáj az a 2 pont?
Ebben pl. bennevan már:
Lite Chat


Hozzászólás jelentése
Vissza a tetejére
   
Hozzászólások megjelenítése:  Rendezés  
Új téma nyitása  Hozzászólás a témához  [ 2 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 31 vendég


Nyithatsz új témákat ebben a fórumban.
Válaszolhatsz egy témára ebben a fórumban.
Nem szerkesztheted a hozzászólásaidat ebben a fórumban.
Nem törölheted a hozzászólásaidat ebben a fórumban.
Nem küldhetsz csatolmányokat ebben a fórumban.

Keresés:
Ugrás:  
Powered by phpBB® Forum Software © phpBB Limited
Magyar fordítás © Magyar phpBB Közösség
Portal: Kiss Portal Extension © Michael O'Toole