HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <engine>
  4.  
  5. new CLIENT_HAPPY_MSG[] = "[AMXX] Egy admin hozzaadott a felhasznalokhoz, mostmar tudod hasznalni az AWP-t!."
  6. new CLIENT_SAD_MSG[] = "[AMXX] Sajnalom, ezt csak egyes felhasznalok hasznalhatjak! Tovabbi infoert fordulj egy adminhoz!"
  7.  
  8. new bool:Awp_User[33]
  9. new g_ConfigDir[64]
  10. new g_File[64]
  11.  
  12. new PLUGIN_NAME[] = "Awp"
  13. new PLUGIN_AUTHOR[] = "Cheap_Suit"
  14. new PLUGIN_VERSION[] = "1.1"
  15.  
  16. public plugin_init()
  17. {
  18. register_plugin( PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR )
  19. register_clcmd( "amx_awpuser", "cmd_adduser", ADMIN_BAN, "<userid> - allow a user to use an awp" )
  20.  
  21. register_event( "CurWeapon", "Event_CurWeapon", "be", "1=1" )
  22. get_configsdir( g_ConfigDir, 63 )
  23. format( g_File, 63, "%s/Awp_Users.ini", g_ConfigDir )
  24.  
  25. if ( !file_exists( g_File ) )
  26. write_file( g_File, "; Awp Users by Cheap_Suit", -1 )
  27. }
  28.  
  29. public client_putinserver( id )
  30. {
  31. new Authid[32]
  32. get_user_authid( id, Authid, 31 )
  33.  
  34. new Text[32], Len = 0, Line = 0
  35. while ( read_file( g_File, Line++, Text, 31, Len ) )
  36. {
  37. if ( Text[0] == ';' || !Len )
  38. continue
  39.  
  40. if ( equal( Text, Authid, 31 ) )
  41. {
  42. Awp_User[id] = true
  43. break
  44. }
  45. else
  46. Awp_User[id] = false
  47. }
  48. }
  49.  
  50. public cmd_adduser( id, level, cid )
  51. {
  52. if ( !cmd_access( id, level, cid, 2 ) )
  53. return PLUGIN_HANDLED
  54.  
  55. new Arg[64], Target
  56. read_argv( 1, Arg, 63 )
  57.  
  58. Target = cmd_target( id, Arg, 0 )
  59. if ( !is_user_connected( Target ) )
  60. return PLUGIN_HANDLED
  61.  
  62. Awp_User[Target] = true
  63.  
  64. new Authid[33]
  65. get_user_authid( Target, Authid, 32 )
  66.  
  67. new Text[33]
  68. format( Text, 32, "%s", Authid )
  69. write_file( g_File, Text, -1 )
  70.  
  71. new Targetname[32]
  72. get_user_name( Target, Targetname, 31 )
  73.  
  74. console_print( id, "Added %s to the Awp User list", Targetname )
  75. client_print( id, print_chat, CLIENT_HAPPY_MSG )
  76.  
  77. return PLUGIN_HANDLED
  78. }
  79.  
  80. public Event_CurWeapon( id )
  81. {
  82. if ( !is_user_connected( id ) || !is_user_alive( id ) )
  83. return PLUGIN_CONTINUE
  84.  
  85. new WeaponID = read_data( 2 )
  86. if ( WeaponID != CSW_AWP || Awp_User[id] )
  87. return PLUGIN_CONTINUE
  88.  
  89. client_cmd( id, "drop" )
  90. set_task(0.1, "Remove_Awp")
  91. client_print( id, print_chat, CLIENT_SAD_MSG )
  92.  
  93. return PLUGIN_CONTINUE
  94. }
  95.  
  96. public Remove_Awp()
  97. {
  98. new Ent = find_ent_by_class( -1, "weaponbox" )
  99. while( Ent > 0 )
  100. {
  101. new Weapon_Model[32]
  102. entity_get_string( Ent, EV_SZ_model, Weapon_Model, 31 )
  103. if( equal( Weapon_Model, "models/w_awp.mdl" ) )
  104. remove_entity( Ent )
  105.  
  106. Ent = find_ent_by_class( Ent, "weaponbox" )
  107. }
  108. }
  109.