seroff

AWP VIP BY ConnorMcLeod

Nov 11th, 2017
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <cstrike>
  3. #include <fakemeta>
  4. #include <hamsandwich>
  5.  
  6. #define VERSION "1.0.0"
  7.  
  8. #define MAX_PLAYERS 32
  9.  
  10. #define XO_WEAPONBOX 4
  11. #define m_rgpPlayerItems_wpnbx_slot1 35
  12.  
  13. new g_iLastTouchedBox[MAX_PLAYERS+1]
  14.  
  15. public plugin_init(){
  16. register_plugin("Awp VIP", VERSION, "ConnorMcLeod");
  17. RegisterHam(Ham_Spawn, "player", "Player_Spawn_Post", 1);
  18. RegisterHam(Ham_Touch, "weaponbox", "WeaponBox_Touch");
  19. register_menucmd(register_menuid("T_BuyRifle", 1), MENU_KEY_5, "BuyAwp")
  20. register_menucmd(register_menuid("CT_BuyRifle", 1), MENU_KEY_6, "BuyAwp")
  21. }
  22.  
  23. public client_putinserver(id) {
  24. g_iLastTouchedBox[id] = 0;
  25. }
  26.  
  27. public Player_Spawn_Post( id ) {
  28. g_iLastTouchedBox[id] = 0;
  29. }
  30.  
  31. public WeaponBox_Touch(iWpnBx, id){
  32. if( is_user_alive(id) && pev(iWpnBx, pev_flags) & FL_ONGROUND ){
  33. new iWeapon = get_pdata_cbase(iWpnBx, m_rgpPlayerItems_wpnbx_slot1, XO_WEAPONBOX)
  34. if( iWeapon > 0 && cs_get_weapon_id(iWeapon) == CSW_AWP && !CanHaveAwp( id ) ){
  35. if( g_iLastTouchedBox[id] != iWpnBx ){
  36. if( !user_has_weapon(id, CSW_SCOUT) ){
  37. client_print(id, print_center, "#Cstrike_TitlesTXT_Cannot_Buy_This");
  38. }
  39. g_iLastTouchedBox[id] = iWpnBx;
  40. }
  41. return HAM_SUPERCEDE
  42. }
  43. }
  44. return HAM_IGNORED
  45. }
  46.  
  47. public BuyAwp(id){
  48. if( !CanHaveAwp( id ) ){
  49. client_print(id, print_center, "#Cstrike_TitlesTXT_Cannot_Buy_This");
  50. return PLUGIN_HANDLED
  51. }
  52. return PLUGIN_CONTINUE
  53. }
  54.  
  55. public client_command(id){
  56. static szCommand[8]
  57. if( read_argv(0, szCommand, charsmax(szCommand)) < 7 ){
  58. return CheckArgAwp(id, szCommand);
  59. }
  60. return PLUGIN_CONTINUE
  61. }
  62.  
  63. public CS_InternalCommand(id, const szCommand[]){
  64. return CheckArgAwp(id, szCommand);
  65. }
  66.  
  67. CheckArgAwp(id, const szCommand[]){
  68. static const awp[] = "awp"
  69. static const magnum[] = "magnum"
  70. if( !CanHaveAwp( id ) && ( equali(szCommand, awp) || equali(szCommand, magnum) ) ){
  71. client_print(id, print_center, "#Cstrike_TitlesTXT_Cannot_Buy_This")
  72. return PLUGIN_HANDLED
  73. }
  74. return PLUGIN_CONTINUE
  75. }
  76.  
  77. bool:CanHaveAwp( id ){
  78. return !!(get_user_flags(id) & ADMIN_LEVEL_H);
  79. }
Advertisement
Add Comment
Please, Sign In to add comment