hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2025.06.15. 19:15



Jelenlévő felhasználók

Jelenleg 348 felhasználó van jelen :: 1 regisztrált, 0 rejtett és 347 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]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  [1 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: Bhop menü spawnoláskor
HozzászólásElküldve:2014.01.31. 21:00 
Offline
Tud valamit
Avatar

Csatlakozott:2013.08.22. 10:48
Hozzászólások:119
Megköszönt másnak: 33 alkalommal
Megköszönték neki: 3 alkalommal
Sziasztok!
Valaki ebbe beírná hogy ha a player spawnol, akkor megjelenjen? (Nem kell leírni hogy az ékezetek nem jók, tudom)
SMA Forráskód: [ Mindet kijelol ]
  1. /*
  2. *
  3. * KZ Menu by Xellath
  4. * Version 1.0.2
  5. *
  6. * CHANGELOG:
  7. *
  8. * -
  9. *
  10. * v1.0.1b - Re-release, rewritten.
  11. * v1.0.1c - Semiclip fixed, index out of bounds error fixed aswell.
  12. * v1.0.2 - Cleaned up the ugly code, and fixed some small errors + added 2 cvars.
  13. *
  14. * -
  15. *
  16. * CVARS:
  17. *
  18. * -
  19. *
  20. * kzmenu_enabled ( 1 | 0 ) On/Off : - Sets the state of the plugin enable/disabled. Default: 1 (on)
  21. * kzmenu_respawndelay ( integer ) : - Value for the delay of respawning Default: 2 (seconds)
  22. *
  23. * -
  24. *
  25. * NOTE:
  26. *
  27. * -
  28. *
  29. * Previous versions is not supported!
  30. *
  31. * -
  32. */
  33.  
  34. #include < amxmodx >
  35. #include < fakemeta >
  36. #include < hamsandwich >
  37. #include < engine >
  38. #include < fun >
  39.  
  40. #pragma semicolon 1
  41.  
  42. const MAX_CLIENTS = 32;
  43.  
  44. const MAX_STRING_LEN = 10;
  45. const VECTOR_SIZE = 3;
  46.  
  47. enum _:PlayerBools
  48. {
  49. BOOL_CHECK,
  50. BOOL_FALL,
  51. BOOL_RESPAWN,
  52. BOOL_SOLID,
  53. BOOL_RESTORED
  54. };
  55.  
  56. new bool:g_bGlobalBools[ MAX_CLIENTS + 1 ][ PlayerBools ];
  57.  
  58. new Float:g_fCheckpointPos[ MAX_CLIENTS + 1 ][ VECTOR_SIZE ],
  59. Float:g_fLastCheckpointPos[ MAX_CLIENTS + 1 ][ VECTOR_SIZE ],
  60. g_iCheckpointCount[ MAX_CLIENTS + 1 ];
  61.  
  62. new g_hEnabledCvar,
  63. g_hDelayCvar;
  64.  
  65. new g_iMaxClients;
  66.  
  67. enum _:RGBA
  68. {
  69. R,
  70. G,
  71. B,
  72. A
  73. };
  74.  
  75. new g_hSemiclipCvar,
  76. g_hSemiclipColorCvar,
  77. g_iColors[ RGBA ];
  78.  
  79. public plugin_init( )
  80. {
  81. register_plugin( "KZ Menu", "1.0.2", "Xellath" );
  82.  
  83. g_hEnabledCvar = register_cvar( "kzmenu_enabled", "1" );
  84. g_hDelayCvar = register_cvar( "kzmenu_respawndelay", "2" );
  85. g_hSemiclipCvar = register_cvar( "kzmenu_semiclip", "1" );
  86. g_hSemiclipColorCvar = register_cvar( "kzmenu_semiclip_color", "255 255 255 85" );
  87.  
  88. CvarToRGB( g_hSemiclipColorCvar );
  89.  
  90. g_iMaxClients = get_maxplayers( );
  91.  
  92. RegisterHam( Ham_Killed, "player", "Forward_ClientKilled" );
  93. RegisterHam( Ham_TakeDamage, "player", "Forward_ClientTakeDamage" );
  94.  
  95. register_forward( FM_AddToFullPack, "Forward_AddToFullPack", 1 );
  96.  
  97. register_clcmd( "say /kzmenu", "ClientCommand_ShowMenu" );
  98. register_clcmd( "say /weapons", "ClientCommand_AllWeapons" );
  99. register_clcmd( "say /checkpoint", "ClientCommand_CreateCheckpoint" );
  100. register_clcmd( "say /cp", "ClientCommand_CreateCheckpoint" );
  101. register_clcmd( "say /gocheck", "ClientCommand_GotoCheckpoint" );
  102. register_clcmd( "say /tp", "ClientCommand_GotoCheckpoint" );
  103. register_clcmd( "say /stuck", "ClientCommand_LastCheckpoint" );
  104. register_clcmd( "say /respawn", "ClientCommand_RespawnPlayer" );
  105. register_clcmd( "say /reset", "ClientCommand_ResetChecks" );
  106. }
  107.  
  108. public client_disconnect( iClient )
  109. {
  110. for( new iBool; iBool < PlayerBools; iBool++ )
  111. {
  112. g_bGlobalBools[ iClient ][ iBool ] = false;
  113. }
  114.  
  115. g_iCheckpointCount[ iClient ] = 0;
  116. }
  117.  
  118. public client_putinserver( iClient )
  119. {
  120. client_disconnect( iClient );
  121. }
  122.  
  123. public Forward_ClientKilled( iVictim, iAttacker, iShouldGib )
  124. {
  125. if( 1 <= iVictim <= g_iMaxClients )
  126. {
  127. if( g_bGlobalBools[ iVictim ][ BOOL_RESPAWN ] && get_pcvar_num( g_hEnabledCvar ) )
  128. {
  129. set_task( get_pcvar_float( g_hDelayCvar ), "ClientCommand_RespawnPlayer", iVictim );
  130. }
  131. }
  132. }
  133.  
  134. public Forward_ClientTakeDamage( iVictim, iInflictor, iAttacker, Float:fDamage, iDamagebits )
  135. {
  136. if( g_bGlobalBools[ iVictim ][ BOOL_FALL ] && get_pcvar_num( g_hEnabledCvar ) )
  137. {
  138. if( iDamagebits & DMG_FALL )
  139. {
  140. client_print( iVictim, print_chat, "[KZ] You took %d damage from falling!", floatround( fDamage ) );
  141. }
  142. }
  143. }
  144.  
  145. public Forward_AddToFullPack( iEntityState, _e, iEnt, iHost, iHostflags, iPlayer, pSet )
  146. {
  147. if( iPlayer )
  148. {
  149. if( g_bGlobalBools[ iHost ][ BOOL_SOLID ] && g_bGlobalBools[ iEnt ][ BOOL_SOLID ] && get_pcvar_num( g_hEnabledCvar ) )
  150. {
  151. set_es( iEntityState, ES_Solid, SOLID_NOT );
  152.  
  153. if( get_pcvar_num( g_hSemiclipCvar ) )
  154. {
  155. set_es( iEntityState, ES_RenderMode, kRenderTransAlpha );
  156. set_es( iEntityState, ES_RenderAmt, g_iColors[ A ] );
  157. set_es( iEntityState, ES_RenderColor, g_iColors[ R ], g_iColors[ G ], g_iColors[ B ] );
  158. }
  159. }
  160. }
  161. }
  162.  
  163. public client_PreThink( iClient )
  164. {
  165. if( !get_pcvar_num( g_hEnabledCvar ) )
  166. {
  167. return;
  168. }
  169.  
  170. static iPlayer, LastThink;
  171.  
  172. if( LastThink > iClient )
  173. {
  174. for( iPlayer = 1; iPlayer <= g_iMaxClients; iPlayer++ )
  175. {
  176. if( !is_user_alive( iPlayer ) )
  177. {
  178. g_bGlobalBools[ iPlayer ][ BOOL_SOLID ] = false;
  179.  
  180. continue;
  181. }
  182.  
  183. g_bGlobalBools[ iPlayer ][ BOOL_SOLID ] = entity_get_int( iPlayer, EV_INT_solid ) == SOLID_SLIDEBOX ? true : false;
  184. }
  185. }
  186.  
  187. LastThink = iClient;
  188.  
  189. if( !g_bGlobalBools[ iClient ][ BOOL_SOLID ] )
  190. {
  191. return;
  192. }
  193.  
  194. for( iPlayer = 1; iPlayer <= g_iMaxClients; iPlayer++ )
  195. {
  196. if ( !g_bGlobalBools[ iPlayer ][ BOOL_SOLID ] || iClient == iPlayer )
  197. {
  198. continue;
  199. }
  200.  
  201. entity_set_int( iPlayer, EV_INT_solid, SOLID_NOT );
  202. g_bGlobalBools[ iPlayer ][ BOOL_RESTORED ] = true;
  203. }
  204. }
  205.  
  206. public client_PostThink( iClient )
  207. {
  208. if( !get_pcvar_num( g_hEnabledCvar ) )
  209. {
  210. return;
  211. }
  212.  
  213. static iPlayer;
  214.  
  215. for( iPlayer = 1; iPlayer <= g_iMaxClients; iPlayer++ )
  216. {
  217. if( g_bGlobalBools[ iPlayer ][ BOOL_RESTORED ] )
  218. {
  219. entity_set_int( iPlayer, EV_INT_solid, SOLID_SLIDEBOX );
  220.  
  221. g_bGlobalBools[ iPlayer ][ BOOL_RESTORED ] = false;
  222. }
  223. }
  224. }
  225.  
  226. public ClientCommand_ShowMenu( iClient )
  227. {
  228. if( !get_pcvar_num( g_hEnabledCvar ) )
  229. return;
  230.  
  231. new hMenu = menu_create( "[BHOP] Menu", "KZMenuHandler" );
  232.  
  233. menu_additem( hMenu, "CheckPoint létrehozása", "1" );
  234. menu_additem( hMenu, "Vissza az utolsó checkpointhoz!", "2", _, menu_makecallback( "KZMenuCallback" ) );
  235. menu_additem( hMenu, "CheckPoint helyreállítása!", "3", _, menu_makecallback( "KZMenuCallback" ) );
  236. menu_additem( hMenu, "CheckPointok törlése!", "4", _, menu_makecallback( "KZMenuCallback" ) );
  237.  
  238. menu_additem( hMenu, "Minden fegyver addolása!", "5" );
  239. menu_additem( hMenu, "Ki-Be", "6" );
  240.  
  241. menu_display( iClient, hMenu, 0 );
  242. }
  243.  
  244. public KZMenuCallback( iClient, hMenu, iItem )
  245. {
  246. return g_bGlobalBools[ iClient ][ BOOL_CHECK ] ? ITEM_ENABLED : ITEM_DISABLED;
  247. }
  248.  
  249. public KZMenuHandler( iClient, hMenu, iItem )
  250. {
  251. if( iItem == MENU_EXIT )
  252. {
  253. menu_destroy( hMenu );
  254. return PLUGIN_HANDLED;
  255. }
  256.  
  257. new szInfo[ 3 ];
  258. new iAccess, iCallback;
  259. menu_item_getinfo( hMenu, iItem, iAccess, szInfo, 2, _, _, iCallback );
  260.  
  261. switch( str_to_num( szInfo ) )
  262. {
  263. case 1: ClientCommand_CreateCheckpoint( iClient );
  264. case 2: ClientCommand_GotoCheckpoint( iClient );
  265. case 3: ClientCommand_LastCheckpoint( iClient );
  266. case 4: ClientCommand_ResetChecks( iClient );
  267. case 5: ClientCommand_AllWeapons( iClient );
  268. case 6:
  269. {
  270. AttributesMenu( iClient );
  271.  
  272. goto HandlerFinish;
  273. }
  274.  
  275. }
  276.  
  277. ClientCommand_ShowMenu( iClient );
  278.  
  279. HandlerFinish:
  280. {
  281. menu_destroy( hMenu );
  282. return PLUGIN_HANDLED;
  283. }
  284. }
  285.  
  286. public AttributesMenu( iClient )
  287. {
  288. new hMenu = menu_create( "KZ Menu -> On/Off Attributes Menu:", "AttributesMenuHandler" );
  289.  
  290. new szOption[ 32 ];
  291.  
  292. formatex( szOption, 31, "Godmode: %s", ( get_user_godmode( iClient ) ? "\yOn" : "\rOff" ) );
  293. menu_additem( hMenu, szOption, "1" );
  294. formatex( szOption, 31, "Noclip: %s^n", ( get_user_noclip( iClient ) ? "\yOn" : "\rOff" ) );
  295. menu_additem( hMenu, szOption, "2" );
  296. formatex( szOption, 31, "Auto-Respawning: %s", ( g_bGlobalBools[ iClient ][ BOOL_RESPAWN ] ? "\yOn" : "\rOff" ) );
  297. menu_additem( hMenu, szOption, "3" );
  298. formatex( szOption, 31, "Show Fall Damage: %s", ( g_bGlobalBools[ iClient ][ BOOL_FALL ] ? "\yOn" : "\rOff" ) );
  299. menu_additem( hMenu, szOption, "4" );
  300.  
  301. menu_setprop( hMenu, MPROP_EXITNAME, "Back to main menu - KZ Menu" );
  302.  
  303. menu_display( iClient, hMenu, 0 );
  304. }
  305.  
  306. public AttributesMenuHandler( iClient, hMenu, iItem )
  307. {
  308. if( iItem == MENU_EXIT )
  309. {
  310. menu_destroy( hMenu );
  311. ClientCommand_ShowMenu( iClient );
  312. return PLUGIN_HANDLED;
  313. }
  314.  
  315. new szInfo[ 3 ];
  316. new iAccess, iCallback;
  317. menu_item_getinfo( hMenu, iItem, iAccess, szInfo, 2, _, _, iCallback );
  318.  
  319. switch( str_to_num( szInfo ) )
  320. {
  321. case 1:
  322. {
  323. switch( get_user_godmode( iClient ) )
  324. {
  325. case 0: set_user_godmode( iClient, 1 );
  326. case 1: set_user_godmode( iClient, 0 );
  327. }
  328. }
  329. case 2:
  330. {
  331. switch( get_user_noclip( iClient ) )
  332. {
  333. case 0: set_user_noclip( iClient, 1 );
  334. case 1: set_user_noclip( iClient, 0 );
  335. }
  336. }
  337. case 3:
  338. {
  339. switch( g_bGlobalBools[ iClient ][ BOOL_RESPAWN ] )
  340. {
  341. case true: g_bGlobalBools[ iClient ][ BOOL_RESPAWN ] = false;
  342. case false: g_bGlobalBools[ iClient ][ BOOL_RESPAWN ] = true;
  343. }
  344. }
  345. case 4:
  346. {
  347. switch( g_bGlobalBools[ iClient ][ BOOL_FALL ] )
  348. {
  349. case true: g_bGlobalBools[ iClient ][ BOOL_FALL ] = false;
  350. case false: g_bGlobalBools[ iClient ][ BOOL_FALL ] = true;
  351. }
  352. }
  353. }
  354.  
  355. AttributesMenu( iClient );
  356. return PLUGIN_HANDLED;
  357. }
  358.  
  359. public ClientCommand_AllWeapons( iClient )
  360. {
  361. if( is_user_alive( iClient ) && get_pcvar_num( g_hEnabledCvar ) )
  362. {
  363. new const szWeaponNames[ ][ ] =
  364. {
  365. "weapon_p228",
  366. "weapon_scout",
  367. "weapon_xm1014",
  368. "weapon_mac10",
  369. "weapon_aug",
  370. "weapon_elite",
  371. "weapon_fiveseven",
  372. "weapon_ump45",
  373. "weapon_sg550",
  374. "weapon_galil",
  375. "weapon_famas",
  376. "weapon_usp",
  377. "weapon_glock18",
  378. "weapon_awp",
  379. "weapon_mp5navy",
  380. "weapon_m249",
  381. "weapon_m3",
  382. "weapon_m4a1",
  383. "weapon_tmp",
  384. "weapon_g3sg1",
  385. "weapon_deagle",
  386. "weapon_sg552",
  387. "weapon_ak47",
  388. "weapon_p90"
  389. };
  390.  
  391. for( new i; i < sizeof( szWeaponNames ); i++ )
  392. {
  393. give_item( iClient, szWeaponNames[ i ] );
  394. }
  395. }
  396. }
  397.  
  398. public ClientCommand_CreateCheckpoint( iClient )
  399. {
  400. if( is_user_alive( iClient ) && get_pcvar_num( g_hEnabledCvar ) )
  401. {
  402. if( g_bGlobalBools[ iClient ][ BOOL_CHECK ] )
  403. {
  404. for( new i; i < VECTOR_SIZE; i++ )
  405. {
  406. g_fLastCheckpointPos[ iClient ][ i ] = g_fCheckpointPos[ iClient ][ i ];
  407. }
  408. }
  409.  
  410. entity_get_vector( iClient, EV_VEC_origin, g_fCheckpointPos[ iClient ] );
  411.  
  412. g_bGlobalBools[ iClient ][ BOOL_CHECK ] = true;
  413.  
  414. g_iCheckpointCount[ iClient ]++;
  415.  
  416. client_print( iClient, print_chat, "[KZ] Checkpoint %d elmentve!", g_iCheckpointCount[ iClient ] );
  417. }
  418.  
  419. return PLUGIN_HANDLED;
  420. }
  421.  
  422. public ClientCommand_GotoCheckpoint( iClient )
  423. {
  424. if( is_user_alive( iClient ) && get_pcvar_num( g_hEnabledCvar ) )
  425. {
  426. if( !g_bGlobalBools[ iClient ][ BOOL_CHECK ] )
  427. {
  428. client_print( iClient, print_chat, "[KZ] Nincsenek checkpointjaid!" );
  429. return PLUGIN_HANDLED;
  430. }
  431.  
  432. entity_set_vector( iClient, EV_VEC_origin, g_fLastCheckpointPos[ iClient ] );
  433. entity_set_vector( iClient, EV_VEC_velocity, Float:{ 0.0, 0.0, 0.0 } );
  434.  
  435. entity_set_int( iClient, EV_INT_bInDuck, 1 );
  436. entity_set_size( iClient, Float:{ -16.0, -16.0, -18.0 }, Float:{ 16.0, 16.0, 18.0 } );
  437.  
  438. entity_set_vector( iClient, EV_VEC_origin, g_fCheckpointPos[ iClient ] );
  439. }
  440.  
  441. return PLUGIN_HANDLED;
  442. }
  443.  
  444. public ClientCommand_LastCheckpoint( iClient )
  445. {
  446. if( is_user_alive( iClient ) && get_pcvar_num( g_hEnabledCvar ) )
  447. {
  448. if( !g_bGlobalBools[ iClient ][ BOOL_CHECK ] )
  449. {
  450. client_print( iClient, print_chat, "[KZ] Nincsenek előző checkpointjaid!" );
  451. return PLUGIN_HANDLED;
  452. }
  453.  
  454. client_print( iClient, print_chat, "[KZ] Visszaállás az előző checkpointra!" );
  455.  
  456. for( new i; i < VECTOR_SIZE; i++ )
  457. {
  458. g_fCheckpointPos[ iClient ][ i ] = g_fLastCheckpointPos[ iClient ][ i ];
  459. }
  460.  
  461. entity_set_vector( iClient, EV_VEC_origin, g_fLastCheckpointPos[ iClient ] );
  462. entity_set_vector( iClient, EV_VEC_velocity, Float:{ 0.0, 0.0, 0.0 } );
  463.  
  464. entity_set_int( iClient, EV_INT_bInDuck, 1 );
  465. entity_set_size( iClient, Float:{ -16.0, -16.0, -18.0 }, Float:{ 16.0, 16.0, 18.0 } );
  466.  
  467. entity_set_vector( iClient, EV_VEC_origin, g_fCheckpointPos[ iClient ] );
  468.  
  469. g_bGlobalBools[ iClient ][ BOOL_CHECK ] = false;
  470.  
  471. g_iCheckpointCount[ iClient ] = 0;
  472. }
  473.  
  474. return PLUGIN_HANDLED;
  475. }
  476.  
  477. public ClientCommand_ResetChecks( iClient )
  478. {
  479. if( !get_pcvar_num( g_hEnabledCvar ) )
  480. {
  481. return;
  482. }
  483.  
  484. g_bGlobalBools[ iClient ][ BOOL_CHECK ] = false;
  485.  
  486. g_iCheckpointCount[ iClient ] = 0;
  487.  
  488. client_print( iClient, print_chat, "[KZ] Checkpointjaid törölve!" );
  489. }
  490.  
  491. public ClientCommand_RespawnPlayer( iClient )
  492. {
  493. if( !get_pcvar_num( g_hEnabledCvar ) )
  494. {
  495. return;
  496. }
  497.  
  498. if( is_user_alive( iClient ) )
  499. {
  500. client_print( iClient, print_chat, "[KZ] Meg kell halnod, hogy a respawnt használhasd!" );
  501. return;
  502. }
  503.  
  504. ExecuteHam( Ham_CS_RoundRespawn, iClient );
  505. }
  506.  
  507. CvarToRGB( hCvar )
  508. {
  509. new szColor[ MAX_STRING_LEN ], iColor[ RGBA ][ MAX_STRING_LEN ];
  510. get_pcvar_string( hCvar, szColor, MAX_STRING_LEN - 1 );
  511.  
  512. parse( szColor,\
  513. iColor[ R ], MAX_STRING_LEN - 1,\
  514. iColor[ G ], MAX_STRING_LEN - 1,\
  515. iColor[ B ], MAX_STRING_LEN - 1,\
  516. iColor[ A ], MAX_STRING_LEN - 1
  517. );
  518.  
  519. for( new i; i < RGBA; i++ )
  520. {
  521. g_iColors[ i ] = str_to_num( iColor[ i ] );
  522. }
  523. }
  524.  
Már megvan.
SMA Forráskód: [ Mindet kijelol ]
  1. RegisterHam(Ham_Spawn, "player", "ClientCommand_ShowMenu", 1);

_________________
STEAM:
[steam]thebvn[/steam]
FaceBook oldal
Dream Deathrun: CSATLAKOZÁS!


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  [1 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 3 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