FlacoBey

Untitled

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