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

[KreedZ] MultiPlayer Bhop 1.1.2 ( 23 may 2013 )


Post New Thread Reply   
 
Thread Tools Display Modes
ANTICHRISTUS
kingdom of weird stuff
Join Date: Jun 2010
Location: My kingdom is not in thi
Old 04-04-2015 , 14:01   Re: [KreedZ] MultiPlayer Bhop 1.1.2 ( 23 may 2013 )
Reply With Quote #271

Like any other plugin. if you want different cvars, put them in your amxxx.cfg.
__________________
ANTICHRISTUS is offline
Xombine
New Member
Join Date: Feb 2019
Old 03-11-2019 , 17:05   Re: [KreedZ] MultiPlayer Bhop 1.1.2 ( 23 may 2013 )
Reply With Quote #272

What is the cvar that pushes player of the block instead of teleporting him back to where he jumped from?
Xombine is offline
sanimare
Senior Member
Join Date: Sep 2010
Old 05-15-2020 , 10:39   Re: [KreedZ] MultiPlayer Bhop 1.1.2 ( 23 may 2013 )
Reply With Quote #273

Quote:
Originally Posted by Xombine View Post
What is the cvar that pushes player of the block instead of teleporting him back to where he jumped from?
Bump!
sanimare is offline
Mistrick
Senior Member
Join Date: Aug 2012
Location: Russia
Old 05-16-2020 , 01:31   Re: [KreedZ] MultiPlayer Bhop 1.1.2 ( 23 may 2013 )
Reply With Quote #274

Quote:
Originally Posted by sanimare View Post
Bump!
My version with deathrun fixes.
PHP Code:
/*    Copyright ********* 2008, ConnorMcLeod

    func_door is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with func_door; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#define MAKE_DOORS_SILENT

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <xs>

#if AMXX_VERSION_NUM < 183
#include <colorchat>
#define client_disconnected client_disconnect
#endif

new const VERSION[] = "1.1.3-dre";

#pragma semicolon 1

#define SetIdBits(%1,%2)        %1 |= 1<<(%2 & 31)
#define ClearIdBits(%1,%2)      %1 &= ~( 1<<(%2 & 31) )
#define GetIdBits(%1,%2)        %1 & 1<<(%2 & 31)

#define SetEntBits(%1,%2)       %1[%2>>5] |= 1<<(%2 & 31)
#define ClearEntBits(%1,%2)     %1[%2>>5] &= ~( 1 << (%2 & 31) )
#define GetEntBits(%1,%2)       %1[%2>>5] & 1<<(%2 & 31)

const TASK_GLOW 123;

enum _:BlocksClasses {
    
FUNC_DOOR,
    
FUNC_WALL_TOGGLE,
    
FUNC_BUTTON,
    
TRIGGER_MULTIPLE
}

new const 
Float:VEC_DUCK_HULL_MIN[3]    = {-16.0, -16.0, -18.0 };
new const 
Float:VEC_DUCK_HULL_MAX[3]    = { 16.0,  16.0,  32.0 };
new const 
Float:VEC_DUCK_VIEW[3]        = {  0.0,   0.0,  12.0 };

new const 
Float:VEC_NULL[3]    = { 0.00.00.0 };

const 
PLAYERS_ARRAY_SIZE 33;
const 
MAX_ENTSARRAYS_SIZE 64// x * 32 // 2048 (should be 1800 on default servers settings)

new g_bitPresentClass;

const 
KEYS = ((1<<0)|(1<<1)|(1<<9));

new 
g_iBlockPLAYERS_ARRAY_SIZE ];
new 
Float:g_flFirstTouchPLAYERS_ARRAY_SIZE ];

new 
Float:g_flJumpOriginPLAYERS_ARRAY_SIZE ][3];
new 
Float:g_flJumpAnglesPLAYERS_ARRAY_SIZE ][3];
new 
Float:g_flJumpGravityPLAYERS_ARRAY_SIZE ];

new 
g_bBlocks[MAX_ENTSARRAYS_SIZE], g_bBlocksByPlugin[MAX_ENTSARRAYS_SIZE];
new 
g_bOnGroundg_bTeleportedg_bAdmin;

new 
bool:g_bBlockEntityTouch;
new 
bool:g_bActive;
new 
bool:g_bSafeInform true;

new 
g_iFhAddToFullPack;
new 
g_iAdminDoor[PLAYERS_ARRAY_SIZE];
new 
szConfigFile[64];

new 
Trie:g_iBlocksClass;

new 
g_iMaxPlayersg_iMaxEnts;
#define IsPlayer(%1)    ( 1 <= %1 <= g_iMaxPlayers )

new Trie:g_tKeyValues;
new 
g_bGlow;
new 
g_hCvarActionOnFail;

public 
plugin_init()
{
    
register_plugin("MultiPlayer Bhop"VERSION"ConnorMcLeod");
    new 
pCvar register_cvar("mp_bhop_version"VERSIONFCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY);
    
set_pcvar_string(pCvarVERSION);

    new const 
szPossibleBlockClass[][] = {"func_door""func_wall_toggle""func_button""trigger_multiple"};
    
g_iBlocksClass TrieCreate();
    for(new 
ii<sizeof(szPossibleBlockClass); i++) {
        
TrieSetCell(g_iBlocksClassszPossibleBlockClass[i], i);
    }

    
register_concmd("kz_mpbhop""ConCmd_MpBhop"ADMIN_CFG"<0/1> set blocks so they can't move when players touch them");
    
register_concmd("kz_mpbhop_entitytouch""ConCmd_EntityTouch"ADMIN_CFG"<0/1> set blocks so they can't move when other entities than players touch them");
    
register_concmd("kz_safe_inform""ClCmd_SafeInform"ADMIN_CFG"<0/1> Inform recorders that their demo will be safe or not safe according to plugin state");

    
register_clcmd("kz_mpbhopmenu""ClCmd_BhopMenu"ADMIN_CFG);
    
register_clcmd("kz_showblocks""ClCmd_ShowBlocks"ADMIN_CFG);

    
g_hCvarActionOnFail register_cvar("kz_action_on_fail""1"); // 0 - nothing, 1 - drop player from block, 2 - teleport to last safe point

    // register_clcmd("fullupdate", "ClCmd_FullUpdate");

    
g_iFhAddToFullPack register_forward(FM_AddToFullPack"AddToFullPack"1);

    
register_menucmd(register_menuid("MpBhop Menu"), KEYS ,"MpBhopMenuAction");

    
g_iMaxPlayers get_maxplayers();
    
g_iMaxEnts global_get(glb_maxEntities);

    new 
iCount;

    
iCount += Set_Doors();
    
iCount += Set_Wall_Toggle();
    
iCount += Set_Buttons();

    
iCount += SetBlocksByFile();

    
TrieDestroy(g_tKeyValues);

    
server_print("[MPBHOP] %d bhop blocks detected"iCount);

    
SetTriggerMultiple();

    if(
iCount) {
        
_SetTouch(true);
    }

    
set_task(0.5"Task_Glow"TASK_GLOW, .flags "b");
}

public 
Task_Glow()
{
    static 
ignore;
    
g_bGlow false;
    if(++
ignore 3) {
        
ignore 0;
        
g_bGlow true;
    }
}

public 
plugin_precache()
{
    
g_tKeyValues TrieCreate();
}

public 
pfn_keyvalue(ent)
{
    new 
classname32 ], key32 ], value32 ];
    
copy_keyvalueclassnamecharsmax(classname), keycharsmax(key), valuecharsmax(value) );

    if(!
equal(classname"multi_manager") || equal(key"classname") || equal(key"targetname") || equal(key"origin")) {
        return 
0;
    }

    
TrieSetCell(g_tKeyValueskey1);

    return 
0;
}

public 
plugin_cfg()
{
    new 
szConfigPath[96];
    
get_localinfo("amxx_configsdir"szConfigPathcharsmax(szConfigPath));
    
format(szConfigPathcharsmax(szConfigPath), "%s/mpbhop.cfg"szConfigPath);

    if( 
file_exists(szConfigPath) ) {
        new 
buffer[2], n;
        
read_file(szConfigPath0buffercharsmax(buffer), n);
        if( 
buffer[0] == ';' ) {
            goto 
ForceWrite;
        }
        
server_cmd("exec %s"szConfigPath);
        
server_exec();
    } else {
ForceWrite:
        new 
fp fopen(szConfigPath"wt");
        if( !
fp ) {
            return;
        }
        new 
szPluginFileName[96], szPluginName[64], szAuthor[32], szVersion[32], szStatus[2];
        new 
iPlugin get_plugin(-1,
                    
szPluginFileNamecharsmax(szPluginFileName),
                    
szPluginNamecharsmax(szPluginName),
                    
szVersioncharsmax(szVersion),
                    
szAuthorcharsmax(szAuthor),
                    
szStatuscharsmax(szStatus) );

        
// server_print("Plugin id is %d", iPlugin);
        
fprintf(fp"// ^"%s^" configuration file^n"szPluginName);
        
fprintf(fp"// Author : ^"%s^"^n"szAuthor);
        
fprintf(fp"// Version : ^"%s^"^n"szVersion);
        
fprintf(fp"// File : ^"%s^"^n"szPluginFileName);

        new 
iMaxiszCommand[64], iCommandAccessszCmdInfo[128], szFlags[32];
        
iMax get_concmdsnum(-1, -1);
        
fprintf(fp"^n// Console Commands :^n");
        for(
0iMaxi++) {
            if( 
get_concmd_plid(i, -1, -1) == iPlugin ) {
                
get_concmd(i,
                        
szCommandcharsmax(szCommand),
                        
iCommandAccess,
                        
szCmdInfocharsmax(szCmdInfo),
                        -
1, -1);
                
get_flags(iCommandAccessszFlagscharsmax(szFlags));
                
fprintf(fp"// %s | Access:^"%s^" | ^"%s^"^n"szCommandszFlagsszCmdInfo);
            }
        }

        
iMax get_plugins_cvarsnum();
        new 
iTempIdiPcvarszCvarName[256], szCvarValue[128];
        
fprintf(fp"^n// Cvars :^n");
        for(new 
ii<iMaxi++) {
            
get_plugins_cvar(iszCvarNamecharsmax(szCvarName), _iTempIdiPcvar);
            if( 
iTempId == iPlugin ) {
                
get_pcvar_string(iPcvarszCvarValuecharsmax(szCvarValue));
                
fprintf(fp"// %s ^"%s^"^n"szCvarNameszCvarValue);
            }
        }

        
fclose(fp);
    }
}

/* public ClCmd_FullUpdate( id )
{
    if( g_bSafeInform ) {
        if( g_bActive ) {
            client_print(id, print_console, "MpBhop is Activated, recording is NOT SAFE");
            client_print_color(id, print_team_red, "^1 * ^4[MpBhop] ^1MpBhop is ^4Activated^1, recording is ^3NOT SAFE");
        } else {
            client_print(id, print_console, "MpBhop is De-Activated, recording is SAFE");
            client_print_color(id, print_team_red, "^1 * ^4[MpBhop] ^1MpBhop is ^3De-Activated^1, recording is ^4SAFE");
        }
    }
} */

public ClCmd_SafeInform(idlvlcid)
{
    if( 
cmd_access(idlvlcid2) ) {
        new 
szStatus[2];
        
read_argv(1szStatuscharsmax(szStatus));
        
g_bSafeInform = !!str_to_num(szStatus);
    }
    return 
PLUGIN_HANDLED;
}

public 
client_putinserver(id)
{
    if( 
get_user_flags(id) & ADMIN_CFG ) {
        
SetIdBits(g_bAdminid);
    } else {
        
ClearIdBits(g_bAdminid);
    }
    
ClearIdBits(g_bOnGroundid);
    
ClearIdBits(g_bTeleportedid);
}

public 
client_disconnected(id)
{
    
ClearIdBits(g_bAdminid);
    
ClearIdBits(g_bOnGroundid);
    
ClearIdBits(g_bTeleportedid);
}

public 
ClCmd_ShowBlocks(idlevelcid)
{
    if( 
cmd_access(idlevelcid2) ) {
        new 
szStatus[2];
        
read_argv(1szStatuscharsmax(szStatus));
        if( 
szStatus[0] == '1' ) {
            if( !
g_iFhAddToFullPack ) {
                
g_iFhAddToFullPack register_forward(FM_AddToFullPack"AddToFullPack"1);

                if( 
g_bSafeInform ) {
                    
client_print(idprint_console"Recording with this feature Activated is NOT SAFE");
                    
client_print_color(idprint_team_red"^1 * ^4[MpBhop] ^1Recording with this feature ^4Activated ^1is ^3NOT SAFE");
                }
            }
            if( !
task_exists(TASK_GLOW) ) {
                
set_task(0.5"Task_Glow"TASK_GLOW, .flags "b");
            }
        } else {
            if( 
g_iFhAddToFullPack ) {
                
unregister_forward(FM_AddToFullPackg_iFhAddToFullPack1);
                
g_iFhAddToFullPack 0;
            }
            
remove_task(TASK_GLOW);
        }
    }
    return 
PLUGIN_HANDLED;
}

public 
MpBhopMenuAction(idiKey)
{
    new 
iEnt g_iAdminDoor[id];

    switch( 
iKey ) {
        case 
0: {
            if( 
GetEntBits(g_bBlocksiEnt) ) {
                
ClearEntBits(g_bBlocksiEnt);
                
client_print_color(idid"^1 * ^4[MpBhop] ^1Block has been set ^4movable^1.");
            } else {
                
client_print_color(idid"^1 * ^4[MpBhop] ^1Block is already ^4movable^1.");
            }
        }
        case 
1: {
            if( 
GetEntBits(g_bBlocksiEnt) ) {
                
client_print_color(idprint_team_red"^1 * ^4[MpBhop] ^1Block is already ^3unmovable^1.");
            } else {
                
SetEntBits(g_bBlocksiEnt);
                
client_print_color(idprint_team_red"^1 * ^4[MpBhop] ^1Block has been set ^3unmovable^1.");
                if( 
g_bActive ) {
                    
_SetTouch(true);
                }
            }
        }
    }
    return 
PLUGIN_HANDLED;
}

ShowMpBhopMenu(idbIsBlocked)
{
    new 
szMenuBody[150];

    
formatex(szMenuBodycharsmax(szMenuBody), "\rMpBhop Menu^n\dThis block is actually \
        \y%smovable \d:^n^n\r1\w. Mark this block as movable^n\r2\w. Mark this block as \
        unmovable^n^n\r0\w. Exit"
bIsBlocked "un" "");

    
show_menu(idKEYSszMenuBody_"MpBhop Menu");
}

public 
ClCmd_BhopMenu(idlevelcid)
{
    if( 
cmd_access(idlevelcid1) ) {
        new 
iEntcrapiClassType;
        
get_user_aiming(idiEntcrap);
        if( 
iEnt && pev_valid(iEnt) ) {
            new 
szClassName[32];
            
pev(iEntpev_classnameszClassNamecharsmax(szClassName));
            if( 
TrieGetCell(g_iBlocksClassszClassNameiClassType) ) {
                
g_bitPresentClass |= 1<<iClassType;
                
g_iAdminDoor[id] = iEnt;
                
ShowMpBhopMenu(id, !!(GetEntBits(g_bBlocksiEnt)));
            }
        }
    }
    return 
PLUGIN_HANDLED;
}

public 
AddToFullPack(eseiEntidhostflagsplayerpSet)
{
    if( !
player && /* GetIdBits(g_bAdmin, id) && */ GetEntBits(g_bBlocksiEnt) ) {
        if(
g_bGlow) {
            
set_es(esES_RenderModekRenderTransColor);
            
set_es(esES_RenderAmt200);
            
set_es(esES_RenderColor, {120,75,170});
            
set_es(esES_RenderFxkRenderFxPulseFast);
        }
    }
}

public 
CBasePlayer_PreThink(id)
{
    if( !
is_user_alive(id) ) {
        return;
    }

    if( 
GetIdBits(g_bTeleportedid) ) {
        
ClearIdBits(g_bTeleportedid);
        
set_pev(idpev_velocityVEC_NULL);
        return;
    }

    static 
fFlags;
    
fFlags pev(idpev_flags);
    if( 
fFlags FL_ONGROUND ) {
        static 
iEntFloat:flVelocity[3], Float:flVecOrigin[3];
        
iEnt pev(idpev_groundentity);
        if( !
iEnt || !(GetEntBits(g_bBlocksiEnt)) ) {
            if( 
iEnt ) {
                
pev(iEntpev_velocityflVelocity);
                if( 
flVelocity[0] || flVelocity[1] || flVelocity[2] ) {
                    
ClearIdBits(g_bOnGroundid);
                    return;
                }
            }

            if( 
fFlags FL_DUCKING ) {
                
pev(idpev_originflVecOrigin);
                
flVecOrigin[2] += 18.0;
                if( !
trace_hull(flVecOriginHULL_HUMANidIGNORE_MONSTERS) ) {
                    
flVecOrigin[2] -= 18.0;
                    
xs_vec_copy(flVecOriging_flJumpOrigin[id]);
                    
SetIdBits(g_bOnGroundid);
                } else {
                    
ClearIdBits(g_bOnGroundid);
                    return;
                }
            } else {
                
pev(idpev_origing_flJumpOrigin[id]);
                
SetIdBits(g_bOnGroundid);
            }
        } else {
            
ClearIdBits(g_bOnGroundid);
        }
    } else if( 
GetIdBits(g_bOnGroundid) ) {
        
ClearIdBits(g_bOnGroundid);
        
pev(idpev_v_angleg_flJumpAngles[id]);
        
pev(idpev_gravityg_flJumpGravity[id]);
    }
}

public 
TriggerMultiple_Touch(iEntid)
{
    if( (
IsPlayer(id) || g_bBlockEntityTouch) && GetEntBits(g_bBlocksiEnt) ) {
        return 
HAM_SUPERCEDE;
    }
    return 
HAM_IGNORED;
}

public 
Touch_Block(iBlockid)
{
    if( !(
GetEntBits(g_bBlocksiBlock)) ) {
        return 
HAM_IGNORED;
    }

    if( 
IsPlayer(id) ) {
        if( !
is_user_alive(id) ) {
            return 
HAM_SUPERCEDE;
        }
    } else {
        return 
g_bBlockEntityTouch HAM_SUPERCEDE HAM_IGNORED;
    }

    if( 
pev(idpev_groundentity) != iBlock ) {
        return 
HAM_SUPERCEDE;
    }

    if( 
g_iBlock[id] != iBlock ) {
        
g_iBlock[id] = iBlock;
        
g_flFirstTouch[id] = get_gametime();
        return 
HAM_SUPERCEDE;
    }

    static 
Float:flTime;
    
flTime get_gametime();

    
// 0.3 == exploit on cg_cbblebhop oO
    
if( flTime g_flFirstTouch[id] > 0.25 ) {
        if( 
flTime g_flFirstTouch[id] > 0.7 ) {
            
g_flFirstTouch[id] = flTime;
            return 
HAM_SUPERCEDE;
        }

        switch(
get_pcvar_num(g_hCvarActionOnFail)) {
            case 
1: {
                
MoveToEdge(idiBlock);
            }
            case 
2: {
                
Util_TeleportPlayerBack(id);
            }
        }
    }
    return 
HAM_SUPERCEDE;
}

stock MoveToEdge(ident)
{
    new 
Float:dmins[3], Float:dmaxs[3];
    
peventpev_absmindmins );
    
peventpev_absmaxdmaxs );

    new 
Float:tcenter[3];
    
tcenter[0] = (dmins[0] + dmaxs[0]) / 2.0;
    
tcenter[1] = (dmins[1] + dmaxs[1]) / 2.0;
    
tcenter[2] = dmaxs[2];

    new 
Float:tmpvec[3], Float:tmpvec2[3];

    
tmpvec[0] = ( dmaxs[0] + dmins[0] ) / 2;
    
tmpvec[1] = dmaxs[1] + 20;
    
tmpvec[2] = dmaxs[2] + 20;

    
// TODO: cache fpos after first search
    
new Float:fpos[3];

    
trace_lineenttcentertmpvectmpvec2 );
    if( !
trace_hulltmpvecHULL_HUMAN ) && tmpvec2[2] == tmpvec[2] ) {
        
fpos tmpvec;
    } else {
        
tmpvec[1] = dmins[1] - 20;
        
trace_lineenttcentertmpvectmpvec2 );
        if( !
trace_hulltmpvecHULL_HUMAN ) && tmpvec2[2] == tmpvec[2] ) {
            
fpos tmpvec;
        } else {
            
tmpvec[0] = dmaxs[0] + 20;
            
tmpvec[1] = ( dmaxs[1] + dmins[1] ) / 2;
            
trace_lineenttcentertmpvectmpvec2 );
            if( !
trace_hulltmpvecHULL_HUMAN ) && tmpvec2[2] == tmpvec[2] ) {
                
fpos tmpvec;
            } else {
                
tmpvec[0] = dmins[0] - 20;
                
fpos tmpvec;
            }
        }
    }

    
set_pev(idpev_velocity, { 0.00.0, -100.0 });
    
entity_set_origin(idfpos);
}

stock Util_TeleportPlayerBack(id)
{
    
SetIdBits(g_bTeleportedid); // apply null velocity on next PreThink()

    
new flags pev(idpev_flags);
    if( 
flags FL_BASEVELOCITY ) {
        
flags &= ~FL_BASEVELOCITY;
        
set_pev(idpev_basevelocityVEC_NULL);
    }
    
set_pev(idpev_velocityVEC_NULL);

    
set_pev(idpev_flagsflags FL_DUCKING);

    
engfunc(EngFunc_SetSizeidVEC_DUCK_HULL_MINVEC_DUCK_HULL_MAX);
    
engfunc(EngFunc_SetOriginidg_flJumpOrigin[id]);
    
set_pev(idpev_view_ofsVEC_DUCK_VIEW);

    
set_pev(idpev_v_angleg_flJumpAngles[id]);
    
set_pev(idpev_anglesg_flJumpAngles[id]);
    
set_pev(idpev_punchangleVEC_NULL);
    
set_pev(idpev_fixangle1);

    
set_pev(idpev_gravityg_flJumpGravity[id]);

    
set_pev(idpev_fuser20.0);
}

public 
ConCmd_MpBhop(idlvlcid)
{
    if( 
cmd_access(idlvlcid2) ) {
        new 
szStatus[2];
        
read_argv(1szStatuscharsmax(szStatus));
        static 
HamHook:iHhPlayerPreThink;
        switch( 
szStatus[0] ) {
            case 
'0': {
                if( !
g_bActive ) {
                    return 
PLUGIN_HANDLED;
                }
                if( 
iHhPlayerPreThink ) {
                    
DisableHamForwardiHhPlayerPreThink );
                }
                
_SetTouchfalse );
                
g_bActive false;

                if( 
g_bSafeInform ) {
                    
client_print(0print_console"MpBhop has been De-Activated, recording is now SAFE");
                    
client_print_color(0print_team_red"^1 * ^4[MpBhop] ^1MpBhop has been ^3De-Activated^1, recording is now ^4SAFE");
                }
            }
            case 
'1': {
                if( 
g_bActive ) {
                    return 
PLUGIN_HANDLED;
                }
                if( !
iHhPlayerPreThink ) {
                    
RegisterHam(Ham_Player_PreThink"player""CBasePlayer_PreThink");
                } else {
                    
EnableHamForwardiHhPlayerPreThink );
                }
                
_SetTouchtrue );
                
