Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <amxmisc>
  3.  
  4. #define PLUGIN "New Plug-In"
  5. #define VERSION "1.0"
  6. #define AUTHOR "arsmi"
  7.  
  8. new Array:g_arNames
  9.  
  10. public plugin_init()
  11. {
  12. register_plugin(PLUGIN, VERSION, AUTHOR)
  13. }
  14.  
  15. public plugin_precache()
  16. {
  17. readIni()
  18. }
  19.  
  20. public client_connectex(id, const name[], const ip[], reason[128])
  21. {
  22. for(new i, szName[MAX_PLAYERS];i < ArraySize(g_arNames);i++)
  23. {
  24. ArrayGetString(g_arNames, i, szName, charsmax(szName))
  25. if(containi(name, szName) != -1)
  26. {
  27. formatex(reason, charsmax(reason), "Get OUT!")
  28. return PLUGIN_HANDLED
  29. }
  30. }
  31.  
  32. return PLUGIN_CONTINUE
  33. }
  34.  
  35. readIni()
  36. {
  37. g_arNames = ArrayCreate(32)
  38. new szConfig[256]
  39. get_configsdir(szConfig, charsmax(szConfig))
  40. format(szConfig, charsmax(szConfig), "%s/blocked_names.ini", szConfig)
  41.  
  42. new iFile = fopen(szConfig,"r");
  43.  
  44. if(iFile)
  45. {
  46. new sText[512],szName[32]
  47.  
  48. while(!feof(iFile))
  49. {
  50. fgets(iFile,sText,charsmax(sText));
  51. trim(sText);
  52.  
  53. switch(sText[0])
  54. {
  55. case EOS, '#', ';', '/':
  56. {
  57. continue;
  58. }
  59.  
  60. default:
  61. {
  62. parse(sText,szName,charsmax(szName))
  63. {
  64. ArrayPushString(g_arNames, szName)
  65. }
  66. }
  67. }
  68. }
  69. fclose(iFile)
  70. }
  71. for(new i, szName[MAX_PLAYERS];i < ArraySize(g_arNames);i++)
  72. {
  73. ArrayGetString(g_arNames, i, szName, charsmax(szName))
  74. log_to_file("log.log", "%s", szName )
  75. }
  76. }
  77.  
  78. public client_infochanged(id)
  79. {
  80. new szNewName[32]
  81. get_user_info( id, "name", szNewName, charsmax(szNewName) );
  82.  
  83. for(new i, szName[MAX_PLAYERS];i < ArraySize(g_arNames);i++)
  84. {
  85. ArrayGetString(g_arNames, i, szName, charsmax(szName))
  86.  
  87. if(containi(szNewName, szName) != -1)
  88. client_print(id, print_chat, "proibido")
  89. }
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement