FlacoBey

Untitled

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