Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sourcemod>
- #include <sdkhooks>
- #pragma semicolon 1
- #define CS_TEAM_CT 3
- #define PLUGIN_VERSION "1.2"
- new Handle:gH_ff = INVALID_HANDLE;
- new bool:boxenabled = false;
- public Plugin:myinfo =
- {
- name = "Jailbreak Box",
- author = "TimeBomb",
- description = "Boxing Feature for T's only in Jailbreak.",
- version = PLUGIN_VERSION,
- url = ""
- }
- public OnPluginStart()
- {
- RegConsoleCmd("sm_box", cmd_box);
- HookEvent("round_end", roundend);
- gH_ff = FindConVar("mp_friendlyfire");
- CreateConVar("sm_box_version", PLUGIN_VERSION, "Jailbreak Box Version");
- }
- public OnClientPutInServer(client)
- {
- SDKHook(client, SDKHook_OnTakeDamage, dmg);
- }
- public roundend(Handle:event, const String:name[], bool:dontBroadcast)
- {
- SetConVarInt(gH_ff, 0);
- boxenabled = false;
- }
- public Action:dmg(victim, &attacker, &inflictor, &Float:damage, &damagetype)
- {
- new team, team2;
- team = GetClientTeam(victim);
- team2 = GetClientTeam(attacker);
- if(team == CS_TEAM_CT && team2 == CS_TEAM_CT && boxenabled && gH_ff && IsClientInGame(victim) && !IsFakeClient(attacker) && IsValidClient(attacker) && IsValidClient(victim))
- {
- damage = 0.0;
- return Plugin_Changed;
- }
- return Plugin_Continue;
- }
- public Action:cmd_box(client, args)
- {
- new team = GetClientTeam(client);
- if(team == CS_TEAM_CT && IsPlayerAlive(client))
- {
- new Handle:boxmenu = CreateMenu(BoxmenuHandler);
- SetMenuTitle(boxmenu, "Box:\nBoxing with Each Other [T's only]");
- AddMenuItem(boxmenu, "1", "Enable");
- AddMenuItem(boxmenu, "0", "Disable");
- DisplayMenu(boxmenu, client, MENU_TIME_FOREVER);
- }
- else
- {
- PrintToChat(client, "\x04[SM]\x01 You have to be a Alive CT to Toggle Box.");
- }
- return Plugin_Handled;
- }
- public BoxmenuHandler(Handle:boxmenu, MenuAction:action, iClient, iMenuItem)
- {
- new team = GetClientTeam(iClient);
- if(action == MenuAction_Select)
- {
- switch (iMenuItem)
- {
- case 0:
- {
- if(team == CS_TEAM_CT && IsPlayerAlive(iClient))
- {
- telleveryoneactivate(iClient);
- }
- else
- {
- PrintToChat(iClient, "\x04[SM]\x01 You have to be a Alive CT to Toggle Box.");
- }
- }
- case 1:
- {
- if(team == CS_TEAM_CT && IsPlayerAlive(iClient))
- {
- telleveryonedisabled(iClient);
- }
- else
- {
- PrintToChat(iClient, "\x04[SM]\x01 You have to be a Alive CT to Toggle Box.");
- }
- }
- }
- }
- else if(action == MenuAction_End)
- {
- CloseHandle(boxmenu);
- }
- }
- public telleveryoneactivate(iClient)
- {
- if(boxenabled == true)
- {
- PrintToChat(iClient, "\x04[SM]\x01 Jailbreak Box is already enabled!");
- }
- else
- {
- decl String:name[MAX_NAME_LENGTH];
- GetClientName(iClient, name, sizeof(name));
- PrintToChatAll("\x04[SM]\x01 Box has been enabled by \x03%s\x01!", name);
- PrintCenterTextAll("Box has been enabled by \x03%s\x01!", name);
- SetConVarInt(gH_ff, 1);
- boxenabled = true;
- }
- }
- public telleveryonedisabled(iClient)
- {
- if(boxenabled == true)
- {
- decl String:name[MAX_NAME_LENGTH];
- GetClientName(iClient, name, sizeof(name));
- PrintToChatAll("\x04[SM]\x01 Box has been disabled by \x03%s\x01!", name);
- PrintCenterTextAll("Box has been disabled by \x03%s\x01!", name);
- SetConVarInt(gH_ff, 0);
- boxenabled = false;
- }
- else
- {
- PrintToChat(iClient, "\x04[SM]\x01 Jailbreak Box is already disabled!");
- }
- }
- stock bool:IsValidClient(client, bool:bAlive = false)
- {
- if(client >= 1 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client) && (bAlive == false || IsPlayerAlive(client)))
- {
- return true;
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment