FlacoBey

Untitled

Jan 1st, 2019
157
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. #pragma semicolon 1
  5.  
  6. #define LoopPlayers(%0) for (int %0 = MaxClients; %0 != 0; --%0) if (IsClientInGame(%0))
  7.  
  8. int pipe_peremenya[MAXPLAYERS+1] = 0;
  9.  
  10. Handle:timerpip[MAXPLAYERS+1] = INVALID_HANDLE;
  11.  
  12. new pipebomb[MAXPLAYERS+1];
  13.  
  14. public OnPluginStart()
  15. {
  16.     CreateTimer(1.0, TimerOut, _, TIMER_REPEAT);
  17. }
  18.  
  19. public Action:TimerOut(Handle timer, fuck)
  20. {
  21.     LoopPlayers(i)
  22.    
  23.     if (pipe_peremenya[i] > 0)
  24.     {
  25.         pipe_peremenya[i]--;
  26.     }
  27. }
  28.  
  29. public Action:OnPlayerRunCmd(client, &buttons,  &impulse, float vel[3], float angles[3], int& weapon)
  30. {
  31.     if (timerpip[client] == INVALID_HANDLE)
  32.     {
  33.         new iCurrentWeapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
  34.  
  35.         if(!IsValidEntity(iCurrentWeapon))
  36.         return Plugin_Continue;
  37.    
  38.         decl String:weaponclass[32];
  39.         GetEntityClassname(iCurrentWeapon, weaponclass, sizeof(weaponclass));
  40.         if(buttons & IN_ATTACK)
  41.         {
  42.             if (StrEqual(weaponclass, "weapon_pipe_bomb"))
  43.             {
  44.                 pipe_peremenya[client] = 6;
  45.                 timerpip[client] = CreateTimer(6.0, timerpipe, client, TIMER_FLAG_NO_MAPCHANGE);
  46.             }
  47.             else if (!(buttons & IN_USE))
  48.             {
  49.                 if(timerpip[client] != INVALID_HANDLE)
  50.                 {
  51.                     KillTimer(timerpip[client]);
  52.                     timerpip[client] = INVALID_HANDLE;
  53.                 }
  54.                 CreateTimer(6.0 - pipe_peremenya[client], TimerBomb, client);
  55.             }
  56.         }
  57.     }
  58.     return Plugin_Continue;
  59. }
  60.  
  61. public OnEntityCreated(int entity, const char[] classname)
  62. {
  63.     if(StrEqual(classname, "pipe_bomb_projectile"))
  64.     {
  65.         new client = GetEntPropEnt(entity, Prop_Send, "m_hThrower");
  66.         pipebomb[client] = EntIndexToEntRef(entity);
  67.     }
  68. }
  69.  
  70. public Action:TimerBomb(Handle:timer, any:client)
  71. {
  72.     new entity = EntRefToEntIndex(pipebomb[client]);
  73.     float origin[3];
  74.     GetEntPropVector(entity, 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