g_bActive true;
                if( 
g_bSafeInform ) {
                    
client_print(0print_console"MpBhop has been Activated, recording is now NOT SAFE");
                    
client_print_color(0print_team_red"^1 * ^4[MpBhop] ^1MpBhop has been ^4Activated^1, recording is now ^3NOT SAFE");
                }
            }
            default: {
                
client_print(idprint_console"Usage: kz_mpbhop <0/1>");
            }
        }
    }
    return 
PLUGIN_HANDLED;
}

public 
ConCmd_EntityTouch(idlvlcid)
{
    if( 
cmd_access(idlvlcid2) ) {
        new 
szStatus[2];
        
read_argv(1szStatuscharsmax(szStatus));
        
g_bBlockEntityTouch = !!str_to_num(szStatus);
    }
    return 
PLUGIN_HANDLED;
}

Set_Doors()
{
    new 
iDoor FM_NULLENTi;
    new 
Float:flMovedir[3], szNoise[32], Float:flSize[3], Float:flDmgFloat:flSpeed;
    new const 
szNull[] = "common/null.wav";
    new 
szTargetName[64];

    while( (
iDoor find_ent_by_classiDoor"func_door")) ) {
        
// definitly not a bhop block
        
pev(iDoorpev_dmgflDmg);
        if( 
flDmg ) {
#if defined MAKE_DOORS_SILENT
            
set_pev(iDoorpev_noise1szNull); // while here, set healing doors silent xD
            
set_pev(iDoorpev_noise2szNull);
            
set_pev(iDoorpev_noise3szNull);
#endif
            
continue;
        }

        
// this func_door goes UP, not a bhop block ?
        // or bhop block but let them move up (kz_megabhop for example)
        
pev(iDoorpev_movedirflMovedir);
        if( 
flMovedir[2] > 0.0 ) {
            continue;
        }

        
// too small : real door ? could this one be skipped ?
        
pev(iDoorpev_sizeflSize);
        if( ( 
flSize[0] < 24.0 && flSize[1] > 50.0 ) || ( flSize[1] < 24.0 && flSize[0] > 50.0 ) ) {
            continue;
        }

        
// real door ? not all doors make sound though...
        
pev(iDoorpev_noise1szNoisecharsmax(szNoise));
        if( 
szNoise[0] && !equal(szNoiseszNull) ) {
            continue;
        }
        
pev(iDoorpev_noise2szNoisecharsmax(szNoise));
        if( 
szNoise[0] && !equal(szNoiseszNull) ) {
            continue;
        }

        
// not a bhop block ? too slow // this at least detects the big ent on kzsca_sewerbhop
        
pev(iDoorpev_speedflSpeed);
        if( 
flSpeed 80.0 ) {
            continue;
        }

        
// FIX for deathrun traps have target in button
        
pev(iDoorpev_targetnameszTargetNamecharsmax(szTargetName));
        if(
Check_Button(szTargetName)) {
            continue;
        }

        
// FIX for deathrun traps have target in multi_manager
        
if(Check_MultiManager(szTargetName)) {
            continue;
        }
        
// set_pev(iDoor, pev_speed, 0.0);
        // Pray for this to be a bhop block
        
SetEntBits(g_bBlocksByPluginiDoor);
        
SetEntBits(g_bBlocksiDoor);
        
g_bitPresentClass |= 1<<FUNC_DOOR;
        
i++;
    }
    return 
i;
}

Set_Wall_Toggle()
{
    new 
iEnt FM_NULLENTi;
    new 
szTargetName[64];

    while( (
iEnt find_ent_by_class(iEnt,"func_wall_toggle")) ) {
        
// FIX for deathrun traps have targetname
        
pev(iEntpev_targetnameszTargetNamecharsmax(szTargetName));
        if(
Check_Button(szTargetName)) {
            continue;
        }

        
// FIX for deathrun traps have target in multi_manager
        
if(Check_MultiManager(szTargetName)) {
            continue;
        }

        
g_bitPresentClass |= 1<<FUNC_WALL_TOGGLE;
        
SetEntBits(g_bBlocksByPluginiEnt);
        
SetEntBits(g_bBlocksiEnt);
        
i++;
    }
    return 
i;
}

