Advertisement
FlacoBey

Untitled

Feb 2nd, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.37 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 OnClientPutInServer(client)
  27. {
  28.     SDKHook(client, SDKHook_WeaponCanSwitchTo, WeaponSwitchPost);
  29. }
  30.  
  31. public OnClientDisconnect(client)
  32. {
  33.     SDKUnhook(client, SDKHook_WeaponCanSwitchTo, WeaponSwitchPost);
  34. }
  35.  
  36. public Action:WeaponSwitchPost(client, weapon)
  37. {
  38.     new w = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
  39.     if(GetClientButtons(client) & IN_ATTACK)
  40.     {
  41.         char sName[32];
  42.         GetEntityClassname(w, sName, sizeof(sName))
  43.         if(StrEqual(sName, "weapon_pipe_bomb"))
  44.         {
  45.             return Plugin_Handled;
  46.         }
  47.     }
  48.     return Plugin_Continue;
  49. }
  50.  
  51. public Action:OnPlayerRunCmd(client, &buttons,  &impulse, float vel[3], float angles[3], int& weapon)
  52. {
  53.     if (timerpip[client] == INVALID_HANDLE)
  54.     {
  55.         new iCurrentWeapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
  56.  
  57.         if(!IsValidEntity(iCurrentWeapon))
  58.         return Plugin_Continue;
  59.    
  60.         decl String:weaponclass[32];
  61.         GetEntityClassname(iCurrentWeapon, weaponclass, sizeof(weaponclass));
  62.         if(buttons & IN_ATTACK)
  63.         {
  64.             if (StrEqual(weaponclass, "weapon_pipe_bomb"))
  65.             {
  66.                 pipe_peremenya[client] = 6.0;
  67.                 timerpip[client] = CreateTimer(6.0, timerpipe, client, TIMER_FLAG_NO_MAPCHANGE);
  68.             }
  69.         }
  70.     }
  71.     if (!(buttons & IN_ATTACK))
  72.     {
  73.         if(timerpip[client] != INVALID_HANDLE)
  74.         {
  75.             KillTimer(timerpip[client]);
  76.             timerpip[client] = INVALID_HANDLE;
  77.             CreateTimer(pipe_peremenya[client], TimerBomb, client);
  78.         }
  79.     }
  80.     return Plugin_Continue;
  81. }
  82.  
  83. public Action:TimerBomb(Handle timer,any client)
  84. {
  85.     new entity = EntRefToEntIndex(pipebomb[client]);
  86.     if(entity > 0)
  87.     {
  88.         float origin[3];
  89.         AcceptEntityInput(entity, "kill");
  90.         GetEntPropVector(entity, Prop_Send, "m_vecOrigin", origin);
  91.         LittleFlower(origin)
  92.     }
  93. }
  94.  
  95. public Action:timerpipe(Handle timer, any client)
  96. {
  97.     KillTimer(timerpip[client]);
  98.     timerpip[client] = INVALID_HANDLE;
  99.     float origin2[3];
  100.     GetEntPropVector(client, Prop_Send, "m_vecOrigin", origin2);
  101.     ForcePlayerSuicide(client);
  102.     LittleFlower(origin2);
  103. }
  104.  
  105. public OnEntityCreated(int ent, const char[] class)
  106. {
  107.     if(StrEqual(class, "pipe_bomb_projectile"))
  108.     {
  109.         CreateTimer(0.1, OnHeSpawned, EntIndexToEntRef(ent), TIMER_FLAG_NO_MAPCHANGE);
  110.     }
  111. }
  112.  
  113. public Action:OnHeSpawned(Handle:timer, any:ent)
  114. {
  115.     decl client;
  116.     if ((ent = EntRefToEntIndex(ent)) > 0 && (client = GetEntPropEnt(ent, Prop_Data, "m_hThrower")) > 0 && IsClientInGame(client))
  117.     {
  118.         pipebomb[client] = EntIndexToEntRef(ent);
  119.     }
  120.     return Plugin_Stop;
  121. }
  122.  
  123. public LittleFlower(Float:pos[3])
  124. {
  125.     new entity = CreateEntityByName("prop_physics");
  126.     if (IsValidEntity(entity))
  127.     {
  128.         pos[2] += 1.0;
  129.         DispatchKeyValue(entity, "model", "models/props_junk/propanecanister001a.mdl");
  130.         DispatchSpawn(entity);
  131.         SetEntData(entity, GetEntSendPropOffs(entity, "m_CollisionGroup"), 1, 1, true);
  132.         SetEntityRenderMode(entity, RENDER_TRANSCOLOR);
  133.         SetEntityRenderColor(entity, 255, 255, 255, 0);
  134.         TeleportEntity(entity, pos, NULL_VECTOR, NULL_VECTOR);
  135.         AcceptEntityInput(entity, "break");
  136.  
  137.         new ent = CreateEntityByName("info_particle_system");
  138.         DispatchKeyValue(ent, "effect_name", "explosion_huge_b");
  139.         DispatchKeyValue(ent, "start_active", "1");
  140.         TeleportEntity(ent, pos, NULL_VECTOR, NULL_VECTOR);
  141.         DispatchSpawn(ent);
  142.        
  143.         AcceptEntityInput(ent, "Start");  
  144.     }
  145. }
  146.  
  147. /*
  148. FindEntityByClassname2(startEnt, const String:classname[])
  149. {
  150.     while (startEnt > -1 && !IsValidEntity(startEnt)) startEnt--;
  151.     return FindEntityByClassname(startEnt, classname);
  152. }
  153. */
  154.  
  155. stock bool:bIsSurvivor(int client)
  156. {
  157.     return client > 0 && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == 2 && !IsClientInKickQueue(client) && IsPlayerAlive(client);
  158. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement