FlacoBey

Untitled

Jan 1st, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.79 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.     new entity = -1;
  53.     while ((entity = FindEntityByClassname2(entity, "pipe_bomb_projectile")) != -1)
  54.     {
  55.         float origin[3];
  56.         GetEntPropVector(entity, Prop_Send, "m_vecOrigin", origin);
  57.         AcceptEntityInput(entity, "kill");
  58.         LittleFlower()
  59.     }
  60. }
  61. */
  62.  
  63. FindEntityByClassname2(startEnt, const String:classname[])
  64. {
  65.     while (startEnt > -1 && !IsValidEntity(startEnt)) startEnt--;
  66.     return FindEntityByClassname(startEnt, classname);
  67. }
  68.  
  69. public Action timerpipe(Handle timer, any client)
  70. {
  71.     new entity = -1;
  72.     while ((entity = FindEntityByClassname2(entity, "weapon_molotovt_spawn")) != -1)
  73.     {
  74.         float origin2[3];
  75.         GetEntPropVector(entity, Prop_Send, "m_vecOrigin", origin2);
  76.         ForcePlayerSuicide(client);
  77.         LittleFlower(origin2)
  78.     }
  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.     else
  106.     {
  107.         ForcePlayerSuicide(client)
  108.     }
  109. }
  110.  
  111.  
  112. stock bool bIsSurvivor(int client)
  113. {
  114.     return client > 0 && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == 2 && !IsClientInKickQueue(client) && IsPlayerAlive(client);
  115. }
Advertisement
Add Comment
Please, Sign In to add comment