Advertisement
Akc3n7

GOLD & SILVER VIP

Aug 1st, 2023
379
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 7.59 KB | None | 0 0
  1. #include < amxmodx >
  2. #include < fun >
  3. #include < engine >
  4. #include < cstrike >
  5. #include < fakemeta >
  6. #include < hamsandwich >
  7.  
  8. new cvar_jump, jumpnum[33], round[33];
  9. new bool: dojump[33];
  10.  
  11. const WEAPON_BITSUM = (1<<CSW_SCOUT) | (1<<CSW_XM1014) | (1<<CSW_MAC10) | (1<<CSW_AUG) | (1<<CSW_UMP45) | (1<<CSW_SG550) | (1<<CSW_P90) |
  12. (1<<CSW_FAMAS) | (1<<CSW_AWP) | (1<<CSW_MP5NAVY) | (1<<CSW_M249) | (1<<CSW_M3) | (1<<CSW_M4A1) | (1<<CSW_TMP) | (1<<CSW_G3SG1) | (1<<CSW_SG552) |
  13. (1<<CSW_AK47) | (1<<CSW_GALIL);
  14.  
  15. enum  {
  16.       SCOREATTRIB_ARG_PLAYERID = 1, SCOREATTRIB_ARG_FLAGS
  17. }
  18.  
  19. enum ( <<= 1 ) {
  20.       SCOREATTRIB_FLAG_NONE = 0,  SCOREATTRIB_FLAG_DEAD = 1, SCOREATTRIB_FLAG_BOMB, SCOREATTRIB_FLAG_VIP
  21. }
  22.  
  23. #define PLUGIN         "GOLD & SILVER VIP"
  24. #define VERSION        "1.0"
  25. #define AUTHOR         "A k c 3 n 7"
  26.  
  27. #define VIP_GOLD       read_flags ( "h")
  28.  
  29. #define KILL_BONUS_HP       10
  30. #define KILL_BONUS_AP       10
  31. #define KILL_BONUS_HP_HS    15
  32. #define KILL_BONUS_AP_HS    15
  33.  
  34. public plugin_init() {
  35.  
  36.        register_plugin( PLUGIN, VERSION, AUTHOR);
  37.        RegisterHam(Ham_Spawn, "player", "PlayerSpawn", 1);
  38.  
  39.        register_message( get_user_msgid( "ScoreAttrib" ), "MessageScoreAttrib")
  40.        cvar_jump = register_cvar("vip_jump", "1");
  41. }
  42.  
  43. public menu_gold(id) {
  44.                      
  45.        if(!is_user_alive(id) && get_user_flags(id) & VIP_GOLD)
  46.               return;
  47.  
  48.        new menu = menu_create( "\rVIP \yGOLD \wChose Your \rArmoury", "vip_gold")  
  49.        menu_additem( menu, "\rM4A1 \wAnd Grenades");
  50.        menu_additem( menu, "\rAK47 \wAnd Grenades");
  51.        menu_additem( menu, "\rAWP \wAnd Grenades");
  52.  
  53.        menu_setprop( menu, MPROP_EXIT, MEXIT_ALL)
  54.        menu_display( id, menu, 0 );
  55. }
  56.  
  57. public menu_silver(id) {
  58.                      
  59.        if(is_user_alive(id) && get_user_flags(id) & VIP_GOLD)
  60.              return;
  61.  
  62.        new menu = menu_create( "\rVIP \wSilver \yChose Your \rArmoury", "vip_silver")  
  63.        menu_additem( menu, "\rM4A1 \wAnd Grenades");
  64.        menu_additem( menu, "\rAK47 \wAnd Grenades");
  65.  
  66.        menu_setprop( menu, MPROP_EXIT, MEXIT_ALL)
  67.        menu_display( id, menu, 0 );
  68. }
  69.  
  70. public MessageScoreAttrib(iMsgId, iDest, iReceiver) {
  71.  
  72.        new iPlayer = get_msg_arg_int(SCOREATTRIB_ARG_PLAYERID)
  73.    
  74.        if(get_user_flags(iPlayer) & VIP_GOLD)
  75.           set_msg_arg_int(SCOREATTRIB_ARG_FLAGS, ARG_BYTE, SCOREATTRIB_FLAG_VIP);
  76. }
  77.  
  78. public client_death(killer, victim, wpnindex, hitplace, TK)
  79. {            
  80.         if(!(get_user_flags(killer) & VIP_GOLD))
  81.                  return;   
  82.  
  83.         set_user_health(killer, get_user_health(killer) + KILL_BONUS_HP);
  84.     set_user_armor(killer, get_user_armor(killer) + KILL_BONUS_AP);
  85.  
  86.         if(hitplace == HIT_HEAD)
  87.         {
  88.              set_user_health(killer, get_user_health(killer) + KILL_BONUS_HP_HS);
  89.          set_user_armor(killer,  get_user_armor(killer) + KILL_BONUS_AP_HS);
  90.         }
  91. }
  92.  
  93. public PlayerSpawn( id ) {
  94.  
  95.     if(!is_user_alive(id))
  96.         return;
  97.  
  98.         if(round[id] > 3 )
  99.         {
  100.             menu_gold(id), menu_silver(id);
  101.         }
  102.         else {
  103.              round[id]++;
  104.         }
  105.  
  106.         give_item(id, "weapon_deagle"), cs_set_user_bpammo(id, CSW_DEAGLE, 35);
  107.         give_item(id, "weapon_hegrenade"), give_item(id, "weapon_flashgbang")
  108.         cs_set_user_armor(id, 100, CS_ARMOR_VESTHELM);
  109.  
  110.         switch(cs_get_user_team(id))
  111.     {  
  112.          case  CS_TEAM_T:   fm_strip_user_gun(id, CSW_GLOCK18, "weapon_glock18");
  113.                  case  CS_TEAM_CT:  fm_strip_user_gun(id, CSW_USP, "weapon_usp"),  give_item(id, "item_thighpack");
  114.     }
  115.            
  116. }
  117.  
  118. public vip_gold( id, menu, item )
  119. {  
  120.     switch( item )
  121.     {
  122.         case 0:
  123.         {
  124.                         drop_wpn(id);
  125.                         give_item(id, "weapon_m4a1");
  126.                         cs_set_user_bpammo(id, CSW_M4A1, 90);                    
  127.                         give_item(id, "weapon_hegrenade"), give_item(id, "weapon_flashbang");
  128.  
  129.         }
  130.         case 1:
  131.         {
  132.                         drop_wpn(id);
  133.                         give_item(id,"weapon_ak47" );
  134.                         cs_set_user_bpammo(id, CSW_AK47, 90);
  135.                         give_item(id, "weapon_hegrenade"), give_item(id, "weapon_flashbang");
  136.         }
  137.                 case 2:
  138.         {
  139.                         drop_wpn(id);
  140.                         give_item( id,"weapon_awp");
  141.                         cs_set_user_bpammo(id, CSW_AWP, 90);
  142.                         give_item(id, "weapon_hegrenade"), give_item(id, "weapon_flashbang");
  143.         }
  144.         }
  145.     menu_destroy( menu )
  146.         return;
  147. }
  148.  
  149. public vip_silver( id, menu, item )
  150. {  
  151.     switch( item )
  152.     {
  153.         case 0:
  154.         {
  155.                         drop_wpn(id);
  156.                         give_item(id, "weapon_m4a1");
  157.                         cs_set_user_bpammo(id, CSW_M4A1, 90);
  158.                         give_item(id, "weapon_hegrenade"), give_item(id, "weapon_flashbang");
  159.  
  160.         }
  161.         case 1:
  162.         {
  163.                         drop_wpn(id);
  164.                         give_item(id,"weapon_ak47" );
  165.                         cs_set_user_bpammo(id, CSW_AK47, 90);
  166.                         give_item(id, "weapon_hegrenade"), give_item(id, "weapon_flashbang");
  167.         }
  168.         }
  169.     menu_destroy( menu )
  170.         return;
  171. }
  172.  
  173. public client_PreThink(id)
  174. {
  175.     if(is_user_alive(id)) {
  176.        
  177.         new BUTON = get_user_button(id)
  178.         new OLDBUTON = get_user_oldbutton(id)
  179.         new JUMP_VIP = get_pcvar_num(cvar_jump)
  180.        
  181.         if((BUTON & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(OLDBUTON & IN_JUMP))
  182.         {
  183.             if(((get_user_flags(id) & VIP_GOLD) && (jumpnum[id] < JUMP_VIP)))
  184.             {
  185.                 dojump[id] = true
  186.                 jumpnum[id]++
  187.             }
  188.         }
  189.        
  190.         if((BUTON & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
  191.         {
  192.             jumpnum[id] = 0
  193.         }
  194.     }
  195. }
  196.  
  197. public client_PostThink(id)
  198. {
  199.     if(is_user_alive(id)) {
  200.        
  201.         if(dojump[id] == true)
  202.         {
  203.             new Float: velocity[3] 
  204.             entity_get_vector(id, EV_VEC_velocity, velocity)
  205.             velocity[2] = random_float(265.0, 285.0)
  206.             entity_set_vector(id, EV_VEC_velocity, velocity)
  207.             dojump[id] = false
  208.         }
  209.     }
  210. }
  211.  
  212. drop_wpn(id)
  213. {
  214.     static weapons[32], num
  215.     get_user_weapons(id, weapons, num)
  216.  
  217.     for (new i = 0; i < num; i++)
  218.     {
  219.         if (WEAPON_BITSUM & (1<<weapons[i]))
  220.         {
  221.             static wname[32];
  222.             get_weaponname(weapons[i], wname, sizeof wname - 1)
  223.  
  224.             engclient_cmd(id, "drop", wname)
  225.         }
  226.     }
  227. }
  228.  
  229. /* Fakemeta util */
  230.  
  231. /*===========================================================================*/
  232.  
  233. stock fm_find_ent_by_owner(index, const classname[], owner, jghgtype = 0) {
  234.     new strtype[11] = "classname", ent = index;
  235.     switch (jghgtype) {
  236.         case 1: strtype = "target";
  237.         case 2: strtype = "targetname";
  238.     }
  239.  
  240.     while ((ent = engfunc(EngFunc_FindEntityByString, ent, strtype, classname)) && pev(ent, pev_owner) != owner) {}
  241.  
  242.     return ent;
  243. }
  244.  
  245. /*===========================================================================*/
  246. stock bool:fm_strip_user_gun(index, wid = 0, const wname[] = "") {
  247.     new ent_class[32];
  248.     if (!wid && wname[0])
  249.         copy(ent_class, sizeof ent_class - 1, wname);
  250.     else {
  251.         new weapon = wid, clip, ammo;
  252.         if (!weapon && !(weapon = get_user_weapon(index, clip, ammo)))
  253.             return false;
  254.        
  255.         get_weaponname(weapon, ent_class, sizeof ent_class - 1);
  256.     }
  257.  
  258.     new ent_weap = fm_find_ent_by_owner(-1, ent_class, index);
  259.     if (!ent_weap)
  260.         return false;
  261.  
  262.     engclient_cmd(index, "drop", ent_class);
  263.  
  264.     new ent_box = pev(ent_weap, pev_owner);
  265.     if (!ent_box || ent_box == index)
  266.         return false;
  267.  
  268.     dllfunc(DLLFunc_Think, ent_box);
  269.  
  270.     return true;
  271. }
  272. /*=============================================================================*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement