找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 1597|回复: 12

【已解决】 SiMen.K请进来。急啊

[复制链接]

该用户从未签到

发表于 2010-10-9 06:25:38 | 显示全部楼层 |阅读模式
本帖最后由 SiMen.K. 于 2010-10-9 14:53 编辑

SiMen.K,我用了你的server 1.8的插件,
管理员进入连跳地图,浮沉箱子不会下沉,一般玩家正常,请问怎么设置?

该用户从未签到

 楼主| 发表于 2010-10-9 06:50:43 | 显示全部楼层
还有能不能顺便给个电灯插件啊,就是类似cs中夜视镜的那种。。。

该用户从未签到

发表于 2010-10-9 06:54:58 | 显示全部楼层
电灯插件。。。好名字啊

该用户从未签到

发表于 2010-10-9 09:33:21 | 显示全部楼层
楼主可以试试换上这个最新版的http://bbs.simen.cn/viewthread.php?tid=75486&from=recommend_f
自带箱子不沉
按N貌似就有了 试试你你这个插件按N有效果没

该用户从未签到

发表于 2010-10-9 14:50:53 | 显示全部楼层
MultiPlayer Bhop




.: Description :.




Every jumper know ian.camarrata plugin, well,
it doesn't detects all doors and it acts with a weird way and sometimes make you get stucked.

This plugin purpose is the same, but the bhop blocks detection is different,
the way the plugin put you out off the block is also different (put you back at the place you jumped or dduck or fall from a block),
and last, a menu let you choose if a block should move or not, so you can enable block movements to allow a shortcut,
or simply enable one because the plugin has not detected it (or disable a real door).

Find Servers Using This Plugin

I see on the tracker that someone has edited the plugin and tagged it as 1.1.0, please do something like 1.1.0YOURNAME when you edit this plugin.



.: Commands :.


  • kz_mpbhop < 0 | 1 >
    This enables the plugin (set block so they can't move when players touch them)
    Put this one on 1 in amxx.cfg in you run a bhop server, else, use per prefixes/maps config files
  • kz_mpbhop_entitytouch < 0 | 1 >
    This enables entity touch detection (set block so they can't move when other entities than players touch them)
    Put this one on 1 in amxx.cfg in you run a bhop server, else, use per prefixes/maps config files.
    This feature works only if kz_mpbhop is set to 1
  • kz_safe_inform < 0 | 1 >
    Inform recorders that their demo will be safe or not safe according to plugin state
  • kz_showblocks < 0 | 1 >
    This make non-movable block transparent and colored so you can quickly notice them.
    This is high consuming, so enable it only to config the plugin
  • kz_mpbhopmenu
    To open the menu and set a block, aim the block to make this cmd work.
    Then use the menu options to set the block.



.: Modules :.


  • Hamsandwich
  • Fakemeta




.: Credit/Thanks :.



Thanks to xPaw who made me work again on the plugin and pointing out some blocks detection bugs.
Thanks to Schlumpf who suggest me to make this menu (many guys gave me this idea in the past but i was too lazy to make it) and pointing out some "jump" detection bugs.
joaquimandrade.
Special thanks to adm.



  1. // 拷贝代码生成AMXX插件替换原插件即可

  2. #include <amxmodx>
  3. #include <amxmisc>
  4. #include <fakemeta>
  5. #include <hamsandwich>
  6. #include <xs>
  7. #define VERSION "1.0.3"
  8. #pragma semicolon 1
  9. #define MAKE_DOORS_SILENT
  10. //#define MAKE_TELEPORT_FX
  11. #define MAX_PLAYERS 32
  12. #define MAX_ENTSARRAYS_SIZE 64
  13. #define SF_BUTTON_TOUCH_ONLY 256
  14. #define SetIdBits(%1,%2)  %1 |= 1<<(%2 & 31)
  15. #define ClearIdBits(%1,%2) %1 &= ~( 1<<(%2 & 31) )
  16. #define GetIdBits(%1,%2)  %1 &  1<<(%2 & 31)
  17. #define SetEntBits(%1,%2) %1[%2>>5] |=  1<<(%2 & 31)
  18. #define ClearEntBits(%1,%2) %1[%2>>5] &= ~( 1 << (%2 & 31) )
  19. #define GetEntBits(%1,%2) %1[%2>>5] &   1<<(%2 & 31)
  20. enum _:BlocksClasses
  21. {
  22. FUNC_DOOR,
  23. FUNC_WALL_TOGGLE,
  24. FUNC_BUTTON,
  25. TRIGGER_MULTIPLE
  26. }
  27. enum _:Colors {
  28. DONT_CHANGE,
  29. TERRORIST,
  30. CT,
  31. SPECTATOR
  32. }
  33. new g_bitPresentClass;
  34. const KEYS = ((1<<0)|(1<<1)|(1<<9));
  35. const FL_ONGROUND2 = (FL_ONGROUND | FL_PARTIALGROUND | FL_INWATER | FL_CONVEYOR | FL_FLOAT);
  36. new g_iBlock[MAX_PLAYERS+1];
  37. new Float:g_flFirstTouch[MAX_PLAYERS+1];
  38. new Float:g_flJumpOrigin[MAX_PLAYERS+1][3];
  39. new Float:g_flJumpAnglesGravity[MAX_PLAYERS+1][3];
  40. new g_bBlocks[MAX_ENTSARRAYS_SIZE], g_bBlocksByPlugin[MAX_ENTSARRAYS_SIZE];
  41. new g_bAlives, g_bOnGround, g_bTeleported, g_bAdmin;
  42. new bool:g_bBlockEntityTouch;
  43. new bool:g_bActive;
  44. new bool:g_bSafeInform = true;
  45. new g_iFhAddToFullPack;
  46. new g_iAdminDoor[MAX_PLAYERS+1];
  47. new szConfigFile[64];
  48. new Trie:g_iBlocksClass;
  49. new g_iMaxPlayers, g_iMaxEnts;
  50. #define IsPlayer(%1) ( 1 <= %1 <= g_iMaxPlayers )
  51. public plugin_init()
  52. {
  53. register_plugin("MultiPlayer Bhop", VERSION, "ConnorMcLeod");
  54. new pCvar = register_cvar("mp_bhop_version", VERSION, FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY);
  55. set_pcvar_string(pCvar, VERSION);
  56. new const szPossibleBlockClass[][] = {"func_door", "func_wall_toggle", "func_button", "trigger_multiple"};
  57. g_iBlocksClass = TrieCreate();
  58. for(new i; i<sizeof(szPossibleBlockClass); i++)
  59. {
  60.   TrieSetCell(g_iBlocksClass, szPossibleBlockClass[i], i);
  61. }
  62. register_event("Health", "Event_Health", "b");
  63. register_event("ResetHUD", "Event_ResetHUD", "b");
  64. register_concmd("kz_mpbhop", "ConsoleCommand_MpBhop", ADMIN_CFG, "<0/1>");
  65. register_concmd("kz_mpbhop_entitytouch", "ConsoleCommand_EntityTouch", ADMIN_CFG, "<0/1>");
  66. register_concmd("kz_safe_inform", "ConsoleCommand_SafeInform", ADMIN_CFG, "<0/1>");
  67. register_clcmd("kz_mpbhopmenu", "ClientCommand_BhopMenu", ADMIN_CFG);
  68. register_clcmd("kz_showblocks", "ClientCommand_ShowBlocks", ADMIN_CFG);

  69. register_clcmd("fullupdate", "ClientCommand_FullUpdate");
  70. register_menucmd(register_menuid("MpBhop Menu"), KEYS ,"MpBhopMenuAction");
  71. g_iMaxPlayers = get_maxplayers();
  72. g_iMaxEnts = global_get(glb_maxEntities);
  73. Set_Doors();
  74. Set_Wall_Toggle();
  75. Set_Buttons();
  76. SetBlocksByFile();
  77. SetTriggerMultiple();
  78. }
  79. public ClientCommand_FullUpdate( id )
  80. {
  81. if( g_bSafeInform )
  82. {
  83.   if( g_bActive )
  84.   {
  85.    client_print(id, print_console, "MpBhop is Activated, recording is NOT SAFE");
  86.    ColorChat(id, TERRORIST, "^1 * ^4[MpBhop] ^1MpBhop is ^4Activated^1, recording is ^3NOT SAFE");
  87.   }
  88.   else
  89.   {
  90.    client_print(id, print_console, "MpBhop is De-Activated, recording is SAFE");
  91.    ColorChat(id, TERRORIST, "^1 * ^4[MpBhop] ^1MpBhop is ^3De-Activated^1, recording is ^4SAFE");
  92.   }
  93. }
  94. }
  95. public ConsoleCommand_SafeInform(id, lvl, cid)
  96. {
  97. if( cmd_access(id, lvl, cid, 2) )
  98. {
  99.   new szStatus[2];
  100.   read_argv(1, szStatus, charsmax(szStatus));
  101.   g_bSafeInform = !!str_to_num(szStatus);
  102. }
  103. return PLUGIN_HANDLED;
  104. }
  105. public client_putinserver(id)
  106. {
  107. if( get_user_flags(id) & ADMIN_CFG )
  108. {
  109.   SetIdBits(g_bAdmin, id);
  110. }
  111. else
  112. {
  113.   ClearIdBits(g_bAdmin, id);
  114. }
  115. ClearIdBits(g_bAlives, id);
  116. ClearIdBits(g_bOnGround, id);
  117. ClearIdBits(g_bTeleported, id);
  118. }
  119. public client_disconnect(id)
  120. {
  121. ClearIdBits(g_bAdmin, id);
  122. ClearIdBits(g_bAlives, id);
  123. ClearIdBits(g_bOnGround, id);
  124. ClearIdBits(g_bTeleported, id);
  125. }
  126. public ClientCommand_ShowBlocks(id, level, cid)
  127. {
  128. if( cmd_access(id, level, cid, 2) )
  129. {
  130.   new szStatus[2];
  131.   read_argv(1, szStatus, charsmax(szStatus));
  132.   if( szStatus[0] == '1' )
  133.   {
  134.    if( !g_iFhAddToFullPack )
  135.    {
  136.     g_iFhAddToFullPack = register_forward(FM_AddToFullPack, "AddToFullPack", 1);
  137.     client_print(id, print_console, "Recording with this feature Activated is NOT SAFE");
  138.     ColorChat(id, TERRORIST, "^1 * ^4[MpBhop] ^1Recording with this feature ^4Activated ^1is ^3NOT SAFE");
  139.    }
  140.   }
  141.   else
  142.   {
  143.    if( g_iFhAddToFullPack )
  144.    {
  145.     unregister_forward(FM_AddToFullPack, g_iFhAddToFullPack, 1);
  146.     g_iFhAddToFullPack = 0;
  147.    }
  148.   }
  149. }
  150. return PLUGIN_HANDLED;
  151. }
  152. public MpBhopMenuAction(id, iKey)
  153. {
  154. new iEnt = g_iAdminDoor[id];
  155. switch( iKey )
  156. {
  157.   case 0:
  158.   {
  159.    if( GetEntBits(g_bBlocks, iEnt) )
  160.    {
  161.     ClearEntBits(g_bBlocks, iEnt);
  162.     ColorChat(id, _, "^1 * ^4[MpBhop] ^1Block has been set ^4movable^1.");
  163.    }
  164.    else
  165.    {
  166.     ColorChat(id, _, "^1 * ^4[MpBhop] ^1Block is already ^4movable^1.");
  167.    }
  168.   }
  169.   case 1:
  170.   {
  171.    if( GetEntBits(g_bBlocks, iEnt) )
  172.    {
  173.     ColorChat(id, TERRORIST, "^1 * ^4[MpBhop] ^1Block is already ^3unmovable^1.");
  174.    }
  175.    else
  176.    {
  177.     SetEntBits(g_bBlocks, iEnt);
  178.     ColorChat(id, TERRORIST, "^1 * ^4[MpBhop] ^1Block has been set ^3unmovable^1.");
  179.    }
  180.   }
  181. }
  182. return PLUGIN_HANDLED;
  183. }
  184. ShowMpBhopMenu(id, bIsBlocked)
  185. {
  186. new szMenuBody[150];
  187. formatex(szMenuBody, charsmax(szMenuBody), "\rMpBhop Menu^n\dThis block is actually \
  188.   \y%smovable \d:^n^n\r1\w. Mark this block as movable^n\r2\w. Mark this block as \
  189.   unmovable^n^n\r0\w. Exit", bIsBlocked ? "un" : "");
  190. show_menu(id, KEYS, szMenuBody, _, "MpBhop Menu");
  191. }
  192. public ClientCommand_BhopMenu(id, level, cid)
  193. {
  194. if( cmd_access(id, level, cid, 1) )
  195. {
  196.   new iEnt, crap, iClassType;
  197.   get_user_aiming(id, iEnt, crap);
  198.   if( iEnt && pev_valid(iEnt) )
  199.   {
  200.    new szClassName[32];
  201.    pev(iEnt, pev_classname, szClassName, charsmax(szClassName));
  202.    if( TrieGetCell(g_iBlocksClass, szClassName, iClassType) )
  203.    {
  204.     g_bitPresentClass |= 1<<iClassType;
  205.     g_iAdminDoor[id] = iEnt;
  206.     ShowMpBhopMenu(id, !!(GetEntBits(g_bBlocks, iEnt)));
  207.    }
  208.   }
  209. }
  210. return PLUGIN_HANDLED;
  211. }
  212. public AddToFullPack(es, e, iEnt, id, hostflags, player, pSet)
  213. {
  214. if( !player && GetIdBits(g_bAdmin, id) && GetEntBits(g_bBlocks, iEnt) )
  215. {
  216.   set_es(es, ES_RenderMode, kRenderTransColor);
  217.   set_es(es, ES_RenderAmt, 150);
  218.   set_es(es, ES_RenderColor, {120,75,170});
  219.   set_es(es, ES_RenderFx, kRenderFxGlowShell);
  220. }
  221. }
  222. public Event_Health(id)
  223. {
  224. if( is_user_alive(id) )
  225. {
  226.   SetIdBits(g_bAlives, id);
  227. }
  228. else
  229. {
  230.   ClearIdBits(g_bAlives, id);
  231. }
  232. }
  233. public Event_ResetHUD(id)
  234. {
  235. if( is_user_alive(id) )
  236. {
  237.   SetIdBits(g_bAlives, id);
  238. }
  239. else
  240. {
  241.   ClearIdBits(g_bAlives, id);
  242. }
  243. }
  244. public CBasePlayer_PreThink(id)
  245. {
  246. if( GetIdBits(g_bAlives, id) )
  247. {
  248.   if( GetIdBits(g_bTeleported, id) )
  249.   {
  250.    ClearIdBits(g_bTeleported, id);
  251.    set_pev(id, pev_velocity, 0);
  252.    return;
  253.   }
  254.   static fFlags;
  255.   fFlags = pev(id, pev_flags);
  256.   if( fFlags & FL_ONGROUND )
  257.   {
  258.    static iEnt, Float:flVelocity[3], Float:flVecOrigin[3];
  259.    iEnt = pev(id, pev_groundentity);
  260.    if( !iEnt || !(GetEntBits(g_bBlocks, iEnt)) )
  261.    {
  262.     if( iEnt )
  263.     {
  264.      pev(iEnt, pev_velocity, flVelocity);
  265.      if( flVelocity[0] || flVelocity[1] || flVelocity[2] )
  266.      {
  267.       ClearIdBits(g_bOnGround, id);
  268.       return;
  269.      }
  270.     }
  271.     if( fFlags & FL_DUCKING )
  272.     {
  273.      pev(id, pev_origin, flVecOrigin);
  274.      flVecOrigin[2] += 18.0;
  275.      engfunc(EngFunc_TraceHull, flVecOrigin, flVecOrigin, IGNORE_MONSTERS, HULL_HUMAN, id, 0);
  276.      if( !get_tr2(0, TR_StartSolid) && !get_tr2(0, TR_AllSolid) && get_tr2(0, TR_InOpen) )
  277.      {
  278.       flVecOrigin[2] -= 18.0;
  279.       xs_vec_copy(flVecOrigin, g_flJumpOrigin[id]);
  280.       SetIdBits(g_bOnGround, id);
  281.      }
  282.      else
  283.      {
  284.       ClearIdBits(g_bOnGround, id);
  285.       return;
  286.      }
  287.     }
  288.     else
  289.     {
  290.      pev(id, pev_origin, g_flJumpOrigin[id]);
  291.      SetIdBits(g_bOnGround, id);
  292.     }
  293.    }
  294.    else
  295.    {
  296.     ClearIdBits(g_bOnGround, id);
  297.    }
  298.   }
  299.   else if( GetIdBits(g_bOnGround, id) )
  300.   {
  301.    ClearIdBits(g_bOnGround, id);
  302.    pev(id, pev_v_angle, g_flJumpAnglesGravity[id]);
  303.    pev(id, pev_gravity, g_flJumpAnglesGravity[id][2]);
  304.   }
  305. }
  306. }
  307. public TriggerMultiple_Touch(iEnt, id)
  308. {
  309. if( (IsPlayer(id) || g_bBlockEntityTouch) && GetEntBits(g_bBlocks, iEnt) )
  310. {
  311.   return HAM_SUPERCEDE;
  312. }
  313. return HAM_IGNORED;
  314. }
  315. public Touch_Block(iBlock, id)
  316. {
  317. if( !(GetEntBits(g_bBlocks, iBlock)) )
  318. {
  319.   return HAM_IGNORED;
  320. }
  321. if( IsPlayer(id) )
  322. {
  323.   if( ~GetIdBits(g_bAlives, id) )
  324.   {
  325.    return HAM_SUPERCEDE;
  326.   }
  327. }
  328. else
  329. {
  330.   return g_bBlockEntityTouch ? HAM_SUPERCEDE : HAM_IGNORED;
  331. }
  332. if( pev(id, pev_groundentity) != iBlock )
  333. {
  334.   return HAM_SUPERCEDE;
  335. }
  336. if( g_iBlock[id] != iBlock )
  337. {
  338.   g_iBlock[id] = iBlock;
  339.   g_flFirstTouch[id] = get_gametime();
  340.   return HAM_SUPERCEDE;
  341. }
  342. static Float:flTime;
  343. flTime = get_gametime();
  344. if( flTime - g_flFirstTouch[id] > 0.25 ) // 0.3 == exploit on cg_cbblebhop oO
  345. {
  346.   if( flTime - g_flFirstTouch[id] > 0.7 )
  347.   {
  348.    g_flFirstTouch[id] = flTime;
  349.    return HAM_SUPERCEDE;
  350.   }
  351. #if defined MAKE_TELEPORT_FX
  352.   new iOrigin[3];
  353.   get_user_origin(id, iOrigin);
  354.   message_begin(MSG_PVS, SVC_TEMPENTITY, iOrigin);
  355.   write_byte(TE_TELEPORT);
  356.   write_coord(iOrigin[0]);
  357.   write_coord(iOrigin[1]);
  358.   write_coord(iOrigin[2]);
  359.   message_end();
  360. #endif
  361.   static const Float:VEC_DUCK_HULL_MIN[3] = {-16.0, -16.0, -18.0 };
  362.   static const Float:VEC_DUCK_HULL_MAX[3] = { 16.0,  16.0,  32.0 };
  363.   static const Float:VEC_DUCK_VIEW[3] = { 0.0, 0.0, 12.0 };
  364.   set_pev(id, pev_flags, pev(id, pev_flags) | FL_DUCKING);
  365.   engfunc(EngFunc_SetSize, id, VEC_DUCK_HULL_MIN, VEC_DUCK_HULL_MAX);
  366.   engfunc(EngFunc_SetOrigin, id, g_flJumpOrigin[id]);
  367.   set_pev(id, pev_view_ofs, VEC_DUCK_VIEW);
  368.   set_pev(id, pev_v_angle, 0);
  369.   set_pev(id, pev_velocity, 0);
  370.   set_pev(id, pev_angles, g_flJumpAnglesGravity[id]);
  371.   set_pev(id, pev_punchangle, 0);
  372.   set_pev(id, pev_fixangle, 1);
  373.   set_pev(id, pev_gravity, g_flJumpAnglesGravity[id][2]);
  374.   SetIdBits(g_bTeleported, id);
  375. }
  376. return HAM_SUPERCEDE;
  377. }
  378. public ConsoleCommand_MpBhop(id, lvl, cid)
  379. {
  380. if( cmd_access(id, lvl, cid, 2) )
  381. {
  382.   new szStatus[2];
  383.   read_argv(1, szStatus, charsmax(szStatus));
  384.   static HamHook:iHhPlayerPreThink;
  385.   switch( szStatus[0] )
  386.   {
  387.    case '0':
  388.    {
  389.     if( !g_bActive )
  390.     {
  391.      return PLUGIN_HANDLED;
  392.     }
  393.     if( iHhPlayerPreThink )
  394.     {
  395.      DisableHamForward( iHhPlayerPreThink );
  396.     }
  397.     SetTouch( false );
  398.     g_bActive = false;
  399.     if( g_bSafeInform )
  400.     {
  401.      client_print(0, print_console, "MpBhop has been De-Activated, recording is now SAFE");
  402.      ColorChat(0, TERRORIST, "^1 * ^4[MpBhop] ^1MpBhop has been ^3De-Activated^1, recording is now ^4SAFE");
  403.     }
  404.    }
  405.    case '1':
  406.    {
  407.     if( g_bActive )
  408.     {
  409.      return PLUGIN_HANDLED;
  410.     }
  411.     if( !iHhPlayerPreThink )
  412.     {
  413.      RegisterHam(Ham_Player_PreThink, "player", "CBasePlayer_PreThink");
  414.     }
  415.     else
  416.     {
  417.      EnableHamForward( iHhPlayerPreThink );
  418.     }
  419.     SetTouch( true );
  420.     g_bActive = true;
  421.     if( g_bSafeInform )
  422.     {
  423.      client_print(0, print_console, "MpBhop has been Activated, recording is now NOT SAFE");
  424.      ColorChat(0, TERRORIST, "^1 * ^4[MpBhop] ^1MpBhop has been ^4Activated^1, recording is now ^3NOT SAFE");
  425.     }
  426.    }
  427.    default:
  428.    {
  429.     client_print(id, print_console, "Usage: kz_mpbhop <0/1>");
  430.    }
  431.   }
  432. }
  433. return PLUGIN_HANDLED;
  434. }
  435. public ConsoleCommand_EntityTouch(id, lvl, cid)
  436. {
  437. if( cmd_access(id, lvl, cid, 2) )
  438. {
  439.   new szStatus[2];
  440.   read_argv(1, szStatus, charsmax(szStatus));
  441.   g_bBlockEntityTouch = !!str_to_num(szStatus);
  442. }
  443. return PLUGIN_HANDLED;
  444. }
  445. Set_Doors()
  446. {
  447. new iDoor = FM_NULLENT;
  448. new Float:flMovedir[3], szNoise[32], Float:flSize[3], Float:flDmg, Float:flSpeed;
  449. new const szNull[] = "common/null.wav";
  450. while( (iDoor = engfunc(EngFunc_FindEntityByString, iDoor, "classname", "func_door")) )
  451. {
  452.   // definitly not a bhop block
  453.   pev(iDoor, pev_dmg, flDmg);
  454.   if( flDmg )
  455.   {
  456. #if defined MAKE_DOORS_SILENT
  457.    set_pev(iDoor, pev_noise1, szNull); // while here, set healing doors silent xD
  458.    set_pev(iDoor, pev_noise2, szNull);
  459.    set_pev(iDoor, pev_noise3, szNull);
  460. #endif
  461.    continue;
  462.   }
  463.   // this func_door goes UP, not a bhop block ?
  464.   // or bhop block but let them move up (kz_megabhop for example)
  465.   pev(iDoor, pev_movedir, flMovedir);
  466.   if( flMovedir[2] > 0.0 )
  467.   {
  468.    continue;
  469.   }
  470.   
  471.   // too small : real door ? could this one be skipped ?
  472.   pev(iDoor, pev_size, flSize);
  473.   if( flSize[0] < 24.0 || flSize[1] < 24.0 )
  474.   {
  475.    continue;
  476.   }
  477.   // real door ? not all doors make sound though...
  478.   pev(iDoor, pev_noise1, szNoise, charsmax(szNoise));
  479.   if( szNoise[0] && !equal(szNoise, szNull) )
  480.   {
  481.    continue;
  482.   }
  483.   pev(iDoor, pev_noise2, szNoise, charsmax(szNoise));
  484.   if( szNoise[0] && !equal(szNoise, szNull) )
  485.   {
  486.    continue;
  487.   }
  488.   // not a bhop block ? too slow // this at least detects the big ent on kzsca_sewerbhop
  489.   pev(iDoor, pev_speed, flSpeed);
  490.   if( flSpeed < 100.0 )
  491.   {
  492.    continue;
  493.   }
  494.   // Pray for this to be a bhop block
  495.   SetEntBits(g_bBlocksByPlugin, iDoor);
  496.   SetEntBits(g_bBlocks, iDoor);
  497.   g_bitPresentClass |= 1<<FUNC_DOOR;
  498. }
  499. }
  500. Set_Wall_Toggle()
  501. {
  502. new iEnt = FM_NULLENT;
  503. while( (iEnt = engfunc(EngFunc_FindEntityByString, iEnt, "classname", "func_wall_toggle")) )
  504. {
  505.   g_bitPresentClass |= 1<<FUNC_WALL_TOGGLE;
  506.   SetEntBits(g_bBlocksByPlugin, iEnt);
  507.   SetEntBits(g_bBlocks, iEnt);
  508. }
  509. }
  510. Set_Buttons()
  511. {
  512. new const szStartStopButtons[][] = {"counter_start", "clockstartbutton", "firsttimerelay", "multi_start",
  513.   "counter_start_button", "counter_off", "clockstop", "clockstopbutton", "multi_stop", "stop_counter" };
  514. new Trie:tButtons = TrieCreate();
  515. for(new i; i<sizeof(szStartStopButtons); i++)
  516. {
  517.   TrieSetCell(tButtons, szStartStopButtons[i], 1);
  518. }
  519. new iEnt = FM_NULLENT, szTarget[32];
  520. while( (iEnt = engfunc(EngFunc_FindEntityByString, iEnt, "classname", "func_button")) )
  521. {
  522.   if( pev(iEnt, pev_spawnflags) & SF_BUTTON_TOUCH_ONLY )
  523.   {
  524.    pev(iEnt, pev_target, szTarget, charsmax(szTarget));
  525.    if( !szTarget[0] || !TrieKeyExists(tButtons, szTarget))
  526.    {
  527.     pev(iEnt, pev_targetname, szTarget, charsmax(szTarget));
  528.     if( !szTarget[0] || !TrieKeyExists(tButtons, szTarget))
  529.     {
  530.      g_bitPresentClass |= 1<<FUNC_BUTTON;
  531.      SetEntBits(g_bBlocksByPlugin, iEnt);
  532.      SetEntBits(g_bBlocks, iEnt);
  533.     }
  534.    }
  535.   }
  536. }
  537. TrieDestroy(tButtons);
  538. }
  539. SetTouch(bool:bActive)
  540. {
  541. static HamHook:iHhBlockTouch[BlocksClasses];
  542. if( bActive )
  543. {
  544.   static const szClassesAndHandlers[BlocksClasses][][] = {
  545.    {"func_door", "Touch_Block"},
  546.    {"func_wall_toggle", "Touch_Block"},
  547.    {"func_button", "Touch_Block"},
  548.    {"trigger_multiple", "TriggerMultiple_Touch"}
  549.   };
  550.   for(new i; i<sizeof(iHhBlockTouch); i++)
  551.   {
  552.    if( g_bitPresentClass & (1<<i) )
  553.    {
  554.     if( iHhBlockTouch[i] )
  555.     {
  556.      EnableHamForward( iHhBlockTouch[i] );
  557.     }
  558.     else
  559.     {
  560.      iHhBlockTouch[i] = RegisterHam(Ham_Touch, szClassesAndHandlers[i][0], szClassesAndHandlers[i][1]);
  561.     }
  562.    }
  563.   }
  564. }
  565. else
  566. {
  567.   for(new i; i<sizeof(iHhBlockTouch); i++)
  568.   {
  569.    if( g_bitPresentClass & (1<<i) && iHhBlockTouch[i] )
  570.    {
  571.     DisableHamForward( iHhBlockTouch[i] );
  572.    }
  573.   }
  574. }
  575. }
  576. SetBlocksByFile()
  577. {
  578. get_localinfo("amxx_datadir", szConfigFile, charsmax(szConfigFile));
  579. format(szConfigFile, charsmax(szConfigFile), "%s/mpbhop", szConfigFile);
  580. if( !dir_exists(szConfigFile) )
  581. {
  582.   mkdir(szConfigFile);
  583. }
  584. new szMapName[32];
  585. get_mapname(szMapName, charsmax(szMapName));
  586. format(szConfigFile, charsmax(szConfigFile), "%s/%s.dat", szConfigFile, szMapName);
  587. new iFile = fopen(szConfigFile, "rt");
  588. if( iFile )
  589. {
  590.   new szDatas[48], szBrushOrigin[3][13], szType[2], Float:flBrushOrigin[3], i, iEnt;
  591.   new szClassName[32], iClassType;
  592.   while( !feof(iFile) )
  593.   {
  594.    fgets(iFile, szDatas, charsmax(szDatas));
  595.    trim(szDatas);
  596.    if(!szDatas[0] || szDatas[0] == ';' || szDatas[0] == '#' || (szDatas[0] == '/' && szDatas[1] == '/'))
  597.    {
  598.     continue;
  599.    }
  600.    parse(szDatas, szBrushOrigin[0], 12, szBrushOrigin[1], 12, szBrushOrigin[2], 12, szType, charsmax(szType));
  601.    for(i=0; i<3; i++)
  602.    {
  603.     flBrushOrigin[i] = str_to_float( szBrushOrigin[i] );
  604.    }
  605.    iEnt = FindEntByBrushOrigin( flBrushOrigin );
  606.    if( iEnt )
  607.    {
  608.     if( szType[0] == '1' )
  609.     {
  610.      pev(iEnt, pev_classname, szClassName, charsmax(szClassName));
  611.      if( TrieGetCell(g_iBlocksClass, szClassName, iClassType) )
  612.      {
  613.       g_bitPresentClass |= 1<<iClassType;
  614.      }
  615.      SetEntBits(g_bBlocks, iEnt);
  616.     }
  617.     else
  618.     {
  619.      ClearEntBits(g_bBlocks, iEnt);
  620.     }
  621.    }
  622.   }
  623.   fclose(iFile);
  624. }
  625. }
  626. FindEntByBrushOrigin(Float:flOrigin[3])
  627. {
  628. new Float:flBrushOrigin[3];
  629. for( new iEnt=g_iMaxPlayers+1; iEnt<=g_iMaxEnts; iEnt++ )
  630. {
  631.   if( pev_valid(iEnt) )
  632.   {
  633.    fm_get_brush_entity_origin(iEnt, flBrushOrigin);
  634.    if( xs_vec_nearlyequal(flBrushOrigin, flOrigin) )
  635.    {
  636.     return iEnt;
  637.    }
  638.   }
  639. }
  640. return 0;
  641. }
  642. fm_get_brush_entity_origin(ent, Float:orig[3])
  643. {
  644. new Float:Min[3], Float:Max[3];
  645. pev(ent, pev_origin, orig);
  646. pev(ent, pev_mins, Min);
  647. pev(ent, pev_maxs, Max);

  648. orig[0] += (Min[0] + Max[0]) * 0.5;
  649. orig[1] += (Min[1] + Max[1]) * 0.5;
  650. orig[2] += (Min[2] + Max[2]) * 0.5;
  651. return 1;
  652. }
  653. SetTriggerMultiple()
  654. {
  655. new iEnt = FM_NULLENT, szTarget[32], iBlock;
  656. while( (iEnt = engfunc(EngFunc_FindEntityByString, iEnt, "classname", "trigger_multiple")) )
  657. {
  658.   pev(iEnt, pev_target, szTarget, charsmax(szTarget));
  659.   iBlock = engfunc(EngFunc_FindEntityByString, -1, "targetname", szTarget);
  660.   if( iBlock && GetEntBits(g_bBlocks, iBlock) )
  661.   {
  662.    g_bitPresentClass |= 1<<TRIGGER_MULTIPLE;
  663.    SetEntBits(g_bBlocksByPlugin, iEnt);
  664.    SetEntBits(g_bBlocks, iEnt);
  665.   }
  666. }
  667. }
  668. public plugin_end()
  669. {
  670. TrieDestroy(g_iBlocksClass);
  671. delete_file(szConfigFile);
  672. new iFile;
  673. new Float:flBrushOrigin[3], bool:bUnMovable;
  674. for(new iEnt=g_iMaxPlayers+1; iEnt<=g_iMaxEnts; iEnt++)
  675. {
  676.   if( pev_valid(iEnt) )
  677.   {
  678.    bUnMovable = !!( GetEntBits(g_bBlocks, iEnt) );
  679.    if( bUnMovable
  680.    != !!( GetEntBits(g_bBlocksByPlugin, iEnt) ) )
  681.    {
  682.     if( !iFile )
  683.     {
  684.      iFile = fopen(szConfigFile, "wt");
  685.     }
  686.     fm_get_brush_entity_origin(iEnt, flBrushOrigin);
  687.     fprintf(iFile, "%f %f %f %d^n",
  688.     flBrushOrigin[0], flBrushOrigin[1], flBrushOrigin[2], bUnMovable);
  689.    }
  690.   }
  691. }
  692. if( iFile )
  693. {
  694.   fclose( iFile );
  695. }
  696. }
  697. ColorChat(id, COLOR=DONT_CHANGE, fmt[], any:...)
  698. {
  699. new szMsg[192];
  700. szMsg[0] = 0x04;
  701. vformat(szMsg[1], charsmax(szMsg)-1, fmt, 4);
  702. new szTeam[11], MSG_DEST = id ? MSG_ONE : MSG_ALL;
  703. static const szTeamNames[Colors][] = {"", "TERRORIST", "CT", "SPECTATOR"};
  704. if( COLOR )
  705. {
  706.   Send_TeamInfo(id, szTeamNames[COLOR], MSG_DEST);
  707. }
  708. static iSayText;
  709. if( iSayText || (iSayText = get_user_msgid("SayText")) )
  710. {
  711.   message_begin(MSG_DEST, iSayText, _, id);
  712.   {
  713.    write_byte(id ? id : g_iMaxPlayers);
  714.    write_string(szMsg);
  715.   }
  716.   message_end();
  717. }
  718. if( COLOR )
  719. {
  720.   if( id || is_user_connected(g_iMaxPlayers) )
  721.   {
  722.    get_user_team(id ? id : g_iMaxPlayers, szTeam, charsmax(szTeam));
  723.    Send_TeamInfo(id, szTeam, MSG_DEST);
  724.   }
  725.   else
  726.   {
  727.    Send_TeamInfo(0, "UNASSIGNED", MSG_DEST);
  728.   }
  729. }
  730. }
  731. Send_TeamInfo(const id, const szTeam[], MSG_DEST)
  732. {
  733. static iTeamInfo;
  734. if( iTeamInfo || (iTeamInfo = get_user_msgid("TeamInfo")) )
  735. {
  736.   message_begin(MSG_DEST, iTeamInfo, _, id);
  737.   {
  738.    write_byte(id ? id : g_iMaxPlayers);
  739.    write_string(szTeam);
  740.   }
  741.   message_end();
  742.     }
  743. }
复制代码

该用户从未签到

发表于 2010-10-9 14:53:18 | 显示全部楼层
夜视灯  按 "N" 即可开启关闭

该用户从未签到

 楼主| 发表于 2010-10-9 16:25:09 | 显示全部楼层
很感谢大家的热心,和SiMen.K提供的源码。可是源码在1.81和1.7下无法编译啊。。请看图。。
123.jpg
123.jpg
123.jpg

该用户从未签到

发表于 2010-10-9 18:03:58 | 显示全部楼层
LS 大神级别

该用户从未签到

发表于 2010-10-9 23:28:30 | 显示全部楼层
回复 7# cuikejie


    你没开启hamsandwich模块,要在modules.ini里把它前面的分号去掉。另外只有1.8以上版本才有这个模块,所以必须用最新版编译,不要再管1.7了。

该用户从未签到

 楼主| 发表于 2010-10-13 02:41:25 | 显示全部楼层
本帖最后由 cuikejie 于 2010-10-13 02:43 编辑
回复  cuikejie


    你没开启hamsandwich模块,要在modules.ini里把它前面的分号去掉。另外只有1.8以 ...
fantasist 发表于 2010-10-9 23:28



    谢谢哥哥的指点,这次开启之后出现错误还是无法编译。不知道这次是什么原因呢?看附件
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表