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;
- Handle sdkActivatePipe;
- public OnPluginStart()
- {
- Handle hGameConf = LoadGameConfigFile("FlacoBey");
- if( hGameConf == null )
- SetFailState("Couldn't find the offsets and signatures file. Please, check that it is installed correctly.");
- StartPrepSDKCall(SDKCall_Static);
- if( PrepSDKCall_SetFromConf(hGameConf, SDKConf_Signature, "CPipeBombProjectile_Create") == false )
- SetFailState("Could not load the \"CPipeBombProjectile_Create\" gamedata signature.");
- StartPrepSDKCall(SDKCall_Static);
- PrepSDKCall_AddParameter(SDKType_Vector, SDKPass_ByRef);
- PrepSDKCall_AddParameter(SDKType_Vector, SDKPass_ByRef);
- PrepSDKCall_AddParameter(SDKType_Vector, SDKPass_ByRef);
- PrepSDKCall_AddParameter(SDKType_Vector, SDKPass_ByRef);
- PrepSDKCall_AddParameter(SDKType_CBasePlayer, SDKPass_Pointer);
- PrepSDKCall_AddParameter(SDKType_Float, SDKPass_Plain);
- PrepSDKCall_SetReturnInfo(SDKType_CBaseEntity, SDKPass_Pointer);
- sdkActivatePipe = EndPrepSDKCall();
- if( sdkActivatePipe == null )
- SetFailState("Could not prep the \"CPipeBombProjectile_Create\" function.");
- 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_WeaponSwitchPost, WeaponSwitchPost);
- }
- public OnClientDisconnect(client)
- {
- SDKUnhook(client, SDKHook_WeaponSwitchPost, WeaponSwitchPost);
- }
- public Action:WeaponSwitchPost(client, weapon)
- {
- if(GetClientButtons(client) & IN_ATTACK)
- {
- char sName[32];
- GetEntityClassname(weapon, sName, sizeof(sName))
- if(StrEqual(sName, "weapon_pipe_bomb"))
- {
- float vPos[3];
- GetEntPropVector(client, Prop_Send, "m_vecOrigin", vPos);
- int entity = SDKCall(sdkActivatePipe, vPos, 0.0, 0.0, 0.0, client, 2.0);
- pipebomb[client] = EntIndexToEntRef(entity);
- CreateTimer(pipe_peremenya[client], TimerSwitch, client)
- }
- }
- }
- public Action:TimerSwitch(Handle timer,any client)
- {
- new entity = EntRefToEntIndex(pipebomb[client])
- AcceptEntityInput(entity, "kill");
- float origin2[3];
- GetEntPropVector(client, Prop_Send, "m_vecOrigin", origin2);
- LittleFlower(origin2);
- }
- 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];
- AcceptEntityInput(entity, "kill");
- 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);
- ForcePlayerSuicide(client);
- 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