FlacoBey

Untitled

Jan 1st, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.52 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.     LittleFlower(origin)
  49. }
  50. /*
  51. public Action TimerBomb(Handle timer, any client)
  52. {
  53.     new entity = -1;
  54.     while ((entity = FindEntityByClassname2(entity, "pipe_bomb_projectile")) != -1)
  55.     {
  56.         float origin[3];
  57.         GetEntPropVector(entity, Prop_Send, "m_vecOrigin", origin);
  58.         AcceptEntityInput(entity, "kill");
  59.         LittleFlower()
  60.     }
  61. }
  62. */
  63.  
  64. public Action timerpipe(Handle timer, any client)
  65. {
  66.     float origin2[3];
  67.     GetEntPropVector(client, Prop_Send, "m_vecOrigin", origin2);
  68.     ForcePlayerSuicide(client);
  69.     LittleFlower(origin2);
  70. }
  71.  
  72. public Action TimerOut(Handle timer, client)
  73. {
  74.     pipe_peremenya = 6;
  75.    
  76.     if(pipe_peremenya > 0)
  77.     {
  78.         pipe_peremenya--;
  79.     }
  80.     else
  81.     {
  82.         ForcePlayerSuicide(client)
  83.     }
  84. }
  85.  
  86. public LittleFlower(Float:pos[3])
  87. {
  88.     new entity = CreateEntityByName("prop_physics");
  89.     if (IsValidEntity(entity))
  90.     {
  91.         pos[2] += 1.0;
  92.         DispatchKeyValue(entity, "model", "models/props_junk/propanecanister001a.mdl");
  93.         DispatchSpawn(entity);
  94.         SetEntData(entity, GetEntSendPropOffs(entity, "m_CollisionGroup"), 1, 1, true);
  95.         TeleportEntity(entity, pos, NULL_VECTOR, NULL_VECTOR);
  96.         AcceptEntityInput(entity, "break");
  97.     }
  98. }
  99.  
  100.  
  101. stock bool bIsSurvivor(int client)
  102. {
  103.     return client > 0 && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == 2 && !IsClientInKickQueue(client) && IsPlayerAlive(client);
  104. }
Advertisement
Add Comment
Please, Sign In to add comment