FlacoBey

Untitled

Jan 1st, 2019
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.36 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <sdktools>
  3. #include <sdkhooks>
  4.  
  5. Handle timeout;
  6. int pipe_peremenya = 0;
  7.  
  8. public void OnPluginStart()
  9. {
  10.     HookEvent("weapon_fire", EventFe);
  11. }
  12.  
  13. public Action EventFe(Event event, const char[] name, bool dontBroadcast)
  14. {
  15.     int client = GetClientOfUserId(event.GetInt("userid"));
  16.     int iCurrentWeapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
  17.     char weapon[32];
  18.     GetEntityClassname(iCurrentWeapon, weapon, sizeof(weapon));
  19.     new b = GetClientButtons(client)
  20.     if(bIsSurvivor(client))
  21.     {
  22.         if(StrEqual(weapon, "weapon_pipe_bomb"))
  23.         {
  24.             if (b & IN_ATTACK)
  25.             {
  26.                 CreateTimer(6.0, timerpipe, client, TIMER_FLAG_NO_MAPCHANGE);
  27.                 timeout = CreateTimer(1.0, TimerOut, client, TIMER_REPEAT);
  28.             }
  29.             else if(!(b & IN_ATTACK))
  30.             {
  31.                 KillTimer(timeout);
  32.                 timeout = null;
  33.                 CreateTimer(6.0 - pipe_peremenya, TimerBomb, client)
  34.             }
  35.         }
  36.     }
  37. }
  38.  
  39. public Action TimerBomb(Handle timer, any client)
  40. {
  41.     new entity = -1;
  42.     while ((entity = FindEntityByClassname2(entity, "pipe_bomb_projectile")) != -1)
  43.     {
  44.         float origin[3];
  45.         GetEntPropVector(entity, Prop_Send, "m_vecOrigin", origin);
  46.         AcceptEntityInput(entity, "kill");
  47.         ForcePlayerSuicide(client);
  48.         LittleFlower(origin)
  49.     }
  50. }
  51.  
  52. public Action TimerOut(Handle timer, client)
  53. {
  54.     pipe_peremenya = 6;
  55.    
  56.     if(pipe_peremenya > 0)
  57.     {
  58.         pipe_peremenya--;
  59.     }
  60. }
  61.  
  62. public Action timerpipe(Handle timer, any client)
  63. {
  64.     float origin2[3];
  65.     GetEntPropVector(client, Prop_Send, "m_vecOrigin", origin2);
  66.     ForcePlayerSuicide(client);
  67.     LittleFlower(origin2)
  68. }
  69.  
  70. stock LittleFlower(Float:pos[3])
  71. {
  72.     new entity = CreateEntityByName("prop_physics");
  73.     if (IsValidEntity(entity))
  74.     {
  75.         pos[2] += 10.0;
  76.         DispatchKeyValue(entity, "model", "models/props_junk/propanecanister001a.mdl");
  77.         DispatchSpawn(entity);
  78.         SetEntData(entity, GetEntSendPropOffs(entity, "m_CollisionGroup"), 1, 1, true);
  79.         TeleportEntity(entity, pos, NULL_VECTOR, NULL_VECTOR);
  80.         AcceptEntityInput(entity, "break");
  81.     }
  82. }
  83.  
  84. FindEntityByClassname2(startEnt, const String:classname[])
  85. {
  86.     while (startEnt > -1 && !IsValidEntity(startEnt)) startEnt--;
  87.     return FindEntityByClassname(startEnt, classname);
  88. }
  89.  
  90. stock bool bIsSurvivor(int client)
  91. {
  92.     return client > 0 && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == 2 && !IsClientInKickQueue(client) && IsPlayerAlive(client);
  93. }
Advertisement
Add Comment
Please, Sign In to add comment