Advertisement
FlacoBey

Untitled

Feb 2nd, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.60 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. float pipe_peremenya[MAXPLAYERS+1] = 0.0;
  8. new pipebomb[MAXPLAYERS+1];
  9. Handle:timerpip[MAXPLAYERS+1] = INVALID_HANDLE;
  10.  
  11. public OnPluginStart()
  12. {
  13.     CreateTimer(1.0, TimerOut, _, TIMER_REPEAT);
  14. }
  15.  
  16. public Action:TimerOut(Handle timer, fuck)
  17. {
  18.     LoopPlayers(i)
  19.    
  20.     if (pipe_peremenya[i] > 0)
  21.     {
  22.         pipe_peremenya[i]--;
  23.     }
  24. }
  25.  
  26. public Action:OnPlayerRunCmd(client, &buttons,  &impulse, float vel[3], float angles[3], int& weapon)
  27. {
  28.     if (timerpip[client] == INVALID_HANDLE)
  29.     {
  30.         new iCurrentWeapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
  31.  
  32.         if(!IsValidEntity(iCurrentWeapon))
  33.         return Plugin_Continue;
  34.    
  35.         decl String:weaponclass[32];
  36.         GetEntityClassname(iCurrentWeapon, weaponclass, sizeof(weaponclass));
  37.         if(buttons & IN_ATTACK)
  38.         {
  39.             if (StrEqual(weaponclass, "weapon_pipe_bomb"))
  40.             {
  41.                 pipe_peremenya[client] = 6.0;
  42.                 timerpip[client] = CreateTimer(6.0, timerpipe, client, TIMER_FLAG_NO_MAPCHANGE);
  43.             }
  44.         }
  45.     }
  46.     if (!(buttons & IN_ATTACK))
  47.     {
  48.         if(timerpip[client] != INVALID_HANDLE)
  49.         {
  50.             KillTimer(timerpip[client]);
  51.             timerpip[client] = INVALID_HANDLE;
  52.             CreateTimer(pipe_peremenya[client], TimerBomb, client);
  53.         }
  54.     }
  55.     return Plugin_Continue;
  56. }
  57.  
  58. public Action:TimerBomb(Handle timer,any client)
  59. {
  60.     new entity = EntRefToEntIndex(pipebomb[client]);
  61.     if(entity > 0)
  62.     {
  63.         float origin[3];
  64.         AcceptEntityInput(entity, "kill");
  65.         GetEntPropVector(entity, Prop_Send, "m_vecOrigin", origin);
  66.         LittleFlower(origin)
  67.     }
  68. }
  69.  
  70. public Action:timerpipe(Handle timer, any client)
  71. {
  72.     KillTimer(timerpip[client]);
  73.     timerpip[client] = INVALID_HANDLE;
  74.     float origin2[3];
  75.     GetEntPropVector(client, Prop_Send, "m_vecOrigin", origin2);
  76.     ForcePlayerSuicide(client);
  77.     LittleFlower(origin2);
  78. }
  79.  
  80. public OnEntityCreated(int ent, const char[] class)
  81. {
  82.     if(StrEqual(class, "pipe_bomb_projectile"))
  83.     {
  84.         CreateTimer(0.1, OnHeSpawned, EntIndexToEntRef(ent), TIMER_FLAG_NO_MAPCHANGE);
  85.     }
  86. }
  87.  
  88. public Action:OnHeSpawned(Handle:timer, any:ent)
  89. {
  90.     decl client;
  91.     if ((ent = EntRefToEntIndex(ent)) > 0 && (client = GetEntPropEnt(ent, Prop_Data, "m_hThrower")) > 0 && IsClientInGame(client))
  92.     {
  93.         pipebomb[client] = EntIndexToEntRef(ent);
  94.     }
  95.     return Plugin_Stop;
  96. }
  97.  
  98. public LittleFlower(Float:pos[3])
  99. {
  100.     new entity = CreateEntityByName("prop_physics");
  101.     if (IsValidEntity(entity))
  102.     {
  103.         pos[2] += 1.0;
  104.         DispatchKeyValue(entity, "model", "models/props_junk/propanecanister001a.mdl");
  105.         DispatchSpawn(entity);
  106.         SetEntData(entity, GetEntSendPropOffs(entity, "m_CollisionGroup"), 1, 1, true);
  107.         SetEntityRenderMode(entity, RENDER_TRANSCOLOR);
  108.         SetEntityRenderColor(entity, 255, 255, 255, 0);
  109.         TeleportEntity(entity, pos, NULL_VECTOR, NULL_VECTOR);
  110.         AcceptEntityInput(entity, "break");
  111.     }
  112. }
  113.  
  114. /*
  115. FindEntityByClassname2(startEnt, const String:classname[])
  116. {
  117.     while (startEnt > -1 && !IsValidEntity(startEnt)) startEnt--;
  118.     return FindEntityByClassname(startEnt, classname);
  119. }
  120. */
  121.  
  122. stock bool:bIsSurvivor(int client)
  123. {
  124.     return client > 0 && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == 2 && !IsClientInKickQueue(client) && IsPlayerAlive(client);
  125. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement