Advertisement
Akc3n7

VIP

Feb 10th, 2023
442
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 7.00 KB | None | 0 0
  1. #include < amxmodx >
  2. #include < fun >
  3. #include < cstrike >
  4. #include < engine >
  5. #include < fakemeta >
  6. #include < hamsandwich >
  7.  
  8. #define VIP_FLAG ADMIN_LEVEL_H // flag vip
  9. #define VIP_HP 20 // hp la spawn
  10. #define VIP_ARMOR 120 // ap la spawn
  11. #define VIP_MONEY 4200 // bani la spawn
  12.  
  13. #define VIP_BONUS_KILL 10 // hp per kill
  14. #define VIP_BONUS_AP 10 // ap per kill
  15. #define VIP_BONUS_MONEY 3000 // bani per kill
  16. #define SPEED 400 // viteza pe cutit
  17.  
  18. #define DAMAGE_RECIEVED
  19.  
  20. new round[33] = 0;
  21. new cvar_vip_jump;
  22. new jumpnum[33];
  23. new bool: dojump[33];
  24. new bool:HasC4[33];
  25. new g_MsgSync
  26.  
  27. enum {
  28.     SCOREATTRIB_ARG_PLAYERID = 1,
  29.     SCOREATTRIB_ARG_FLAGS
  30. };
  31.  
  32. enum ( <<= 1 ) {
  33.     SCOREATTRIB_FLAG_NONE = 0,
  34.     SCOREATTRIB_FLAG_DEAD = 1,
  35.     SCOREATTRIB_FLAG_BOMB,
  36.     SCOREATTRIB_FLAG_VIP
  37. };
  38.  
  39. #if defined DAMAGE_RECIEVED
  40. new g_MsgSync2
  41. #endif
  42.  
  43. public plugin_init() {
  44.    
  45.     register_plugin("VIP", "1.1", "A k c 3 n 7" );
  46.     RegisterHam(Ham_Spawn, "player", "PlayerSpawn", 1)  
  47.     register_event("DeathMsg", "death_msg", "a", "1>0");
  48.     register_event("Damage", "on_damage", "b", "2!0", "3=0", "4!0")
  49.     register_message( get_user_msgid( "ScoreAttrib" ), "MessageScoreAttrib" );
  50.     register_event("CurWeapon", "EventCurWeapon", "be", "1=1")
  51.    
  52.     cvar_vip_jump = register_cvar("vip_jump", "1" );
  53.  
  54.     g_MsgSync = CreateHudSyncObj()
  55.     #if defined DAMAGE_RECIEVED
  56.     g_MsgSync2 = CreateHudSyncObj()
  57.     #endif     
  58. }
  59.  
  60. public on_damage(id)
  61. {
  62.     new attacker = get_user_attacker(id)
  63.    
  64.    
  65.     #if defined DAMAGE_RECIEVED
  66.    
  67.     if ( is_user_connected(id) && is_user_connected(attacker) )
  68.         if (get_user_flags(attacker) & VIP_FLAG)
  69.     {
  70.         new damage = read_data(2)
  71.        
  72.        
  73.         set_hudmessage(255, 0, 0, 0.45, 0.50, 2, 0.1, 4.0, 0.1, 0.1, -1)
  74.         ShowSyncHudMsg(id, g_MsgSync2, "%i^n", damage)
  75.         #else
  76.         if ( is_user_connected(attacker) && if (get_user_flags(attacker) & VIP_FLAG) )
  77.         {
  78.             new damage = read_data(2)
  79.             #endif
  80.             set_hudmessage(0, 100, 200, -1.0, 0.55, 2, 0.1, 4.0, 0.02, 0.02, -1)
  81.             ShowSyncHudMsg(attacker, g_MsgSync, "%i^n", damage)
  82.         }
  83.     }
  84.    
  85.     public death_msg() {
  86.        
  87.         new killer = read_data(1);
  88.         new victim = read_data(2);
  89.        
  90.         if(killer == victim || !is_user_connected(victim) || !is_user_alive(killer))
  91.             return PLUGIN_HANDLED;
  92.        
  93.         set_user_health(killer, get_user_health(killer) + VIP_BONUS_KILL );
  94.         set_user_armor(killer, get_user_armor(killer) + VIP_BONUS_AP );
  95.         cs_set_user_money(killer, cs_get_user_money(killer) + VIP_BONUS_MONEY);
  96.         return PLUGIN_CONTINUE;
  97.     }
  98.    
  99.     public client_putinserver(id)
  100.     {  
  101.         //set_task(2.0, "in", id);
  102.         if(get_user_flags(id) & VIP_FLAG)
  103.         {
  104.             jumpnum[id] = 0;
  105.             dojump[id] = false;
  106.             round[id] = 0;
  107.         }  
  108.     }
  109.    
  110.     public PlayerSpawn( iPlayer ) {
  111.        
  112.         if(is_user_alive( iPlayer ) && get_user_flags( iPlayer ) & VIP_FLAG) {
  113.            
  114.             round[ iPlayer ]++ 
  115.             if(round[ iPlayer ]>=3)
  116.                 vip_menu( iPlayer )
  117.            
  118.             set_user_health(iPlayer, get_user_health( iPlayer ) + VIP_HP );
  119.             set_user_armor(iPlayer, get_user_armor(iPlayer) + VIP_ARMOR );
  120.             cs_set_user_money(iPlayer, cs_get_user_money(iPlayer) + VIP_MONEY );
  121.         }
  122.     }
  123.    
  124.     public EventCurWeapon( iPlayer ) {
  125.        
  126.         if ( get_user_flags( iPlayer ) & VIP_FLAG ) {
  127.            
  128.             new iWeapon = read_data(2);
  129.            
  130.             if( iWeapon == CSW_KNIFE )
  131.             {
  132.                 set_user_maxspeed(iPlayer, float(SPEED));
  133.             }
  134.         }
  135.     }
  136.    
  137.     public client_PreThink( id )
  138.     {
  139.         if(!is_user_alive(id))
  140.             return PLUGIN_CONTINUE;
  141.        
  142.         new BUTON = get_user_button(id)
  143.         new OLDBUTON = get_user_oldbutton(id)
  144.         new JUMP_VIP = get_pcvar_num(cvar_vip_jump)
  145.        
  146.         if((BUTON & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(OLDBUTON & IN_JUMP))
  147.         {
  148.             if(((get_user_flags(id) & VIP_FLAG) && (jumpnum[id] < JUMP_VIP)))
  149.             {
  150.                 dojump[id] = true
  151.                 jumpnum[id]++
  152.             }
  153.         }
  154.        
  155.         if((BUTON & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
  156.         {
  157.             jumpnum[id] = 0
  158.         }
  159.        
  160.         return PLUGIN_CONTINUE;
  161.     }
  162.    
  163.     public client_PostThink(id)
  164.     {
  165.         if(!is_user_alive(id))
  166.             return PLUGIN_CONTINUE;
  167.        
  168.         if(dojump[id] == true)
  169.         {
  170.             new Float: velocity[3] 
  171.             entity_get_vector(id, EV_VEC_velocity, velocity)
  172.             velocity[2] = random_float(265.0, 285.0)
  173.             entity_set_vector(id, EV_VEC_velocity, velocity)
  174.             dojump[id] = false
  175.         }
  176.         return PLUGIN_CONTINUE;
  177.     }
  178.    
  179.     public MessageScoreAttrib(iMsgId, iDest, iReceiver)
  180.     {
  181.         new iPlayer = get_msg_arg_int(SCOREATTRIB_ARG_PLAYERID);
  182.        
  183.         if(get_user_flags(iPlayer) & VIP_FLAG )
  184.             set_msg_arg_int(SCOREATTRIB_ARG_FLAGS, ARG_BYTE, SCOREATTRIB_FLAG_VIP);
  185.     }
  186.    
  187.     public vip_menu( id ) {
  188.         new menu = menu_create( "VIP MENU", "menu_handler" );
  189.        
  190.         menu_additem( menu, "\yM4A1 \w+ \yDeagle \w+ \rSet grenade", "", 0, VIP_FLAG );
  191.         menu_additem( menu, "\yAK47 \w+ \yDeagle \w+ \rSet grenade", "", 1, VIP_FLAG );
  192.         menu_additem( menu, "\yAWP \w+ \yDeagle \w+ \rSet grenade", "", 2, VIP_FLAG );    
  193.         menu_setprop( menu, MPROP_EXIT, MEXIT_ALL);
  194.        
  195.         menu_display( id, menu, 0 );
  196.     }
  197.    
  198.     public menu_handler( iPlayer, menu, item )
  199.     {
  200.        
  201.         switch( item )
  202.         {
  203.             case 0:
  204.             {
  205.                 if (user_has_weapon(iPlayer, CSW_C4) && get_user_team(iPlayer) == 1)
  206.                     HasC4[iPlayer] = true;
  207.                 else
  208.                     HasC4[iPlayer] = false;
  209.                
  210.                 strip_user_weapons (iPlayer)
  211.                 if (HasC4[iPlayer])
  212.                 {
  213.                     give_item(iPlayer, "weapon_c4");
  214.                     cs_set_user_plant(iPlayer);
  215.                 }
  216.                 give_item(iPlayer, "weapon_m4a1");
  217.                 cs_set_user_bpammo(iPlayer, CSW_M4A1, 90);
  218.                 give_item(iPlayer, "weapon_deagle");
  219.                 cs_set_user_bpammo(iPlayer, CSW_DEAGLE, 35);
  220.                 give_item(iPlayer,"weapon_knife")
  221.                 give_item(iPlayer, "weapon_hegrenade");
  222.                 give_item(iPlayer, "weapon_flashbang");
  223.                 give_item(iPlayer, "weapon_smokegrenade");    
  224.             }
  225.             case 1:
  226.             {
  227.                 if (user_has_weapon(iPlayer, CSW_C4) && get_user_team(iPlayer) == 1)
  228.                     HasC4[iPlayer] = true;
  229.                 else
  230.                     HasC4[iPlayer] = false;
  231.                
  232.                 strip_user_weapons (iPlayer)
  233.                 if (HasC4[iPlayer])
  234.                 {
  235.                     give_item(iPlayer, "weapon_c4");
  236.                     cs_set_user_plant(iPlayer);
  237.                 }
  238.  
  239.                 give_item(iPlayer, "weapon_ak47");
  240.                 cs_set_user_bpammo(iPlayer, CSW_AK47, 90);
  241.                 give_item(iPlayer, "weapon_deagle");
  242.                 cs_set_user_bpammo(iPlayer, CSW_DEAGLE, 35);
  243.                 give_item(iPlayer,"weapon_knife")
  244.                 give_item(iPlayer, "weapon_hegrenade");
  245.                 give_item(iPlayer, "weapon_flashbang");
  246.                 give_item(iPlayer, "weapon_smokegrenade");
  247.             }  
  248.             case 2:
  249.             {
  250.                 if (user_has_weapon(iPlayer, CSW_C4) && get_user_team(iPlayer) == 1)
  251.                     HasC4[iPlayer] = true;
  252.                 else
  253.                     HasC4[iPlayer] = false;
  254.                
  255.                 strip_user_weapons (iPlayer)
  256.                 if (HasC4[iPlayer])
  257.                 {
  258.                     give_item(iPlayer, "weapon_c4");
  259.                     cs_set_user_plant(iPlayer);
  260.                 }  
  261.        
  262.                 give_item(iPlayer, "weapon_awp");
  263.                 cs_set_user_bpammo(iPlayer, CSW_AWP, 90);
  264.                 give_item(iPlayer, "weapon_deagle");
  265.                 cs_set_user_bpammo(iPlayer, CSW_DEAGLE, 35);
  266.                 give_item(iPlayer,"weapon_knife")
  267.                 give_item(iPlayer, "weapon_hegrenade");
  268.                 give_item(iPlayer, "weapon_flashbang");
  269.                 give_item(iPlayer, "weapon_smokegrenade");
  270.             }
  271.         }
  272.        
  273.         menu_destroy( menu );
  274.         return PLUGIN_HANDLED;
  275.     }
  276.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement