Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdktools>
- #include <sdkhooks>
- #define LoopPlayers(%0) for (int %0 = MaxClients; %0 != 0; --%0) if (IsClientInGame(%0))
- float pipe_peremenya[MAXPLAYERS+1] = 0.0;
- new pipebomb[MAXPLAYERS+1];
- Handle:timerpip[MAXPLAYERS+1] = INVALID_HANDLE;
- public OnPluginStart()
- {
- CreateTimer(1.0, TimerOut, _, TIMER_REPEAT);
- }
- public Action:TimerOut(Handle timer, fuck)
- {
- LoopPlayers(i)
- if (pipe_peremenya[i] > 0)
- {
- pipe_peremenya[i]--;
- }
- }
- public OnClientPutInServer(client)
- {
- SDKHook(client, SDKHook_WeaponCanSwitchTo, WeaponSwitchPost);
- }
- public OnClientDisconnect(client)
- {
- SDKUnhook(client, SDKHook_WeaponCanSwitchTo, WeaponSwitchPost);
- }
- public Action:WeaponSwitchPost(client, weapon)
- {
- if(bIsSurvivor(client))
- {
- new w = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
- if(GetClientButtons(client) & IN_ATTACK)
- {
- char sName[32];
- GetEntityClassname(w, sName, sizeof(sName))
- if(StrEqual(sName, "weapon_pipe_bomb"))
- {
- return Plugin_Handled;
- }
- }
- }
- return Plugin_Continue;
- }
- public Action:OnPlayerRunCmd(client, &buttons, &impulse, float vel[3], float angles[3], int& weapon)
- {
- if (timerpip[client] == INVALID_HANDLE)
- {
- new iCurrentWeapon = GetEntPropEnt(client, Prop_Send, "m_hActiveWeapon");
- if(!IsValidEntity(iCurrentWeapon))
- return Plugin_Continue;
- decl String:weaponclass[32];
- GetEntityClassname(iCurrentWeapon, weaponclass, sizeof(weaponclass));
- if(buttons & IN_ATTACK)
- {
- if (StrEqual(weaponclass, "weapon_pipe_bomb"))
- {
- pipe_peremenya[client] = 6.0;
- timerpip[client] = CreateTimer(6.0, timerpipe, client, TIMER_FLAG_NO_MAPCHANGE);
- }
- }
- }
- if (!(buttons & IN_ATTACK))
- {
- if(timerpip[client] != INVALID_HANDLE)
- {
- KillTimer(timerpip[client]);
- timerpip[client] = INVALID_HANDLE;
- CreateTimer(pipe_peremenya[client], TimerBomb, client);
- }
- }
- return Plugin_Continue;
- }
- public Action:TimerBomb(Handle timer,any client)
- {
- new entity = EntRefToEntIndex(pipebomb[client]);
- if(entity > 0)
- {
- float origin[3];
- SetEntProp(entity, Prop_Data, "m_takedamage", 2 );
- SDKHooks_TakeDamage(entity, 0, 0, 1.0);
- GetEntPropVector(entity, Prop_Send, "m_vecOrigin", origin);
- //LittleFlower(origin)
- }
- }
- public Action:timerpipe(Handle timer, any client)
- {
- KillTimer(timerpip[client]);
- timerpip[client] = INVALID_HANDLE;
- float origin2[3];
- GetEntPropVector(client, Prop_Send, "m_vecOrigin", origin2);
- new pipe = GetPlayerWeaponSlot(client, 2);
- RemovePlayerItem(client, pipe)
- LittleFlower(origin2);
- }
- public OnEntityCreated(int ent, const char[] class)
- {
- if(StrEqual(class, "pipe_bomb_projectile"))
- {
- CreateTimer(0.1, OnHeSpawned, EntIndexToEntRef(ent), TIMER_FLAG_NO_MAPCHANGE);
- }
- }
- public Action:OnHeSpawned(Handle:timer, any:ent)
- {
- decl client;
- if ((ent = EntRefToEntIndex(ent)) > 0 && (client = GetEntPropEnt(ent, Prop_Data, "m_hThrower")) > 0 && IsClientInGame(client))
- {
- pipebomb[client] = EntIndexToEntRef(ent);
- }
- return Plugin_Stop;
- }
- public LittleFlower(Float:pos[3])
- {
- new entity = CreateEntityByName("prop_physics");
- if (IsValidEntity(entity))
- {
- pos[2] += 1.0;
- DispatchKeyValue(entity, "model", "models/props_junk/propanecanister001a.mdl");
- DispatchSpawn(entity);
- SetEntData(entity, GetEntSendPropOffs(entity, "m_CollisionGroup"), 1, 1, true);
- SetEntityRenderMode(entity, RENDER_TRANSCOLOR);
- SetEntityRenderColor(entity, 255, 255, 255, 0);
- 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
Advertisement