hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2025.06.17. 08:11



Jelenlévő felhasználók

Jelenleg 361 felhasználó van jelen :: 2 regisztrált, 0 rejtett és 359 vendég

A legtöbb felhasználó (2761 fő) 2025.01.09. 20:06-kor tartózkodott itt.

Regisztrált felhasználók: Bing [Bot], Google [Bot]az elmúlt 5 percben aktív felhasználók alapján

Utoljára aktív
Ahhoz hogy lásd ki volt utoljára aktív, be kell jelentkezned.



Az oldal teljeskörű
használatához regisztrálj.

Regisztráció

Kereső


Új téma nyitása Hozzászólás a témához  [3 hozzászólás ] 
Szerző Üzenet
HozzászólásElküldve:2013.01.12. 12:14 
Offline
Újonc

Csatlakozott:2013.01.12. 12:09
Hozzászólások:3
Sziasztok!
Valaki át tudná írni nekem ezt a plugin arra, hogy ha rajta maradok a bhop blockokon akkor ne teleportáljon vissza hanem megöljön?:)

SMA Forráskód: [ Mindet kijelol ]
  1. /* Copyright © 2008, ConnorMcLeod
  2.  
  3. func_door is free software;
  4. you can redistribute it and/or modify it under the terms of the
  5. GNU General Public License as published by the Free Software Foundation.
  6.  
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11.  
  12. You should have received a copy of the GNU General Public License
  13. along with func_door; if not, write to the
  14. Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  15. Boston, MA 02111-1307, USA.
  16. */
  17.  
  18. #include <amxmodx>
  19. #include <amxmisc>
  20. #include <fakemeta>
  21. #include <hamsandwich>
  22. #include <xs>
  23.  
  24. #define VERSION "1.1.0"
  25.  
  26. #pragma semicolon 1
  27.  
  28. #define MAKE_DOORS_SILENT
  29. //#define MAKE_TELEPORT_FX
  30.  
  31. #define MAX_PLAYERS 32
  32. #define MAX_ENTSARRAYS_SIZE 64
  33.  
  34. #define SF_BUTTON_TOUCH_ONLY 256
  35.  
  36. #define SetIdBits(%1,%2) %1 |= 1<<(%2 & 31)
  37. #define ClearIdBits(%1,%2) %1 &= ~( 1<<(%2 & 31) )
  38. #define GetIdBits(%1,%2) %1 & 1<<(%2 & 31)
  39.  
  40. #define SetEntBits(%1,%2) %1[%2>>5] |= 1<<(%2 & 31)
  41. #define ClearEntBits(%1,%2) %1[%2>>5] &= ~( 1 << (%2 & 31) )
  42. #define GetEntBits(%1,%2) %1[%2>>5] & 1<<(%2 & 31)
  43.  
  44. enum _:BlocksClasses
  45. {
  46. FUNC_DOOR,
  47. FUNC_WALL_TOGGLE,
  48. FUNC_BUTTON,
  49. TRIGGER_MULTIPLE
  50. }
  51.  
  52. enum _:Colors {
  53. DONT_CHANGE,
  54. TERRORIST,
  55. CT,
  56. SPECTATOR
  57. }
  58.  
  59. new g_bitPresentClass;
  60.  
  61. const KEYS = ((1<<0)|(1<<1)|(1<<9));
  62.  
  63. const FL_ONGROUND2 = (FL_ONGROUND | FL_PARTIALGROUND | FL_INWATER | FL_CONVEYOR | FL_FLOAT);
  64.  
  65. new g_iBlock[MAX_PLAYERS+1];
  66. new Float:g_flFirstTouch[MAX_PLAYERS+1];
  67.  
  68. new Float:g_flJumpOrigin[MAX_PLAYERS+1][3];
  69. new Float:g_flJumpAnglesGravity[MAX_PLAYERS+1][3];
  70.  
  71. new g_bBlocks[MAX_ENTSARRAYS_SIZE], g_bBlocksByPlugin[MAX_ENTSARRAYS_SIZE];
  72. new g_bAlives, g_bOnGround, g_bTeleported, g_bAdmin;
  73.  
  74. new bool:g_bBlockEntityTouch;
  75. new bool:g_bActive;
  76. new bool:g_bSafeInform = true;
  77.  
  78. new g_iFhAddToFullPack;
  79. new g_iAdminDoor[MAX_PLAYERS+1];
  80. new szConfigFile[64];
  81.  
  82. new Trie:g_iBlocksClass;
  83.  
  84. new g_iMaxPlayers, g_iMaxEnts;
  85. #define IsPlayer(%1) ( 1 <= %1 <= g_iMaxPlayers )
  86.  
  87. public plugin_init()
  88. {
  89. register_plugin("MultiPlayer Bhop", VERSION, "ConnorMcLeod");
  90. new pCvar = register_cvar("mp_bhop_version", VERSION, FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY);
  91. set_pcvar_string(pCvar, VERSION);
  92.  
  93. new const szPossibleBlockClass[][] = {"func_door", "func_wall_toggle", "func_button", "trigger_multiple"};
  94. g_iBlocksClass = TrieCreate();
  95. for(new i; i<sizeof(szPossibleBlockClass); i++)
  96. {
  97. TrieSetCell(g_iBlocksClass, szPossibleBlockClass[i], i);
  98. }
  99.  
  100. register_event("Health", "Event_Health", "b");
  101. register_event("ResetHUD", "Event_ResetHUD", "b");
  102.  
  103. register_concmd("kz_mpbhop", "ConsoleCommand_MpBhop", ADMIN_CFG, "<0/1> set blocks so they can't move when players touch them");
  104. register_concmd("kz_mpbhop_entitytouch", "ConsoleCommand_EntityTouch", ADMIN_CFG, "<0/1> set blocks so they can't move when other entities than players touch them");
  105. register_concmd("kz_safe_inform", "ConsoleCommand_SafeInform", ADMIN_CFG, "<0/1> Inform recorders that their demo will be safe or not safe according to plugin state");
  106.  
  107. register_clcmd("kz_mpbhopmenu", "ClientCommand_BhopMenu", ADMIN_CFG);
  108. register_clcmd("kz_showblocks", "ClientCommand_ShowBlocks", ADMIN_CFG);
  109.  
  110.  
  111. register_clcmd("fullupdate", "ClientCommand_FullUpdate");
  112.  
  113. register_menucmd(register_menuid("MpBhop Menu"), KEYS ,"MpBhopMenuAction");
  114.  
  115. g_iMaxPlayers = get_maxplayers();
  116. g_iMaxEnts = global_get(glb_maxEntities);
  117.  
  118. Set_Doors();
  119. Set_Wall_Toggle();
  120. Set_Buttons();
  121.  
  122. SetBlocksByFile();
  123.  
  124. SetTriggerMultiple();
  125. }
  126.  
  127. public plugin_cfg()
  128. {
  129. new szConfigPath[96];
  130. get_localinfo("amxx_configsdir", szConfigPath, charsmax(szConfigPath));
  131. format(szConfigPath, charsmax(szConfigPath), "%s/mpbhop.cfg", szConfigPath);
  132.  
  133. if( file_exists(szConfigPath) )
  134. {
  135. server_cmd("exec %s", szConfigPath);
  136. server_exec();
  137. }
  138. else
  139. {
  140. new fp = fopen(szConfigPath, "wt");
  141. if( !fp )
  142. {
  143. return;
  144. }
  145. new szPluginFileName[96], szPluginName[64], szAuthor[32], szVersion[32], szStatus[2];
  146. new iPlugin = get_plugin(-1,
  147. szPluginFileName, charsmax(szPluginFileName),
  148. szPluginName, charsmax(szPluginName),
  149. szVersion, charsmax(szVersion),
  150. szAuthor, charsmax(szAuthor),
  151. szStatus, charsmax(szStatus) );
  152.  
  153. server_print("Plugin id is %d", iPlugin);
  154. fprintf(fp, "; ^"%s^" configuration file^n", szPluginName);
  155. fprintf(fp, "; Author : ^"%s^"^n", szAuthor);
  156. fprintf(fp, "; Version : ^"%s^"^n", szVersion);
  157. fprintf(fp, "; File : ^"%s^"^n", szPluginFileName);
  158.  
  159. new iMax, i, szCommand[64], iCommandAccess, szCmdInfo[128], szFlags[32];
  160. iMax = get_concmdsnum(-1, -1);
  161. fprintf(fp, "^n; Console Commands :^n");
  162. for(i=0; i<iMax; i++)
  163. {
  164. if( get_concmd_plid(i, -1, -1) == iPlugin )
  165. {
  166. get_concmd(i,
  167. szCommand, charsmax(szCommand),
  168. iCommandAccess,
  169. szCmdInfo, charsmax(szCmdInfo),
  170. -1, -1);
  171. get_flags(iCommandAccess, szFlags, charsmax(szFlags));
  172. fprintf(fp, "; %s | Access:^"%s^" | ^"%s^"^n", szCommand, szFlags, szCmdInfo);
  173. }
  174. }
  175.  
  176. iMax = get_plugins_cvarsnum();
  177. new iTempId, iPcvar, szCvarName[256], szCvarValue[128];
  178. fprintf(fp, "^n; Cvars :^n");
  179. for(new i; i<iMax; i++)
  180. {
  181. get_plugins_cvar(i, szCvarName, charsmax(szCvarName), _, iTempId, iPcvar);
  182. if( iTempId == iPlugin )
  183. {
  184. get_pcvar_string(iPcvar, szCvarValue, charsmax(szCvarValue));
  185. fprintf(fp, "%s ^"%s^"^n", szCvarName, szCvarValue);
  186. }
  187. }
  188.  
  189. fclose(fp);
  190. }
  191. }
  192.  
  193. public ClientCommand_FullUpdate( id )
  194. {
  195. if( g_bSafeInform )
  196. {
  197. if( g_bActive )
  198. {
  199. client_print(id, print_console, "MpBhop is Activated, recording is NOT SAFE");
  200. ColorChat(id, TERRORIST, "^1 * ^4[MpBhop] ^1MpBhop is ^4Activated^1, recording is ^3NOT SAFE");
  201. }
  202. else
  203. {
  204. client_print(id, print_console, "MpBhop is De-Activated, recording is SAFE");
  205. ColorChat(id, TERRORIST, "^1 * ^4[MpBhop] ^1MpBhop is ^3De-Activated^1, recording is ^4SAFE");
  206. }
  207. }
  208. }
  209.  
  210. public ConsoleCommand_SafeInform(id, lvl, cid)
  211. {
  212. if( cmd_access(id, lvl, cid, 2) )
  213. {
  214. new szStatus[2];
  215. read_argv(1, szStatus, charsmax(szStatus));
  216. g_bSafeInform = !!str_to_num(szStatus);
  217. }
  218. return PLUGIN_HANDLED;
  219. }
  220.  
  221. public client_putinserver(id)
  222. {
  223. if( get_user_flags(id) & ADMIN_CFG )
  224. {
  225. SetIdBits(g_bAdmin, id);
  226. }
  227. else
  228. {
  229. ClearIdBits(g_bAdmin, id);
  230. }
  231. ClearIdBits(g_bAlives, id);
  232. ClearIdBits(g_bOnGround, id);
  233. ClearIdBits(g_bTeleported, id);
  234. }
  235.  
  236. public client_disconnect(id)
  237. {
  238. ClearIdBits(g_bAdmin, id);
  239. ClearIdBits(g_bAlives, id);
  240. ClearIdBits(g_bOnGround, id);
  241. ClearIdBits(g_bTeleported, id);
  242. }
  243.  
  244. public ClientCommand_ShowBlocks(id, level, cid)
  245. {
  246. if( cmd_access(id, level, cid, 2) )
  247. {
  248. new szStatus[2];
  249. read_argv(1, szStatus, charsmax(szStatus));
  250. if( szStatus[0] == '1' )
  251. {
  252. if( !g_iFhAddToFullPack )
  253. {
  254. g_iFhAddToFullPack = register_forward(FM_AddToFullPack, "AddToFullPack", 1);
  255. client_print(id, print_console, "Recording with this feature Activated is NOT SAFE");
  256. ColorChat(id, TERRORIST, "^1 * ^4[MpBhop] ^1Recording with this feature ^4Activated ^1is ^3NOT SAFE");
  257. }
  258. }
  259. else
  260. {
  261. if( g_iFhAddToFullPack )
  262. {
  263. unregister_forward(FM_AddToFullPack, g_iFhAddToFullPack, 1);
  264. g_iFhAddToFullPack = 0;
  265. }
  266. }
  267. }
  268. return PLUGIN_HANDLED;
  269. }
  270.  
  271. public MpBhopMenuAction(id, iKey)
  272. {
  273. new iEnt = g_iAdminDoor[id];
  274.  
  275. switch( iKey )
  276. {
  277. case 0:
  278. {
  279. if( GetEntBits(g_bBlocks, iEnt) )
  280. {
  281. ClearEntBits(g_bBlocks, iEnt);
  282. ColorChat(id, _, "^1 * ^4[MpBhop] ^1Block has been set ^4movable^1.");
  283. }
  284. else
  285. {
  286. ColorChat(id, _, "^1 * ^4[MpBhop] ^1Block is already ^4movable^1.");
  287. }
  288. }
  289. case 1:
  290. {
  291. if( GetEntBits(g_bBlocks, iEnt) )
  292. {
  293. ColorChat(id, TERRORIST, "^1 * ^4[MpBhop] ^1Block is already ^3unmovable^1.");
  294. }
  295. else
  296. {
  297. SetEntBits(g_bBlocks, iEnt);
  298. ColorChat(id, TERRORIST, "^1 * ^4[MpBhop] ^1Block has been set ^3unmovable^1.");
  299. }
  300. }
  301. }
  302. return PLUGIN_HANDLED;
  303. }
  304.  
  305. ShowMpBhopMenu(id, bIsBlocked)
  306. {
  307. new szMenuBody[150];
  308.  
  309. formatex(szMenuBody, charsmax(szMenuBody), "\rMpBhop Menu^n\dThis block is actually \
  310. \y%smovable \d:^n^n\r1\w. Mark this block as movable^n\r2\w. Mark this block as \
  311. unmovable^n^n\r0\w. Exit", bIsBlocked ? "un" : "");
  312.  
  313. show_menu(id, KEYS, szMenuBody, _, "MpBhop Menu");
  314. }
  315.  
  316. public ClientCommand_BhopMenu(id, level, cid)
  317. {
  318. if( cmd_access(id, level, cid, 1) )
  319. {
  320. new iEnt, crap, iClassType;
  321. get_user_aiming(id, iEnt, crap);
  322. if( iEnt && pev_valid(iEnt) )
  323. {
  324. new szClassName[32];
  325. pev(iEnt, pev_classname, szClassName, charsmax(szClassName));
  326. if( TrieGetCell(g_iBlocksClass, szClassName, iClassType) )
  327. {
  328. g_bitPresentClass |= 1<<iClassType;
  329. g_iAdminDoor[id] = iEnt;
  330. ShowMpBhopMenu(id, !!(GetEntBits(g_bBlocks, iEnt)));
  331. }
  332. }
  333. }
  334. return PLUGIN_HANDLED;
  335. }
  336.  
  337. public AddToFullPack(es, e, iEnt, id, hostflags, player, pSet)
  338. {
  339. if( !player && GetIdBits(g_bAdmin, id) && GetEntBits(g_bBlocks, iEnt) )
  340. {
  341. set_es(es, ES_RenderMode, kRenderTransColor);
  342. set_es(es, ES_RenderAmt, 150);
  343. set_es(es, ES_RenderColor, {120,75,170});
  344. set_es(es, ES_RenderFx, kRenderFxGlowShell);
  345. }
  346. }
  347.  
  348. public Event_Health(id)
  349. {
  350. if( is_user_alive(id) )
  351. {
  352. SetIdBits(g_bAlives, id);
  353. }
  354. else
  355. {
  356. ClearIdBits(g_bAlives, id);
  357. }
  358. }
  359.  
  360. public Event_ResetHUD(id)
  361. {
  362. if( is_user_alive(id) )
  363. {
  364. SetIdBits(g_bAlives, id);
  365. }
  366. else
  367. {
  368. ClearIdBits(g_bAlives, id);
  369. }
  370. }
  371.  
  372. public CBasePlayer_PreThink(id)
  373. {
  374. if( GetIdBits(g_bAlives, id) )
  375. {
  376. if( GetIdBits(g_bTeleported, id) )
  377. {
  378. ClearIdBits(g_bTeleported, id);
  379. set_pev(id, pev_velocity, 0);
  380. return;
  381. }
  382.  
  383. static fFlags;
  384. fFlags = pev(id, pev_flags);
  385. if( fFlags & FL_ONGROUND )
  386. {
  387. static iEnt, Float:flVelocity[3], Float:flVecOrigin[3];
  388. iEnt = pev(id, pev_groundentity);
  389. if( !iEnt || !(GetEntBits(g_bBlocks, iEnt)) )
  390. {
  391. if( iEnt )
  392. {
  393. pev(iEnt, pev_velocity, flVelocity);
  394. if( flVelocity[0] || flVelocity[1] || flVelocity[2] )
  395. {
  396. ClearIdBits(g_bOnGround, id);
  397. return;
  398. }
  399. }
  400.  
  401. if( fFlags & FL_DUCKING )
  402. {
  403. pev(id, pev_origin, flVecOrigin);
  404. flVecOrigin[2] += 18.0;
  405. engfunc(EngFunc_TraceHull, flVecOrigin, flVecOrigin, IGNORE_MONSTERS, HULL_HUMAN, id, 0);
  406. if( !get_tr2(0, TR_StartSolid) && !get_tr2(0, TR_AllSolid) && get_tr2(0, TR_InOpen) )
  407. {
  408. flVecOrigin[2] -= 18.0;
  409. xs_vec_copy(flVecOrigin, g_flJumpOrigin[id]);
  410. SetIdBits(g_bOnGround, id);
  411. }
  412. else
  413. {
  414. ClearIdBits(g_bOnGround, id);
  415. return;
  416. }
  417. }
  418. else
  419. {
  420. pev(id, pev_origin, g_flJumpOrigin[id]);
  421. SetIdBits(g_bOnGround, id);
  422. }
  423. }
  424. else
  425. {
  426. ClearIdBits(g_bOnGround, id);
  427. }
  428. }
  429. else if( GetIdBits(g_bOnGround, id) )
  430. {
  431. ClearIdBits(g_bOnGround, id);
  432. pev(id, pev_v_angle, g_flJumpAnglesGravity[id]);
  433. pev(id, pev_gravity, g_flJumpAnglesGravity[id][2]);
  434. }
  435. }
  436. }
  437.  
  438. public TriggerMultiple_Touch(iEnt, id)
  439. {
  440. if( (IsPlayer(id) || g_bBlockEntityTouch) && GetEntBits(g_bBlocks, iEnt) )
  441. {
  442. return HAM_SUPERCEDE;
  443. }
  444. return HAM_IGNORED;
  445. }
  446.  
  447. public Touch_Block(iBlock, id)
  448. {
  449. if( !(GetEntBits(g_bBlocks, iBlock)) )
  450. {
  451. return HAM_IGNORED;
  452. }
  453.  
  454. if( IsPlayer(id) )
  455. {
  456. if( ~GetIdBits(g_bAlives, id) )
  457. {
  458. return HAM_SUPERCEDE;
  459. }
  460. }
  461. else
  462. {
  463. return g_bBlockEntityTouch ? HAM_SUPERCEDE : HAM_IGNORED;
  464. }
  465.  
  466. if( pev(id, pev_groundentity) != iBlock )
  467. {
  468. return HAM_SUPERCEDE;
  469. }
  470.  
  471. if( g_iBlock[id] != iBlock )
  472. {
  473. g_iBlock[id] = iBlock;
  474. g_flFirstTouch[id] = get_gametime();
  475. return HAM_SUPERCEDE;
  476. }
  477.  
  478. static Float:flTime;
  479. flTime = get_gametime();
  480.  
  481. if( flTime - g_flFirstTouch[id] > 0.25 ) // 0.3 == exploit on cg_cbblebhop oO
  482. {
  483. if( flTime - g_flFirstTouch[id] > 0.7 )
  484. {
  485. g_flFirstTouch[id] = flTime;
  486. return HAM_SUPERCEDE;
  487. }
  488.  
  489. #if defined MAKE_TELEPORT_FX
  490. new iOrigin[3];
  491. get_user_origin(id, iOrigin);
  492. message_begin(MSG_PVS, SVC_TEMPENTITY, iOrigin);
  493. write_byte(TE_TELEPORT);
  494. write_coord(iOrigin[0]);
  495. write_coord(iOrigin[1]);
  496. write_coord(iOrigin[2]);
  497. message_end();
  498. #endif
  499. static const Float:VEC_DUCK_HULL_MIN[3] = {-16.0, -16.0, -18.0 };
  500. static const Float:VEC_DUCK_HULL_MAX[3] = { 16.0, 16.0, 32.0 };
  501. static const Float:VEC_DUCK_VIEW[3] = { 0.0, 0.0, 12.0 };
  502.  
  503. set_pev(id, pev_flags, pev(id, pev_flags) | FL_DUCKING);
  504. engfunc(EngFunc_SetSize, id, VEC_DUCK_HULL_MIN, VEC_DUCK_HULL_MAX);
  505. engfunc(EngFunc_SetOrigin, id, g_flJumpOrigin[id]);
  506. set_pev(id, pev_view_ofs, VEC_DUCK_VIEW);
  507.  
  508. set_pev(id, pev_v_angle, 0);
  509. set_pev(id, pev_velocity, 0);
  510. set_pev(id, pev_angles, g_flJumpAnglesGravity[id]);
  511. set_pev(id, pev_punchangle, 0);
  512. set_pev(id, pev_fixangle, 1);
  513. set_pev(id, pev_gravity, g_flJumpAnglesGravity[id][2]);
  514.  
  515. SetIdBits(g_bTeleported, id);
  516. }
  517. return HAM_SUPERCEDE;
  518. }
  519.  
  520. public ConsoleCommand_MpBhop(id, lvl, cid)
  521. {
  522. if( cmd_access(id, lvl, cid, 2) )
  523. {
  524. new szStatus[2];
  525. read_argv(1, szStatus, charsmax(szStatus));
  526. static HamHook:iHhPlayerPreThink;
  527. switch( szStatus[0] )
  528. {
  529. case '0':
  530. {
  531. if( !g_bActive )
  532. {
  533. return PLUGIN_HANDLED;
  534. }
  535. if( iHhPlayerPreThink )
  536. {
  537. DisableHamForward( iHhPlayerPreThink );
  538. }
  539. SetTouch( false );
  540. g_bActive = false;
  541.  
  542. if( g_bSafeInform )
  543. {
  544. client_print(0, print_console, "MpBhop has been De-Activated, recording is now SAFE");
  545. ColorChat(0, TERRORIST, "^1 * ^4[MpBhop] ^1MpBhop has been ^3De-Activated^1, recording is now ^4SAFE");
  546. }
  547. }
  548. case '1':
  549. {
  550. if( g_bActive )
  551. {
  552. return PLUGIN_HANDLED;
  553. }
  554. if( !iHhPlayerPreThink )
  555. {
  556. RegisterHam(Ham_Player_PreThink, "player", "CBasePlayer_PreThink");
  557. }
  558. else
  559. {
  560. EnableHamForward( iHhPlayerPreThink );
  561. }
  562. SetTouch( true );
  563. g_bActive = true;
  564. if( g_bSafeInform )
  565. {
  566. client_print(0, print_console, "MpBhop has been Activated, recording is now NOT SAFE");
  567. ColorChat(0, TERRORIST, "^1 * ^4[MpBhop] ^1MpBhop has been ^4Activated^1, recording is now ^3NOT SAFE");
  568. }
  569. }
  570. default:
  571. {
  572. client_print(id, print_console, "Usage: kz_mpbhop <0/1>");
  573. }
  574. }
  575. }
  576. return PLUGIN_HANDLED;
  577. }
  578.  
  579. public ConsoleCommand_EntityTouch(id, lvl, cid)
  580. {
  581. if( cmd_access(id, lvl, cid, 2) )
  582. {
  583. new szStatus[2];
  584. read_argv(1, szStatus, charsmax(szStatus));
  585. g_bBlockEntityTouch = !!str_to_num(szStatus);
  586. }
  587. return PLUGIN_HANDLED;
  588. }
  589.  
  590. Set_Doors()
  591. {
  592. new iDoor = FM_NULLENT;
  593. new Float:flMovedir[3], szNoise[32], Float:flSize[3], Float:flDmg, Float:flSpeed;
  594. new const szNull[] = "common/null.wav";
  595. while( (iDoor = engfunc(EngFunc_FindEntityByString, iDoor, "classname", "func_door")) )
  596. {
  597. // definitly not a bhop block
  598. pev(iDoor, pev_dmg, flDmg);
  599. if( flDmg )
  600. {
  601. #if defined MAKE_DOORS_SILENT
  602. set_pev(iDoor, pev_noise1, szNull); // while here, set healing doors silent xD
  603. set_pev(iDoor, pev_noise2, szNull);
  604. set_pev(iDoor, pev_noise3, szNull);
  605. #endif
  606. continue;
  607. }
  608.  
  609. // this func_door goes UP, not a bhop block ?
  610. // or bhop block but let them move up (kz_megabhop for example)
  611. pev(iDoor, pev_movedir, flMovedir);
  612. if( flMovedir[2] > 0.0 )
  613. {
  614. continue;
  615. }
  616.  
  617. // too small : real door ? could this one be skipped ?
  618. pev(iDoor, pev_size, flSize);
  619. if( flSize[0] < 24.0 || flSize[1] < 24.0 )
  620. {
  621. continue;
  622. }
  623.  
  624. // real door ? not all doors make sound though...
  625. pev(iDoor, pev_noise1, szNoise, charsmax(szNoise));
  626. if( szNoise[0] && !equal(szNoise, szNull) )
  627. {
  628. continue;
  629. }
  630. pev(iDoor, pev_noise2, szNoise, charsmax(szNoise));
  631. if( szNoise[0] && !equal(szNoise, szNull) )
  632. {
  633. continue;
  634. }
  635.  
  636. // not a bhop block ? too slow // this at least detects the big ent on kzsca_sewerbhop
  637. pev(iDoor, pev_speed, flSpeed);
  638. if( flSpeed < 100.0 )
  639. {
  640. continue;
  641. }
  642.  
  643. // Pray for this to be a bhop block
  644. SetEntBits(g_bBlocksByPlugin, iDoor);
  645. SetEntBits(g_bBlocks, iDoor);
  646. g_bitPresentClass |= 1<<FUNC_DOOR;
  647. }
  648. }
  649.  
  650. Set_Wall_Toggle()
  651. {
  652. new iEnt = FM_NULLENT;
  653. while( (iEnt = engfunc(EngFunc_FindEntityByString, iEnt, "classname", "func_wall_toggle")) )
  654. {
  655. g_bitPresentClass |= 1<<FUNC_WALL_TOGGLE;
  656. SetEntBits(g_bBlocksByPlugin, iEnt);
  657. SetEntBits(g_bBlocks, iEnt);
  658. }
  659. }
  660.  
  661. Set_Buttons()
  662. {
  663. new const szStartStopButtons[][] = {"counter_start", "clockstartbutton", "firsttimerelay", "multi_start",
  664. "counter_start_button", "counter_off", "clockstop", "clockstopbutton", "multi_stop", "stop_counter" };
  665.  
  666. new Trie:tButtons = TrieCreate();
  667.  
  668. for(new i; i<sizeof(szStartStopButtons); i++)
  669. {
  670. TrieSetCell(tButtons, szStartStopButtons[i], 1);
  671. }
  672.  
  673. new iEnt = FM_NULLENT, szTarget[32];
  674. while( (iEnt = engfunc(EngFunc_FindEntityByString, iEnt, "classname", "func_button")) )
  675. {
  676. if( pev(iEnt, pev_spawnflags) & SF_BUTTON_TOUCH_ONLY )
  677. {
  678. pev(iEnt, pev_target, szTarget, charsmax(szTarget));
  679. if( !szTarget[0] || !TrieKeyExists(tButtons, szTarget))
  680. {
  681. pev(iEnt, pev_targetname, szTarget, charsmax(szTarget));
  682. if( !szTarget[0] || !TrieKeyExists(tButtons, szTarget))
  683. {
  684. g_bitPresentClass |= 1<<FUNC_BUTTON;
  685. SetEntBits(g_bBlocksByPlugin, iEnt);
  686. SetEntBits(g_bBlocks, iEnt);
  687. }
  688. }
  689. }
  690. }
  691. TrieDestroy(tButtons);
  692. }
  693.  
  694. SetTouch(bool:bActive)
  695. {
  696. static HamHook:iHhBlockTouch[BlocksClasses];
  697. if( bActive )
  698. {
  699. static const szClassesAndHandlers[BlocksClasses][][] = {
  700. {"func_door", "Touch_Block"},
  701. {"func_wall_toggle", "Touch_Block"},
  702. {"func_button", "Touch_Block"},
  703. {"trigger_multiple", "TriggerMultiple_Touch"}
  704. };
  705. for(new i; i<sizeof(iHhBlockTouch); i++)
  706. {
  707. if( g_bitPresentClass & (1<<i) )
  708. {
  709. if( iHhBlockTouch[i] )
  710. {
  711. EnableHamForward( iHhBlockTouch[i] );
  712. }
  713. else
  714. {
  715. iHhBlockTouch[i] = RegisterHam(Ham_Touch, szClassesAndHandlers[i][0], szClassesAndHandlers[i][1]);
  716. }
  717. }
  718. }
  719. }
  720. else
  721. {
  722. for(new i; i<sizeof(iHhBlockTouch); i++)
  723. {
  724. if( g_bitPresentClass & (1<<i) && iHhBlockTouch[i] )
  725. {
  726. DisableHamForward( iHhBlockTouch[i] );
  727. }
  728. }
  729. }
  730. }
  731.  
  732. SetBlocksByFile()
  733. {
  734. get_localinfo("amxx_datadir", szConfigFile, charsmax(szConfigFile));
  735. format(szConfigFile, charsmax(szConfigFile), "%s/mpbhop", szConfigFile);
  736. if( !dir_exists(szConfigFile) )
  737. {
  738. mkdir(szConfigFile);
  739. }
  740.  
  741. new szMapName[32];
  742. get_mapname(szMapName, charsmax(szMapName));
  743. format(szConfigFile, charsmax(szConfigFile), "%s/%s.dat", szConfigFile, szMapName);
  744.  
  745. new iFile = fopen(szConfigFile, "rt");
  746. if( iFile )
  747. {
  748. new szDatas[48], szBrushOrigin[3][13], szType[2], Float:flBrushOrigin[3], i, iEnt;
  749. new szClassName[32], iClassType;
  750. while( !feof(iFile) )
  751. {
  752. fgets(iFile, szDatas, charsmax(szDatas));
  753. trim(szDatas);
  754. if(!szDatas[0] || szDatas[0] == ';' || szDatas[0] == '#' || (szDatas[0] == '/' && szDatas[1] == '/'))
  755. {
  756. continue;
  757. }
  758.  
  759. parse(szDatas, szBrushOrigin[0], 12, szBrushOrigin[1], 12, szBrushOrigin[2], 12, szType, charsmax(szType));
  760. for(i=0; i<3; i++)
  761. {
  762. flBrushOrigin[i] = str_to_float( szBrushOrigin[i] );
  763. }
  764.  
  765. iEnt = FindEntByBrushOrigin( flBrushOrigin );
  766. if( iEnt )
  767. {
  768. if( szType[0] == '1' )
  769. {
  770. pev(iEnt, pev_classname, szClassName, charsmax(szClassName));
  771. if( TrieGetCell(g_iBlocksClass, szClassName, iClassType) )
  772. {
  773. g_bitPresentClass |= 1<<iClassType;
  774. }
  775. SetEntBits(g_bBlocks, iEnt);
  776. }
  777. else
  778. {
  779. ClearEntBits(g_bBlocks, iEnt);
  780. }
  781. }
  782. }
  783. fclose(iFile);
  784. }
  785. }
  786.  
  787. FindEntByBrushOrigin(Float:flOrigin[3])
  788. {
  789. new Float:flBrushOrigin[3];
  790. for( new iEnt=g_iMaxPlayers+1; iEnt<=g_iMaxEnts; iEnt++ )
  791. {
  792. if( pev_valid(iEnt) )
  793. {
  794. fm_get_brush_entity_origin(iEnt, flBrushOrigin);
  795. if( xs_vec_nearlyequal(flBrushOrigin, flOrigin) )
  796. {
  797. return iEnt;
  798. }
  799. }
  800. }
  801. return 0;
  802. }
  803.  
  804. fm_get_brush_entity_origin(ent, Float:orig[3])
  805. {
  806. new Float:Min[3], Float:Max[3];
  807.  
  808. pev(ent, pev_origin, orig);
  809. pev(ent, pev_mins, Min);
  810. pev(ent, pev_maxs, Max);
  811.  
  812. orig[0] += (Min[0] + Max[0]) * 0.5;
  813. orig[1] += (Min[1] + Max[1]) * 0.5;
  814. orig[2] += (Min[2] + Max[2]) * 0.5;
  815.  
  816. return 1;
  817. }
  818.  
  819. SetTriggerMultiple()
  820. {
  821. new iEnt = FM_NULLENT, szTarget[32], iBlock;
  822. while( (iEnt = engfunc(EngFunc_FindEntityByString, iEnt, "classname", "trigger_multiple")) )
  823. {
  824. pev(iEnt, pev_target, szTarget, charsmax(szTarget));
  825. iBlock = engfunc(EngFunc_FindEntityByString, -1, "targetname", szTarget);
  826. if( iBlock && GetEntBits(g_bBlocks, iBlock) )
  827. {
  828. g_bitPresentClass |= 1<<TRIGGER_MULTIPLE;
  829. SetEntBits(g_bBlocksByPlugin, iEnt);
  830. SetEntBits(g_bBlocks, iEnt);
  831. }
  832. }
  833. }
  834.  
  835. public plugin_end()
  836. {
  837. TrieDestroy(g_iBlocksClass);
  838. delete_file(szConfigFile);
  839.  
  840. new iFile;
  841.  
  842. new Float:flBrushOrigin[3], bool:bUnMovable;
  843. for(new iEnt=g_iMaxPlayers+1; iEnt<=g_iMaxEnts; iEnt++)
  844. {
  845. if( pev_valid(iEnt) )
  846. {
  847. bUnMovable = !!( GetEntBits(g_bBlocks, iEnt) );
  848. if( bUnMovable
  849. != !!( GetEntBits(g_bBlocksByPlugin, iEnt) ) )
  850. {
  851. if( !iFile )
  852. {
  853. iFile = fopen(szConfigFile, "wt");
  854. }
  855. fm_get_brush_entity_origin(iEnt, flBrushOrigin);
  856. fprintf(iFile, "%f %f %f %d^n",
  857. flBrushOrigin[0], flBrushOrigin[1], flBrushOrigin[2], bUnMovable);
  858. }
  859. }
  860. }
  861. if( iFile )
  862. {
  863. fclose( iFile );
  864. }
  865. }
  866.  
  867. ColorChat(id, COLOR=DONT_CHANGE, fmt[], any:...)
  868. {
  869. new szMsg[192];
  870. szMsg[0] = 0x04;
  871. vformat(szMsg[1], charsmax(szMsg)-1, fmt, 4);
  872.  
  873. new szTeam[11], MSG_DEST = id ? MSG_ONE : MSG_ALL;
  874.  
  875. static const szTeamNames[Colors][] = {"", "TERRORIST", "CT", "SPECTATOR"};
  876.  
  877. if( COLOR )
  878. {
  879. Send_TeamInfo(id, szTeamNames[COLOR], MSG_DEST);
  880. }
  881.  
  882. static iSayText;
  883.  
  884. if( iSayText || (iSayText = get_user_msgid("SayText")) )
  885. {
  886. message_begin(MSG_DEST, iSayText, _, id);
  887. {
  888. write_byte(id ? id : g_iMaxPlayers);
  889. write_string(szMsg);
  890. }
  891. message_end();
  892. }
  893.  
  894. if( COLOR )
  895. {
  896. if( id || is_user_connected(g_iMaxPlayers) )
  897. {
  898. get_user_team(id ? id : g_iMaxPlayers, szTeam, charsmax(szTeam));
  899. Send_TeamInfo(id, szTeam, MSG_DEST);
  900. }
  901. else
  902. {
  903. Send_TeamInfo(0, "UNASSIGNED", MSG_DEST);
  904. }
  905. }
  906. }
  907.  
  908. Send_TeamInfo(const id, const szTeam[], MSG_DEST)
  909. {
  910. static iTeamInfo;
  911. if( iTeamInfo || (iTeamInfo = get_user_msgid("TeamInfo")) )
  912. {
  913. message_begin(MSG_DEST, iTeamInfo, _, id);
  914. {
  915. write_byte(id ? id : g_iMaxPlayers);
  916. write_string(szTeam);
  917. }
  918. message_end();
  919. }
  920. }


