HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /*
  2.  
  3.   #@#######HH$
  4.   @X
  5.   H@#,
  6.   #######X$-. $M:
  7.   MHX$- M%@:
  8.   MHXM M%M
  9.   .;@X# #X-
  10.   %@%# MM
  11.   HX$H$X$M@@H#M#H%M =##
  12.   MX@#@HHHHH#@$$XM$X#%+###
  13.   X@##. #$H#M@X%#$MMMM# H#@M%
  14.   @#H HXHH$ #MMM####M% ;M#.#@@$
  15.   ,H XHX; XM#MMMHM H#M ###
  16.   H# .@ ####@#MM- .MM/M#M .@H$.
  17.   H# $$#MMH@##H %$M#X## :H@
  18.   $# $XH#H###### ;@H#HH H# #H## M
  19.   H# XH@+###@##;H=X=$=@@M#MM#@#M###: #H
  20.   ## M# #@MX#%:+//;:::=H M####MM@$@MM## ##
  21.   # H# #%MM#X;=:;;:;//::M###$$HHHHX@H@M## ,@
  22.   H H$ M$#M###MH;=;;;-:/+M#@@HHMHHHHXMHHM#% #M
  23.   #M: #X MM. #MM#MMX=;;/;=:M###@H#HHHHHM@HHH### @=
  24.   # MM #@ M###MH;//+/;%M#M#M@@HMH#HH#@HHM##, #@
  25.   @H#: M$M #M#MM+++%++#M###MMMMMM@M@#HH@M### M:
  26.   XXM ####M$$$$%M########MMMMMMHMMM###. ##
  27.   XH# :M##M@HH%$##M################### #:
  28.   ,@$ M#MH@#@MMM #############H##### .H@
  29.   #@ #@, XM ,#########H###. ##:
  30.   #@ ##
  31.   -# #H
  32.   M# #
  33.   ## -== Tuty ==- #
  34.   M# -H
  35.   /@## www.mapping.ro #@.
  36.   ##
  37.  
  38. ==========================================
  39.  
  40. Volley Ball Mod
  41.  
  42. by: tuty@mapping.ro
  43.  
  44. Data: 13.08.2010
  45.  
  46. ==========================================
  47.  
  48. Credite:
  49. ---------
  50. * chaosmedia90 - mapping
  51. * Nokia - pentru teste
  52. * edduard - pt teste si sugestii
  53. * ghw_chronic - ceva din sursele sale
  54. * neurotoxin - ceva din sursa lui
  55. * OT [:x] - cum sa verific sa nu mai fie mingea blocata in ziduri :)
  56. * BLUE - teste pana peste cap !
  57. * vb.mapping.ro - pentru teste
  58. * Tiesto - pentru banner
  59.  
  60. */
  61.  
  62.  
  63.  
  64.  
  65.  
  66. #include < amxmodx >
  67. #include < amxmisc >
  68.  
  69. #include < fakemeta >
  70. #include < engine >
  71.  
  72. #include < hamsandwich >
  73. #include < fun >
  74. #include < cstrike >
  75.  
  76. #pragma semicolon 1
  77.  
  78. // --| Some globals, defines, enums etc
  79.  
  80. #define PLUGIN_VERSION "2.1.0"
  81. #define HUD_LIFE_TIME 0.4
  82. #define ADMIN_ACCESS ADMIN_CFG
  83. #define WHITE_SPACE " "
  84. #define VOLLEYBALL_BALL_GRAVITY 0.6
  85.  
  86. #define TASKID_UNQ1 33322
  87. #define TASKID_UNQ2 77731
  88.  
  89. #define HUD_HIDE_RHA (1<<3)
  90. #define HUD_HIDE_TIMER (1<<4)
  91. #define HUD_HIDE_MONEY (1<<5)
  92.  
  93. #define VOLLEYBALL_CFGNAME "VolleyBall.cfg"
  94. #define VOLLEYBALL_TAG "[VolleyBall]"
  95. #define VOLLEYBALL_MODEL "models/VolleyBallMod/volleyball1.mdl"
  96. #define VOLLEYBALL_BEAMSPRITE "sprites/laserbeam.spr"
  97. #define VOLLEYBALL_EXPLOSPRITE "sprites/shockwave.spr"
  98. #define VOLLEYBALL_THUBDERSPR "sprites/lgtning.spr"
  99.  
  100. #define VOLLEYBALL_BOUNCE_SND "VolleyBallMod/boing.wav"
  101.  
  102. // --| If you want to change players custom models, rename the Terr and Ct names here
  103. // --| And add to models/player/ a folder with same CT and Terr model name!
  104.  
  105. #define VOLLEYBALL_PLAYER_CT "volleyct"
  106. #define VOLLEYBALL_PLAYER_T "volleyte"
  107.  
  108. #define MODEL_V_HANDS "models/v_volleybhands.mdl"
  109. #define MODEL_P_HANDS "models/p_volleyhands.mdl"
  110.  
  111. new const gVolleyBallEntityName[ ] = "VolleyBallEntity";
  112. new const gAmbienceSound[ ] = "ambience/thunder_clap.waV";
  113.  
  114. new Float:bFlLastHudTime[ 32 ];
  115. new Float:flBallOldOrigin[ 3 ];
  116.  
  117. new gTerroristScore = 0;
  118. new gCTScore = 0;
  119.  
  120. new gBeamFollowSprite;
  121. new gThunderSprite;
  122. new gBallDiskSprite;
  123. new gHudSync;
  124. new gHudSync1;
  125. new gHudSync2;
  126. new gHudSync3;
  127. new gMaxPlayers;
  128. new gMessageScoreInfo;
  129.  
  130. new gCvarBlockRadio;
  131. new gCvarBlockSpray;
  132. new gCvarPlayersGlow;
  133. new gCvarBallSpeed;
  134. new gCvarFragsBonus;
  135. new gCvarRandomSkyColor;
  136. new gCvarWelcomeMessage;
  137. new gCvarSecondsToGiveBall;
  138. new gCvarSecondsVoiceEnable;
  139. new gCvarPlayerSpeed;
  140. new gCvarKillPlayerOnEnemy;
  141.  
  142. new gTimerCounter[ 32 ] = 0;
  143.  
  144. enum
  145. {
  146. x,
  147. y,
  148. z
  149. };
  150.  
  151. enum _:RGB
  152. {
  153. red,
  154. green,
  155. blue
  156. };
  157.  
  158. new Ham:Ham_Player_ResetMaxSpeed = Ham_Item_PreFrame;
  159.  
  160. const m_iHideHUD = 361;
  161. const m_iClientHideHUD = 362;
  162. const m_iHUD_HIDE = HUD_HIDE_RHA | HUD_HIDE_TIMER | HUD_HIDE_MONEY;
  163.  
  164. new const szHelloSounds[ ][ ] =
  165. {
  166. "scientist/hello.wav",
  167. "scientist/hello2.wav",
  168. "scientist/hellothere.wav",
  169. "scientist/hellofreeman.wav"
  170. };
  171.  
  172. new const szWinnerSounds[ ][ ] =
  173. {
  174. "VolleyBallMod/boomchakalaka.wav",
  175. "VolleyBallMod/hoho.wav",
  176. "VolleyBallMod/mhaha.wav",
  177. "VolleyBallMod/tazrazz.wav",
  178. "VolleyBallMod/whoa.wav",
  179. "VolleyBallMod/yeahbaby.wav",
  180. "VolleyBallMod/bart.wav",
  181. "ambience/goal_1.wav"
  182. };
  183.  
  184. // --| World entities where ball can bounce \:D/
  185.  
  186. new const szWorldEntities[ ][ ] =
  187. {
  188. "worldspawn",
  189. "func_wall",
  190. "func_wall_toggle",
  191. "func_door",
  192. "func_door_rotating"
  193. };
  194.  
  195. // --| If some guy put some buttons in a volley map, lets find it and block buttons
  196.  
  197. new const szButtonsEntities[ ][ ] =
  198. {
  199. "func_button",
  200. "func_rot_button",
  201. "momentary_rot_button",
  202. "button_target"
  203. };
  204.  
  205. // --| Those sounds must blocked since it's annoying
  206.  
  207. new const szBlockRadios[ ][ ] =
  208. {
  209. "%!MRAD_GO",
  210. "%!MRAD_LOCKNLOAD",
  211. "%!MRAD_LETSGO",
  212. "%!MRAD_MOVEOUT",
  213. "%!MRAD_terwin",
  214. "%!MRAD_ctwin"
  215. };
  216.  
  217. public plugin_init( )
  218. {
  219. // --| Register the plugin
  220.  
  221. register_plugin( "VolleyBall Mod", PLUGIN_VERSION, "tuty" );
  222. register_cvar( "volleyball_version", PLUGIN_VERSION, FCVAR_SERVER | FCVAR_SPONLY );
  223.  
  224. new i;
  225.  
  226. // --| Block some commands, won't need it since is VB
  227.  
  228. register_clcmd( "radio1", "CommandBlockRadio" );
  229. register_clcmd( "radio2", "CommandBlockRadio" );
  230. register_clcmd( "radio3", "CommandBlockRadio" );
  231. register_clcmd( "fullupdate", "CommandBlockRadio" );
  232.  
  233. // --| Register some commands
  234.  
  235. register_clcmd( "say /help", "CommandShowHelp" );
  236. register_clcmd( "say_team /help", "CommandShowHelp" );
  237. register_clcmd( "say /reset", "CommandResetMatch" );
  238. register_clcmd( "say_team /reset", "CommandResetMatch" );
  239.  
  240. // --| Detect ball touch, player touch
  241.  
  242. register_touch( gVolleyBallEntityName, "func_breakable", "ForwardBallTouchFloor" );
  243. register_touch( "player", gVolleyBallEntityName, "ForwardBallTouchPlayer" );
  244. register_touch( "player", "func_breakable", "ForwardPlayerTouchTerritory" );
  245.  
  246. for( i = 0; i < sizeof szWorldEntities; i++ )
  247. {
  248. register_touch( gVolleyBallEntityName, szWorldEntities[ i ], "ForwardBallTouchWorld" );
  249. }
  250.  
  251. // --| Some forwards
  252.  
  253. register_think( gVolleyBallEntityName, "ForwardBallThink" );
  254. register_impulse( 201, "ForwardSprayPaint" );
  255.  
  256. register_forward( FM_CmdStart, "ForwardCmdStart" );
  257. register_forward( FM_GetGameDescription, "ForwardGameDescription" );
  258. register_forward( FM_ClientKill, "ForwardClientKill" );
  259.  
  260. // --| Some hams
  261.  
  262. RegisterHam( Ham_Player_PreThink, "player", "bacon_PlayerPreThink" );
  263. RegisterHam( Ham_Spawn, "player", "bacon_PlayerSpawned", 1 );
  264. RegisterHam( Ham_Killed, "player", "bacon_PlayerKilled" );
  265. RegisterHam( Ham_Player_ResetMaxSpeed, "player", "bacon_ResetMaxSpeed", 1 );
  266.  
  267. for( i = 0; i < sizeof szButtonsEntities; i++ )
  268. {
  269. RegisterHam( Ham_Use, szButtonsEntities[ i ], "bacon_ButtonUsed" );
  270. }
  271.  
  272. // --| Register some events
  273.  
  274. register_event( "CurWeapon", "Event_CurWeapon", "be", "1=1" );
  275. register_logevent( "LogEvent_RoundStart", 2, "1=Round_Start" );
  276. register_event( "TextMsg", "RoundRestart_Attempt", "a", "2&#Game_C", "2&Game_W" );
  277. register_event( "30", "Hook_EventIntermission", "a" );
  278. register_event( "ResetHUD", "Hook_ResetHUD", "be" );
  279. register_event( "HideWeapon", "Hook_HideWeapon", "be" );
  280.  
  281. register_message( get_user_msgid( "SendAudio" ), "Message_SendAudio" );
  282. register_message( get_user_msgid( "TextMsg" ), "Message_TextMsg" );
  283. register_message( get_user_msgid( "StatusIcon" ), "Message_StatusIcon" );
  284.  
  285. // --| Block DeathMsg because we avoid the death messages and console flood prints, won't need it
  286.  
  287. set_msg_block( get_user_msgid( "DeathMsg" ), BLOCK_SET );
  288. set_msg_block( get_user_msgid( "ClCorpse" ), BLOCK_SET );
  289.  
  290. // --| Register the cvars
  291.  
  292. gCvarBlockRadio = register_cvar( "volleyball_blockradio", "1" );
  293. gCvarBlockSpray = register_cvar( "volleyball_blockspray", "1" );
  294. gCvarPlayersGlow = register_cvar( "volleyball_playerglow", "1" );
  295. gCvarBallSpeed = register_cvar( "volleyball_ballspeed", "731" );
  296. gCvarFragsBonus = register_cvar( "volleyball_fragbonus", "1" );
  297. gCvarRandomSkyColor = register_cvar( "volleyball_randomskycolor", "1" );
  298. gCvarWelcomeMessage = register_cvar( "volleyball_welcomemessage", "1" );
  299. gCvarSecondsToGiveBall = register_cvar( "volleyball_balltime", "7" );
  300. gCvarSecondsVoiceEnable = register_cvar( "volleyball_secondvoice", "1" );
  301. gCvarPlayerSpeed = register_cvar( "volleyball_player_speed", "400" );
  302. gCvarKillPlayerOnEnemy = register_cvar( "volleyball_playerkill", "1" );
  303.  
  304. // --| Some variables
  305.  
  306. gHudSync = CreateHudSyncObj( );
  307. gHudSync1 = CreateHudSyncObj( );
  308. gHudSync2 = CreateHudSyncObj( );
  309. gHudSync3 = CreateHudSyncObj( );
  310.  
  311. gMessageScoreInfo = get_user_msgid( "ScoreInfo" );
  312. gMaxPlayers = get_maxplayers( );
  313.  
  314. // --| ML support
  315.  
  316. register_dictionary( "VolleyBall.txt" );
  317. }
  318.  
  319. public plugin_precache( )
  320. {
  321. // --| Precache required sprites, sounds, mdls
  322.  
  323. gBeamFollowSprite = precache_model( VOLLEYBALL_BEAMSPRITE );
  324. gBallDiskSprite = precache_model( VOLLEYBALL_EXPLOSPRITE );
  325. gThunderSprite = precache_model( VOLLEYBALL_THUBDERSPR );
  326.  
  327. new szPlayerModelPath[ 64 ];
  328.  
  329. formatex( szPlayerModelPath, charsmax( szPlayerModelPath ), "models/player/%s/%s.mdl", VOLLEYBALL_PLAYER_CT, VOLLEYBALL_PLAYER_CT );
  330. precache_model( szPlayerModelPath );
  331.  
  332. formatex( szPlayerModelPath, charsmax( szPlayerModelPath ), "models/player/%s/%s.mdl", VOLLEYBALL_PLAYER_T, VOLLEYBALL_PLAYER_T );
  333. precache_model( szPlayerModelPath );
  334.  
  335. precache_model( VOLLEYBALL_MODEL );
  336. precache_model( MODEL_V_HANDS );
  337. precache_model( MODEL_P_HANDS );
  338.  
  339. precache_sound( VOLLEYBALL_BOUNCE_SND );
  340. precache_sound( gAmbienceSound );
  341.  
  342. new i;
  343.  
  344. for( i = 0; i < sizeof szHelloSounds; i++ )
  345. {
  346. precache_sound( szHelloSounds[ i ] );
  347. }
  348.  
  349. for( i = 0; i < sizeof szWinnerSounds; i++ )
  350. {
  351. precache_sound( szWinnerSounds[ i ] );
  352. }
  353. }
  354.  
  355. public plugin_cfg( )
  356. {
  357. // --| Executing the config file!
  358.  
  359. new szConfigsDir[ 64 ], szFile[ 200 ];
  360.  
  361. get_configsdir( szConfigsDir, charsmax( szConfigsDir ) );
  362. formatex( szFile, charsmax( szFile ), "%s/%s", szConfigsDir, VOLLEYBALL_CFGNAME );
  363.  
  364. if( file_exists( szFile ) )
  365. {
  366. server_print( "%s %L", VOLLEYBALL_TAG, LANG_SERVER , "FILE_LOADED", szFile );
  367. log_amx( "%s %L", VOLLEYBALL_TAG, LANG_SERVER, "FILE_LOADED", szFile );
  368.  
  369. server_cmd( "exec %s", szFile );
  370. }
  371.  
  372. else
  373. {
  374. server_print( "%s %L", VOLLEYBALL_TAG, LANG_SERVER, "FILE_NOT_FOUND", szFile );
  375. log_amx( "%s %L", VOLLEYBALL_TAG, LANG_SERVER, "FILE_NOT_FOUND", szFile );
  376. }
  377.  
  378. // --| Enforce some server cvars for gameplay
  379.  
  380. server_cmd( "mp_autoteambalance 1" );
  381. server_cmd( "mp_freezetime 0" );
  382. server_cmd( "sv_gravity 800" );
  383. server_cmd( "sv_maxspeed 2000.0" );
  384. server_cmd( "mp_friendlyfire 0" );
  385. }
  386.  
  387. public client_putinserver( id )
  388. {
  389. if( get_pcvar_num( gCvarWelcomeMessage ) == 1 )
  390. {
  391. set_task( 7.0, "ShowMessageInfo", id );
  392. }
  393.  
  394. gTimerCounter[ id ] = 0;
  395. }
  396.  
  397. // --| Find at rou8ndstart a random guy, and if its necessary set the sky color in random colors
  398.  
  399. public LogEvent_RoundStart( )
  400. {
  401. // --| Clear center message channel because will apper some random messages like free look etc
  402.  
  403. client_print( 0, print_center, " " );
  404. client_print( 0, print_center, " " );
  405.  
  406. remove_entity_name( gVolleyBallEntityName );
  407.  
  408. UTIL_GiveBallRandom( );
  409.  
  410. if( get_pcvar_num( gCvarRandomSkyColor ) == 1 )
  411. {
  412. new iSkyColor[ RGB ];
  413.  
  414. iSkyColor[ red ] = random_num( 0, 255 );
  415. iSkyColor[ green ] = random_num( 0, 255 );
  416. iSkyColor[ blue ] = random_num( 0, 255 );
  417.  
  418. server_cmd( "sv_skycolor_r %d", iSkyColor[ red ] );
  419. server_cmd( "sv_skycolor_g %d", iSkyColor[ green ] );
  420. server_cmd( "sv_skycolor_b %d", iSkyColor[ blue ] );
  421. }
  422.  
  423. return PLUGIN_CONTINUE;
  424. }
  425.  
  426. // --| If game is restarting, remove current tasks and remove ball
  427.  
  428. public RoundRestart_Attempt( )
  429. {
  430. new iPlayers[ 32 ], iNum, Index;
  431. get_players( iPlayers, iNum, "cgh" );
  432.  
  433. for( new i = 0; i < iNum; i++ )
  434. {
  435. Index = iPlayers[ i ];
  436.  
  437. UTIL_CheckExistingTasks( Index );
  438. remove_entity_name( gVolleyBallEntityName );
  439. }
  440.  
  441. UTIL_ResetTeamsScore( );
  442. }
  443.  
  444. // --| Show a hud message as countdown and sound if enabled
  445.  
  446. public ShowCountDown( taskid )
  447. {
  448. new iRandomPlayer = taskid - TASKID_UNQ2;
  449.  
  450. new szName[ 32 ];
  451. get_user_name( iRandomPlayer, szName, charsmax( szName ) );
  452.  
  453. gTimerCounter[ iRandomPlayer ]++;
  454.  
  455. new iTimer = get_pcvar_num( gCvarSecondsToGiveBall ) - gTimerCounter[ iRandomPlayer ];
  456.  
  457. set_hudmessage( 42, 255, 42, -1.0, 0.39, 1, 6.0, 2.0 );
  458. ShowSyncHudMsg( 0, gHudSync2, "%s %L", VOLLEYBALL_TAG, LANG_PLAYER, "WILL_HAVE_BALL", szName, iTimer );
  459.  
  460. if( get_pcvar_num( gCvarSecondsVoiceEnable ) == 1 )
  461. {
  462. if( iTimer <= 3 )
  463. {
  464. new szNumToWord[ 20 ];
  465. num_to_word( iTimer, szNumToWord, charsmax( szNumToWord ) );
  466.  
  467. client_cmd( 0, "speak ^"fvox/%s^"", szNumToWord );
  468. }
  469. }
  470. }
  471.  
  472. // --| Here we create ball, and give to player's head ^^
  473.  
  474. public GiveBallToPlayer( taskid )
  475. {
  476. new iRandomPlayer = taskid - TASKID_UNQ1;
  477.  
  478. UTIL_CheckExistingTasks( iRandomPlayer );
  479.  
  480. new iOrigin[ 3 ], Float:flOrigin[ 3 ];
  481. get_user_origin( iRandomPlayer, iOrigin );
  482.  
  483. new szName[ 32 ];
  484. get_user_name( iRandomPlayer, szName, charsmax( szName ) );
  485.  
  486. iOrigin[ z ] += 400;
  487.  
  488. IVecFVec( iOrigin, flOrigin );
  489.  
  490. new iEntity = engfunc( EngFunc_CreateNamedEntity, engfunc( EngFunc_AllocString, "info_target" ) );
  491.  
  492. if( !pev_valid( iEntity ) )
  493. {
  494. return PLUGIN_HANDLED;
  495. }
  496.  
  497. set_pev( iEntity, pev_classname, gVolleyBallEntityName );
  498.  
  499. engfunc( EngFunc_SetModel, iEntity, VOLLEYBALL_MODEL );
  500. engfunc( EngFunc_SetSize, iEntity, Float:{ -15.930000, -15.930000, -15.930000 }, Float:{ 15.930000, 15.930000, 15.930000 } );
  501. engfunc( EngFunc_SetOrigin, iEntity, flOrigin );
  502.  
  503. set_pev( iEntity, pev_solid, SOLID_BBOX );
  504. set_pev( iEntity, pev_movetype, MOVETYPE_BOUNCE );
  505. set_pev( iEntity, pev_iuser2, get_user_team( iRandomPlayer ) );
  506. set_pev( iEntity, pev_target, szName );
  507. set_pev( iEntity, pev_gravity, VOLLEYBALL_BALL_GRAVITY );
  508. set_pev( iEntity, pev_nextthink, get_gametime( ) + 6.0 );
  509.  
  510. gTimerCounter[ iRandomPlayer ] = 0;
  511.  
  512. return PLUGIN_HANDLED;
  513. }
  514.  
  515. // --| If player JUMP in the ball, set ball glow color as player team and trail
  516. // --| Do the ball velocity and update last player name who touched ball
  517.  
  518. public ForwardBallTouchPlayer( iPlayer, iBall )
  519. {
  520. set_pev( iBall, pev_iuser2, get_user_team( iPlayer ) );
  521.  
  522. new iTeam = pev( iBall, pev_iuser2 );
  523.  
  524. switch( iTeam )
  525. {
  526. case 1:
  527. {
  528. UTIL_KillBeamFollow( iBall );
  529. UTIL_BeamFollow( iBall, 255, 0, 0 );
  530.  
  531. set_rendering( iBall, kRenderFxGlowShell, 255, 0, 0, kRenderNormal, 25 );
  532. }
  533.  
  534. case 2:
  535. {
  536. UTIL_KillBeamFollow( iBall );
  537. UTIL_BeamFollow( iBall, 0, 0, 255 );
  538.  
  539. set_rendering( iBall, kRenderFxGlowShell, 0, 0, 255, kRenderNormal, 25 );
  540. }
  541. }
  542.  
  543. new Float:flVelocity[ 3 ];
  544. velocity_by_aim( iPlayer, get_pcvar_num( gCvarBallSpeed ), flVelocity );
  545.  
  546. set_pev( iBall, pev_velocity, flVelocity );
  547.  
  548. new szName[ 32 ];
  549. get_user_name( iPlayer, szName, charsmax( szName ) );
  550.  
  551. set_pev( iBall, pev_target, szName );
  552. }
  553.  
  554. // --| If player touch the enemy's terrain, let's slay the whole team
  555.  
  556. public ForwardPlayerTouchTerritory( iPlayer, iEntity )
  557. {
  558. if( !is_user_alive( iPlayer ) || get_pcvar_num( gCvarKillPlayerOnEnemy ) == 0 || !pev_valid( iEntity ) )
  559. {
  560. return PLUGIN_HANDLED;
  561. }
  562.  
  563. new szTeritoryName[ 10 ];
  564. pev( iEntity, pev_target, szTeritoryName, charsmax( szTeritoryName ) );
  565.  
  566. new szName[ 32 ];
  567. get_user_name( iPlayer, szName, charsmax( szName ) );
  568.  
  569. if( equal( szTeritoryName, "CT", 2 ) )
  570. {
  571. if( get_user_team( iPlayer ) == 1 )
  572. {
  573. UTIL_SlayTeam( "TERRORIST" );
  574.  
  575. set_hudmessage( 255, 0, 0, -1.0, 0.86, 1, 6.0, 5.0 );
  576. ShowSyncHudMsg( 0, gHudSync3, "%L", LANG_PLAYER, "PIROS_TEAM_SLAY", szName );
  577.  
  578. client_print( 0, print_chat, "%L", LANG_PLAYER, "PIROS_TEAM_SLAY", szName );
  579. client_cmd( 0, "speak %s", gAmbienceSound );
  580. }
  581. }
  582.  
  583. if( equal( szTeritoryName, "T", 1 ) )
  584. {
  585. if( get_user_team( iPlayer ) == 2 )
  586. {
  587. UTIL_SlayTeam( "CT" );
  588.  
  589. set_hudmessage( 0, 0, 255, -1.0, 0.86, 1, 6.0, 5.0 );
  590. ShowSyncHudMsg( 0, gHudSync3, "%L", LANG_PLAYER, "KEK_TEAM_SLAY", szName );
  591.  
  592. client_print( 0, print_chat, "%L", LANG_PLAYER, "KEK_TEAM_SLAY", szName );
  593. client_cmd( 0, "speak %s", gAmbienceSound );
  594. }
  595. }
  596.  
  597. return PLUGIN_HANDLED;
  598. }
  599.  
  600. // --| If ball touch enemy or owner terrain let's do same slays and score
  601.  
  602. public ForwardBallTouchFloor( iBall, iTrigger )
  603. {
  604. new Float:flOrigin[ 3 ], iOrigin[ 3 ];
  605.  
  606. pev( iBall, pev_origin, flOrigin );
  607. FVecIVec( flOrigin, iOrigin );
  608.  
  609. new szTeritoryName[ 10 ];
  610. pev( iTrigger, pev_target, szTeritoryName, charsmax( szTeritoryName ) );
  611.  
  612. new szPlayerName[ 32 ];
  613. pev( iBall, pev_target, szPlayerName, charsmax( szPlayerName ) );
  614.  
  615. if( equal( szTeritoryName, "CT", 2 ) )
  616. {
  617. gTerroristScore++;
  618.  
  619. UTIL_SlayTeam( "CT" );
  620. UTIL_AddFragToTeam( "TERRORIST" );
  621.  
  622. set_hudmessage( 255, 0, 0, -1.0, 0.86, 1, 6.0, 5.0 );
  623. ShowSyncHudMsg( 0, gHudSync, "%L", LANG_PLAYER, "Kek_Csapat_Nyert", szPlayerName );
  624.  
  625. client_print( 0, print_chat, "%s %L", VOLLEYBALL_TAG, LANG_PLAYER, "Piros_Csapatpont", gTerroristScore, gCTScore );
  626. client_cmd( 0, "speak %s", szWinnerSounds[ random_num( 0, charsmax( szWinnerSounds ) ) ] );
  627. }
  628.  
  629. if( equal( szTeritoryName, "T", 1 ) )
  630. {
  631. gCTScore++;
  632.  
  633. UTIL_SlayTeam( "TERRORIST" );
  634. UTIL_AddFragToTeam( "CT" );
  635.  
  636. set_hudmessage( 0, 0, 255, -1.0, 0.86, 1, 6.0, 5.0 );
  637. ShowSyncHudMsg( 0, gHudSync, "%L", LANG_PLAYER, "Kek_Csapat_Nyert", szPlayerName );
  638.  
  639. client_print( 0, print_chat, "%s %L", VOLLEYBALL_TAG, LANG_PLAYER, "Kek_Csapatpont", gCTScore, gTerroristScore );
  640. client_cmd( 0, "speak %s", szWinnerSounds[ random_num( 0, charsmax( szWinnerSounds ) ) ] );
  641. }
  642.  
  643. UTIL_BeamDisk( iOrigin );
  644. UTIL_TareExplosion( iOrigin );
  645.  
  646. set_pev( iBall, pev_flags, pev( iBall, pev_flags ) | FL_KILLME );
  647. }
  648.  
  649. // --| Ball touch world so, let make it bounce
  650.  
  651. public ForwardBallTouchWorld( iBall, iWorld )
  652. {
  653. if( pev_valid( iBall ) )
  654. {
  655. new Float:flOrigin[ 3 ], Float:flVelocity[ 3 ];
  656.  
  657. pev( iBall, pev_origin, flOrigin );
  658. pev( iBall, pev_velocity, flVelocity );
  659.  
  660. // --| Keep the old origin for checking if is in same origin to remve it when stuck
  661.  
  662. flBallOldOrigin[ x ] = flOrigin[ 0 ];
  663. flBallOldOrigin[ y ] = flOrigin[ 1 ];
  664. flBallOldOrigin[ z ] = flOrigin[ 2 ];
  665.  
  666. UTIL_Sparks( flOrigin );
  667.  
  668. flVelocity[ x ] = floatmul( flVelocity[ 0 ], 0.85 );
  669. flVelocity[ y ] = floatmul( flVelocity[ 1 ], 0.85 );
  670. flVelocity[ z ] = floatmul( flVelocity[ 2 ], 0.85 );
  671.  
  672. set_pev( iBall, pev_velocity, flVelocity );
  673. emit_sound( iBall, CHAN_BODY, VOLLEYBALL_BOUNCE_SND, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
  674. }
  675. }
  676.  
  677. // --| Ball think, here we remove it if is stuck or is in same origin for X seconds
  678. // --| We remove the ball and re-give to a random guy
  679.  
  680. public ForwardBallThink( iBall )
  681. {
  682. if( pev_valid( iBall ) )
  683. {
  684. set_pev( iBall, pev_nextthink, get_gametime( ) + 6.0 );
  685.  
  686. new Float:flOrigin[ 3 ];
  687. pev( iBall, pev_origin, flOrigin );
  688.  
  689. if( UTIL_IsHullVacant( flOrigin, HULL_HEAD ) )
  690. {
  691. remove_entity_name( gVolleyBallEntityName );
  692.  
  693. UTIL_GiveBallRandom( );
  694. }
  695.  
  696. if( flOrigin[ x ] == flBallOldOrigin[ x ] && flOrigin[ y ] == flBallOldOrigin[ y ] && flOrigin[ z ] == flBallOldOrigin[ z ] )
  697. {
  698. remove_entity_name( gVolleyBallEntityName );
  699.  
  700. UTIL_GiveBallRandom( );
  701. }
  702. }
  703. }
  704.  
  705. // --| When player connected, let's show him a info message
  706.  
  707. public ShowMessageInfo( id )
  708. {
  709. new szServerName[ 64 ];
  710. get_cvar_string( "hostname", szServerName, charsmax( szServerName ) );
  711.  
  712. new szName[ 32 ];
  713. get_user_name( id, szName, charsmax( szName ) );
  714.  
  715. client_print( id, print_chat, "%s %L", VOLLEYBALL_TAG, id, "WELCOME_MSG1", szName, szServerName );
  716. client_print( id, print_chat, "%s %L", VOLLEYBALL_TAG, id, "WELCOME_MSG2" );
  717.  
  718. client_cmd( id, "speak ^"%s^"", szHelloSounds[ random_num( 0, charsmax( szHelloSounds ) ) ] );
  719. }
  720.  
  721. // --| If player weapon is a knife, let's replace knife with hands[our custom model]
  722.  
  723. public Event_CurWeapon( id )
  724. {
  725. if( !is_user_alive( id ) || !is_user_connected( id ) )
  726. {
  727. return PLUGIN_CONTINUE;
  728. }
  729.  
  730. new iTempId[ 2 ];
  731. new iWeapon = get_user_weapon( id, iTempId[ 0 ], iTempId[ 1 ] );
  732.  
  733. if( iWeapon == CSW_KNIFE )
  734. {
  735. set_pev( id, pev_viewmodel2, MODEL_V_HANDS );
  736. set_pev( id, pev_weaponmodel2, MODEL_P_HANDS );
  737. }
  738.  
  739. return PLUGIN_CONTINUE;
  740. }
  741.  
  742. // --| Here we remove the unnecessary hud messages
  743.  
  744. public Hook_ResetHUD( id )
  745. {
  746. set_pdata_int( id, m_iClientHideHUD, 0 );
  747. set_pdata_int( id, m_iHideHUD, m_iHUD_HIDE );
  748. }
  749.  
  750. public Hook_HideWeapon( id )
  751. {
  752. set_pdata_int( id, m_iClientHideHUD, 0 );
  753. set_pdata_int( id, m_iHideHUD, m_iHUD_HIDE );
  754. }
  755.  
  756. // --| Block some radio sounds here
  757.  
  758. public Message_SendAudio( msg_id, msg_dest, msg_entity )
  759. {
  760. if( get_msg_args( ) == 3 )
  761. {
  762. if( get_msg_argtype( 2 ) == ARG_STRING )
  763. {
  764. new szValue[ 64 ];
  765. get_msg_arg_string( 2 , szValue, charsmax( szValue ) );
  766.  
  767. new i;
  768.  
  769. for( i = 0; i < sizeof szBlockRadios; i++ )
  770. {
  771. if( equal( szValue, szBlockRadios[ i ] ) )
  772. {
  773. return PLUGIN_HANDLED;
  774. }
  775. }
  776. }
  777. }
  778.  
  779. return PLUGIN_CONTINUE;
  780. }
  781.  
  782. // --| Block ct win , ter winn messages
  783.  
  784. public Message_TextMsg( msg_id, msg_dest, msg_entity )
  785. {
  786. new szMessage[ 3 ];
  787. get_msg_arg_string( 2, szMessage, charsmax( szMessage ) );
  788.  
  789. switch( szMessage[ 1 ] )
  790. {
  791. case 'C', 'T', 'R': return PLUGIN_HANDLED;
  792. }
  793.  
  794. return PLUGIN_CONTINUE;
  795. }
  796.  
  797. // --| Remove buyicon because is annoying
  798.  
  799. public Message_StatusIcon( msg_id, msg_dest, msg_entity )
  800. {
  801. new szIcon[ 8 ];
  802. get_msg_arg_string( 2, szIcon, charsmax( szIcon ) );
  803.  
  804. if( equal( szIcon, "buyzone", 7 ) )
  805. {
  806. return PLUGIN_HANDLED;
  807. }
  808.  
  809. return PLUGIN_CONTINUE;
  810. }
  811.  
  812. // --| When scoreboard is ON at map end let's remove tasks and entity
  813.  
  814. public Hook_EventIntermission( )
  815. {
  816. new iPlayers[ 32 ], iNum, Index;
  817. get_players( iPlayers, iNum, "cgh" );
  818.  
  819. for( new i = 0; i < iNum; i++ )
  820. {
  821. Index = iPlayers[ i ];
  822.  
  823. UTIL_CheckExistingTasks( Index );
  824. }
  825.  
  826. remove_entity_name( gVolleyBallEntityName );
  827. }
  828.  
  829. // --| Best event to check player speed
  830. // --| With curweapon will have some serious bugs, so this is the best way
  831.  
  832. public bacon_ResetMaxSpeed( id )
  833. {
  834. if( is_user_alive( id ) )
  835. {
  836. new Float:flMaxSpeed = float( get_pcvar_num( gCvarPlayerSpeed ) );
  837.  
  838. engfunc( EngFunc_SetClientMaxspeed, id, flMaxSpeed );
  839. set_pev( id, pev_maxspeed, flMaxSpeed );
  840.  
  841. /*
  842. // --| For some people, is slowfuckinghacking, if you want to enable it just remove the slash's
  843. client_cmd( id, "cl_forwardspeed %0.1f;cl_sidespeed %0.1f;cl_backspeed %0.1f", flMaxSpeed, flMaxSpeed, flMaxSpeed );
  844. */
  845. }
  846. }
  847.  
  848. // --| If player is spawned let's glow his suit and set the team custom model
  849.  
  850. public bacon_PlayerSpawned( id )
  851. {
  852. if( !is_user_alive( id ) )
  853. {
  854. return HAM_IGNORED;
  855. }
  856.  
  857. if( get_pcvar_num( gCvarPlayersGlow ) == 1 )
  858. {
  859. switch( get_user_team( id ) )
  860. {
  861. case 1: set_user_rendering( id, kRenderFxGlowShell, 255, 0, 0, kRenderNormal, 20 );
  862. case 2: set_user_rendering( id, kRenderFxGlowShell, 0, 0, 255, kRenderNormal, 20 );
  863. }
  864. }
  865.  
  866. new CsTeams:team = cs_get_user_team( id );
  867. cs_set_user_model( id, team == CS_TEAM_CT ? VOLLEYBALL_PLAYER_CT : VOLLEYBALL_PLAYER_T );
  868.  
  869. return HAM_IGNORED;
  870. }
  871.  
  872. // --| Block buttons because our floor func_breakable is with only trigger flag, so if
  873. // --| Some guy want to destroy the map and have fun with bugs, to prevent it.
  874.  
  875. public bacon_ButtonUsed( this, idcaller, idactivator, use_type, Float:value )
  876. {
  877. if( idcaller == idactivator )
  878. {
  879. return HAM_SUPERCEDE;
  880. }
  881.  
  882. return HAM_IGNORED;
  883. }
  884.  
  885. // --| Here we show the "score board" with team score
  886.  
  887. public bacon_PlayerPreThink( id )
  888. {
  889. if( is_user_alive( id ) )
  890. {
  891. new Float:flGameTime = get_gametime( );
  892.  
  893. new iTimeleft = get_timeleft( );
  894. new iPlayersNum = get_playersnum( );
  895. new iTotalScore = gCTScore + gTerroristScore;
  896.  
  897. if( flGameTime - bFlLastHudTime[ id ] >= HUD_LIFE_TIME )
  898. {
  899. bFlLastHudTime[ id ] = flGameTime;
  900.  
  901. switch( get_user_team( id ) )
  902. {
  903. case 1: set_hudmessage( 255, 0, 0, -1.0, 0.03, 0, 6.0, HUD_LIFE_TIME );
  904. case 2: set_hudmessage( 0, 0, 255, -1.0, 0.03, 0, 6.0, HUD_LIFE_TIME );
  905. }
  906.  
  907. ShowSyncHudMsg( id, gHudSync1, "%s^n%L", VOLLEYBALL_TAG, id, "HUD_SCOREBOARD", iTotalScore, gCTScore, gTerroristScore, ( iTimeleft / 60 ), ( iTimeleft % 60 ), iPlayersNum, gMaxPlayers );
  908. }
  909. }
  910. }
  911.  
  912. // --| Since deathmsg is blocked, this ham event is good to check if player died and remove the current ball task
  913.  
  914. public bacon_PlayerKilled( iVictim, iAttacker, shouldgib )
  915. {
  916. if( 1 <= iVictim <= gMaxPlayers )
  917. {
  918. UTIL_CheckExistingTasks( iVictim );
  919. }
  920. }
  921.  
  922. // --| Command to reset match
  923.  
  924. public CommandResetMatch( id )
  925. {
  926. if( !( get_user_flags( id ) & ADMIN_ACCESS ) )
  927. {
  928. client_print( id, print_chat, "%s %L", VOLLEYBALL_TAG, id, "DONT_HAVE_ACCESS" );
  929.  
  930. return PLUGIN_HANDLED;
  931. }
  932.  
  933. new id2;
  934.  
  935. for( id2 = 1; id2 <= gMaxPlayers; id2++ )
  936. {
  937. UTIL_CheckExistingTasks( id2 );
  938. }
  939.  
  940. set_task( 1.0, "RestartMatch" );
  941.  
  942. client_print( 0, print_chat, "%s %L", VOLLEYBALL_TAG, LANG_PLAYER, "GAME_WILL_START" );
  943. client_print( 0, print_center, "%L", LANG_PLAYER, "GAME_WILL" );
  944.  
  945. remove_entity_name( gVolleyBallEntityName );
  946.  
  947. return PLUGIN_CONTINUE;
  948. }
  949.  
  950. public RestartMatch( )
  951. {
  952. server_cmd( "sv_restartround %d", random_num( 1, 2 ) );
  953.  
  954. remove_entity_name( gVolleyBallEntityName );
  955. UTIL_ResetTeamsScore( );
  956. }
  957.  
  958. // --| Here will show some help in player console
  959.  
  960. public CommandShowHelp( id )
  961. {
  962. client_cmd( id, "toggleconsole" );
  963.  
  964. console_print( id, "=================================" );
  965. console_print( id, "* %L *", id, "INFO_1" );
  966. console_print( id, "=================================" );
  967. console_print( id, "%s", WHITE_SPACE );
  968. console_print( id, "%s", WHITE_SPACE );
  969. console_print( id, "%L", id, "INFO_2" );
  970. console_print( id, "%L", id, "INFO_3" );
  971. console_print( id, "%L", id, "INFO_4" );
  972. console_print( id, "%L", id, "INFO_5" );
  973. console_print( id, "%s", WHITE_SPACE );
  974. console_print( id, "%s", WHITE_SPACE );
  975. console_print( id, "%L", id, "INFO_6" );
  976. console_print( id, "%L", id, "INFO_7" );
  977. console_print( id, "%L", id, "INFO_8" );
  978. console_print( id, "%s", WHITE_SPACE );
  979. console_print( id, "=================================" );
  980. }
  981.  
  982. // --| Set the mod name
  983.  
  984. public ForwardGameDescription( )
  985. {
  986. forward_return( FMV_STRING, "[Volley Ball Mod]" );
  987.  
  988. return FMRES_SUPERCEDE;
  989. }
  990.  
  991. // --| Block player kill
  992.  
  993. public ForwardClientKill( id )
  994. {
  995. client_print( id, print_chat, "%s %L", VOLLEYBALL_TAG, id, "CANNOT_SUICIDE" );
  996. console_print( id, "%s %L", VOLLEYBALL_TAG, id, "CANNOT_SUICIDE" );
  997.  
  998. return FMRES_SUPERCEDE;
  999. }
  1000.  
  1001. // --| Block spraypaint
  1002.  
  1003. public ForwardSprayPaint( id )
  1004. {
  1005. if( get_pcvar_num( gCvarBlockSpray ) == 1 )
  1006. {
  1007. return PLUGIN_HANDLED;
  1008. }
  1009.  
  1010. return PLUGIN_CONTINUE;
  1011. }
  1012.  
  1013. // --| Block radio
  1014.  
  1015. public CommandBlockRadio( id )
  1016. {
  1017. if( get_pcvar_num( gCvarBlockRadio ) == 1 )
  1018. {
  1019. return PLUGIN_HANDLED_MAIN;
  1020. }
  1021.  
  1022. return PLUGIN_CONTINUE;
  1023. }
  1024.  
  1025. // --| At changing map, reset team scores
  1026.  
  1027. public plugin_end( )
  1028. {
  1029. UTIL_ResetTeamsScore( );
  1030. }
  1031.  
  1032. // --| Some stocks with effect and more made by me or amx mod x members
  1033. // --| Use it if you want
  1034.  
  1035. stock UTIL_Sparks( Float:flOrigin[ 3 ] )
  1036. {
  1037. engfunc( EngFunc_MessageBegin, MSG_PAS, SVC_TEMPENTITY, flOrigin, 0 );
  1038. write_byte( TE_SPARKS );
  1039. engfunc( EngFunc_WriteCoord, flOrigin[ x ] );
  1040. engfunc( EngFunc_WriteCoord, flOrigin[ y ] );
  1041. engfunc( EngFunc_WriteCoord, flOrigin[ z ] );
  1042. message_end( );
  1043. }
  1044.  
  1045. stock UTIL_BeamDisk( iOrigin[ 3 ] )
  1046. {
  1047. message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
  1048. write_byte( TE_BEAMDISK );
  1049. write_coord( iOrigin[ x ] );
  1050. write_coord( iOrigin[ y ] );
  1051. write_coord( iOrigin[ z ] + random_num( -30, 50 ) );
  1052. write_coord( iOrigin[ x ] );
  1053. write_coord( iOrigin[ y ] );
  1054. write_coord( iOrigin[ z ] + 200 );
  1055. write_short( gBallDiskSprite );
  1056. write_byte( 1 );
  1057. write_byte( 3 );
  1058. write_byte( 8 );
  1059. write_byte( 20 );
  1060. write_byte( 6 );
  1061. write_byte( random( 256 ) );
  1062. write_byte( random( 256 ) );
  1063. write_byte( random( 256 ) );
  1064. write_byte( 255 );
  1065. write_byte( 0 );
  1066. message_end( );
  1067. }
  1068.  
  1069. stock UTIL_TareExplosion( iOrigin[ 3 ] )
  1070. {
  1071. message_begin( MSG_PVS, SVC_TEMPENTITY, iOrigin );
  1072. write_byte( TE_TAREXPLOSION );
  1073. write_coord( iOrigin[ x ] );
  1074. write_coord( iOrigin[ y ] );
  1075. write_coord( iOrigin[ z ] );
  1076. message_end( );
  1077. }
  1078.  
  1079. stock UTIL_SlayTeam( const szTeam[ ] )
  1080. {
  1081. new iPlayers[ 32 ], iCount, Index;
  1082. get_players( iPlayers, iCount, "ce", szTeam );
  1083.  
  1084. for( new i = 0; i < iCount; i++ )
  1085. {
  1086. Index = iPlayers[ i ];
  1087.  
  1088. if( is_user_alive( Index ) && is_user_connected( Index ) )
  1089. {
  1090. new iOrigin[ 3 ], iPosition[ 3 ];
  1091. get_user_origin( Index, iOrigin );
  1092.  
  1093. iPosition[ x ] = iOrigin[ 0 ] + 100;
  1094. iPosition[ y ] = iOrigin[ 1 ] + 150;
  1095. iPosition[ z ] = iOrigin[ 2 ] + 812;
  1096.  
  1097. UTIL_CreateThunder( iPosition, iOrigin );
  1098. ExecuteHam( Ham_TakeDamage, Index, 0, Index, 9999.0, DMG_GENERIC );
  1099.  
  1100. UTIL_SetClientDeaths( Index, 0 );
  1101. UTIL_ScoreInfo( Index, get_user_frags( Index ), get_user_deaths( Index ), get_user_team( Index ) );
  1102. }
  1103. }
  1104. }
  1105.  
  1106. stock UTIL_AddFragToTeam( const szTeam[ ] )
  1107. {
  1108. new iPlayers[ 32 ], iCount, Index;
  1109. get_players( iPlayers, iCount, "ce", szTeam );
  1110.  
  1111. for( new i = 0; i < iCount; i++ )
  1112. {
  1113. Index = iPlayers[ i ];
  1114.  
  1115. if( is_user_connected( Index ) )
  1116. {
  1117. set_user_frags( Index, get_user_frags( Index ) + get_pcvar_num( gCvarFragsBonus ) );
  1118.  
  1119. UTIL_ScoreInfo( Index, get_user_frags( Index ), get_user_deaths( Index ), get_user_team( Index ) );
  1120. }
  1121. }
  1122. }
  1123.  
  1124. stock UTIL_BeamFollow( ent, r, g, b )
  1125. {
  1126. message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
  1127. write_byte( TE_BEAMFOLLOW );
  1128. write_short( ent );
  1129. write_short( gBeamFollowSprite );
  1130. write_byte( 8 );
  1131. write_byte( 16 );
  1132. write_byte( r );
  1133. write_byte( g );
  1134. write_byte( b );
  1135. write_byte( 255 );
  1136. message_end( );
  1137. }
  1138.  
  1139. stock UTIL_KillBeamFollow( ent )
  1140. {
  1141. message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
  1142. write_byte( TE_KILLBEAM );
  1143. write_short( ent );
  1144. message_end( );
  1145. }
  1146.  
  1147. stock UTIL_SetClientDeaths( iClient, iDeathsNum )
  1148. {
  1149. set_pdata_int( iClient, 444, iDeathsNum, 5 );
  1150. }
  1151.  
  1152. stock UTIL_CheckExistingTasks( index )
  1153. {
  1154. if( task_exists( index + TASKID_UNQ1 ) )
  1155. {
  1156. remove_task( index + TASKID_UNQ1 );
  1157. }
  1158.  
  1159. if( task_exists( index + TASKID_UNQ2 ) )
  1160. {
  1161. remove_task( index + TASKID_UNQ2 );
  1162. }
  1163.  
  1164. gTimerCounter[ index ] = 0;
  1165. }
  1166.  
  1167. stock UTIL_ScoreInfo( id, iFrags, iDeaths, iTeam )
  1168. {
  1169. message_begin( MSG_BROADCAST, gMessageScoreInfo );
  1170. write_byte( id );
  1171. write_short( iFrags );
  1172. write_short( iDeaths );
  1173. write_short( 0 );
  1174. write_short( iTeam );
  1175. message_end( );
  1176. }
  1177.  
  1178. stock UTIL_ResetTeamsScore( )
  1179. {
  1180. gTerroristScore = 0;
  1181. gCTScore = 0;
  1182. }
  1183.  
  1184. stock bool:UTIL_IsHullVacant( const Float:origin[ 3 ], hull )
  1185. {
  1186. new tr = 0;
  1187. engfunc( EngFunc_TraceHull, origin, origin, 0, hull, 0, tr );
  1188.  
  1189. if( !get_tr2( tr, TR_StartSolid ) && !get_tr2( tr, TR_AllSolid ) && get_tr2( tr, TR_InOpen ) )
  1190. {
  1191. return true;
  1192. }
  1193.  
  1194. return false;
  1195. }
  1196.  
  1197. stock UTIL_CreateThunder( iStart[ 3 ], iEnd[ 3 ] )
  1198. {
  1199. message_begin( MSG_BROADCAST, SVC_TEMPENTITY );
  1200. write_byte( TE_BEAMPOINTS );
  1201. write_coord( iStart[ x ] );
  1202. write_coord( iStart[ y ] );
  1203. write_coord( iStart[ z ] );
  1204. write_coord( iEnd[ x ] );
  1205. write_coord( iEnd[ y ] );
  1206. write_coord( iEnd[ z ] );
  1207. write_short( gThunderSprite );
  1208. write_byte( 0 );
  1209. write_byte( 0 );
  1210. write_byte( 7 );
  1211. write_byte( 200 );
  1212. write_byte( 25 );
  1213. write_byte( 127 );
  1214. write_byte( 255 );
  1215. write_byte( 0 );
  1216. write_byte( 220 );
  1217. write_byte( 1 );
  1218. message_end( );
  1219. }
  1220.  
  1221. stock UTIL_GiveBallRandom( )
  1222. {
  1223. new iPlayers[ 32 ], iNum;
  1224. get_players( iPlayers, iNum, "ach" );
  1225.  
  1226. if( iNum )
  1227. {
  1228. new iRandomPlayer = iPlayers[ random( iNum ) ];
  1229. new iTime = get_pcvar_num( gCvarSecondsToGiveBall );
  1230.  
  1231. UTIL_CheckExistingTasks( iRandomPlayer );
  1232.  
  1233. if( is_user_connected( iRandomPlayer ) )
  1234. {
  1235. set_task( 1.0, "ShowCountDown", iRandomPlayer + TASKID_UNQ2, _, _, "a", iTime );
  1236. set_task( float( iTime ), "GiveBallToPlayer", iRandomPlayer + TASKID_UNQ1 );
  1237. }
  1238. }
  1239. }
  1240.  
  1241. // --| End of plugin
  1242. // --| Y!M: tuty_max_boy@yahoo.com ^^
  1243. // --| www.mapping.ro
  1244.