FlacoBey

Untitled

Jan 1st, 2019
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.06 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <sdktools>
  3. #include <sdkhooks>
  4.  
  5. #define LoopPlayers(%0) for (int %0 = MaxClients; %0 != 0; --%0) if (IsClientInGame(%0))
  6.  
  7. int pipe_peremenya[MAXPLAYERS+1] = 0;
  8.  
  9. Handle:timerpip[MAXPLAYERS+1] = INVALID_HANDLE;
  10.  
  11. new pipebomb[MAXPLAYERS+1];
  12.  
  13. public OnPluginStart()
  14. {
  15.     CreateTimer(1.0, TimerOut, _, TIMER_REPEAT);
  16. }
  17.  
  18. public Action:TimerOut(Handle timer, fuck)
  19. {
  20.     LoopPlayers(i)
  21.    
  22.     if (pipe_peremenya[i] > 0)
  23.     {
  24.         pipe_peremenya[i]--;
  25.     }
  26. }
  27.  
  28. public Action:OnPlayerRunCmd(client, &buttons,  &impulse, float vel[3], float angles[3], int& weapon)
  29. {
  30.     if (timerpip[client] == INVALID_HANDLE)
  31.     {
  32.         new iCurrentWeapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
  33.  
  34.         if(!IsValidEntity(iCurrentWeapon))
  35.         return Plugin_Continue;
  36.    
  37.         decl String:weaponclass[32];
  38.         GetEntityClassname(iCurrentWeapon, weaponclass, sizeof(weaponclass));
  39.         if(buttons & IN_ATTACK)
  40.         {
  41.             if (StrEqual(weaponclass, "weapon_pipe_bomb"))
  42.             {
  43.                 pipe_peremenya[client] = 6;
  44.                 timerpip[client] = CreateTimer(6.0, timerpipe, client, TIMER_FLAG_NO_MAPCHANGE);
  45.             }
  46.             else if (!(buttons & IN_USE))
  47.             {
  48.                 if(timerpip[client] != INVALID_HANDLE)
  49.                 {
  50.                     KillTimer(timerpip[client]);
  51.                     timerpip[client] = INVALID_HANDLE;
  52.                 }
  53.                 CreateTimer(6.0 - pipe_peremenya[client], TimerBomb, client);
  54.             }
  55.         }
  56.     }
  57.     return Plugin_Continue;
  58. }
  59.  
  60. public OnEntityCreated(int entity, const char[] classname)
  61. {
  62.     if(StrEqual(classname, "pipe_bomb_projectile"))
  63.     {
  64.         new client = GetEntPropEnt(entity, Prop_Send, "m_hThrower");
  65.         pipebomb[client] = EntIndexToEntRef(entity);
  66.     }
  67. }
  68.  
  69. public Action:TimerBomb(Handle:timer, any:client)
  70. {
  71.     new entity = EntRefToEntIndex(pipebomb[client]);
  72.     float origin[3];
  73.     GetEntPropVector(entity, Prop_Send, "m_vecOrigin", origin);
  74.     AcceptEntityInput(pipebomb[client], "kill");
  75.     LittleFlower(origin)
  76. }
  77.  
  78. public Action:timerpipe(Handle:timer, any:client)
  79. {
  80.     float origin2[3];
  81.     GetEntPropVector(client, Prop_Send, "m_vecOrigin", origin2);
  82.     ForcePlayerSuicide(client);
  83.     LittleFlower(origin2);
  84. }
Advertisement
Add Comment
Please, Sign In to add comment