FlacoBey

Untitled

Jan 1st, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.04 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 Action:OnPlayerRunCmd(client, &buttons,  &impulse, float vel[3], float angles[3], int& weapon)
  9. {
  10.     new iCurrentWeapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
  11.  
  12.     if(!IsValidEntity(iCurrentWeapon))
  13.     return Plugin_Continue;
  14.    
  15.     decl String:weaponclass[32];
  16.     GetEntityClassname(iCurrentWeapon, weaponclass, sizeof(weaponclass));
  17.     if(buttons & IN_ATTACK)
  18.     {
  19.         if(StrEqual(weaponclass, "weapon_pipe_bomb"))
  20.         {
  21.             CreateTimer(6.0, timerpipe, client, TIMER_FLAG_NO_MAPCHANGE);
  22.             timeout = CreateTimer(1.0, TimerOut, client, TIMER_REPEAT);
  23.         }
  24.         else if (!(buttons & IN_USE))
  25.         {
  26.             // CreateTimer(6.0 - pipe_peremenya, TimerBomb, client)
  27.             KillTimer(timeout);
  28.             timeout = null;
  29.         }
  30.     }
  31.     return Plugin_Continue;
  32. }
  33.  
  34.  
  35. public OnEntityCreated(entity, const String:classname[])
  36. {
  37.     if (StrEqual(classname, "pipe_bomb_projectile"))
  38.     {
  39.         CreateTimer(6.0 - pipe_peremenya, TimerBomb, entity)
  40.     }
  41. }
  42.  
  43. public Action TimerBomb(Handle timer, any entity)
  44. {
  45.     float origin[3];
  46.     GetEntPropVector(entity, Prop_Send, "m_vecOrigin", origin);
  47.     AcceptEntityInput(entity, "kill");
  48. }
  49. /*
  50. public Action TimerBomb(Handle timer, any client)
  51. {
  52.     new entity = -1;
  53.     while ((entity = FindEntityByClassname2(entity, "pipe_bomb_projectile")) != -1)
  54.     {
  55.         float origin[3];
  56.         GetEntPropVector(entity, Prop_Send, "m_vecOrigin", origin);
  57.         AcceptEntityInput(entity, "kill");
  58.         LittleFlower()
  59.     }
  60. }
  61. */
  62.  
  63. public Action timerpipe(Handle timer, any client)
  64. {
  65.     float origin2[3];
  66.     GetEntPropVector(client, Prop_Send, "m_vecOrigin", origin2);
  67.     ForcePlayerSuicide(client);
  68. }
  69.  
  70. public Action TimerOut(Handle timer, client)
  71. {
  72.     pipe_peremenya = 6;
  73.    
  74.     if(pipe_peremenya > 0)
  75.     {
  76.         pipe_peremenya--;
  77.     }
  78.     else
  79.     {
  80.         ForcePlayerSuicide(client)
  81.     }
  82. }
  83.  
  84.  
  85. stock bool bIsSurvivor(int client)
  86. {
  87.     return client > 0 && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == 2 && !IsClientInKickQueue(client) && IsPlayerAlive(client);
  88. }
Advertisement
Add Comment
Please, Sign In to add comment