FlacoBey

Untitled

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