Set_Buttons()
{
    new const 
szStartStopButtons[][] = {
        
"counter_start""clockstartbutton""firsttimerelay""gogogo""multi_start","counter_start_button""startcounter"
        
"counter_off""clockstop""clockstopbutton""multi_stop""stop_counter""stopcounter" };

    new 
Trie:tButtons TrieCreate();

    for(new 
ii<sizeof(szStartStopButtons); i++) {
        
TrieSetCell(tButtonsszStartStopButtons[i], 1);
    }

    new 
iEnt FM_NULLENTiszTarget[32], spawnflags;
    while( (
iEnt find_ent_by_class(iEnt,"func_button")) ) {
        
spawnflags pev(iEntpev_spawnflags);
        if( 
spawnflags & (SF_BUTTON_DONTMOVE|SF_BUTTON_TOGGLE|SF_BUTTON_TOUCH_ONLY) == SF_BUTTON_TOUCH_ONLY ) {
            
pev(iEntpev_targetszTargetcharsmax(szTarget));
            if( !
szTarget[0] || !TrieKeyExists(tButtonsszTarget)) {
                
pev(iEntpev_targetnameszTargetcharsmax(szTarget));
                if( !
szTarget[0] || !TrieKeyExists(tButtonsszTarget)) {
                    
g_bitPresentClass |= 1<<FUNC_BUTTON;
                    
SetEntBits(g_bBlocksByPluginiEnt);
                    
SetEntBits(g_bBlocksiEnt);
                    
i++;
                }
            }
        }
#if defined MAKE_DOORS_SILENT
        
if( spawnflags SF_BUTTON_SPARK_IF_OFF ) {
            
set_pev(iEntpev_spawnflagsspawnflags & ~SF_BUTTON_SPARK_IF_OFF);
        }
#endif
    
}
    
TrieDestroy(tButtons);
    return 
i;
}

_SetTouch(bool:bActive)
{
    static 
HamHook:iHhBlockTouch[BlocksClasses];
    if( 
bActive ) {
        static const 
szClassesAndHandlers[BlocksClasses][][] = {
            {
"func_door""Touch_Block"},
            {
"func_wall_toggle""Touch_Block"},
            {
"func_button""Touch_Block"},
            {
"trigger_multiple""TriggerMultiple_Touch"}
        };

        for(new 
ii<sizeof(iHhBlockTouch); i++) {
            if( 
g_bitPresentClass & (1<<i) ) {
                if( 
iHhBlockTouch[i] ) {
                    
EnableHamForwardiHhBlockTouch[i] );
                } else {
                    
iHhBlockTouch[i] = RegisterHam(Ham_TouchszClassesAndHandlers[i][0], szClassesAndHandlers[i][1]);
                }
            }
        }
    } else {
        for(new 
ii<sizeof(iHhBlockTouch); i++) {
            if( 
g_bitPresentClass & (1<<i) && iHhBlockTouch[i] ) {
                
DisableHamForwardiHhBlockTouch[i] );
            }
        }
    }
}

SetBlocksByFile()
{
    
get_localinfo("amxx_datadir"szConfigFilecharsmax(szConfigFile));
    
format(szConfigFilecharsmax(szConfigFile), "%s/mpbhop"szConfigFile);
    if( !
dir_exists(szConfigFile) ) {
        
mkdir(szConfigFile);
    }

    new 
szMapName[32];
    
get_mapname(szMapNamecharsmax(szMapName));
    
format(szConfigFilecharsmax(szConfigFile), "%s/%s.dat"szConfigFileszMapName);

    new 
iFile fopen(szConfigFile"rt"), i;
    if( 
iFile ) {
        new 
szDatas[48], szBrushOrigin[3][13], szType[2], Float:flBrushOrigin[3], iiEnt;
        new 
szClassName[32], iClassType;
        while( !
feof(iFile) ) {
            
fgets(iFileszDatascharsmax(szDatas));
            
trim(szDatas);
            if(!
szDatas[0] || szDatas[0] == ';' || szDatas[0] == '#' || (szDatas[0] == '/' && szDatas[1] == '/')) {
                continue;
            }

            
parse(szDatasszBrushOrigin[0], 12szBrushOrigin[1], 12szBrushOrigin[2], 12szTypecharsmax(szType));
            for(
i=0i<3i++) {
                
flBrushOrigin[i] = str_to_floatszBrushOrigin[i] );
            }

            
iEnt FindEntByBrushOriginflBrushOrigin );
            if( 
iEnt ) {
                if( 
szType[0] == '1' ) {
                    
pev(iEntpev_classnameszClassNamecharsmax(szClassName));
                    if( 
TrieGetCell(g_iBlocksClassszClassNameiClassType) ) {
                        
g_bitPresentClass |= 1<<iClassType;
                    }
                    if( ~
GetEntBits(g_bBlocksiEnt) ) {
                        
i++;
                    }
                    
SetEntBits(g_bBlocksiEnt);
                } else {
                    if( 
GetEntBits(g_bBlocksiEnt) ) {
                        
i--;
                    }
                    
ClearEntBits(g_bBlocksiEnt);
                }
            }
        }
        
