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

Problema con Touch del MPBhop


  
 
 
Thread Tools Display Modes
Author Message
gladius
Veteran Member
Join Date: Jul 2008
Location: Santiago, Chile
Old 07-31-2011 , 00:15   Problema con Touch del MPBhop
#1

Hola a todos,

Estoy modificando un poco el MPBhop de ConnorMcleod y bueno le agregué que cada vez que lo toquen el bloque, este se hace invisible. Para terminar el error es que cuando el player sobrepasa el tiempo que puede tocar el bloque, este se teletransporta al punto de origin guardado(default del plugin), pero yo quiero hacer es que lo haga no sólido y el player caiga, haciendo que se devuelva al punto inicial del bhop. Pero eso no está funcionando; el player puede quedarse en el bhop sin límite de tiempo o el player traspasa el bloque sin poder saltar en él en el tiempo que se puede.

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.
*/

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

#define VERSION "1.0.3"

#pragma semicolon 1

#define MAKE_DOORS_SILENT
//#define MAKE_TELEPORT_FX

#define MAX_PLAYERS    32
#define MAX_ENTSARRAYS_SIZE 64

#define SF_BUTTON_TOUCH_ONLY    256

#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) 

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

enum _:Colors {
    
DONT_CHANGE,
    
TERRORIST,
    
CT,
    
SPECTATOR
}

new 
g_bitPresentClass;

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

const 
FL_ONGROUND2 = (FL_ONGROUND FL_PARTIALGROUND FL_INWATER FL_CONVEYOR FL_FLOAT);

new 
g_iBlock[MAX_PLAYERS+1];
new 
Float:g_flFirstTouch[MAX_PLAYERS+1];

new 
Float:g_flJumpOrigin[MAX_PLAYERS+1][3];
new 
Float:g_flJumpAnglesGravity[MAX_PLAYERS+1][3];

new 
g_bBlocks[MAX_ENTSARRAYS_SIZE], g_bBlocksByPlugin[MAX_ENTSARRAYS_SIZE];
new 
g_bAlivesg_bOnGround/*g_bTeleported,*/ g_bAdmin;

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

new 
g_iFhAddToFullPack;
new 
g_iAdminDoor[MAX_PLAYERS+1];
new 
szConfigFile[64];

new 
Trie:g_iBlocksClass;

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

new toucherid;
new 
g_bInvisible[MAX_ENTSARRAYS_SIZE], g_bSolid[MAX_ENTSARRAYS_SIZE];

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_event("Health""Event_Health""b");
    
register_event("ResetHUD""Event_ResetHUD""b");
    
    
register_forward(FM_AddToFullPack"AddToFullPack"1);
    
    
register_concmd("kz_mpbhop""ConsoleCommand_MpBhop"ADMIN_CFG"<0/1>");
    
register_concmd("kz_mpbhop_entitytouch""ConsoleCommand_EntityTouch"ADMIN_CFG"<0/1>");
    
register_concmd("kz_safe_inform""ConsoleCommand_SafeInform"ADMIN_CFG"<0/1>");
    
    
register_clcmd("kz_mpbhopmenu""ClientCommand_BhopMenu"ADMIN_CFG);
    
register_clcmd("kz_showblocks""ClientCommand_ShowBlocks"ADMIN_CFG);
    
    
    
register_clcmd("fullupdate""ClientCommand_FullUpdate");
    
    
register_menucmd(register_menuid("MpBhop Menu"), KEYS ,"MpBhopMenuAction");
    
    
g_iMaxPlayers get_maxplayers();
    
g_iMaxEnts global_get(glb_maxEntities);
    
    
Set_Doors();
    
Set_Wall_Toggle();
    
Set_Buttons();
    
    
SetBlocksByFile();
    
    
SetTriggerMultiple();
}

public 
ClientCommand_FullUpdateid )
{
    if( 
g_bSafeInform )
    {
        if( 
g_bActive )
        {
            
client_print(idprint_console"MpBhop is Activated, recording is NOT SAFE");
            
ColorChat(idTERRORIST"^1 * ^4[MpBhop] ^1MpBhop is ^4Activated^1, recording is ^3NOT SAFE");
        }
        else
        {
            
client_print(idprint_console"MpBhop is De-Activated, recording is SAFE");
            
ColorChat(idTERRORIST"^1 * ^4[MpBhop] ^1MpBhop is ^3De-Activated^1, recording is ^4SAFE");
        }
    }
}

public 
ConsoleCommand_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_bAlivesid);
    
ClearIdBits(g_bOnGroundid);
    
//ClearIdBits(g_bTeleported, id);
}

public 
client_disconnect(id)
{
    
ClearIdBits(g_bAdminid);
    
ClearIdBits(g_bAlivesid);
    
ClearIdBits(g_bOnGroundid);
    
//ClearIdBits(g_bTeleported, id);
}

public 
ClientCommand_ShowBlocks(idlevelcid)
{
    if( 
cmd_access(idlevelcid2) )
    {
        new 
szStatus[2];
        
read_argv(1szStatuscharsmax(szStatus));
        if( 
szStatus[0] == '1' )
        {
            if( !
g_iFhAddToFullPack )
            {
                
g_iFhAddToFullPack 1;
                
client_print(idprint_console"Recording with this feature Activated is NOT SAFE");
                
ColorChat(idTERRORIST"^1 * ^4[MpBhop] ^1Recording with this feature ^4Activated ^1is ^3NOT SAFE");
            }
        }
        else
        {
            if( 
g_iFhAddToFullPack )
            {
                
g_iFhAddToFullPack 0;
            }
        }
    }
    return 
PLUGIN_HANDLED;
}

public 
MpBhopMenuAction(idiKey)
{
    new 
iEnt g_iAdminDoor[id];
    
    switch( 
iKey )
    {
        case 
0:
        {
            if( 
GetEntBits(g_bBlocksiEnt) )
            {
                
ClearEntBits(g_bBlocksiEnt);
                
ColorChat(id_"^1 * ^4[MpBhop] ^1Block has been set ^4movable^1.");
            }
            else
            {
                
ColorChat(id_"^1 * ^4[MpBhop] ^1Block is already ^4movable^1.");
            }
        }
        case 
1:
        {
            if( 
GetEntBits(g_bBlocksiEnt) )
            {
                
ColorChat(idTERRORIST"^1 * ^4[MpBhop] ^1Block is already ^3unmovable^1.");
            }
            else
            {
                
SetEntBits(g_bBlocksiEnt);
                
ColorChat(idTERRORIST"^1 * ^4[MpBhop] ^1Block has been set ^3unmovable^1.");
            }
        }
    }
    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 
ClientCommand_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)
    {
        if(
IsPlayer(id) && is_user_alive(id) && id == toucherid && pev_valid(iEnt) && iEnt == g_iBlock[id])
        {
            if(
GetEntBits(g_bInvisibleiEnt))
            {            
                
set_es(esES_RenderModekRenderTransColor);
                
set_es(esES_RenderAmt80);
                
set_es(esES_RenderColor, {200,200,200});
                
set_es(esES_RenderFxkRenderFxGlowShell);
            }
            
            if(
GetEntBits(g_bSolidiEnt))
            {
                
//set_es(es, ES_Solid, SOLID_NOT);
                
entity_set_intiEntEV_INT_solidSOLID_NOT);
            }
            
            else
            {
                
//set_es(es, ES_Solid, SOLID_SLIDEBOX);
                
entity_set_intiEntEV_INT_solidSOLID_SLIDEBOX );
            }
        }
        
        if(
GetIdBits(g_bAdminid) && GetEntBits(g_bBlocksiEnt) && g_iFhAddToFullPack)
        {
            
set_es(esES_RenderModekRenderTransColor);
            
set_es(esES_RenderAmt150);
            
set_es(esES_RenderColor, {120,75,170});
            
set_es(esES_RenderFxkRenderFxGlowShell);
        }
    }
}

public 
Event_Health(id)
{
    if( 
is_user_alive(id) )
    {
        
SetIdBits(g_bAlivesid);
    }
    else
    {
        
ClearIdBits(g_bAlivesid);
    }
}

public 
Event_ResetHUD(id)
{
    if( 
is_user_alive(id) )
    {
        
SetIdBits(g_bAlivesid);
    }
    else
    {
        
ClearIdBits(g_bAlivesid);
    }
}

