Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma semicolon 1
- #include <sourcemod>
- #include <sdkhooks>
- #include <sdktools>
- #include <cstrike>
- #include <basecomm>
- #include <hosties>
- new Handle:timer = INVALID_HANDLE;
- new Handle:gH_Menu = INVALID_HANDLE;
- new bool:enabled;
- new bool:weaponlock = false;
- new iTimer;
- new iEnt;
- new String:EntityList[][] = {"func_door", "func_movelinear", "func_door_rotating"};
- public OnPluginStart()
- {
- RegAdminCmd("sm_ffd", FfdCommand, ADMFLAG_GENERIC, "JailBreak FriendlyFire Day Menu");
- HookEvent("round_end", OnRoundEnd);
- timer = CreateConVar("sm_jbffd_time", "40", "Seconds for teaming up and to get in position");
- gH_Menu = CreateMenu(MenuHandler);
- SetMenuTitle(gH_Menu, "Weapon Selection Menu");
- AddMenuItem(gH_Menu, "m4a1", "M4A1");
- AddMenuItem(gH_Menu, "ak47", "AK47");
- AddMenuItem(gH_Menu, "awp", "AWP");
- AddMenuItem(gH_Menu, "p90", "P90");
- AddMenuItem(gH_Menu, "m249", "M249");
- AddMenuItem(gH_Menu, "mac10", "Mac10");
- AddMenuItem(gH_Menu, "m3", "M3");
- AddMenuItem(gH_Menu, "xm1014", "XM1014");
- AddMenuItem(gH_Menu, "scout", "Scout");
- }
- public OnMapStart()
- {
- if(enabled)
- {
- enabled = false;
- weaponlock = false;
- SetConVarInt(FindConVar("mp_friendlyfire"), 0);
- //SetConVarInt(FindConVar("sm_hosties_lr"), 1);
- }
- }
- public Action:OnRoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
- {
- if(enabled)
- {
- enabled = false;
- weaponlock = false;
- SetConVarInt(FindConVar("mp_friendlyfire"), 0);
- //SetConVarInt(FindConVar("sm_hosties_lr"), 1);
- PrintToChatAll("\x04JailBreak FriendlyFire Day has ended.");
- }
- }
- public Action:Timer_Delay(Handle:hTimer, any:data)
- {
- if(timer)
- {
- if(iTimer == 0)
- {
- if(!enabled)
- {
- return Plugin_Stop;
- }
- else
- {
- weaponlock = false;
- PrintToChatAll("\x04Weapons are now UNLOCKED!");
- PrintCenterTextAll("Weapons are now UNLOCKED!");
- SetConVarInt(FindConVar("mp_friendlyfire"), 1);
- return Plugin_Stop;
- }
- }
- else
- {
- if(!enabled)
- {
- return Plugin_Stop;
- }
- else
- {
- iTimer--;
- PrintCenterTextAll("You have %02i seconds to team up and get in position.", iTimer % 60);
- return Plugin_Continue;
- }
- }
- }
- return Plugin_Stop;
- }
- public Action:FfdCommand(client, args)
- {
- if(GetClientTeam(client) == CS_TEAM_CT)
- {
- new Handle:FFD = CreateMenu(MenuHandler_FFD);
- SetMenuTitle(FFD, "FriendlyFire Day:");
- AddMenuItem(FFD, "on", "Enable");
- AddMenuItem(FFD, "off", "Disable");
- DisplayMenu(FFD, client, MENU_TIME_FOREVER);
- }
- else
- {
- PrintToChat(client, "\x04This command is reserved for CT Admins.");
- }
- return Plugin_Handled;
- }
- public MenuHandler_FFD(Handle:FFD, MenuAction:action, iClient, iMenuItem)
- {
- if(action == MenuAction_Select)
- {
- switch (iMenuItem)
- {
- case 0:
- {
- if(enabled)
- {
- PrintToChat(iClient, "\x04JailBreak FriendlyFire Day is already enabled.");
- }
- else
- {
- iTimer = GetConVarInt(FindConVar("sm_jbffd_time"));
- enabled = true;
- weaponlock = true;
- OpenCells();
- UnmuteAlive();
- //SetConVarInt(FindConVar("sm_hosties_lr"), 0);
- PrintToChatAll("\x04%N has started JailBreak FriendlyFire Day.", iClient);
- CreateTimer(1.0, Timer_Delay, _, TIMER_REPEAT);
- ServerCommand("sm_hp @ct 250");
- for(new i = 1; i < MaxClients; i++)
- {
- CreateTimer(2.0, GiveWeapons, i, TIMER_FLAG_NO_MAPCHANGE);
- }
- }
- }
- case 1:
- {
- if(enabled)
- {
- enabled = false;
- weaponlock = false;
- //SetConVarInt(FindConVar("sm_hosties_lr"), 1);
- SetConVarInt(FindConVar("mp_friendlyfire"), 0);
- PrintToChatAll("\x04%N has stopped JailBreak FriendlyFire Day.", iClient);
- }
- else
- {
- PrintToChat(iClient, "\x04JailBreak FriendlyFire Day is already disabled.");
- }
- }
- }
- }
- else if(action == MenuAction_End)
- {
- CloseHandle(FFD);
- }
- }
- public Action:OpenCells()
- {
- for(new i = 0; i < sizeof(EntityList); i++)
- while((iEnt = FindEntityByClassname(iEnt, EntityList[i])) != -1)
- AcceptEntityInput(iEnt, "Open");
- }
- public MenuHandler(Handle:menu, MenuAction:action, client, param2)
- {
- if(action == MenuAction_Select)
- {
- if(IsPlayerAlive(client))
- {
- decl String:selection[64];
- decl String:selectiondisp[64];
- GetMenuItem(menu, param2, selection, sizeof(selection), _, selectiondisp, sizeof(selectiondisp));
- decl String:buffer[64];
- Format(buffer, sizeof(buffer), "weapon_%s", selection);
- GivePlayerItem(client, buffer);
- PrintToChat(client, "You were given %s, team up and get in position!", selectiondisp);
- }
- }
- }
- stock UnmuteAlive()
- {
- for(new i = 1; i <= MaxClients; i++)
- {
- if (IsClientInGame(i) && IsPlayerAlive(i)) // if player is in game and alive
- {
- if (!BaseComm_IsClientMuted(i))
- {
- UnmutePlayer(i);
- }
- }
- }
- }
- public Action:GiveWeapons(Handle:htimer, any:client)
- {
- if(enabled && IsClientInGame(client) && IsPlayerAlive(client))
- {
- GivePlayerItem(client, "weapon_deagle");
- DisplayMenu(gH_Menu, client, 0);
- }
- return Plugin_Handled;
- }
- public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon)
- {
- if(buttons & IN_ATTACK && enabled && weaponlock)
- {
- buttons &= ~IN_ATTACK;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement