Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdktools>
- #include <sdkhooks>
- Handle timeout;
- int pipe_peremenya = 0;
- public void OnPluginStart()
- {
- HookEvent("weapon_fire", EventFe);
- }
- public Action EventFe(Event event, const char[] name, bool dontBroadcast)
- {
- int client = GetClientOfUserId(event.GetInt("userid"));
- int iCurrentWeapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
- char weapon[32];
- GetEntityClassname(iCurrentWeapon, weapon, sizeof(weapon));
- new b = GetClientButtons(client)
- if(bIsSurvivor(client))
- {
- if(StrEqual(weapon, "weapon_pipe_bomb"))
- {
- if (b & IN_ATTACK)
- {
- CreateTimer(6.0, timerpipe, client, TIMER_FLAG_NO_MAPCHANGE);
- timeout = CreateTimer(1.0, TimerOut, client, TIMER_REPEAT);
- }
- else if(!(b & IN_ATTACK))
- {
- KillTimer(timeout);
- timeout = null;
- CreateTimer(6.0 - pipe_peremenya, TimerBomb, client)
- }
- }
- }
- }
- public Action TimerBomb(Handle timer, any client)
- {
- new entity = -1;
- while ((entity = FindEntityByClassname2(entity, "pipe_bomb_projectile")) != -1)
- {
- float origin[3];
- GetEntPropVector(entity, Prop_Send, "m_vecOrigin", origin);
- AcceptEntityInput(entity, "kill");
- ForcePlayerSuicide(client);
- LittleFlower(origin)
- }
- }
- public Action TimerOut(Handle timer, client)
- {
- pipe_peremenya = 6;
- if(pipe_peremenya > 0)
- {
- pipe_peremenya--;
- }
- }
- public Action timerpipe(Handle timer, any client)
- {
- float origin2[3];
- GetEntPropVector(client, Prop_Send, "m_vecOrigin", origin2);
- ForcePlayerSuicide(client);
- LittleFlower(origin2)
- }
- stock LittleFlower(Float:pos[3])
- {
- new entity = CreateEntityByName("prop_physics");
- if (IsValidEntity(entity))
- {
- pos[2] += 10.0;
- DispatchKeyValue(entity, "model", "models/props_junk/propanecanister001a.mdl");
- DispatchSpawn(entity);
- SetEntData(entity, GetEntSendPropOffs(entity, "m_CollisionGroup"), 1, 1, true);
- TeleportEntity(entity, pos, NULL_VECTOR, NULL_VECTOR);
- AcceptEntityInput(entity, "break");
- }
- }
- FindEntityByClassname2(startEnt, const String:classname[])
- {
- while (startEnt > -1 && !IsValidEntity(startEnt)) startEnt--;
- return FindEntityByClassname(startEnt, classname);
- }
- stock bool bIsSurvivor(int client)
- {
- return client > 0 && client <= MaxClients && IsClientInGame(client) && GetClientTeam(client) == 2 && !IsClientInKickQueue(client) && IsPlayerAlive(client);
- }
Advertisement
Add Comment
Please, Sign In to add comment