FlacoBey

Untitled

Dec 28th, 2018
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.93 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 client = GetClientOfUserId(GetEventInt(event, "userid"));
  12.     new upgradeid = GetEventInt(event, "upgradeid");
  13.     if (!IsValidEdict(upgradeid))
  14.     {
  15.         return;
  16.     }
  17.     new m_iPrimaryAmmoType = -1;
  18.     if ((m_iPrimaryAmmoType = GetEntProp(GetPlayerWeaponSlot(client, 0), Prop_Send, "m_iPrimaryAmmoType")) != -1)
  19.     {
  20.         SetEntProp(GetPlayerWeaponSlot(client, 0), Prop_Send, "m_nUpgradedPrimaryAmmoLoaded", 0, 1);
  21.         SetEntProp(GetPlayerWeaponSlot(client, 0), Prop_Send, "m_iAmmo", GetRandomInt(40, 100), _, m_iPrimaryAmmoType);
  22.         RemoveEdict(upgradeid);
  23.         return;
  24.     }
  25. }
  26.    
  27. stock bool:IsClientInGameHuman(client)
  28. {
  29.     if (client > 0) return IsClientInGame(client) && !IsFakeClient(client);
  30.     else return false;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment