Sorinel

CustomVip AMXX

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