FlacoBey

Untitled

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