Advertisement
Akc3n7

Custom Vip

Feb 10th, 2023 (edited)
406
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 4.88 KB | None | 0 0
  1. #include < amxmodx >
  2. #include < cstrike >
  3. #include < engine >
  4. #include < fakemeta >
  5. #include < hamsandwich >
  6.  
  7. /* Copyright 2018 © eXtreamcs Team */
  8.  
  9. new const vip_model_t[]  =  "vip_model_t"
  10. new const vip_model_ct[]  =  "vip_model_ct"
  11.  
  12. new WEAPON_MAXAMMO[33]= {-2, 52, 0, 90, 1, 32, 1, 100, 90, 1, 120, 100, 100, 90, 90, 90, 100, 120, 30, 120, 200, 32, 90, 120, 90, 2, 35, 90, 90, 0, 100, -1, -1}
  13.  
  14. new cvar_jump
  15. new jumpnum[33]
  16. new bool: dojump[33]
  17.  
  18. #define PLUGIN     "Custom Vip"
  19. #define VERSION    "1.0"
  20. #define AUTHOR     "Sorinel"
  21.  
  22. #define VIP_HEALTH  50
  23. #define VIP_ARMOR   100
  24. #define VIP_BONUS_DMG 1.0
  25.  
  26. #define     ARMOR               read_flags( "a" )
  27. #define     HEALTH              read_flags( "h" )
  28. #define     VIP_SCOREBOARD      read_flags( "s" )
  29. #define     VIP_MODEL           read_flags( "m" )
  30. #define     MULTI_JUMP          read_flags( "j" )
  31. #define     DAMAGE_AMPLIFIED    read_flags( "d" )
  32. #define     UNLIMITED_CHARGER   read_flags( "c" )
  33.  
  34. enum {
  35.     SCOREATTRIB_ARG_PLAYERID = 1,
  36.     SCOREATTRIB_ARG_FLAGS
  37. }
  38.  
  39. enum ( <<= 1 ) {
  40.     SCOREATTRIB_FLAG_NONE = 0,
  41.     SCOREATTRIB_FLAG_DEAD = 1,
  42.     SCOREATTRIB_FLAG_BOMB,
  43.     SCOREATTRIB_FLAG_VIP
  44. }
  45.  
  46. public plugin_init() {
  47.    
  48.        register_plugin( PLUGIN, VERSION, AUTHOR)
  49.  
  50.        RegisterHam( Ham_Spawn, "player", "PlayerSpawn", 1 )
  51.        RegisterHam(Ham_TakeDamage, "player", "player_damage")
  52.  
  53.        register_message( get_user_msgid( "ScoreAttrib" ), "MessageScoreAttrib")
  54.        register_event("CurWeapon", "CheckWeapon", "be", "1=1")
  55.        cvar_jump = register_cvar("vip_jump", "1")
  56. }
  57.  
  58. public plugin_precache() {
  59.  
  60.     new ModelOrSoundPath[128]
  61.  
  62.     formatex(  ModelOrSoundPath,  sizeof  (  ModelOrSoundPath  )  -1, "models/player/%s/%s.mdl",  vip_model_t,  vip_model_t)
  63.     engfunc( EngFunc_PrecacheModel, ModelOrSoundPath)
  64.  
  65.         formatex(  ModelOrSoundPath,  sizeof  (  ModelOrSoundPath  )  -1, "models/player/%s/%s.mdl",  vip_model_ct,  vip_model_ct)
  66.     engfunc( EngFunc_PrecacheModel, ModelOrSoundPath)
  67. }
  68.  
  69. public MessageScoreAttrib(iMsgId, iDest, iReceiver) {
  70.  
  71.        new iPlayer = get_msg_arg_int(SCOREATTRIB_ARG_PLAYERID)
  72.    
  73.        if(get_user_flags(iPlayer) & VIP_SCOREBOARD)
  74.           set_msg_arg_int(SCOREATTRIB_ARG_FLAGS, ARG_BYTE, SCOREATTRIB_FLAG_VIP)
  75. }
  76.  
  77. public CheckWeapon(id) {
  78.    
  79.     new weaponID = read_data(2)
  80.    
  81.     if( is_user_alive(id) && get_user_flags(id) & UNLIMITED_CHARGER )
  82.     {      
  83.         cs_set_user_bpammo(id, weaponID, WEAPON_MAXAMMO[weaponID])
  84.     }
  85. }
  86.  
  87. public PlayerSpawn(id) {
  88.    
  89.     if(!(is_user_alive(id)))
  90.         return
  91.    
  92.     if(get_user_flags(id) & ARMOR)
  93.     {
  94.         fm_set_user_armor(id, get_user_armor(id) + VIP_ARMOR)
  95.     }
  96.    
  97.     if(get_user_flags(id) & HEALTH ) {
  98.        
  99.         fm_set_user_health(id, get_user_health(id) + VIP_HEALTH)
  100.     }
  101.    
  102.     if(get_user_flags(id) & VIP_MODEL) {
  103.        
  104.        
  105.         switch(cs_get_user_team(id))
  106.         {  
  107.             case  CS_TEAM_T:  cs_set_user_model(  id,  vip_model_t)
  108.             case  CS_TEAM_CT: cs_set_user_model(  id,  vip_model_ct)        
  109.             }
  110.     }
  111. }
  112.  
  113. public player_damage(victim, ent, attacker, Float:damage, bits) {
  114.    
  115.     if(get_user_flags(attacker) & DAMAGE_AMPLIFIED) {
  116.        
  117.         if(!is_user_connected(victim))
  118.             return HAM_IGNORED
  119.         if(!is_user_connected(attacker))
  120.             return HAM_IGNORED
  121.         if(victim == attacker)
  122.             return HAM_IGNORED
  123.        
  124.         SetHamParamFloat(4, damage * VIP_BONUS_DMG)
  125.     }
  126.     return HAM_OVERRIDE
  127. }
  128.  
  129. public client_PreThink(id)
  130. {
  131.     if(is_user_alive(id)) {
  132.        
  133.         new BUTON = get_user_button(id)
  134.         new OLDBUTON = get_user_oldbutton(id)
  135.         new JUMP_VIP = get_pcvar_num(cvar_jump)
  136.        
  137.         if((BUTON & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(OLDBUTON & IN_JUMP))
  138.         {
  139.             if(((get_user_flags(id) & MULTI_JUMP) && (jumpnum[id] < JUMP_VIP)))
  140.             {
  141.                 dojump[id] = true
  142.                 jumpnum[id]++
  143.             }
  144.         }
  145.        
  146.         if((BUTON & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
  147.         {
  148.             jumpnum[id] = 0
  149.         }
  150.     }
  151. }
  152.  
  153. public client_PostThink(id)
  154. {
  155.     if(is_user_alive(id)) {
  156.        
  157.         if(dojump[id] == true)
  158.         {
  159.             new Float: velocity[3]  
  160.             entity_get_vector(id, EV_VEC_velocity, velocity)
  161.             velocity[2] = random_float(265.0, 285.0)
  162.             entity_set_vector(id, EV_VEC_velocity, velocity)
  163.             dojump[id] = false
  164.         }
  165.     }
  166. }
  167.  
  168. /* Fakemeta Util */
  169.  
  170. stock fm_set_user_health(index, health) {
  171.     health > 0 ? set_pev(index, pev_health, float(health)) : dllfunc(DLLFunc_ClientKill, index)
  172.  
  173.     return 1
  174. }
  175.  
  176. stock fm_set_user_armor( index, armor ) {
  177.     set_pev(index, pev_armorvalue, float(armor));
  178.  
  179.     return 1;
  180. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement