Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2014
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.37 KB | None | 0 0
  1. #include < amxmodx >
  2. #include < dhudmessage >
  3. #include < hamsandwich >
  4. #include < fakemeta >
  5. #include < engine >
  6. #define fm_create_entity(%1) engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, %1))
  7.  
  8. #pragma semicolon 1
  9.  
  10. native cs_set_user_model( id, const model[ ] );
  11. native cs_reset_user_model( id );
  12.  
  13. forward ForwardHitGrenade( client );
  14.  
  15. const gMaxWinSounds = 16;
  16. const gMaxInfectSounds = 3;
  17.  
  18. new const g_WinnerSound[ gMaxWinSounds ][ ] =
  19. {
  20. "HitandRun/intwin_01.mp3",
  21. "HitandRun/intwin_02.mp3",
  22. "HitandRun/intwin_03.mp3",
  23. "HitandRun/intwin_04.mp3",
  24. "HitandRun/intwin_05.mp3",
  25. "HitandRun/intwin_06.mp3",
  26. "HitandRun/intwin_07.mp3",
  27. "HitandRun/intwin_08.mp3",
  28. "HitandRun/intwin_09.mp3",
  29. "HitandRun/intwin_10.mp3",
  30. "HitandRun/intwin_11.mp3",
  31. "HitandRun/intwin_12.mp3",
  32. "HitandRun/intwin_13.mp3",
  33. "HitandRun/intwin_14.mp3",
  34. "HitandRun/intwin_15.mp3",
  35. "HitandRun/intwin_16.mp3"
  36. };
  37.  
  38. new const gInfectSounds[ gMaxInfectSounds ][ ] =
  39. {
  40. "HitandRun/hit_sound_1.wav",
  41. "HitandRun/hit_sound_2.wav",
  42. "HitandRun/hit_sound_3.wav"
  43. };
  44.  
  45. new const g_Events[ ][ ] =
  46. {
  47. "\rScout NoZoom Round [ x2 Cash + XP]",
  48. "\yAwp Round [x2 Cash + XP]",
  49. "Gravity Round [x2 Cash + XP]",
  50. "\dSpeed Round [x2 Cash + XP]",
  51. "Knife Round [x2 Cash + XP]"
  52. };
  53.  
  54. new const g_Event[ ][ ] =
  55. {
  56. "nozoom",
  57. "awpround",
  58. "gravityround",
  59. "speedround",
  60. "knife"
  61. };
  62.  
  63. new const gBuyCommands[ ][ ] =
  64. {
  65. "jointeam", "usp", "glock",
  66. "deagle", "p228", "elites", "fn57", "m3",
  67. "xm1014", "mp5", "tmp", "p90", "mac10",
  68. "ump45", "ak47", "galil", "famas", "sg552",
  69. "m4a1", "aug", "scout", "awp", "g3sg1", "sg550",
  70. "m249", "vest", "vesthelm", "flash",
  71. "hegren", "sgren", "defuser", "nvgs", "shield",
  72. "primammo", "secammo", "km45", "9x19mm",
  73. "nighthawk", "228compact", "12gauge",
  74. "autoshotgun", "smg", "mp", "c90", "cv47",
  75. "defender", "clarion", "krieg552",
  76. "bullpup", "magnum", "d3au1", "krieg550",
  77. "buyammo1", "buyammo2", "buy"
  78. };
  79.  
  80. enum _:Teams
  81. {
  82. FM_TEAM_UNASSIGNED,
  83. FM_TEAM_T,
  84. FM_TEAM_CT,
  85. FM_TEAM_SPECTATOR
  86. };
  87.  
  88. new WinnerBeam;
  89. new g_LastHit;
  90. new g_szLastHit;
  91. new event;
  92. new gSyncHud[ 4 ];
  93. new ForwardWonGame;
  94. new ForwardReturn;
  95. new ForwardBack;
  96. new g_szRoundEvent;
  97. new gMaxPlayers;
  98. new g_szKind[ 5 ];
  99. new HamHook:NoZoom;
  100.  
  101. new bool:GameStarted;
  102. new bool:g_szTwoInfect;
  103. new bool:gStartingGame;
  104. new bool:WinnerEffect;
  105. new bool:AntiRetry;
  106. new bool:gFalling[ 33 ];
  107. new bool:knifer;
  108. new bool:eventt;
  109.  
  110. new Float:g_HnrDieTimer;
  111.  
  112. public plugin_init()
  113. {
  114. register_plugin( "Advanced HitAndRun", "1.0", "noamb7" );
  115.  
  116. for( new i = 0; i < sizeof gBuyCommands; i++ )
  117. {
  118. register_clcmd( gBuyCommands[ i ], "ClcmdBlock" );
  119. }
  120.  
  121. register_clcmd( "say /start", "StartGame" );
  122.  
  123. RegisterHam( Ham_Spawn, "player", "FwdHamPlayerSpawn", true );
  124. RegisterHam( Ham_TakeDamage, "player", "FwdHamTakeDamage", true );
  125. RegisterHam( Ham_Killed, "player", "FwdHamPlayerKilled", true );
  126.  
  127. register_event( "HLTV", "NewRound", "a", "1=0", "2=0" );
  128. register_logevent( "RoundEnd", 2, "1=Round_End" );
  129. register_event( "ScreenFade","FlashedEvent","be","4=255","5=255","6=255","7>199" );
  130. register_event( "CurWeapon", "Event_CurWeapon", "be","1=1" );
  131.  
  132. register_forward( FM_PlayerPreThink, "FwdClientPreThink" );
  133. register_forward( FM_PlayerPostThink, "FwdClientPostThink" );
  134.  
  135. gSyncHud[ 0 ] = CreateHudSyncObj( );
  136. gSyncHud[ 1 ] = CreateHudSyncObj( );
  137. gSyncHud[ 2 ] = CreateHudSyncObj( );
  138. gSyncHud[ 3 ] = CreateHudSyncObj( );
  139.  
  140. NoZoom = RegisterHam( Ham_Weapon_SecondaryAttack, "weapon_scout", "OnSecondaryAttack" );
  141.  
  142. ForwardWonGame = CreateMultiForward( "ForwardWonTheGame", ET_IGNORE, FP_CELL );
  143. event = CreateMultiForward( "ForwardEvent", ET_IGNORE, FP_CELL );
  144. gMaxPlayers = get_maxplayers( );
  145.  
  146.  
  147. }
  148.  
  149. public plugin_precache()
  150. {
  151. for( new i = 0; i < gMaxWinSounds; i++ )
  152. {
  153. precache_sound( g_WinnerSound[ i ] );
  154. }
  155.  
  156. for( new i = 0; i < gMaxInfectSounds; i++ )
  157. {
  158. precache_sound( gInfectSounds[ i ] );
  159. }
  160.  
  161.  
  162. precache_model( "models/player/Adv-Sick/Adv-Sick.mdl" );
  163. precache_model( "models/HitandRun/v_He.mdl" );
  164. precache_model( "models/HitandRun/p_He.mdl" );
  165. precache_model( "models/HitandRun/v_Flash.mdl" );
  166. precache_model( "models/HitandRun/p_Flash.mdl" );
  167.  
  168.  
  169. WinnerBeam = precache_model( "sprites/zbeam2.spr" );
  170. }
  171.  
  172. public plugin_cfg()
  173. {
  174. set_cvar_num( "mp_roundtime", 9 );
  175. set_cvar_num( "mp_freezetime", 0 );
  176. set_cvar_num( "mp_limitteams", 0 );
  177. set_cvar_num( "mp_autoteambalance", 0 );
  178. set_cvar_num( "fn_enabled", 1 );
  179. set_cvar_string( "humans_join_team", "T" );
  180. }
  181.  
  182. public ClcmdBlock( iPlayer )
  183. {
  184. return PLUGIN_HANDLED;
  185. }
  186.  
  187. public OnSecondaryAttack( const iEntity )
  188. {
  189. return HAM_SUPERCEDE;
  190. }
  191.  
  192. public knife( )
  193. {
  194. knifer = true;
  195. Check();
  196. }
  197.  
  198. public NewRound()
  199. {
  200. for( new i; i < sizeof g_szKind; i++ )
  201. {
  202. g_szKind[ i ] = 0;
  203. }
  204. set_lights( "m" );
  205. DisableHamForward( NoZoom );
  206.  
  207. g_HnrDieTimer = 20.0;
  208. g_szRoundEvent++;
  209. knifer = false;
  210. eventt = false;
  211.  
  212. ColorChat( 0, "there will be event in: %i", 9 - g_szRoundEvent );
  213.  
  214. WinnerEffect = false;
  215. set_hudmessage( 255, 0, 0, -1.0, 0.3, 2, 6.0, 6.0 );
  216. ShowSyncHudMsg( 0, gSyncHud[ 0 ], "Spawn Protection is Enabled For 5 Seconds!" );
  217.  
  218. set_dhudmessage( 255, 0, 0, -1.0, 0.71, 2, 0.0, 4.0 );
  219. show_dhudmessage( 0, "The Game is About To Begin!" );
  220.  
  221. set_hudmessage( 255, 0, 0, -1.0, 0.75, 2, 4.0, 6.0 );
  222. ShowSyncHudMsg( 0, gSyncHud[ 1 ], "HitandRun" );
  223.  
  224. set_task( 0.1, "StopEffect" );
  225. g_szRoundEvent == 9 ? set_task( 1.0, "dddVote" ) : set_task( 7.6, "Check" );
  226. }
  227.  
  228. public dddVote( )
  229. {
  230. g_szRoundEvent = 0;
  231. new menu = menu_create( "event, choose event KIND", "handlerdddd" );
  232.  
  233. new st[ 3 ];
  234. for( new k; k < sizeof g_Events; k++ )
  235. {
  236. num_to_str( k, st, 2 );
  237. menu_additem( menu, g_Events[ k ], st );
  238. }
  239.  
  240. new players[ 32 ], szNum;
  241. get_players( players, szNum, "ach" );
  242.  
  243. for( new i; i < szNum; i++ )
  244. {
  245. menu_display( players[ i ], menu );
  246. }
  247. set_task( 10.0, "checkvotesd" );
  248. }
  249.  
  250. public checkvotesd( )
  251. {
  252. new Winner = 0;
  253. for( new i = 0; i < sizeof g_Events; i++ )
  254. {
  255. if( g_szKind[ Winner ] < g_szKind[ i ] )
  256. Winner = i;
  257. }
  258. ColorChat( 0, "The Event %s won, it will start NOW", g_Events[ Winner ] );
  259.  
  260. set_dhudmessage( 255, 0, 0, -1.0, 0.18, 0, 6.0, 5.0 );
  261. show_dhudmessage( 0, "%s Will Start!!!!", g_Events[ Winner ] );
  262. eventt = true;
  263. ExecuteForward( event, ForwardBack, 0 );
  264.  
  265.  
  266. set_task( 4.0, g_Event[ Winner ] );
  267. }
  268.  
  269. public handlerdddd( client, menu, item )
  270. {
  271. if( item == MENU_EXIT )
  272. {
  273. return;
  274. }
  275. new szName[ 32 ];
  276. get_user_name( client, szName, 32 );
  277.  
  278. ColorChat( 0, "%s has voted for: %s", szName, g_Events[ item ] );
  279. g_szKind[ item ]++;
  280. return;
  281. }
  282.  
  283. public nozoom( )
  284. {
  285. EnableHamForward( NoZoom );
  286. Check();
  287. }
  288.  
  289. public awpround( )
  290. {
  291. if( GetAliveContesters() >= 2 )
  292. {
  293. GetRandomPlayer();
  294.  
  295. if( GetAliveContesters( ) > 10 )
  296. GetOtherPlayer( );
  297.  
  298. GameStarted = true;
  299. set_task( 0.1, "GameCountDown" );
  300. set_task( 14.0, "TickTock" );
  301. set_task( 0.2, "start" );
  302.  
  303. GetPlayers();
  304.  
  305. for( new i, j = gMaxPlayers; i <= j; i++ )
  306. {
  307. fm_give_item( i, "weapon_awp" );
  308. }
  309. }
  310. }
  311.  
  312. public speedround( )
  313. {
  314. if( GetAliveContesters() >= 2 )
  315. {
  316. GetRandomPlayer();
  317.  
  318. if( GetAliveContesters( ) > 10 )
  319. GetOtherPlayer( );
  320.  
  321. GameStarted = true;
  322. set_task( 0.1, "GameCountDown" );
  323. set_task( 14.0, "TickTock" );
  324. set_task( 0.2, "start" );
  325. }
  326. for( new i, j = gMaxPlayers; i <= j; i++ )
  327. {
  328. if( is_user_alive( i ) )
  329. {
  330. set_pev( i, pev_maxspeed, 400.0 );
  331. fm_give_item( i, "weapon_scout" );
  332. }
  333. }
  334. ColorChat( 0, "Started!! Good Luck" );
  335. }
  336.  
  337. public gravityround( )
  338. {
  339. if( GetAliveContesters() >= 2 )
  340. {
  341. GetRandomPlayer();
  342.  
  343. if( GetAliveContesters( ) > 10 )
  344. GetOtherPlayer( );
  345.  
  346. GameStarted = true;
  347. set_task( 0.1, "GameCountDown" );
  348. set_task( 14.0, "TickTock" );
  349. set_task( 0.2, "start" );
  350. }
  351. for( new i, j = gMaxPlayers; i <= j; i++ )
  352. {
  353. if( is_user_alive( i ) )
  354. {
  355. set_pev( i, pev_gravity, 500.0 / 800.0 );
  356. fm_give_item( i, "weapon_scout" );
  357. }
  358. }
  359. ColorChat( 0, "Started!! Good Luck" );
  360. }
  361.  
  362. public client_disconnect( client )
  363. {
  364. remove_task( client );
  365. if( g_LastHit == client )
  366. {
  367. if( GetAliveContesters() >= 2 && g_HnrDieTimer != 0 )
  368. {
  369. GetRandomPlayer();
  370. }
  371. }
  372. }
  373.  
  374. public client_putinserver( client )
  375. {
  376. client_cmd( client, "cl_minmodels 1" );
  377. if( !gStartingGame && !GameStarted )
  378. set_task( 3.0, "CheckStart", client );
  379. }
  380.  
  381. public CheckStart( client )
  382. {
  383. if( is_user_alive( client ) && !gStartingGame && !GameStarted )
  384. {
  385. gStartingGame = true;
  386. set_cvar_num( "sv_restart", 3 );
  387. }
  388. }
  389.  
  390. public ForwardHitGrenade( client )
  391. {
  392. if( g_LastHit != client )
  393. {
  394. g_LastHit = client;
  395. MakeInfected();
  396. }
  397. }
  398.  
  399. public RoundEnd()
  400. {
  401. knifer = false;
  402. event = false;
  403. set_task( 1.0, "Stop" );
  404. }
  405.  
  406. public StartGame( client )
  407. {
  408. if( is_user_alive( client ) && !GameStarted && get_user_flags( client ) & ADMIN_BAN )
  409. {
  410. set_cvar_num( "sv_restart", 3 );
  411. }
  412. }
  413.  
  414. public FwdHamPlayerSpawn( client )
  415. {
  416. if( !is_user_alive( client ) || !is_user_connected( client ) )
  417. return HAM_IGNORED;
  418.  
  419. fm_strip_user_weapons( client );
  420. fm_give_item( client, "weapon_knife" );
  421. //fm_set_user_rendering( client );
  422. set_pev( client, pev_gravity, 1.0 );
  423. if( AntiRetry )
  424. {
  425. user_silentkill( client );
  426. }
  427. return HAM_IGNORED;
  428. }
  429.  
  430.  
  431. public Check()
  432. {
  433. if( GetAliveContesters() >= 2 )
  434. {
  435. GetRandomPlayer();
  436.  
  437. if( GetAliveContesters( ) > 10 )
  438. GetOtherPlayer( );
  439.  
  440. GameStarted = true;
  441. set_task( 0.1, "GameCountDown" );
  442. set_task( 14.0, "TickTock" );
  443. set_task( 0.2, "start" );
  444. GetPlayers();
  445. for( new i, j = gMaxPlayers; i <= j; i++ )
  446. {
  447. PrepareClient( i );
  448. }
  449. }
  450. else
  451. {
  452. ColorChat( 0, "^4Minimum ^1Players Needed To ^3Start ^1A Game Are:^4 2" );
  453. GameStarted = false;
  454. }
  455. gStartingGame = false;
  456. }
  457.  
  458. GetOtherPlayer( )
  459. {
  460. new players[ 32 ], szNum, szName[ 32 ];
  461. get_players( players, szNum, "ache", "TERRORIST" );
  462.  
  463. if( szNum )
  464. g_szLastHit = players[ random( szNum ) ];
  465.  
  466. get_user_name( g_szLastHit, szName, charsmax( szName ) );
  467.  
  468. set_hudmessage( 255, 0, 0, -1.0, 0.8, 1, 0.0, 6.0 );
  469. ShowSyncHudMsg( 0, gSyncHud[ 3 ], "^"%s^" Was Randomly Picked...", szName );
  470. }
  471.  
  472. public start()
  473. {
  474. AntiRetry = true;
  475. }
  476.  
  477. public FwdHamPlayerKilled( victim )
  478. {
  479. static iOrigin[ 3 ];
  480. get_user_origin( victim, iOrigin );
  481.  
  482. message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
  483. write_byte( TE_BEAMCYLINDER );
  484. write_coord( iOrigin[ 0 ] );
  485. write_coord( iOrigin[ 1 ] );
  486. write_coord( iOrigin[ 2 ] - 20 );
  487. write_coord( iOrigin[ 0 ] );
  488. write_coord( iOrigin[ 1 ] );
  489. write_coord( iOrigin[ 2 ] + 200 );
  490. write_short( WinnerBeam );
  491. write_byte( 0 );
  492. write_byte( 1 );
  493. write_byte( 6 );
  494. write_byte( 1000 );
  495. write_byte( 1 );
  496. write_byte( random( 250 ) );
  497. write_byte( random( 250 ) );
  498. write_byte( random( 250 ) );
  499. write_byte( 200 );
  500. write_byte( 0 );
  501. message_end( );
  502.  
  503. GetPlayers();
  504. }
  505.  
  506. public StopEffect()
  507. {
  508. for( new i, j = gMaxPlayers; i <= j; i++ )
  509. {
  510. if( !is_user_connected( i ) || !is_user_alive( i ) )
  511. continue;
  512.  
  513. remove_task( i );
  514. fm_set_user_rendering( i );
  515. cs_reset_user_model( i );
  516. }
  517. }
  518.  
  519. public FlashedEvent( client )
  520. {
  521. message_begin( MSG_ONE, get_user_msgid( "ScreenFade" ) ,{ 0, 0, 0 }, client );
  522. write_short( read_data( 1 ) );
  523. write_short( read_data( 2 ) );
  524. write_short( read_data( 3 ) );
  525. write_byte( random( 250 ) );
  526. write_byte( random( 250 ) );
  527. write_byte( random( 250 ) );
  528. write_byte( read_data( 7 ) );
  529. message_end();
  530.  
  531. return PLUGIN_HANDLED;
  532. }
  533.  
  534. public Event_CurWeapon( client )
  535. {
  536. if( !is_user_alive( client ) || !is_user_connected( client ) )
  537. return PLUGIN_HANDLED;
  538.  
  539. if( knifer )
  540. {
  541. if( get_user_weapon( client ) != CSW_KNIFE )
  542. {
  543. fm_strip_user_weapons( client );
  544. fm_give_item( client, "weapon_knife" );
  545. }
  546. }
  547. switch( get_user_weapon( client ) )
  548. {
  549. case CSW_HEGRENADE:
  550. {
  551. set_pev( client, pev_viewmodel2, "models/HitandRun/v_He.mdl" );
  552. set_pev( client, pev_weaponmodel2, "models/HitandRun/p_He.mdl" );
  553. }
  554. case CSW_FLASHBANG:
  555. {
  556. set_pev( client, pev_viewmodel2, "models/HitandRun/v_Flash.mdl" );
  557. set_pev( client, pev_weaponmodel2, "models/HitandRun/p_Flash.mdl" );
  558. }
  559.  
  560.  
  561. }
  562. return PLUGIN_HANDLED;
  563. }
  564.  
  565. public FwdClientPostThink( client )
  566. {
  567. if( is_user_alive( client ) && is_user_connected( client ) )
  568. {
  569. if( gFalling[ client ] )
  570. {
  571. set_pev( client, pev_watertype, -3 );
  572. }
  573. }
  574. }
  575.  
  576. public FwdClientPreThink( client )
  577. {
  578. if( is_user_alive( client ) && is_user_connected( client ) )
  579. {
  580. if( pev( client, pev_flFallVelocity ) >= 350.0 )
  581. {
  582. gFalling[ client ] = true;
  583. }
  584. else
  585. {
  586. gFalling[ client ] = false;
  587. }
  588. set_pev( client, pev_fuser2 , 0.0 );
  589. }
  590. }
  591.  
  592. public GameCountDown( )
  593. {
  594. if( GameStarted )
  595. {
  596. if( g_HnrDieTimer <= 0.0 )
  597. {
  598. Kill_user( g_LastHit );
  599.  
  600. if( GetAliveContesters() >= 2 )
  601. {
  602. remove_task( );
  603.  
  604. g_HnrDieTimer = 20.0;
  605.  
  606. set_task( 14.0, "TickTock" );
  607. set_task( 2.5, "GetRandomPlayer" );
  608.  
  609. if( GetAliveContesters( ) > 10 )
  610. set_task( 2.5, "GetOtherPlayer" );
  611.  
  612. set_task( 2.5, "GameCountDown" );
  613.  
  614. return PLUGIN_HANDLED;
  615. }
  616. else
  617. {
  618. if( !WinnerEffect )
  619. {
  620. CheckGameResult();
  621. }
  622. }
  623. }
  624. else
  625. {
  626. static szName[ 32 ];
  627. get_user_name( g_LastHit, szName, 32 );
  628.  
  629. set_dhudmessage( 255, 0, 0, -1.0, 0.71, 1, 0.0, 0.12, 0.0, 0.0 );
  630. show_dhudmessage( 0, "Time Left: %.1f Seconds!^n^"%s^" Was Last Hit", g_HnrDieTimer, szName );
  631.  
  632. g_HnrDieTimer -= 0.1;
  633. }
  634. set_task( 0.1, "GameCountDown" );
  635. }
  636. return PLUGIN_HANDLED;
  637. }
  638.  
  639. public TickTock()
  640. {
  641. }
  642.  
  643. GetPlayers()
  644. {
  645. new Alives;
  646. for( new i, j = gMaxPlayers; i <= j; i++ )
  647. {
  648. if( !is_user_alive( i ) || !is_user_connected( i ) )
  649. continue;
  650. Alives++;
  651.  
  652. }
  653. ColorChat( 0, "Online:^4 %i ^3| ^1Alive:^4 %i ^3| ^1Dead:^4 %i",
  654. get_playersnum( 1 ),
  655. Alives,
  656. get_playersnum( 1 ) - Alives
  657. );
  658. }
  659.  
  660. Kill_user( index )
  661. {
  662. if( g_szTwoInfect )
  663. {
  664. user_kill( g_szLastHit );
  665. g_szTwoInfect = false;
  666. }
  667. if( is_user_alive( index ) )
  668. {
  669. client_cmd( 0, "spk ^"ambience/thunder_clap.wav^"" );
  670. user_silentkill( index );
  671. }
  672. }
  673.  
  674. CheckGameResult()
  675. {
  676. new Winner;
  677. if( GetAliveContesters() == 1 && !WinnerEffect )
  678. {
  679. for( new i, j = gMaxPlayers; i <= j; i++ )
  680. {
  681. if( !is_user_alive( i ) || !is_user_connected( i ) ||
  682. fm_get_user_team( i ) != FM_TEAM_T )
  683. continue;
  684.  
  685. Winner = i;
  686. }
  687. set_lights( "b" );
  688. WinnerEffect = true;
  689. static WinnerName[ 32 ];
  690. get_user_name( Winner, WinnerName, 32 );
  691.  
  692. client_cmd( 0, "mp3 play sound/%s", g_WinnerSound[ random( gMaxWinSounds ) ] );
  693.  
  694. set_task( 0.15, "ShowWinner", Winner );
  695. //set_task( 3.0, "SplashEffect", Winner, _, _, "b" );
  696. set_task( 13.0, "StartG" );
  697.  
  698. set_task( 17.0, "Stop" );
  699. ColorChat( 0, "Congratulations ^4%s, ^1Won %i ^"^4Cash^1^",^1 %i ^4Exp ^1For Winning %i ^4Players!",
  700. WinnerName,
  701. get_playersnum( 1 ) * eventt ? 400 : 200,
  702. eventt ? get_playersnum( 1 ) * 2 : get_playersnum( 1 ),
  703. get_playersnum( 1 ) - 1
  704. );
  705.  
  706. ExecuteForward( ForwardWonGame, ForwardReturn, Winner );
  707. //DHUD_display(id, dhud, Float:fInterval = 0.1, channel = 4, const szMessage[], any:...);
  708. //DHUD_display( 0, DynamicWin, _, 1, "Congratulations, %s Won The Game!!", WinnerName );
  709.  
  710. set_dhudmessage( 255, 0, 0, -1.0, 0.2, 0, 6.0, 12.0 );
  711. show_dhudmessage( 0, "%s Is The Winner!", WinnerName );
  712. }
  713. return PLUGIN_HANDLED;
  714. }
  715.  
  716. public StartG( )
  717. {
  718. set_hudmessage( 255, 0, 0, -1.0, 0.3, 1, 6.0, 6.0 );
  719. ShowSyncHudMsg( 0, gSyncHud[ 1 ], "The Game Will Start in 4 Seconds" );
  720. }
  721.  
  722. public Stop()
  723. {
  724. AntiRetry = false;
  725. GameStarted = false;
  726. gStartingGame = true;
  727. g_szTwoInfect = false;
  728. set_cvar_num( "sv_restart", 1 );
  729. }
  730.  
  731. public SplashEffect( client )
  732. {
  733. if( is_user_alive( client ) )
  734. {
  735. static iOrigin[ 3 ];
  736. get_user_origin( client, iOrigin );
  737.  
  738. message_begin( MSG_ALL, SVC_TEMPENTITY );
  739. write_byte( TE_LAVASPLASH );
  740. write_coord( iOrigin[ 0 ] );
  741. write_coord( iOrigin[ 1 ] );
  742. write_coord( iOrigin[ 2 ] - 26 );
  743. message_end( );
  744. }
  745. }
  746.  
  747. public FwdHamTakeDamage( victim, inflictor, attacker, damage, damagebits )
  748. {
  749. if( !is_user_alive( victim ) || !is_user_alive( attacker ) || !GameStarted )
  750. return HAM_IGNORED;
  751.  
  752. if( g_LastHit != victim && victim != attacker && attacker == g_LastHit )
  753. {
  754. g_LastHit = victim;
  755.  
  756. MakeInfected( );
  757. }
  758. return HAM_IGNORED;
  759. }
  760.  
  761. public GetRandomPlayer()
  762. {
  763. new players[ 32 ], pnum;
  764. get_players( players, pnum, "ae", "TERRORIST" );
  765.  
  766. if( !pnum )
  767. return PLUGIN_HANDLED;
  768.  
  769. g_LastHit = players[ random( pnum ) ];
  770.  
  771. static szName[ 33 ];
  772. get_user_name( g_LastHit, szName, 32 );
  773.  
  774. ShakeScreen( g_LastHit );
  775.  
  776. for( new i, j = gMaxPlayers; i <= j; i++ )
  777. {
  778. if ( !is_user_connected( i ) || !is_user_alive( i ) )
  779. continue;
  780.  
  781. cs_reset_user_model( i );
  782. //fm_set_user_rendering( i );
  783. }
  784. ColorChat( 0, "^"^4%s^1^" Was ^3Randomly ^1Choosen...", szName );
  785. cs_set_user_model( g_LastHit, "Adv-Sick" );
  786. //fm_set_user_rendering( g_LastHit, kRenderFxGlowShell, random( 255 ), random( 255 ), random( 255 ), kRenderTransAlpha, 200 );
  787.  
  788. client_cmd( g_LastHit, "spk ^"sound/%s^"", gInfectSounds[ random( gMaxInfectSounds ) ] );
  789.  
  790. MakeSickness( g_LastHit );
  791. return PLUGIN_CONTINUE;
  792. }
  793.  
  794. MakeInfected()
  795. {
  796. ShakeScreen( g_LastHit );
  797.  
  798. static szName[ 33 ];
  799. get_user_name( g_LastHit, szName, 32 );
  800.  
  801. for( new i, j = gMaxPlayers; i <= j; i++ )
  802. {
  803. //set_hudmessage( 255, 0, 0, -1.0, 0.75, 1, 0.0, 6.0 );
  804. //ShowSyncHudMsg( i, g_szTwoInfect ? gSyncHud[ random( 3 ) ] : gSyncHud[ 2 ], "^"%s^" Was Last Hit...", szName );
  805.  
  806. if ( !is_user_alive( i ) || !is_user_connected( i ) )
  807. continue;
  808.  
  809. //fm_set_user_rendering( i );
  810. cs_reset_user_model( i );
  811. }
  812. cs_set_user_model( g_LastHit, "Adv-Sick" );
  813. //fm_set_user_rendering( g_LastHit, kRenderFxGlowShell, random( 255 ), random( 255 ), random( 255 ), kRenderTransAlpha, 120 );
  814.  
  815. client_cmd( g_LastHit, "spk ^"sound/%s^"", gInfectSounds[ random( gMaxInfectSounds ) ] );
  816.  
  817. MakeSickness( g_LastHit );
  818. }
  819.  
  820. MakeSickness( index )
  821. {
  822. static Origin[ 3 ];
  823. get_user_origin( index, Origin );
  824.  
  825. message_begin( MSG_PVS, SVC_TEMPENTITY, Origin );
  826. write_byte( TE_IMPLOSION );
  827. write_coord( Origin[ 0 ] );
  828. write_coord( Origin[ 1 ] );
  829. write_coord( Origin[ 2 ] );
  830. write_byte( 128 );
  831. write_byte( 20 );
  832. write_byte( 3 );
  833. message_end();
  834. }
  835.  
  836. public ShowWinner( client )
  837. {
  838. new RGB[ 3 ];
  839. RGB[ 0 ] = random( 250 );
  840. RGB[ 1 ] = random( 250 );
  841. RGB[ 2 ] = random( 250 );
  842.  
  843. static Origin[ 3 ];
  844. get_user_origin( client, Origin );
  845.  
  846. message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
  847. write_byte( TE_BEAMTORUS );
  848. write_coord( Origin[ 0 ] );
  849. write_coord( Origin[ 1 ] );
  850. write_coord( Origin[ 2 ] );
  851. write_coord( Origin[ 0 ] );
  852. write_coord( Origin[ 1 ] );
  853. write_coord( Origin[ 2 ] + 400 );
  854. write_short( WinnerBeam );
  855. write_byte( 0 );
  856. write_byte( 1 );
  857. write_byte( 7 );
  858. write_byte( 80 );
  859. write_byte( 1 );
  860. write_byte( RGB[ 0 ] );
  861. write_byte( RGB[ 1 ] );
  862. write_byte( RGB[ 2 ] );
  863. write_byte( 200 );
  864. write_byte( 0 );
  865. message_end( );
  866.  
  867. set_task( 0.21 ,"ShowWinner", client );
  868. }
  869.  
  870. PrepareClient( index )
  871. {
  872. if( !is_user_alive( index ) || !is_user_connected( index ) )
  873. return PLUGIN_HANDLED;
  874.  
  875. fm_strip_user_weapons( index );
  876.  
  877. fm_give_item( index, "weapon_knife" );
  878. fm_give_item( index, "weapon_scout" );
  879. fm_give_item( index, "weapon_hegrenade" );
  880. fm_give_item( index, "weapon_flashbang" );
  881. fm_give_item( index, "weapon_flashbang" );
  882. fm_give_item( index, "weapon_smokegrenade" );
  883. return PLUGIN_HANDLED;
  884. }
  885.  
  886. GetAliveContesters()
  887. {
  888. new Contesters;
  889. for( new i, j = gMaxPlayers; i <= j; i++ )
  890. {
  891. if( !is_user_alive( i ) || fm_get_user_team( i ) != FM_TEAM_T )
  892. continue;
  893.  
  894. Contesters++;
  895. }
  896. return Contesters;
  897. }
  898.  
  899. stock fm_get_user_team( client )
  900. {
  901. return get_pdata_int( client, 114 );
  902. }
  903.  
  904. stock fm_set_user_team( client, team )
  905. {
  906. set_pdata_int( client, 114, team );
  907.  
  908. static const TeamInfo[ Teams ][ ] =
  909. {
  910. "UNASSIGNED",
  911. "TERRORIST",
  912. "CT",
  913. "SPECTATOR"
  914. };
  915. message_begin( MSG_ALL, get_user_msgid( "TeamInfo" ) ) ;
  916. write_byte( client );
  917. write_string( TeamInfo[ team ] );
  918. message_end( );
  919. }
  920.  
  921. stock fm_strip_user_weapons( client )
  922. {
  923. new ent = fm_create_entity( "player_weaponstrip" );
  924.  
  925. if ( !pev_valid( ent ) )
  926. return 0;
  927.  
  928. dllfunc( DLLFunc_Spawn, ent );
  929. dllfunc( DLLFunc_Use, ent, client );
  930. engfunc( EngFunc_RemoveEntity, ent );
  931.  
  932. return 1;
  933. }
  934.  
  935. stock fm_give_item( client, const item[ ] )
  936. {
  937. if ( !equal( item, "weapon_", 7 ) && !equal( item, "ammo_", 5 )
  938. && !equal( item, "item_", 5 ) && !equal( item, "tf_weapon_", 10 ) )
  939. return 0;
  940.  
  941. new ent = fm_create_entity( item );
  942.  
  943. if ( !pev_valid( ent ) )
  944. return 0;
  945.  
  946. new Float:origin[3];
  947.  
  948. pev( client, pev_origin, origin );
  949.  
  950. set_pev( ent, pev_origin, origin );
  951. set_pev( ent, pev_spawnflags, pev( ent, pev_spawnflags ) | SF_NORESPAWN );
  952.  
  953. dllfunc( DLLFunc_Spawn, ent );
  954.  
  955. new save = pev( ent, pev_solid );
  956.  
  957. dllfunc( DLLFunc_Touch, ent, client );
  958.  
  959. if ( pev( ent, pev_solid ) != save )
  960. return ent;
  961.  
  962. engfunc( EngFunc_RemoveEntity, ent );
  963.  
  964. return -1;
  965. }
  966.  
  967. stock fm_set_user_rendering( index, fx = kRenderFxNone, r = 255, g = 255, b = 255, render = kRenderNormal, amount = 16 )
  968. {
  969. new Float:RenderColor[ 3 ];
  970. RenderColor[ 0 ] = float( r );
  971. RenderColor[ 1 ] = float( g );
  972. RenderColor[ 2 ] = float( b );
  973.  
  974. set_pev( index, pev_renderfx, fx );
  975. set_pev( index, pev_rendercolor, RenderColor );
  976. set_pev( index, pev_rendermode, render );
  977. set_pev( index, pev_renderamt, float( amount ) );
  978.  
  979. return 1;
  980. }
  981.  
  982. ShakeScreen( index )
  983. {
  984. message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "ScreenShake" ), _, index );
  985. write_short( 10 << 12 );
  986. write_short( 5 << 12 );
  987. write_short( 10 << 12 );
  988. message_end( );
  989. }
  990.  
  991. stock cs_set_user_bpammo( client, weaponid, amnt )
  992. {
  993. static offset;
  994.  
  995. switch( weaponid )
  996. {
  997. case CSW_AWP: offset = 377;
  998. case CSW_SCOUT,CSW_AK47: offset = 378;
  999. case CSW_FAMAS,CSW_M4A1,CSW_AUG: offset = 380;
  1000. case CSW_DEAGLE: offset = 384;
  1001. case CSW_FLASHBANG: offset = 387;
  1002. case CSW_HEGRENADE: offset = 388;
  1003. case CSW_SMOKEGRENADE: offset = 389;
  1004.  
  1005. default: return 0;
  1006. }
  1007. set_pdata_int( client, offset, amnt, 5 );
  1008. return 1;
  1009. }
  1010.  
  1011. stock ColorChat( const client, const string[ ], { Float, Sql, Resul, _ } :... )
  1012. {
  1013. new msg[ 191 ], players[ 32 ], count = 1;
  1014.  
  1015. static len; len = formatex( msg, charsmax(msg), "^4| HitandRun | Agent:^1 " );
  1016. vformat( msg[ len ], charsmax( msg ) - len, string, 3 );
  1017.  
  1018. if( client ) players[ 0 ] = client;
  1019. else get_players( players,count, "ch" );
  1020.  
  1021. for( new i = 0; i < count; i++ )
  1022. {
  1023. if( is_user_connected( players[ i ] ) )
  1024. {
  1025. message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ),_, players[ i ] );
  1026. write_byte( players[ i ] );
  1027. write_string( msg );
  1028. message_end( );
  1029. }
  1030. }
  1031. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement