FlacoBey

Untitled

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