FlacoBey

Untitled

Jan 1st, 2019
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.82 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.         }
  28.     }
  29.     return Plugin_Continue;
  30. }
  31.  
  32. /*
  33. public OnEntityCreated(entity, const String:classname[])
  34. {
  35.     if (StrEqual(classname, "pipe_bomb_projectile"))
  36.     {
  37.         CreateTimer(6.0 - pipe_peremenya, TimerBomb, entity)
  38.     }
  39. }
  40. */
  41.  
  42. public Action TimerBomb(Handle timer, any entity)
  43. {
  44.     new entity = -1;
  45.     while ((entity = FindEntityByClassname2(entity, "weapon_molotovt_spawn")) != -1)
  46.     {
  47.         float origin[3];
  48.         GetEntPropVector(entity, Prop_Send, "m_vecOrigin", origin);
  49.         AcceptEntityInput(entity, "kill");
  50.         LittleFlower(origin)
  51.     }
  52. }
  53.  
  54. /*
  55. public Action TimerBomb(Handle timer, any client)
  56. {
  57.     new entity = -1;
  58.     while ((entity = FindEntityByClassname2(entity, "pipe_bomb_projectile")) != -1)
  59.     {
  60.         float origin[3];
  61.         GetEntPropVector(entity, Prop_Send, "m_vecOrigin", origin);
  62.         AcceptEntityInput(entity, "kill");
  63.         LittleFlower()
  64.     }
  65. }
  66. */
  67.  
  68. FindEntityByClassname2(startEnt, const String:classname[])
  69. {
  70.     while (startEnt > -1 && !IsValidEntity(startEnt)) startEnt--;
  71.     return FindEntityByClassname(startEnt, classname);
  72. }
  73.  
  74. public Action timerpipe(Handle timer, any client)
  75. {
  76.     float origin2[3];
  77.     GetEntPropVector(client, Prop_Send, "m_vecOrigin", origin2);
  78.     ForcePlayerSuicide(client);
  79.     LittleFlower(origin2)
  80. }
  81.  
  82. stock LittleFlower(Float:pos[3])
  83. {
  84.     /* Cause fire(type=0) or explosion(type=1) */
  85.     new entity = CreateEntityByName("prop_physics");
  86.     if (IsValidEntity(entity))
  87.     {
  88.         pos[2] += 10.0;
  89.         DispatchKeyValue(entity, "model", "models/props_junk/propanecanister001a.mdl");
  90.         DispatchSpawn(entity);
  91.         SetEntData(entity, GetEntSendPropOffs(entity, "m_CollisionGroup"), 1, 1, true);
  92.         TeleportEntity(entity, pos, NULL_VECTOR, NULL_VECTOR);
  93.         AcceptEntityInput(entity, "break");
  94.     }
  95. }
  96.  
  97.  
  98. public Action TimerOut(Handle timer, client)
  99. {
  100.     pipe_peremenya = 6;
  101.    
  102.     if(pipe_peremenya > 0)
  103.     {
  104.         pipe_peremenya--;
  105.     }
  106.     else
  107.     {
  108.         ForcePlayerSuicide(client)
  109.     }
  110. }
  111.  
  112.  
  113. stock bool bIsSurvivor(int client)
  114. {
  115.     return client > 0 && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == 2 && !IsClientInKickQueue(client) && IsPlayerAlive(client);
  116. }
Advertisement
Add Comment
Please, Sign In to add comment