public 
CBasePlayer_PreThink(id)
{
    if( 
GetIdBits(g_bAlivesid) )
    {
        
/*if( GetIdBits(g_bTeleported, id) )
        {
            ClearIdBits(g_bTeleported, id);
            set_pev(id, pev_velocity, 0);
            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;
                    
engfunc(EngFunc_TraceHullflVecOriginflVecOriginIGNORE_MONSTERSHULL_HUMANid0);
                    if( !
get_tr2(0TR_StartSolid) && !get_tr2(0TR_AllSolid) && get_tr2(0TR_InOpen) )
                    {
                        
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_flJumpAnglesGravity[id]);
            
pev(idpev_gravityg_flJumpAnglesGravity[id][2]);
        }
    }
}

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( ~
GetIdBits(g_bAlivesid) )
        {
            return 
HAM_SUPERCEDE;
        }
    }
    else
    {
        return 
g_bBlockEntityTouch HAM_SUPERCEDE HAM_IGNORED;
    }
    
    if( 
pev(idpev_groundentity) != iBlock )
    {
        return 
HAM_SUPERCEDE;
    }
    
    
ClearEntBits(g_bSolidg_iBlock[id]);
    
    if( 
g_iBlock[id] != iBlock )
    {
        
g_iBlock[id] = iBlock;
        
        
g_flFirstTouch[id] = get_gametime();
        return 
HAM_SUPERCEDE;
    }
    
    
set_task(0.7"remove_rende"iBlock);
    
SetEntBits(g_bInvisibleiBlock);
    
    
toucherid id;
    
    static 
Float:flTime;
    
flTime get_gametime();
    
    if( 
flTime g_flFirstTouch[id] > 0.25 // 0.3 == exploit on cg_cbblebhop oO
    
{    
        
SetEntBits(g_bSolidiBlock);
        
set_task(0.45"set_solid"iBlock);
        
        if( 
flTime g_flFirstTouch[id] > 0.7 )
        {
            
g_flFirstTouch[id] = flTime;
            return 
HAM_SUPERCEDE;
        }
        
        
#if defined MAKE_TELEPORT_FX
        
new iOrigin[3];
        
get_user_origin(idiOrigin);
        
message_begin(MSG_PVSSVC_TEMPENTITYiOrigin);
        
write_byte(TE_TELEPORT);
        
write_coord(iOrigin[0]);
        
write_coord(iOrigin[1]);
        
write_coord(iOrigin[2]);
        
message_end();
        
#endif
        
        /*static const Float:VEC_DUCK_HULL_MIN[3]    = {-16.0, -16.0, -18.0 };
        static const Float:VEC_DUCK_HULL_MAX[3]    = { 16.0,  16.0,  32.0 };
        static const Float:VEC_DUCK_VIEW[3] = { 0.0, 0.0, 12.0 };
        
        set_pev(id, pev_flags, pev(id, pev_flags) | FL_DUCKING);
        engfunc(EngFunc_SetSize, id, VEC_DUCK_HULL_MIN, VEC_DUCK_HULL_MAX);
        engfunc(EngFunc_SetOrigin, id, g_flJumpOrigin[id]);
        set_pev(id, pev_view_ofs, VEC_DUCK_VIEW);
        
        set_pev(id, pev_v_angle, 0);
        set_pev(id, pev_velocity, 0);
        set_pev(id, pev_angles, g_flJumpAnglesGravity[id]);
        set_pev(id, pev_punchangle, 0);
        set_pev(id, pev_fixangle, 1);
        set_pev(id, pev_gravity, g_flJumpAnglesGravity[id][2]);
        
        SetIdBits(g_bTeleported, id);*/
    
}
    return 
HAM_SUPERCEDE;
}

public 
remove_rende(ent)
{
    
set_rendering(ent);
    
ClearEntBits(g_bInvisibleent);
}

public 
set_solid(ent)
{
    
ClearEntBits(g_bSolident);
}

public 
ConsoleCommand_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");
                    
ColorChat(0TERRORIST"^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");
                    