fclose(iFile);
    }
    return 
i;
}

FindEntByBrushOrigin(Float:flOrigin[3])
{
    new 
Float:flBrushOrigin[3];
    for( new 
iEnt=g_iMaxPlayers+1iEnt<=g_iMaxEntsiEnt++ ) {
        if( 
pev_valid(iEnt) ) {
            
fm_get_brush_entity_origin(iEntflBrushOrigin);
            if( 
xs_vec_nearlyequal(flBrushOriginflOrigin) ) {
                return 
iEnt;
            }
        }
    }
    return 
0;
}

fm_get_brush_entity_origin(entFloat:orig[3])
{
    new 
Float:Min[3], Float:Max[3];

    
pev(entpev_originorig);
    
pev(entpev_minsMin);
    
pev(entpev_maxsMax);

    
orig[0] += (Min[0] + Max[0]) * 0.5;
    
orig[1] += (Min[1] + Max[1]) * 0.5;
    
orig[2] += (Min[2] + Max[2]) * 0.5;

    return 
1;
}

SetTriggerMultiple()
{
    new 
iEnt FM_NULLENTszTarget[32], iBlock;
    while( (
iEnt find_ent_by_class(iEnt,"trigger_multiple")) ) {
        
pev(iEntpev_targetszTargetcharsmax(szTarget));
        
iBlock find_ent_by_tname(FM_NULLENTszTarget);
        if( 
iBlock && GetEntBits(g_bBlocksiBlock) ) {
            
g_bitPresentClass |= 1<<TRIGGER_MULTIPLE;
            
SetEntBits(g_bBlocksByPluginiEnt);
            
SetEntBits(g_bBlocksiEnt);
        }
    }
}

Check_Button(targetname[])
{
    new 
ent find_ent_by_target(-1targetname);
    if( 
ent ) {
        new 
tmpstr[64];
        
pev(entpev_classnametmpstrcharsmax(tmpstr));
        if( 
equal(tmpstr"func_button") )
            return 
true;
    }
    return 
false;
}

Check_MultiManager(targetname[])
{
    new 
val;
    if(
TrieGetCell(g_tKeyValuestargetnameval)) {
        return 
true;
    }
    return 
false;
}

public 
plugin_end()
{
    
TrieDestroy(g_iBlocksClass);
    
delete_file(szConfigFile);

    new 
iFile;

    new 
Float:flBrushOrigin[3], bool:bUnMovable;
    for(new 
iEnt=g_iMaxPlayers+1iEnt<=g_iMaxEntsiEnt++) {
        if( 
pev_valid(iEnt) ) {
            
bUnMovable = !!( GetEntBits(g_bBlocksiEnt) );
            if( 
bUnMovable != !!( GetEntBits(g_bBlocksByPluginiEnt) ) ) {
                if( !
iFile ) {
                    
iFile fopen(szConfigFile"wt");
                }
                
fm_get_brush_entity_origin(iEntflBrushOrigin);
                
fprintf(iFile"%f %f %f %d^n",
                
flBrushOrigin[0], flBrushOrigin[1], flBrushOrigin[2], bUnMovable);
            }
        }
    }
    if( 
iFile ) {
        
fcloseiFile );
    }

Mistrick is offline
Old 07-01-2022, 00:40
analepic
This message has been deleted by analepic.
Mistrick
Senior Member
Join Date: Aug 2012
Location: Russia
Old 07-01-2022 , 00:44   Re: [KreedZ] MultiPlayer Bhop 1.1.2 ( 23 may 2013 )
Reply With Quote #275

Quote:
Originally Posted by analepic View Post
Could u remove the block color ? and just leave it as it is without chaning the color, leave it as its default texture ?
Comment 116 line.
PHP Code:
// register_clcmd("fullupdate", "ClCmd_FullUpdate");

g_iFhAddToFullPack register_forward(FM_AddToFullPack"AddToFullPack"1); // <<<--- this

register_menucmd(register_menuid("MpBhop Menu"), KEYS ,"MpBhopMenuAction"); 
Mistrick is offline
analepic
Junior Member
Join Date: Apr 2022
Old 07-01-2022 , 00:49   Re: [KreedZ] MultiPlayer Bhop 1.1.2 ( 23 may 2013 )
Reply With Quote #276

Quote:
Originally Posted by Mistrick View Post
Comment 116 line.
PHP Code:
// register_clcmd("fullupdate", "ClCmd_FullUpdate");

g_iFhAddToFullPack register_forward(FM_AddToFullPack"AddToFullPack"1); // <<<--- this

register_menucmd(register_menuid("MpBhop Menu"), KEYS ,"MpBhopMenuAction"); 
Oh didnt think you would answer that fast. I already fixed it but thank you for your help.
analepic is offline
Reply



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 13:59.


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