Advertisement
FlacoBey

Untitled

Feb 15th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.86 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <sdktools>
  3.  
  4. #pragma tabsize 0
  5.  
  6. public OnPluginStart()
  7. {
  8.     HookEvent("ammo_pickup", Event_ItemPickup, EventHookMode_Pre)
  9. }
  10.  
  11. public Action:Event_ItemPickup(Handle:event, const String:name[], bool:dontBroadcast)
  12. {
  13.    
  14.     new client = GetClientOfUserId(GetEventInt(event, "userid"))
  15.    
  16.     if (!client || !IsClientInGame(client)) return Plugin_Continue;
  17.    
  18.     new weaponIndex = GetPlayerWeaponSlot(client, 0);
  19.            
  20.     if(weaponIndex == -1)
  21.     return Plugin_Continue;
  22.            
  23.     new String:classname[64];
  24.            
  25.     GetEdictClassname(weaponIndex, classname, sizeof(classname));
  26.          
  27.     if(StrEqual(classname, "weapon_grenade_launcher"))
  28.     {
  29.         new iPrimType = GetEntProp(weaponIndex, Prop_Send, "m_iPrimaryAmmoType");
  30.         SetEntProp(client, Prop_Send, "m_iAmmo", 7, _, iPrimType);
  31.     }
  32.     return Plugin_Continue;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement