FlacoBey

Untitled

Feb 26th, 2019
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.70 KB | None | 0 0
  1. #include sdktools
  2.  
  3. public void OnPluginStart()
  4. {
  5.     HookEvent("weapon_reload", eReloadWeapon);
  6. }
  7.  
  8. public Action:eReloadWeapon(Handle:event, const String:name[], bool:dontBroadcast)
  9. {
  10.     new iClient = GetClientOfUserId(GetEventInt(event, "userid"));
  11.     if(!IsValidClient(iClient)  
  12.             || !IsPlayerAlive(iClient)
  13.             || IsFakeClient(iClient)
  14.             || GetClientTeam(iClient) != 2)
  15.     return Plugin_Continue;
  16.  
  17.     new iCurrentWeapon = GetEntPropEnt(iClient, Prop_Send, "m_hActiveWeapon");
  18.    
  19.     if(!IsValidEntity(iCurrentWeapon))
  20.     return Plugin_Continue;
  21.  
  22.     new iViewModel = GetEntPropEnt(iClient, Prop_Send, "m_hViewModel");
  23.    
  24.     if(!IsValidEntity(iViewModel))
  25.     return Plugin_Continue;
  26.    
  27.    
  28.     new iClip = GetEntProp(iCurrentWeapon, Prop_Send, "m_iClip1");
  29.    
  30.     char sWeaponEx[32];
  31.     GetEntityClassname(iCurrentWeapon, sWeaponEx, sizeof(sWeaponEx))
  32.     if(StrEqual(sWeaponEx, "weapon_hunting_rifle"))
  33.     {
  34.         if(iClip > 5)
  35.         {
  36.             SetEntProp(iViewModel, Prop_Send, "m_nLayerSequence", 0);
  37.             SetEntPropFloat(iViewModel, Prop_Send, "m_flLayerStartTime", GetGameTime());
  38.             ChangeEdictState(iViewModel, FindDataMapInfo(iViewModel, "m_nLayerSequence"));
  39.         }
  40.     }
  41.     else if(StrEqual(sWeaponEx, "weapon_rifle_ak47"))
  42.     {
  43.         if(iClip > 5)
  44.         {
  45.             SetEntProp(iViewModel, Prop_Send, "m_nLayerSequence", 0);
  46.             SetEntPropFloat(iViewModel, Prop_Send, "m_flLayerStartTime", GetGameTime());
  47.             ChangeEdictState(iViewModel, FindDataMapInfo(iViewModel, "m_nLayerSequence"));
  48.         }
  49.     }
  50.     else if(StrEqual(sWeaponEx, "weapon_rifle_desert"))
  51.     {
  52.         if(iClip > 5)
  53.         {
  54.             SetEntProp(iViewModel, Prop_Send, "m_nLayerSequence", 0);
  55.             SetEntPropFloat(iViewModel, Prop_Send, "m_flLayerStartTime", GetGameTime());
  56.             ChangeEdictState(iViewModel, FindDataMapInfo(iViewModel, "m_nLayerSequence"));
  57.         }
  58.     }
  59.     else if(StrEqual(sWeaponEx, "weapon_rifle_m60"))
  60.     {
  61.         if(iClip > 5)
  62.         {
  63.             SetEntProp(iViewModel, Prop_Send, "m_nLayerSequence", 0);
  64.             SetEntPropFloat(iViewModel, Prop_Send, "m_flLayerStartTime", GetGameTime());
  65.             ChangeEdictState(iViewModel, FindDataMapInfo(iViewModel, "m_nLayerSequence"));
  66.         }
  67.     }
  68.     else if(StrEqual(sWeaponEx, "weapon_rifle_sg552"))
  69.     {
  70.         if(iClip > 5)
  71.         {
  72.             SetEntProp(iViewModel, Prop_Send, "m_nLayerSequence", 0);
  73.             SetEntPropFloat(iViewModel, Prop_Send, "m_flLayerStartTime", GetGameTime());
  74.             ChangeEdictState(iViewModel, FindDataMapInfo(iViewModel, "m_nLayerSequence"));
  75.         }
  76.     }
  77.     else if(StrEqual(sWeaponEx, "weapon_smg"))
  78.     {
  79.         if(iClip > 5)
  80.         {
  81.             SetEntProp(iViewModel, Prop_Send, "m_nLayerSequence", 0);
  82.             SetEntPropFloat(iViewModel, Prop_Send, "m_flLayerStartTime", GetGameTime());
  83.             ChangeEdictState(iViewModel, FindDataMapInfo(iViewModel, "m_nLayerSequence"));
  84.         }
  85.     }
  86.     else if(StrEqual(sWeaponEx, "weapon_smg_mp5"))
  87.     {
  88.         if(iClip > 5)
  89.         {
  90.             SetEntProp(iViewModel, Prop_Send, "m_nLayerSequence", 0);
  91.             SetEntPropFloat(iViewModel, Prop_Send, "m_flLayerStartTime", GetGameTime());
  92.             ChangeEdictState(iViewModel, FindDataMapInfo(iViewModel, "m_nLayerSequence"));
  93.         }
  94.     }
  95.     else if(StrEqual(sWeaponEx, "weapon_smg_silenced"))
  96.     {
  97.         if(iClip > 5)
  98.         {
  99.             SetEntProp(iViewModel, Prop_Send, "m_nLayerSequence", 0);
  100.             SetEntPropFloat(iViewModel, Prop_Send, "m_flLayerStartTime", GetGameTime());
  101.             ChangeEdictState(iViewModel, FindDataMapInfo(iViewModel, "m_nLayerSequence"));
  102.         }
  103.     }
  104.     else if(StrEqual(sWeaponEx, "weapon_sniper_awp"))
  105.     {
  106.         if(iClip > 5)
  107.         {
  108.             SetEntProp(iViewModel, Prop_Send, "m_nLayerSequence", 0);
  109.             SetEntPropFloat(iViewModel, Prop_Send, "m_flLayerStartTime", GetGameTime());
  110.             ChangeEdictState(iViewModel, FindDataMapInfo(iViewModel, "m_nLayerSequence"));
  111.         }
  112.     }
  113.     else if(StrEqual(sWeaponEx, "weapon_sniper_military"))
  114.     {
  115.         if(iClip > 5)
  116.         {
  117.             SetEntProp(iViewModel, Prop_Send, "m_nLayerSequence", 0);
  118.             SetEntPropFloat(iViewModel, Prop_Send, "m_flLayerStartTime", GetGameTime());
  119.             ChangeEdictState(iViewModel, FindDataMapInfo(iViewModel, "m_nLayerSequence"));
  120.         }
  121.     }
  122.     else if(StrEqual(sWeaponEx, "weapon_rifle"))
  123.     {
  124.         if(iClip > 5)
  125.         {
  126.             SetEntProp(iViewModel, Prop_Send, "m_nLayerSequence", 0);
  127.             SetEntPropFloat(iViewModel, Prop_Send, "m_flLayerStartTime", GetGameTime());
  128.             ChangeEdictState(iViewModel, FindDataMapInfo(iViewModel, "m_nLayerSequence"));
  129.         }
  130.     }
  131.     else if(StrEqual(sWeaponEx, "weapon_sniper_scout"))
  132.     {
  133.         if(iClip > 5)
  134.         {
  135.             SetEntProp(iViewModel, Prop_Send, "m_nLayerSequence", 0);
  136.             SetEntPropFloat(iViewModel, Prop_Send, "m_flLayerStartTime", GetGameTime());
  137.             ChangeEdictState(iViewModel, FindDataMapInfo(iViewModel, "m_nLayerSequence"));
  138.         }
  139.     }
  140.     return Plugin_Continue;
  141. }
  142.  
  143.  
  144. stock bool:IsValidClient(iClient)
  145. {
  146.     if(iClient < 1 || iClient > MaxClients)
  147.     return false;
  148.  
  149.     return IsClientInGame(iClient);
  150. }
Advertisement
Add Comment
Please, Sign In to add comment