FlacoBey

Untitled

Jan 4th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.84 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. new pipe_peremenya[MAXPLAYERS+1] = 0;
  8.  
  9. Handle:timerpip[MAXPLAYERS+1] = INVALID_HANDLE;
  10.  
  11. new pipebomb[MAXPLAYERS+1];
  12.  
  13. public OnPluginStart()
  14. {
  15.     CreateTimer(1.0, TimerOut, _, TIMER_REPEAT);
  16. }
  17.  
  18. public Action:TimerOut(Handle timer, fuck)
  19. {
  20.     LoopPlayers(i)
  21.  
  22.     if (pipe_peremenya[i] > 0)
  23.     {
  24.         pipe_peremenya[i]--;
  25.     }
  26. }
  27.  
  28. public Action:OnPlayerRunCmd(client, &buttons,  &impulse, float vel[3], float angles[3], int& weapon)
  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(StrEqual(weaponclass, "weapon_pipe_bomb"))
  38.     {
  39.         if (buttons & IN_ATTACK)
  40.         {
  41.             if (timerpip[client] == INVALID_HANDLE)
  42.             {
  43.                 pipe_peremenya[client] = 6;
  44.                 PrintToChatAll("Держит в руке");
  45.                 timerpip[client] = CreateTimer(6.0, timerpipe, client, TIMER_FLAG_NO_MAPCHANGE);
  46.             }
  47.         }
  48.         else if (!(buttons & IN_ATTACK))
  49.         {
  50.             if (timerpip[client] != INVALID_HANDLE)
  51.             {
  52.                 PrintToChatAll("Отпустил");
  53.                 KillTimer(timerpip[client]);
  54.                 timerpip[client] = INVALID_HANDLE;
  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.         PrintToChatAll("OnEntityCreated");
  67.         new client = GetEntPropEnt(entity, Prop_Send, "m_hThrower");
  68.         pipebomb[client] = EntIndexToEntRef(entity);
  69.     }
  70. }
  71.  
  72. public Action:TimerBomb(Handle:timer, any:client)
  73. {
  74.     new entity = EntRefToEntIndex(pipebomb[client]);
  75.     float origin[3];
  76.     GetEntPropVector(entity, Prop_Send, "m_vecOrigin", origin);
  77.     AcceptEntityInput(pipebomb[client], "kill");
  78.     LittleFlower(origin)
  79. }
  80.  
  81. public Action:timerpipe(Handle:timer, any:client)
  82. {
  83.     float origin2[3];
  84.     GetEntPropVector(client, Prop_Send, "m_vecOrigin", origin2);
  85.     ForcePlayerSuicide(client);
  86.     LittleFlower(origin2);
  87. }
  88.  
  89. public LittleFlower(Float:pos[3])
  90. {
  91.     new entity = CreateEntityByName("prop_physics");
  92.     if (IsValidEntity(entity))
  93.     {
  94.         pos[2] += 1.0;
  95.         DispatchKeyValue(entity, "model", "models/props_junk/propanecanister001a.mdl");
  96.         DispatchSpawn(entity);
  97.         SetEntData(entity, GetEntSendPropOffs(entity, "m_CollisionGroup"), 1, 1, true);
  98.         SetEntityRenderMode(entity, RENDER_TRANSCOLOR);
  99.         SetEntityRenderColor(entity, 255, 255, 255, 0);
  100.         TeleportEntity(entity, pos, NULL_VECTOR, NULL_VECTOR);
  101.         AcceptEntityInput(entity, "break");
  102.     }
  103. }
Advertisement
Add Comment
Please, Sign In to add comment