ColorChat(0TERRORIST"^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 
ConsoleCommand_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_NULLENT;
    new 
Float:flMovedir[3], szNoise[32], Float:flSize[3], Float:flDmgFloat:flSpeed;
    new const 
szNull[] = "common/null.wav";
    while( (
iDoor engfunc(EngFunc_FindEntityByStringiDoor"classname""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] < 24.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 100.0 )
        {
            continue;
        }
        
        
// Pray for this to be a bhop block
        
SetEntBits(g_bBlocksByPluginiDoor);
        
SetEntBits(g_bBlocksiDoor);
        
g_bitPresentClass |= 1<<FUNC_DOOR;
    }
}

Set_Wall_Toggle() {
    new 
iEnt FM_NULLENT;
    while( (
iEnt engfunc(EngFunc_FindEntityByStringiEnt"classname""func_wall_toggle")) )
    {
        
g_bitPresentClass |= 1<<FUNC_WALL_TOGGLE;
        
SetEntBits(g_bBlocksByPluginiEnt);
        
SetEntBits(g_bBlocksiEnt);
    }
}

Set_Buttons() {
    new const 
szStartStopButtons[][] = {"counter_start""clockstartbutton""firsttimerelay""multi_start"
    
"counter_start_button""counter_off""clockstop""clockstopbutton""multi_stop""stop_counter" };
    
    new 
Trie:tButtons TrieCreate();
    
    for(new 
ii<sizeof(szStartStopButtons); i++)
    {
        
TrieSetCell(tButtonsszStartStopButtons[i], 1);
    }
    
    new 
iEnt FM_NULLENTszTarget[32];
    while( (
iEnt engfunc(EngFunc_FindEntityByStringiEnt"classname""func_button")) )
    {
        if( 
pev(iEntpev_spawnflags) & 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);
                }
            }
        }
    }
    
TrieDestroy(tButtons);
}

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");
    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;
                    }
                    
SetEntBits(g_bBlocksiEnt);
                }
                else
                {
                    
ClearEntBits(g_bBlocksiEnt);
                }
            }
        }
        
fclose(iFile);
    }
}

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 engfunc(EngFunc_FindEntityByStringiEnt"classname""trigger_multiple")) )
    {
        
pev(iEntpev_targetszTargetcharsmax(szTarget));
        
iBlock engfunc(EngFunc_FindEntityByString, -1"targetname"szTarget);
        if( 
iBlock && GetEntBits(g_bBlocksiBlock) )
        {
            
g_bitPresentClass |= 1<<TRIGGER_MULTIPLE;
            
SetEntBits(g_bBlocksByPluginiEnt);
            
SetEntBits(g_bBlocksiEnt);
        }
    }
}

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 );
    }
}

ColorChat(idCOLOR=DONT_CHANGEfmt[], any:...) {
    new 
szMsg[192];
    
szMsg[0] = 0x04;
    
vformat(szMsg[1], charsmax(szMsg)-1fmt4);
    
    new 
szTeam[11], MSG_DEST id MSG_ONE MSG_ALL;
    
    static const 
szTeamNames[Colors][] = {"""TERRORIST""CT""SPECTATOR"};
    
    if( 
COLOR )
    {
        
Send_TeamInfo(idszTeamNames[COLOR], MSG_DEST);
    }
    
    static 
iSayText;
    
    if( 
iSayText || (iSayText get_user_msgid("SayText")) )
    {
        
message_begin(MSG_DESTiSayText_id); 
        {
            
write_byte(id id g_iMaxPlayers);
            
write_string(szMsg);
        }
        
message_end();
    }
    
    if( 
COLOR )
    {
        if( 
id || is_user_connected(g_iMaxPlayers) )
        {
            
get_user_team(id id g_iMaxPlayersszTeamcharsmax(szTeam));
            
Send_TeamInfo(idszTeamMSG_DEST);
        }
        else
        {
            
Send_TeamInfo(0"UNASSIGNED"MSG_DEST);
        }
    }
}

Send_TeamInfo(const id, const szTeam[], MSG_DEST) {
    static 
iTeamInfo;
    if( 
iTeamInfo || (iTeamInfo get_user_msgid("TeamInfo")) )
    {
        
message_begin(MSG_DESTiTeamInfo_id);
        {
            
write_byte(id id g_iMaxPlayers);
            
write_string(szTeam);
        }
        
message_end();
    }

Gracias, y por favor respondan los que saben

Saludos.
__________________
Proyects
Kreedz Chile Mod [100%] (Fixing some details).

gladius is offline
Send a message via MSN to gladius Send a message via Skype™ to gladius
 



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 07:58.


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