Hozzászólás jelentése
Vissza a tetejére
   
HozzászólásElküldve:2013.01.12. 13:06 
Offline
Jómunkásember
Avatar

Csatlakozott:2012.08.24. 19:42
Hozzászólások:320
Megköszönt másnak: 11 alkalommal
Megköszönték neki: 30 alkalommal
az a pályától függ ha jól tudom.


Hozzászólás jelentése
Vissza a tetejére
   
HozzászólásElküldve:2013.01.12. 13:16 
Offline
Újonc

Csatlakozott:2013.01.12. 12:09
Hozzászólások:3
TysOn írta:
az a pályától függ ha jól tudom.


Deathrun szerverre kell :D


Hozzászólás jelentése
Vissza a tetejére
   
Hozzászólások megjelenítése: Rendezés 
Új téma nyitása Hozzászólás a témához  [3 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: Google [Bot] valamint 13 vendég


Nyithatsz új témákat ebben a fórumban.
Válaszolhatsz egy témára ebben a fórumban.
Nem szerkesztheted a hozzászólásaidat ebben a fórumban.
Nem törölheted a hozzászólásaidat ebben a fórumban.
Nem küldhetsz csatolmányokat ebben a fórumban.

Keresés:
Ugrás:  
Powered by phpBB® Forum Software © phpBB Limited
Magyar fordítás © Magyar phpBB Közösség
Portal: Kiss Portal Extension © Michael O'Toole