Veteran Member
Join Date: Jul 2008
Location: Santiago, Chile
|
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_bAlives, g_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_iMaxPlayers, g_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", VERSION, FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY);
set_pcvar_string(pCvar, VERSION);
new const szPossibleBlockClass[][] = {"func_door", "func_wall_toggle", "func_button", "trigger_multiple"};
g_iBlocksClass = TrieCreate();
for(new i; i<sizeof(szPossibleBlockClass); i++)
{
TrieSetCell(g_iBlocksClass, szPossibleBlockClass[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_FullUpdate( id )
{
if( g_bSafeInform )
{
if( g_bActive )
{
client_print(id, print_console, "MpBhop is Activated, recording is NOT SAFE");
ColorChat(id, TERRORIST, "^1 * ^4[MpBhop] ^1MpBhop is ^4Activated^1, recording is ^3NOT SAFE");
}
else
{
client_print(id, print_console, "MpBhop is De-Activated, recording is SAFE");
ColorChat(id, TERRORIST, "^1 * ^4[MpBhop] ^1MpBhop is ^3De-Activated^1, recording is ^4SAFE");
}
}
}
public ConsoleCommand_SafeInform(id, lvl, cid)
{
if( cmd_access(id, lvl, cid, 2) )
{
new szStatus[2];
read_argv(1, szStatus, charsmax(szStatus));
g_bSafeInform = !!str_to_num(szStatus);
}
return PLUGIN_HANDLED;
}
public client_putinserver(id)
{
if( get_user_flags(id) & ADMIN_CFG )
{
SetIdBits(g_bAdmin, id);
}
else
{
ClearIdBits(g_bAdmin, id);
}
ClearIdBits(g_bAlives, id);
ClearIdBits(g_bOnGround, id);
//ClearIdBits(g_bTeleported, id);
}
public client_disconnect(id)
{
ClearIdBits(g_bAdmin, id);
ClearIdBits(g_bAlives, id);
ClearIdBits(g_bOnGround, id);
//ClearIdBits(g_bTeleported, id);
}
public ClientCommand_ShowBlocks(id, level, cid)
{
if( cmd_access(id, level, cid, 2) )
{
new szStatus[2];
read_argv(1, szStatus, charsmax(szStatus));
if( szStatus[0] == '1' )
{
if( !g_iFhAddToFullPack )
{
g_iFhAddToFullPack = 1;
client_print(id, print_console, "Recording with this feature Activated is NOT SAFE");
ColorChat(id, TERRORIST, "^1 * ^4[MpBhop] ^1Recording with this feature ^4Activated ^1is ^3NOT SAFE");
}
}
else
{
if( g_iFhAddToFullPack )
{
g_iFhAddToFullPack = 0;
}
}
}
return PLUGIN_HANDLED;
}
public MpBhopMenuAction(id, iKey)
{
new iEnt = g_iAdminDoor[id];
switch( iKey )
{
case 0:
{
if( GetEntBits(g_bBlocks, iEnt) )
{
ClearEntBits(g_bBlocks, iEnt);
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_bBlocks, iEnt) )
{
ColorChat(id, TERRORIST, "^1 * ^4[MpBhop] ^1Block is already ^3unmovable^1.");
}
else
{
SetEntBits(g_bBlocks, iEnt);
ColorChat(id, TERRORIST, "^1 * ^4[MpBhop] ^1Block has been set ^3unmovable^1.");
}
}
}
return PLUGIN_HANDLED;
}
ShowMpBhopMenu(id, bIsBlocked) {
new szMenuBody[150];
formatex(szMenuBody, charsmax(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(id, KEYS, szMenuBody, _, "MpBhop Menu");
}
public ClientCommand_BhopMenu(id, level, cid)
{
if( cmd_access(id, level, cid, 1) )
{
new iEnt, crap, iClassType;
get_user_aiming(id, iEnt, crap);
if( iEnt && pev_valid(iEnt) )
{
new szClassName[32];
pev(iEnt, pev_classname, szClassName, charsmax(szClassName));
if( TrieGetCell(g_iBlocksClass, szClassName, iClassType) )
{
g_bitPresentClass |= 1<<iClassType;
g_iAdminDoor[id] = iEnt;
ShowMpBhopMenu(id, !!(GetEntBits(g_bBlocks, iEnt)));
}
}
}
return PLUGIN_HANDLED;
}
public AddToFullPack(es, e, iEnt, id, hostflags, player, pSet)
{
if(!player)
{
if(IsPlayer(id) && is_user_alive(id) && id == toucherid && pev_valid(iEnt) && iEnt == g_iBlock[id])
{
if(GetEntBits(g_bInvisible, iEnt))
{
set_es(es, ES_RenderMode, kRenderTransColor);
set_es(es, ES_RenderAmt, 80);
set_es(es, ES_RenderColor, {200,200,200});
set_es(es, ES_RenderFx, kRenderFxGlowShell);
}
if(GetEntBits(g_bSolid, iEnt))
{
//set_es(es, ES_Solid, SOLID_NOT);
entity_set_int( iEnt, EV_INT_solid, SOLID_NOT);
}
else
{
//set_es(es, ES_Solid, SOLID_SLIDEBOX);
entity_set_int( iEnt, EV_INT_solid, SOLID_SLIDEBOX );
}
}
if(GetIdBits(g_bAdmin, id) && GetEntBits(g_bBlocks, iEnt) && g_iFhAddToFullPack)
{
set_es(es, ES_RenderMode, kRenderTransColor);
set_es(es, ES_RenderAmt, 150);
set_es(es, ES_RenderColor, {120,75,170});
set_es(es, ES_RenderFx, kRenderFxGlowShell);
}
}
}
public Event_Health(id)
{
if( is_user_alive(id) )
{
SetIdBits(g_bAlives, id);
}
else
{
ClearIdBits(g_bAlives, id);
}
}
public Event_ResetHUD(id)
{
if( is_user_alive(id) )
{
SetIdBits(g_bAlives, id);
}
else
{
ClearIdBits(g_bAlives, id);
}
}
public CBasePlayer_PreThink(id)
{
if( GetIdBits(g_bAlives, id) )
{
/*if( GetIdBits(g_bTeleported, id) )
{
ClearIdBits(g_bTeleported, id);
set_pev(id, pev_velocity, 0);
return;
}*/
static fFlags;
fFlags = pev(id, pev_flags);
if( fFlags & FL_ONGROUND )
{
static iEnt, Float:flVelocity[3], Float:flVecOrigin[3];
iEnt = pev(id, pev_groundentity);
if( !iEnt || !(GetEntBits(g_bBlocks, iEnt)) )
{
if( iEnt )
{
pev(iEnt, pev_velocity, flVelocity);
if( flVelocity[0] || flVelocity[1] || flVelocity[2] )
{
ClearIdBits(g_bOnGround, id);
return;
}
}
if( fFlags & FL_DUCKING )
{
pev(id, pev_origin, flVecOrigin);
flVecOrigin[2] += 18.0;
engfunc(EngFunc_TraceHull, flVecOrigin, flVecOrigin, IGNORE_MONSTERS, HULL_HUMAN, id, 0);
if( !get_tr2(0, TR_StartSolid) && !get_tr2(0, TR_AllSolid) && get_tr2(0, TR_InOpen) )
{
flVecOrigin[2] -= 18.0;
xs_vec_copy(flVecOrigin, g_flJumpOrigin[id]);
SetIdBits(g_bOnGround, id);
}
else
{
ClearIdBits(g_bOnGround, id);
return;
}
}
else
{
pev(id, pev_origin, g_flJumpOrigin[id]);
SetIdBits(g_bOnGround, id);
}
}
else
{
ClearIdBits(g_bOnGround, id);
}
}
else if( GetIdBits(g_bOnGround, id) )
{
ClearIdBits(g_bOnGround, id);
pev(id, pev_v_angle, g_flJumpAnglesGravity[id]);
pev(id, pev_gravity, g_flJumpAnglesGravity[id][2]);
}
}
}
public TriggerMultiple_Touch(iEnt, id)
{
if( (IsPlayer(id) || g_bBlockEntityTouch) && GetEntBits(g_bBlocks, iEnt) )
{
return HAM_SUPERCEDE;
}
return HAM_IGNORED;
}
public Touch_Block(iBlock, id)
{
if( !(GetEntBits(g_bBlocks, iBlock)) )
{
return HAM_IGNORED;
}
if( IsPlayer(id) )
{
if( ~GetIdBits(g_bAlives, id) )
{
return HAM_SUPERCEDE;
}
}
else
{
return g_bBlockEntityTouch ? HAM_SUPERCEDE : HAM_IGNORED;
}
if( pev(id, pev_groundentity) != iBlock )
{
return HAM_SUPERCEDE;
}
ClearEntBits(g_bSolid, g_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_bInvisible, iBlock);
toucherid = id;
static Float:flTime;
flTime = get_gametime();
if( flTime - g_flFirstTouch[id] > 0.25 ) // 0.3 == exploit on cg_cbblebhop oO
{
SetEntBits(g_bSolid, iBlock);
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(id, iOrigin);
message_begin(MSG_PVS, SVC_TEMPENTITY, iOrigin);
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_bInvisible, ent);
}
public set_solid(ent)
{
ClearEntBits(g_bSolid, ent);
}
public ConsoleCommand_MpBhop(id, lvl, cid)
{
if( cmd_access(id, lvl, cid, 2) )
{
new szStatus[2];
read_argv(1, szStatus, charsmax(szStatus));
static HamHook:iHhPlayerPreThink;
switch( szStatus[0] )
{
case '0':
{
if( !g_bActive )
{
return PLUGIN_HANDLED;
}
if( iHhPlayerPreThink )
{
DisableHamForward( iHhPlayerPreThink );
}
SetTouch( false );
g_bActive = false;
if( g_bSafeInform )
{
client_print(0, print_console, "MpBhop has been De-Activated, recording is now SAFE");
ColorChat(0, TERRORIST, "^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
{
EnableHamForward( iHhPlayerPreThink );
}
SetTouch( true );
g_bActive = true;
if( g_bSafeInform )
{
client_print(0, print_console, "MpBhop has been Activated, recording is now NOT SAFE");
ColorChat(0, TERRORIST, "^1 * ^4[MpBhop] ^1MpBhop has been ^4Activated^1, recording is now ^3NOT SAFE");
}
}
default: {
client_print(id, print_console, "Usage: kz_mpbhop <0/1>");
}
}
}
return PLUGIN_HANDLED;
}
public ConsoleCommand_EntityTouch(id, lvl, cid)
{
if( cmd_access(id, lvl, cid, 2) )
{
new szStatus[2];
read_argv(1, szStatus, charsmax(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:flDmg, Float:flSpeed;
new const szNull[] = "common/null.wav";
while( (iDoor = engfunc(EngFunc_FindEntityByString, iDoor, "classname", "func_door")) )
{
// definitly not a bhop block
pev(iDoor, pev_dmg, flDmg);
if( flDmg )
{
#if defined MAKE_DOORS_SILENT
set_pev(iDoor, pev_noise1, szNull); // while here, set healing doors silent xD
set_pev(iDoor, pev_noise2, szNull);
set_pev(iDoor, pev_noise3, szNull);
#endif
continue;
}
// this func_door goes UP, not a bhop block ?
// or bhop block but let them move up (kz_megabhop for example)
pev(iDoor, pev_movedir, flMovedir);
if( flMovedir[2] > 0.0 )
{
continue;
}
// too small : real door ? could this one be skipped ?
pev(iDoor, pev_size, flSize);
if( flSize[0] < 24.0 || flSize[1] < 24.0 )
{
continue;
}
// real door ? not all doors make sound though...
pev(iDoor, pev_noise1, szNoise, charsmax(szNoise));
if( szNoise[0] && !equal(szNoise, szNull) )
{
continue;
}
pev(iDoor, pev_noise2, szNoise, charsmax(szNoise));
if( szNoise[0] && !equal(szNoise, szNull) )
{
continue;
}
// not a bhop block ? too slow // this at least detects the big ent on kzsca_sewerbhop
pev(iDoor, pev_speed, flSpeed);
if( flSpeed < 100.0 )
{
continue;
}
// Pray for this to be a bhop block
SetEntBits(g_bBlocksByPlugin, iDoor);
SetEntBits(g_bBlocks, iDoor);
g_bitPresentClass |= 1<<FUNC_DOOR;
}
}
Set_Wall_Toggle() {
new iEnt = FM_NULLENT;
while( (iEnt = engfunc(EngFunc_FindEntityByString, iEnt, "classname", "func_wall_toggle")) )
{
g_bitPresentClass |= 1<<FUNC_WALL_TOGGLE;
SetEntBits(g_bBlocksByPlugin, iEnt);
SetEntBits(g_bBlocks, iEnt);
}
}
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 i; i<sizeof(szStartStopButtons); i++)
{
TrieSetCell(tButtons, szStartStopButtons[i], 1);
}
new iEnt = FM_NULLENT, szTarget[32];
while( (iEnt = engfunc(EngFunc_FindEntityByString, iEnt, "classname", "func_button")) )
{
if( pev(iEnt, pev_spawnflags) & SF_BUTTON_TOUCH_ONLY )
{
pev(iEnt, pev_target, szTarget, charsmax(szTarget));
if( !szTarget[0] || !TrieKeyExists(tButtons, szTarget))
{
pev(iEnt, pev_targetname, szTarget, charsmax(szTarget));
if( !szTarget[0] || !TrieKeyExists(tButtons, szTarget))
{
g_bitPresentClass |= 1<<FUNC_BUTTON;
SetEntBits(g_bBlocksByPlugin, iEnt);
SetEntBits(g_bBlocks, iEnt);
}
}
}
}
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 i; i<sizeof(iHhBlockTouch); i++)
{
if( g_bitPresentClass & (1<<i) )
{
if( iHhBlockTouch[i] )
{
EnableHamForward( iHhBlockTouch[i] );
}
else
{
iHhBlockTouch[i] = RegisterHam(Ham_Touch, szClassesAndHandlers[i][0], szClassesAndHandlers[i][1]);
}
}
}
}
else
{
for(new i; i<sizeof(iHhBlockTouch); i++)
{
if( g_bitPresentClass & (1<<i) && iHhBlockTouch[i] )
{
DisableHamForward( iHhBlockTouch[i] );
}
}
}
}
SetBlocksByFile() {
get_localinfo("amxx_datadir", szConfigFile, charsmax(szConfigFile));
format(szConfigFile, charsmax(szConfigFile), "%s/mpbhop", szConfigFile);
if( !dir_exists(szConfigFile) )
{
mkdir(szConfigFile);
}
new szMapName[32];
get_mapname(szMapName, charsmax(szMapName));
format(szConfigFile, charsmax(szConfigFile), "%s/%s.dat", szConfigFile, szMapName);
new iFile = fopen(szConfigFile, "rt");
if( iFile )
{
new szDatas[48], szBrushOrigin[3][13], szType[2], Float:flBrushOrigin[3], i, iEnt;
new szClassName[32], iClassType;
while( !feof(iFile) )
{
fgets(iFile, szDatas, charsmax(szDatas));
trim(szDatas);
if(!szDatas[0] || szDatas[0] == ';' || szDatas[0] == '#' || (szDatas[0] == '/' && szDatas[1] == '/'))
{
continue;
}
parse(szDatas, szBrushOrigin[0], 12, szBrushOrigin[1], 12, szBrushOrigin[2], 12, szType, charsmax(szType));
for(i=0; i<3; i++)
{
flBrushOrigin[i] = str_to_float( szBrushOrigin[i] );
}
iEnt = FindEntByBrushOrigin( flBrushOrigin );
if( iEnt )
{
if( szType[0] == '1' )
{
pev(iEnt, pev_classname, szClassName, charsmax(szClassName));
if( TrieGetCell(g_iBlocksClass, szClassName, iClassType) )
{
g_bitPresentClass |= 1<<iClassType;
}
SetEntBits(g_bBlocks, iEnt);
}
else
{
ClearEntBits(g_bBlocks, iEnt);
}
}
}
fclose(iFile);
}
}
FindEntByBrushOrigin(Float:flOrigin[3]) {
new Float:flBrushOrigin[3];
for( new iEnt=g_iMaxPlayers+1; iEnt<=g_iMaxEnts; iEnt++ )
{
if( pev_valid(iEnt) )
{
fm_get_brush_entity_origin(iEnt, flBrushOrigin);
if( xs_vec_nearlyequal(flBrushOrigin, flOrigin) )
{
return iEnt;
}
}
}
return 0;
}
fm_get_brush_entity_origin(ent, Float:orig[3]) {
new Float:Min[3], Float:Max[3];
pev(ent, pev_origin, orig);
pev(ent, pev_mins, Min);
pev(ent, pev_maxs, Max);
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_NULLENT, szTarget[32], iBlock;
while( (iEnt = engfunc(EngFunc_FindEntityByString, iEnt, "classname", "trigger_multiple")) )
{
pev(iEnt, pev_target, szTarget, charsmax(szTarget));
iBlock = engfunc(EngFunc_FindEntityByString, -1, "targetname", szTarget);
if( iBlock && GetEntBits(g_bBlocks, iBlock) )
{
g_bitPresentClass |= 1<<TRIGGER_MULTIPLE;
SetEntBits(g_bBlocksByPlugin, iEnt);
SetEntBits(g_bBlocks, iEnt);
}
}
}
public plugin_end()
{
TrieDestroy(g_iBlocksClass);
delete_file(szConfigFile);
new iFile;
new Float:flBrushOrigin[3], bool:bUnMovable;
for(new iEnt=g_iMaxPlayers+1; iEnt<=g_iMaxEnts; iEnt++)
{
if( pev_valid(iEnt) )
{
bUnMovable = !!( GetEntBits(g_bBlocks, iEnt) );
if( bUnMovable != !!( GetEntBits(g_bBlocksByPlugin, iEnt) ) )
{
if( !iFile )
{
iFile = fopen(szConfigFile, "wt");
}
fm_get_brush_entity_origin(iEnt, flBrushOrigin);
fprintf(iFile, "%f %f %f %d^n",
flBrushOrigin[0], flBrushOrigin[1], flBrushOrigin[2], bUnMovable);
}
}
}
if( iFile )
{
fclose( iFile );
}
}
ColorChat(id, COLOR=DONT_CHANGE, fmt[], any:...) {
new szMsg[192];
szMsg[0] = 0x04;
vformat(szMsg[1], charsmax(szMsg)-1, fmt, 4);
new szTeam[11], MSG_DEST = id ? MSG_ONE : MSG_ALL;
static const szTeamNames[Colors][] = {"", "TERRORIST", "CT", "SPECTATOR"};
if( COLOR )
{
Send_TeamInfo(id, szTeamNames[COLOR], MSG_DEST);
}
static iSayText;
if( iSayText || (iSayText = get_user_msgid("SayText")) )
{
message_begin(MSG_DEST, iSayText, _, 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_iMaxPlayers, szTeam, charsmax(szTeam));
Send_TeamInfo(id, szTeam, MSG_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_DEST, iTeamInfo, _, 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).
|
|