FlacoBey

Untitled

Dec 30th, 2018
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.45 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.                 origin[2] += 5;
  26.                 char buffer[64];
  27.                 Format(buffer, sizeof(buffer), "%N", i);
  28.                 new ammo_stack = CreateEntityByName("weapon_ammo_spawn");
  29.                 PrintHintTextToAll("%N поставил коробку с патронами.");
  30.                 AcceptEntityInput(entity_id, "kill")
  31.                 DispatchSpawn(ammo_stack);
  32.                 SetEntityModel(ammo_stack, MODEL_ADRENALINE);
  33.                 TeleportEntity(ammo_stack, origin, NULL_VECTOR, NULL_VECTOR);
  34.             }
  35.         }
  36.     }
  37. }
  38.  
  39. stock bool:IsClientInGameHuman(client)
  40. {
  41.     if (client > 0) return IsClientInGame(client) && !IsFakeClient(client);
  42.     else return false;
  43. }
Advertisement
Add Comment
Please, Sign In to add comment