Advertisement
FlacoBey

Untitled

Jan 29th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 5.38 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <sdktools>
  3.  
  4. public OnPluginStart()
  5. {
  6.     HookEvent("upgrade_pack_added", Event_UpgradePackAdded);
  7. }
  8.  
  9. public Action:Event_UpgradePackAdded(Handle:event, const String:name[], bool:dontBroadcast)
  10. {
  11.     new i = GetClientOfUserId(GetEventInt(event, "userid"));
  12.     new iWeapon = GetPlayerWeaponSlot(i, 0);
  13.    
  14.     int AmmoType = GetEntProp(iWeapon, Prop_Data, "m_iPrimaryAmmoType");
  15.     int Clip = GetEntProp(iWeapon, Prop_Send, "m_iClip1");
  16.     int Ammo = GetEntProp(i, Prop_Data, "m_iAmmo", _, AmmoType);
  17.    
  18.     char sWeapon[32];
  19.     GetEntityClassname(iWeapon, sWeapon, sizeof(sWeapon));
  20.    
  21.     if(bIsSurvivor(i))
  22.     {
  23.         int num;
  24.         if(StrEqual(sWeapon, "weapon_hunting_rifle"))
  25.         {
  26.             num = 120 - Ammo;
  27.             SetEntProp(iWeapon , Prop_Send, "m_iClip1", Clip);
  28.             SetEntProp(i, Prop_Send, "m_iAmmo", num, _, AmmoType);
  29.             SetEntProp(iWeapon, Prop_Send, "m_nUpgradedPrimaryAmmoLoaded", 0);
  30.             SetEntProp(iWeapon, Prop_Send, "m_upgradeBitVec", 0);
  31.         }
  32.         else if(StrEqual(sWeapon, "weapon_rifle_ak47"))
  33.         {
  34.             SetEntProp(iWeapon , Prop_Send, "m_iClip1", 0);
  35.             SetEntProp(i, Prop_Send, "m_iAmmo", 120 + Clip, _, AmmoType);
  36.             SetEntProp(iWeapon, Prop_Send, "m_nUpgradedPrimaryAmmoLoaded", 0);
  37.             SetEntProp(iWeapon, Prop_Send, "m_upgradeBitVec", 0);
  38.         }
  39.         else if(StrEqual(sWeapon, "weapon_pistol"))
  40.         {
  41.             SetEntProp(iWeapon , Prop_Send, "m_iClip1", 0);
  42.             SetEntProp(i, Prop_Send, "m_iAmmo", 50, _, AmmoType);
  43.             SetEntProp(iWeapon, Prop_Send, "m_nUpgradedPrimaryAmmoLoaded", 0);
  44.             SetEntProp(iWeapon, Prop_Send, "m_upgradeBitVec", 0);
  45.         }
  46.         else if(StrEqual(sWeapon, "weapon_rifle"))
  47.         {
  48.             SetEntProp(iWeapon , Prop_Send, "m_iClip1", 0);
  49.             SetEntProp(i, Prop_Send, "m_iAmmo", 160 + Clip, _, AmmoType);
  50.             SetEntProp(iWeapon, Prop_Send, "m_nUpgradedPrimaryAmmoLoaded", 0);
  51.             SetEntProp(iWeapon, Prop_Send, "m_upgradeBitVec", 0);
  52.         }
  53.         else if(StrEqual(sWeapon, "weapon_pistol_magnum"))
  54.         {
  55.             SetEntProp(iWeapon , Prop_Send, "m_iClip1", 0);
  56.             SetEntProp(i, Prop_Send, "m_iAmmo", 50, _, AmmoType);
  57.             SetEntProp(iWeapon, Prop_Send, "m_nUpgradedPrimaryAmmoLoaded", 0);
  58.             SetEntProp(iWeapon, Prop_Send, "m_upgradeBitVec", 0);
  59.         }
  60.         else if(StrEqual(sWeapon, "weapon_rifle_desert"))
  61.         {
  62.             SetEntProp(iWeapon , Prop_Send, "m_iClip1", 0);
  63.             SetEntProp(i, Prop_Send, "m_iAmmo", 160 + Clip, _, AmmoType);
  64.             SetEntProp(iWeapon, Prop_Send, "m_nUpgradedPrimaryAmmoLoaded", 0);
  65.             SetEntProp(iWeapon, Prop_Send, "m_upgradeBitVec", 0);
  66.         }
  67.         else if(StrEqual(sWeapon, "weapon_rifle_sg552"))
  68.         {
  69.             SetEntProp(iWeapon , Prop_Send, "m_iClip1", 0);
  70.             SetEntProp(i, Prop_Send, "m_iAmmo", 160 + Clip, _, AmmoType);
  71.             SetEntProp(iWeapon, Prop_Send, "m_nUpgradedPrimaryAmmoLoaded", 0);
  72.             SetEntProp(iWeapon, Prop_Send, "m_upgradeBitVec", 0);
  73.         }
  74.         else if(StrEqual(sWeapon, "weapon_smg"))
  75.         {
  76.             SetEntProp(iWeapon , Prop_Send, "m_iClip1", 0);
  77.             SetEntProp(i, Prop_Send, "m_iAmmo", 350 + Clip, _, AmmoType);
  78.             SetEntProp(iWeapon, Prop_Send, "m_nUpgradedPrimaryAmmoLoaded", 0);
  79.             SetEntProp(iWeapon, Prop_Send, "m_upgradeBitVec", 0);
  80.         }
  81.         else if(StrEqual(sWeapon, "weapon_smg_mp5"))
  82.         {
  83.             SetEntProp(iWeapon , Prop_Send, "m_iClip1", 0);
  84.             SetEntProp(i, Prop_Send, "m_iAmmo", 350 + Clip, _, AmmoType);
  85.             SetEntProp(iWeapon, Prop_Send, "m_nUpgradedPrimaryAmmoLoaded", 0);
  86.             SetEntProp(iWeapon, Prop_Send, "m_upgradeBitVec", 0);
  87.         }
  88.         else if(StrEqual(sWeapon, "weapon_sniper_awp"))
  89.         {
  90.             SetEntProp(iWeapon , Prop_Send, "m_iClip1", 0);
  91.             SetEntProp(i, Prop_Send, "m_iAmmo", 40 + Clip, _, AmmoType);  
  92.             SetEntProp(iWeapon, Prop_Send, "m_nUpgradedPrimaryAmmoLoaded", 0);
  93.             SetEntProp(iWeapon, Prop_Send, "m_upgradeBitVec", 0);
  94.         }
  95.         else if(StrEqual(sWeapon, "weapon_sniper_military"))
  96.         {
  97.             SetEntProp(iWeapon , Prop_Send, "m_iClip1", 0);
  98.             SetEntProp(i, Prop_Send, "m_iAmmo", 80 + Clip, _, AmmoType);
  99.             SetEntProp(iWeapon, Prop_Send, "m_nUpgradedPrimaryAmmoLoaded", 0);
  100.             SetEntProp(iWeapon, Prop_Send, "m_upgradeBitVec", 0);
  101.         }
  102.         else if(StrEqual(sWeapon, "weapon_sniper_scout"))
  103.         {
  104.             SetEntProp(iWeapon , Prop_Send, "m_iClip1", 0);
  105.             SetEntProp(i, Prop_Send, "m_iAmmo", 80 + Clip, _, AmmoType);
  106.             SetEntProp(iWeapon, Prop_Send, "m_nUpgradedPrimaryAmmoLoaded", 0);
  107.             SetEntProp(iWeapon, Prop_Send, "m_upgradeBitVec", 0);
  108.         }
  109.         else if(StrEqual(sWeapon, "weapon_grenade_launcher"))
  110.         {
  111.             SetEntProp(iWeapon , Prop_Send, "m_iClip1", 0);
  112.             SetEntProp(i, Prop_Send, "m_iAmmo", 8 + Clip, _, AmmoType);  
  113.             SetEntProp(iWeapon, Prop_Send, "m_nUpgradedPrimaryAmmoLoaded", 0);
  114.             SetEntProp(iWeapon, Prop_Send, "m_upgradeBitVec", 0);
  115.         }
  116.         else if(StrEqual(sWeapon, "weapon_rifle_m60"))
  117.         {
  118.             SetEntProp(iWeapon , Prop_Send, "m_iClip1", 0);
  119.             SetEntProp(i, Prop_Send, "m_iAmmo", 200 + Clip, _, AmmoType);  
  120.             SetEntProp(iWeapon, Prop_Send, "m_nUpgradedPrimaryAmmoLoaded", 0);
  121.             SetEntProp(iWeapon, Prop_Send, "m_upgradeBitVec", 0);
  122.         }
  123.         else if(StrEqual(sWeapon, "weapon_smg_silenced "))
  124.         {
  125.             SetEntProp(iWeapon , Prop_Send, "m_iClip1", 0);
  126.             SetEntProp(i, Prop_Send, "m_iAmmo", 200 + Clip, _, AmmoType);  
  127.             SetEntProp(iWeapon, Prop_Send, "m_nUpgradedPrimaryAmmoLoaded", 0);
  128.             SetEntProp(iWeapon, Prop_Send, "m_upgradeBitVec", 0);
  129.         }
  130.     }
  131. }
  132.  
  133. stock bool bIsSurvivor(int client)
  134. {
  135.     return client > 0 && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == 2 && !IsClientInKickQueue(client) && IsPlayerAlive(client);
  136. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement