Raised This Month: $12 Target: $400
 3% 

!box


Post New Thread Reply   
 
Thread Tools Display Modes
Mathiaas
Senior Member
Join Date: Aug 2014
Location: Sweden ♥
Old 01-20-2016 , 06:09   Re: !box
Reply With Quote #11

Quote:
Originally Posted by weeeishy View Post
Cool, I'll be waiting.
I changed mp_autokick to 0 and some ff commands and it worked fine to kill teammates, without any bans.

Not sure what's wrong. :7
Are you sure that the commands are being changed? Double check i.e mp_autokick by just typing "mp_autokick" in the server console and see what it outputs.
Mathiaas is offline
weeeishy
Senior Member
Join Date: Jul 2015
Location: Kuwait
Old 01-21-2016 , 13:56   Re: !box
Reply With Quote #12

Last time I saw, it was on 1.

Anyways, why should I do the commands every time I want to enable !box? Because sometimes CT aren't admins, and they cant do it :/.


Thanks for your help thoo
__________________
weeeishy is offline
Mathiaas
Senior Member
Join Date: Aug 2014
Location: Sweden ♥
Old 01-22-2016 , 18:00   Re: !box
Reply With Quote #13

Quote:
Originally Posted by weeeishy View Post
Last time I saw, it was on 1.

Anyways, why should I do the commands every time I want to enable !box? Because sometimes CT aren't admins, and they cant do it :/.


Thanks for your help thoo
Then the plugin you posted doesn't set mp_autokick properly.
I'll edit it to set the proper CVars tomorrow for you.

Last edited by Mathiaas; 01-22-2016 at 18:01.
Mathiaas is offline
weeeishy
Senior Member
Join Date: Jul 2015
Location: Kuwait
Old 01-23-2016 , 14:16   Re: !box
Reply With Quote #14

Quote:
Originally Posted by Mathiaas View Post
Then the plugin you posted doesn't set mp_autokick properly.
I'll edit it to set the proper CVars tomorrow for you.
Thanks, i'll be waiting ^_^.
__________________
weeeishy is offline
GinNNy
Senior Member
Join Date: Mar 2014
Old 02-01-2016 , 15:38   Re: !box
Reply With Quote #15

Try this one not sure if its working though and also have the mp_autokick set to 0 in your server.cfg
PHP Code:
#include <sourcemod>
#include <sdkhooks>
#include <cstrike>
#include <hosties>
#include <lastrequest>

#pragma semicolon 1

#define PLUGIN_VERSION "1.5"

new Handle:gH_Enabled INVALID_HANDLE;

new 
bool:gB_Enabled;
new 
bool:gB_Boxing;

new 
gI_LastUsed[MAXPLAYERS+1];

new 
Handle:gH_Cvars[5] = {INVALID_HANDLE, ...};

public 
Plugin:myinfo 
{
    
name "Jailbreak Box",
    
author "shavit",
    
description "Oh my god they're boxing in Jailbreak",
    
version PLUGIN_VERSION
}

public 
OnPluginStart()
{
    
CreateConVar("sm_box_version"PLUGIN_VERSION"Jailbreak Box version"FCVAR_PLUGIN|FCVAR_DONTRECORD|FCVAR_NOTIFY);
    
    
gH_Enabled CreateConVar("sm_box_enabled""1""Enable this plugin functionality?"FCVAR_PLUGIN);
    
gB_Enabled true;
    
HookConVarChange(gH_EnabledOnConvarChanged);
    
    
HookEvent("round_end"Round_End);
    
    
RegConsoleCmd("sm_box"Command_Box"Toggle Jailbreak Box status, available for admins/CTs.");
    
    
AutoExecConfig(true"jailbreakbox");
    
    
gH_Cvars[0] = FindConVar("ff_damage_reduction_bullets");
    
gH_Cvars[1] = FindConVar("ff_damage_reduction_grenade");
    
gH_Cvars[2] = FindConVar("ff_damage_reduction_grenade_self");
    
gH_Cvars[3] = FindConVar("ff_damage_reduction_other");
    
gH_Cvars[4] = FindConVar("mp_friendlyfire");
}

public 
OnAvailableLR(Announced)
{
    if(
gB_Boxing)
    {
        
gB_Boxing false;
        
        for(new 
i<= MaxClientsi++)
        {
            if(
IsValidClient(i))
            {
                
PrintToConsole(i"Jailbreak Box has automatically disabled due to an LR.");
            }
        }
    }
    
    if(
gB_Enabled)
    {
        
Disable();
    }
}

public 
OnConvarChanged(Handle:cvar, const String:oldVal[], const String:newVal[])
{
    if(
cvar == gH_Enabled)
    {
        
gB_Enabled bool:StringToInt(newVal);
    }
}

public 
OnClientPutInServer(client)
{
    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage);
    
gI_LastUsed[client] = 0;
}

public 
Action:OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
{
    if(
gB_Enabled && gB_Boxing)
    {
        if(
IsValidClient(attacker) && IsValidClient(victimtrue))
        {
            if(
attacker != victim && GetClientTeam(attacker) == && GetClientTeam(victim) == 3)
            {
                
damage 0.0;
                
                return 
Plugin_Changed;
            }
        }
    }
    
    return 
Plugin_Continue;
}

public 
Action:Round_End(Handle:event, const String:name[], bool:dB)
{
    
gB_Boxing false;
    
    if(
gB_Enabled)
    {
        
Disable();
    }
    
    return 
Plugin_Continue;
}

public 
Action:Command_Box(clientargs)
{
    if(!
IsValidClient(client))
    {
        return 
Plugin_Handled;
    }
    
    if(!
HasAccess(client))
    {
        
ReplyToCommand(client"\x04[Box]\x01 This command is available for \x05admins \x01and \x05alive prison guards\x01.");
        
        return 
Plugin_Handled;
    }
    
    new 
Time GetTime();
    
    if(
Time gI_LastUsed[client] < 15)
    {
        
ReplyToCommand(client"\x04[Box]\x01 You can't spam this command, time left - \x05[%d/15]\x01."Time gI_LastUsed[client]);
        
        return 
Plugin_Handled;
    }
    
    
gI_LastUsed[client] = Time;
    
    new 
Handle:menu CreateMenu(MenuHandler_BoxMENU_ACTIONS_ALL);
    
SetMenuTitle(menu"Jailbreak Box:");
    
    
AddMenuItem(menu"on""Enable");
    
AddMenuItem(menu"off""Disable");
    
    
SetMenuExitButton(menutrue);
    
    
DisplayMenu(menuclient20);
    
    return 
Plugin_Handled;
}

public 
MenuHandler_Box(Handle:menuMenuAction:actionparam1param2)
{
    switch(
action)
    {
        case 
MenuAction_Select:
        {
            if(!
HasAccess(param1))
            {
                
PrintToChat(param1"\x04[Box]\x01 This command is available for \x05admins \x01and \x05alive prison guards\x01.");
                
                return 
0;
            }
            
            new 
String:info[8];
            
GetMenuItem(menuparam2info8);
            
            new 
bool:enabled StrEqual(info"on");
            
            
enabledEnable():Disable();
            
            
PrintToChatAll("\x04[Box]\x01 Jailbreak Box has been \x05%sabled\x01."enabled"en":"dis");
        }
        
        case 
MenuAction_End:
        {
            
CloseHandle(menu);
        }
    }
    
    return 
0;
}

void:Enable()
{
    for(new 
isizeof(gH_Cvars); i++)
    {
        if(
gH_Cvars[i] != INVALID_HANDLE)
        {
            
SetConVarBool(gH_Cvars[i], (<= 4)? true:false);
        }
    }
}

void:Disable()
{
    for(new 
isizeof(gH_Cvars); i++)
    {
        if(
gH_Cvars[i] != INVALID_HANDLE)
        {
            
SetConVarBool(gH_Cvars[i], (<= 4)? false:true);
        }
    }
}

stock bool:HasAccess(client)
{
    if(
CheckCommandAccess(client"jailbreakbox"ADMFLAG_SLAY))
    {
        return 
true;
    }
    
    if(
GetClientTeam(client) == CS_TEAM_CT && IsPlayerAlive(client))
    {
        return 
true;
    }
    
    return 
false;
}

stock bool:IsValidClient(clientbool:alive false)
{
    if(
client >= && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client) && (alive == false || IsPlayerAlive(client)))
    {
        return 
true;
    }
    
    return 
false;

GinNNy is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:33.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode