FlacoBey

Untitled

Dec 25th, 2018
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.26 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <sdktools>
  3.  
  4. #define MODEL_ADRENALINE "models/w_models/weapons/w_eq_adrenaline.mdl"
  5.  
  6. public OnPluginStart()
  7. {
  8.     HookEvent("upgrade_pack_used", Event_PlayerUse);
  9. }
  10.  
  11. public Event_PlayerUse(Handle:event, const String:name[], bool:dontBroadcast)
  12. {
  13.     int i = GetClientOfUserId(GetEventInt(event, "userid"));
  14.  
  15.     int entity_id = GetEventInt(event, "upgradeid");
  16.     if (IsValidEdict(entity_id))
  17.     {
  18.         decl String:ent_name[64];
  19.         GetEdictClassname(entity_id, ent_name, sizeof(ent_name))
  20.         {
  21.             if (StrEqual(ent_name, "weapon_upgradepack_explosive", false))
  22.             {
  23.                 float origin[3];
  24.                 GetEntPropVector(entity_id, Prop_Send, "m_vecOrigin", origin);
  25.                 char buffer[64];
  26.                 Format(buffer, sizeof(buffer), "%N", i);
  27.                 new ammo_stack = CreateEntityByName("weapon_ammo_spawn");
  28.                 PrintHintTextToAll("%N поставил коробку с патронами.");
  29.                 AcceptEntityInput(entity_id, "kill")
  30.                 DispatchSpawn(ammo_stack);
  31.                 SetEntityModel(ammo_stack, MODEL_ADRENALINE);
  32.                 TeleportEntity(ammo_stack, origin, NULL_VECTOR, NULL_VECTOR);
  33.             }
  34.         }
  35.     }
  36. }
  37.  
  38. stock bool:IsClientInGameHuman(client)
  39. {
  40.     if (client > 0) return IsClientInGame(client) && !IsFakeClient(client);
  41.     else return false;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment