hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.06.17. 00:57



Jelenlévő felhasználók

Jelenleg 488 felhasználó van jelen :: 1 regisztrált, 0 rejtett és 487 vendég

A legtöbb felhasználó (1565 fő) 2020.11.21. 11:26-kor tartózkodott itt.

Regisztrált felhasználók: 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  [ 4 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: körvégi...
HozzászólásElküldve: 2013.12.16. 20:09 
Offline
Jómunkásember

Csatlakozott: 2013.02.11. 16:06
Hozzászólások: 491
Megköszönt másnak: 96 alkalommal
Megköszönték neki: 50 alkalommal
Hello. Melyik az a körvégi zene plugin, ami ugye ini ből olvassa ki, de /roundsound paranccsal ki / be lehet kapcsolni, hogy egy személy hallja-e, vagy nem a zenét?

_________________
Rengeteg új beszólás eléréséhez kattints IDE (Ezek alapból sank soundshoz készültek)

Steam profil:
[steam]http://steamcommunity.com/profiles/76561198089487307[/steam]


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: körvégi...
HozzászólásElküldve: 2013.12.16. 20:12 
Offline
Őskövület
Avatar

Csatlakozott: 2012.03.22. 18:22
Hozzászólások: 2978
Megköszönt másnak: 115 alkalommal
Megköszönték neki: 368 alkalommal
Alt end round sound

_________________
Blasenkampfwagen

https://discord.gg/uBYnNnZP
GTA:PURSUIT MTA


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: körvégi...
HozzászólásElküldve: 2013.12.16. 20:59 
Offline
Jómunkásember

Csatlakozott: 2013.02.11. 16:06
Hozzászólások: 491
Megköszönt másnak: 96 alkalommal
Megköszönték neki: 50 alkalommal
SMA-t pls! mert nem tudom letölteni. És ez .mp3 fájlokat játszik le?

_________________
Rengeteg új beszólás eléréséhez kattints IDE (Ezek alapból sank soundshoz készültek)

Steam profil:
[steam]http://steamcommunity.com/profiles/76561198089487307[/steam]


Hozzászólás jelentése
Vissza a tetejére
   
 Hozzászólás témája: Re: körvégi...
HozzászólásElküldve: 2013.12.16. 21:22 
Offline
Jómunkásember
Avatar

Csatlakozott: 2013.10.27. 23:13
Hozzászólások: 412
Megköszönt másnak: 21 alkalommal
Megköszönték neki: 68 alkalommal
Asszem wav-ot meg mp3 is lejátssza.
Amit linkelt ultra abba a rar-ba többi cucc ott van (ini, stb).
SMA Forráskód: [ Mindet kijelol ]
  1.  
  2.  
  3. /* - - - - - - - - - - -
  4.  
  5.   AMX Mod X script.
  6.   Copyright (C) 2007 - Arkshine
  7.  
  8.   Plugin : 'Alternative End Round Sounds'
  9.   Version : v2.3b
  10.  
  11.   Original idea and plugin by PaintLancer.
  12.  
  13.   This program is free software; you can redistribute it and/or modify it
  14.   under the terms of the GNU General Public License as published by the
  15.   Free Software Foundation; either version 2 of the License, or (at
  16.   your option) any later version.
  17.  
  18.   This program is distributed in the hope that it will be useful, but
  19.   WITHOUT ANY WARRANTY; without even the implied warranty of
  20.   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  21.   General Public License for more details.
  22.  
  23.   You should have received a copy of the GNU General Public License
  24.   along with this program; if not, write to the Free Software Foundation,
  25.   Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  26.  
  27.   In addition, as a special exception, the author gives permission to
  28.   link the code of this program with the Half-Life Game Engine ("HL
  29.   Engine") and Modified Game Libraries ("MODs") developed by Valve,
  30.   L.L.C ("Valve"). You must obey the GNU General Public License in all
  31.   respects for all of the code used other than the HL Engine and MODs
  32.   from Valve. If you modify this file, you may extend this exception
  33.   to your version of the file, but you are not obligated to do so. If
  34.   you do not wish to do so, delete this exception statement from your
  35.   version.
  36.  
  37.   ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
  38.  
  39.   Description :
  40.   - - - - - - -
  41.   Plays random music at the end of a round according to who wins,
  42.   instead of just "Terrorists Win" or "Counter-Terrorists Win".
  43.  
  44.  
  45.   Features :
  46.   - - - - - -
  47.   * Support for mp3 and wav files
  48.   * Using a file for the sounds
  49.   * Per-map config files supported
  50.   * Per-map prefix config files supported
  51.   * Sounds can be toggle on/off by players
  52.   * Ability to choice x sounds to be precache per map
  53.   * Multilingual support
  54.  
  55.  
  56.   Requirements :
  57.   - - - - - - - -
  58.   * CS 1.6 / CZ
  59.   * AMX/X 1.7x or higher
  60.  
  61.  
  62.   Cvars :
  63.   - - - -
  64.   * ers_enabled <iNum
  65.  
  66.   <0|1> Disable/Enable this plugin.
  67.   (default: 1)
  68.  
  69.  
  70.   * ers_player_toggle <iNum>
  71.  
  72.   <0|1> Disable/Enable the client command /roundsound
  73.   (default: 1)
  74.  
  75.  
  76.   * erc_time_ads <iTime>
  77.  
  78.   Times in seconds between each ads messages. 0 disable ads.
  79.   (default: 120)
  80.  
  81.  
  82.   * erc_random_precache <iMaxTeam or iMax_T-iMax_CT>
  83.  
  84.   Specify how many sounds by team you want to precache randomly among all sounds.
  85.   This means that x sounds will be choosen randomly among all sounds of each team so to be precache at each map. ( 0 = disable feature )
  86.  
  87.   e.g : erc_random_precache "2" : 2 sounds will be choosen among all CTs sounds and all Ts sounds
  88.   erc_random_precache "2-3" : 2 Ts sounds will be choosen randomly among all Ts sounds.
  89.   3 CT sound will be choosen randomly among all CTs sounds.
  90.   /!\ Don't forget to insert '-' .
  91.  
  92.   /!\ Map change on cvar change required !
  93.  
  94.  
  95.   Client command :
  96.   - - - - - - - -
  97.   * say /roundsound : Give to players the ability to turn on/off the end round sounds
  98.  
  99.  
  100.   Changelog :
  101.   - - - - - -
  102.  
  103.   -> Arksine :
  104.  
  105.   v3.0 - [ 2007-xx-xx ] ( Major update )
  106.  
  107.   - Soon. A lot of changes/new features. Huge update. <!-- s;) --><img src=\"{SMILIES_PATH}/icon_e_wink.gif\" alt=\";)\" title=\"kacsintás\" /><!-- s;) -->
  108.  
  109.   v2.3b - [ 2007-11-22 ]
  110.  
  111.   (!) Fixed a compatibility bug from 2.3a version.
  112.  
  113.   v2.3a - [ 2007-11-19 ]
  114.  
  115.   (+) Added compatibility for Amxx 1.7x.
  116.   (!) Now 'erc_random_precache' cvar is set to 0 by default.
  117.   (!) Fixed. At the first start of server, value from 'erc_random_precache' cvar from a config file was not read.
  118.   (!) Some others minors changes.
  119.  
  120.   v2.3 - [ 2007-10-29 ]
  121.  
  122.   (+) Added 'erc_random_precache' cvar : Specify how many sounds per team you want to precache randomly among all sounds.
  123.   This means that x sounds will be choosen randomly among all sounds of each team so to be precache at each map. ( request by Arion )
  124.   (!) Debug mode is enabled by default now.
  125.   (-) Removed 3 keys languages. No more need.( ERS_LOG_TOTAL_SOUND_LOADED, ERS_LOG_DEBUG_T, ERS_LOG_DEBUG_CT )
  126.  
  127.   v2.2b - [ 2007-10-28 ]
  128.  
  129.   (!) Removed a check. Since trim() is used :
  130.   Now no need to check space, new line, tabs, carriage returns, etc..
  131.  
  132.   v2.2a - [ 2007-10-28 ]
  133.  
  134.   (!) Changed the method of checking empty file. Now it's more efficient.
  135.   (!) Added another check to ignore texts which are no comments.
  136.   (!) Fixed a typo ( key language ).
  137.  
  138.   v2.2 - [ 2007-10-27 ]
  139.  
  140.   (+) Added a check to prevent to get a warning when a team has no sound.
  141.   (+) Added a check to prevent to not load empty file.
  142.   (+) Added support for coding-style '//' comments.
  143.   (!) No longer has a predefined max sounds limit. ( using dynamic array from amxx 1.8.0 )
  144.   (!) Minors optimizations.
  145.   (-) Removed useless code.
  146.  
  147.   v2.1a - [ 2007-07-13 ]
  148.  
  149.   (!) Fixed a bug with ML system.
  150.   (!) Fixed a stupid glitch with formatex().
  151.  
  152.   v2.1 - [ 2007-07-06 ]
  153.  
  154.   (!) Optimize a little.
  155.   (!) Rewritted loading_file() function.
  156.   (+) Added ML system & some texts.
  157.   (+) Added Color in text. ( !g = green ; !t = team color; !n = yellow (normal) )
  158.   (+) Added #_DEBUG.
  159.   (+) Added chat command : toggle on/off end round sounds.
  160.   (+) Added "ers_enabled" cvar : enable/disable plugin
  161.   (+) Added "ers_player_toggle" cvar : enable/disabled command chat for players
  162.   (+) Added ads message for chat command
  163.   (+) Added "erc_time_ads" cvar : control amount of times between 2 messages.
  164.  
  165.   v2.0b - [ 2007-07-04 ]
  166.  
  167.   (!) No features added. Sma reorganized a little and more.
  168.  
  169.   v2.0a - [ 2007-06-26 ]
  170.  
  171.   (!) Fixed. Bug under linux. Some blank lines weren't ignored. (thanks Deejay & NiLuje)
  172.  
  173.   v2.0 - [ 2007-06-26 ]
  174.  
  175.   (!) Totaly rewritted
  176.   (+) Added support for mp3 files.
  177.   (+) Added support per file. No more to edit .sma file to add sounds.
  178.   (+) Added support per-map file.
  179.   (+) Added support per-map prefix file.
  180.  
  181.   -> Paintlancer :
  182.  
  183.   v1.0 : [ 2004-10-14 ]
  184.   First release by Paintlancer.
  185.  
  186.   Credits:
  187.   - - - - - - -
  188.   * PaintLancer : Original idea and plugin.
  189.   * Avalanche : Inspired color chat function from gungame plugin.
  190.   * Arion : Random precache idea.
  191.  
  192.   * Languages translation :
  193.   - [fr] : Arkshine
  194.   - [de] : Mordekay
  195.   - [es] : Darkless
  196.  
  197.  
  198.   - - - - - - - - - - - */
  199.  
  200. #include <amxmodx>
  201. #include <amxmisc>
  202.  
  203.  
  204. new const
  205. // _________________________________________________
  206.  
  207. PLUGIN [] = "Alternative End Round Sounds",
  208. VERSION[] = "2.3b",
  209. AUTHOR [] = "Arkshine";
  210. // _________________________________________________
  211.  
  212.  
  213. #if AMXX_VERSION_NUM < 180
  214. #define old_amxx
  215. #endif
  216.  
  217.  
  218. /* ========================= [ "START" AERA FOR CHANGES ] ========================= */
  219.  
  220.  
  221. #define _DEBUG // Active debug
  222. #define MAX_FILE_LENGTH 196 // Max length for files + path.
  223.  
  224. #if defined old_amxx
  225. #define MAX_SOUNDS 25 // Max sounds per team
  226. #endif
  227.  
  228. new const
  229.  
  230. g_FileName[] = "roundsound", // Name of the main file if no files is found in 'g_FileFolder'.
  231. g_FileFolder[] = "round_sound", // Name of the directory in amxmodx/configs/ for per-map files.
  232. g_FilePrefix[] = "ini", // File extension used for the files.
  233. g_CmdChat[] = "/roundsound"; // Chat command for player.
  234.  
  235.  
  236. /* ========================= [ "END" AERA FOR CHANGES ] ========================= */
  237.  
  238.  
  239.  
  240. // - - - - - - - - - - - - - - - - - - - - - - -
  241.  
  242. #define MAX_PLAYERS 32
  243. #define TASKID_ADS 1333
  244. #define SIZE_FILE 0
  245. #define NULL -1
  246.  
  247. new
  248. bool:g_pHeardSound[ MAX_PLAYERS + 1 ],
  249.  
  250. #if !defined old_amxx
  251. Array:g_lstSoundCT,
  252. Array:g_lstSoundT,
  253. #endif
  254.  
  255. p_enabled,
  256. p_player_toggle,
  257. p_time_ads,
  258. p_random_precache,
  259.  
  260. g_sRp_value[12],
  261. g_msgSayText;
  262.  
  263.  
  264. enum _:e_Team
  265. {
  266. T = 0,
  267. CT,
  268. };
  269.  
  270. new g_nSnd[ e_Team ];
  271.  
  272. #if defined old_amxx
  273. new g_sTeam_sounds[ MAX_SOUNDS ][ e_Team ][ MAX_FILE_LENGTH ];
  274. #define charsmax(%1) sizeof( %1 ) - 1
  275. #endif
  276.  
  277. #define _is_wav(%1) equali( %1[strlen( %1 ) - 4 ], ".wav" )
  278.  
  279. // - - - - - - - - - - - - - - - - - - - - - - -
  280.  
  281.  
  282. public plugin_precache()
  283. {
  284. register_dictionary( "end_roundsound.txt" );
  285.  
  286. if( ( p_random_precache = get_cvar_pointer( "erc_random_precache" ) ) )
  287. get_pcvar_string( p_random_precache, g_sRp_value, charsmax( g_sRp_value ) );
  288.  
  289. if( !p_random_precache )
  290. return;
  291.  
  292. #if !defined old_amxx
  293. g_lstSoundCT = ArrayCreate( MAX_FILE_LENGTH );
  294. g_lstSoundT = ArrayCreate( MAX_FILE_LENGTH );
  295. #endif
  296.  
  297. loading_file();
  298. }
  299.  
  300.  
  301. public plugin_init()
  302. {
  303. register_plugin( PLUGIN, VERSION, AUTHOR );
  304. register_cvar( "ers_version", VERSION, FCVAR_SERVER | FCVAR_SPONLY );
  305.  
  306. register_event( "SendAudio", "eT_win" , "a", "2&%!MRAD_terwin" );
  307. register_event( "SendAudio", "eCT_win", "a", "2&%!MRAD_ctwin" );
  308.  
  309. p_enabled = register_cvar( "ers_enabled" , "1" );
  310. p_player_toggle = register_cvar( "ers_player_toggle" , "1" );
  311. p_time_ads = register_cvar( "erc_time_ads" , "120" );
  312.  
  313. if( !p_random_precache )
  314. {
  315. register_cvar( "erc_random_precache", g_sRp_value );
  316. server_cmd( "restart" );
  317. }
  318.  
  319. register_clcmd( "say" , "cmd_Say" );
  320. register_clcmd( "say_team" , "cmd_Say" );
  321.  
  322. g_msgSayText = get_user_msgid( "SayText" );
  323. }
  324.  
  325.  
  326. public client_authorized( id )
  327. g_pHeardSound[id] = true;
  328.  
  329.  
  330. public client_disconnect( id )
  331. {
  332. g_pHeardSound[id] = true;
  333. remove_task( id + TASKID_ADS );
  334. }
  335.  
  336.  
  337. public client_putinserver( id )
  338. {
  339. new Float:time = get_pcvar_float( p_time_ads );
  340.  
  341. if( !time )
  342. return;
  343.  
  344. remove_task( id + TASKID_ADS );
  345. set_task( time, "show_ads", id + TASKID_ADS, _, _, "b" );
  346. }
  347.  
  348.  
  349. public show_ads( taskid )
  350. {
  351. new id = taskid - TASKID_ADS;
  352. ShowPrint( id, "%L", id, "ERS_DISPLAY_ADS", g_CmdChat );
  353. }
  354.  
  355.  
  356. public cmd_Say( id )
  357. {
  358. if( !get_pcvar_num( p_enabled ) )
  359. return PLUGIN_CONTINUE;
  360.  
  361. static sMsg[64];
  362. read_argv( 1, sMsg, charsmax( sMsg ) );
  363.  
  364. if( equali( sMsg, g_CmdChat ) )
  365. {
  366. if( !get_pcvar_num( p_player_toggle ) )
  367. {
  368. ShowPrint( id, "%L", id, "ERS_CMD_DISABLED" );
  369. return PLUGIN_HANDLED;
  370. }
  371.  
  372. g_pHeardSound[id] = g_pHeardSound[id] ? false : true;
  373. ShowPrint( id, "%L", id, g_pHeardSound[id] ? "ERS_SOUND_ENABLED" : "ERS_SOUND_DISABLED" );
  374.  
  375. return PLUGIN_HANDLED;
  376. }
  377.  
  378. return PLUGIN_CONTINUE;
  379. }
  380.  
  381.  
  382. public eT_win()
  383. {
  384. if( !g_nSnd[ e_Team:T ] )
  385. return;
  386.  
  387. play_sound( e_Team:T );
  388. }
  389.  
  390.  
  391. public eCT_win()
  392. {
  393. if( !g_nSnd[ e_Team:CT ] )
  394. return;
  395.  
  396. play_sound( e_Team:CT );
  397. }
  398.  
  399.  
  400. play_sound( iTeam )
  401. {
  402. static
  403. // - - - - - - - - - - - - - - - -
  404. sCurSnd[ MAX_FILE_LENGTH ];
  405. // - - - - - - - - - - - - - - - -
  406.  
  407. new iRand;
  408.  
  409. if( g_nSnd[ iTeam ] > 1 )
  410. iRand = random( g_nSnd[ iTeam ] );
  411.  
  412. #if defined old_amxx
  413. copy( sCurSnd, MAX_FILE_LENGTH - 1, g_sTeam_sounds[ iRand ][ iTeam ] );
  414. #else
  415. ArrayGetString( iTeam == CT ? g_lstSoundCT : g_lstSoundT, iRand, sCurSnd, MAX_FILE_LENGTH - 1 );
  416. #endif
  417.  
  418. _is_wav( sCurSnd ) ?
  419.  
  420. format( sCurSnd, MAX_FILE_LENGTH - 1, "spk %s", sCurSnd[6] ) :
  421. format( sCurSnd, MAX_FILE_LENGTH - 1, "mp3 play %s", sCurSnd );
  422.  
  423. if( get_pcvar_num( p_player_toggle ) )
  424. {
  425. static
  426. // - - - - - - - - - - -
  427. iPlayers[32],
  428. iNum, pid;
  429. // - - - - - - - - - - -
  430.  
  431. get_players( iPlayers, iNum, "c" );
  432.  
  433. for( new i; i < iNum; i++ )
  434. {
  435. pid = iPlayers[i];
  436.  
  437. if( !g_pHeardSound[pid] || is_user_bot( pid ) )
  438. continue;
  439.  
  440. client_cmd( pid, "%s", sCurSnd );
  441. }
  442. }
  443. else
  444. client_cmd( 0, "%s", sCurSnd );
  445. }
  446.  
  447.  
  448. get_prefix( sMap[], iLen_map, sMapType[], iLen_type )
  449. {
  450. new
  451. // - - - - - - - - -
  452. sRest[32];
  453. // - - - - - - - - -
  454.  
  455. get_mapname( sMap, iLen_map );
  456. strtok( sMap, sMapType, iLen_type, sRest, charsmax( sRest ), '_', 1 );
  457. }
  458.  
  459.  
  460. loading_file()
  461. {
  462. static
  463. // - - - - - - - - - - - - - - - - -
  464. sPath[ MAX_FILE_LENGTH ],
  465. // |
  466. sConfigsDir[64],
  467. sPrefix[6],
  468. sMap[32];
  469. // - - - - - - - - - - - - - - - - -
  470.  
  471. get_prefix( sMap, charsmax( sMap ), sPrefix, charsmax( sPrefix ) );
  472. get_configsdir( sConfigsDir, charsmax( sConfigsDir ) );
  473.  
  474.  
  475. new bool:bFound;
  476.  
  477. for( new i = 1; i <= 3; i++ )
  478. {
  479. switch( i )
  480. {
  481. case 1 : formatex( sPath, charsmax( sPath ), "%s/%s/prefix-%s.%s", sConfigsDir, g_FileFolder, sPrefix, g_FilePrefix );
  482. case 2 : formatex( sPath, charsmax( sPath ), "%s/%s/%s.%s", sConfigsDir, g_FileFolder, sMap, g_FilePrefix );
  483. case 3 : formatex( sPath, charsmax( sPath ), "%s/%s.%s", sConfigsDir, g_FileName, g_FilePrefix );
  484.  
  485. default : break;
  486. }
  487.  
  488. if( !CheckFile( sPath ) )
  489. continue;
  490.  
  491. bFound = true;
  492. break;
  493. }
  494.  
  495. log_amx( "---" );
  496.  
  497. bFound ?
  498. log_amx( "%L", LANG_SERVER, "ERS_LOG_LOADING", sPath ) :
  499. log_amx( "%L", LANG_SERVER, "ERS_LOG_NO_FILES_FOUND" );
  500.  
  501. load_sound( sPath );
  502. }
  503.  
  504.  
  505. load_sound( const file[] )
  506. {
  507. new
  508. // - - - - - - - - - - - - - - -
  509. sBuffer[256],
  510. // |
  511. sLeft[ MAX_FILE_LENGTH ],
  512. sRight[4],
  513. sExt[6],
  514. // |
  515. eTeam;
  516. // - - - - - - - - - - - - - - -
  517.  
  518. new fp = fopen( file, "rt" );
  519.  
  520. while( !feof( fp ) )
  521. {
  522. fgets( fp, sBuffer, charsmax( sBuffer ) );
  523.  
  524. trim( sBuffer );
  525.  
  526. if( !sBuffer[0] || sBuffer[0] == ';' || ( sBuffer[0] == '/' && sBuffer[1] == '/' ) )
  527. continue;
  528.  
  529. if( sBuffer[0] != '"' || strlen( sBuffer ) < 11 )
  530. continue;
  531.  
  532. parse( sBuffer, sLeft, charsmax( sLeft ), sRight, charsmax( sRight ) );
  533. formatex( sExt, charsmax( sExt ), sLeft[ strlen( sLeft ) - 4 ] );
  534.  
  535. if( equali( sExt, ".mp3" ) == -1 || equali( sExt, ".wav" ) == -1 )
  536. {
  537. log_amx( "%L", LANG_SERVER, "ERS_LOG_UNKNOW_EXTENSION", sExt );
  538. continue;
  539. }
  540.  
  541. if( !file_exists( sLeft ) )
  542. {
  543. log_amx( "%L", LANG_SERVER, "ERS_LOG_INEXISTENT_FILE", sLeft );
  544. continue;
  545. }
  546.  
  547. eTeam = NULL;
  548.  
  549. if( equali( sRight, "CT" ) )
  550. eTeam = CT;
  551.  
  552. else if( equali( sRight, "T" ) )
  553. eTeam = T;
  554.  
  555. if( eTeam == NULL )
  556. {
  557. log_amx( "%L", LANG_SERVER, "ERS_LOG_NO_TEAM_SOUND", sLeft );
  558. continue;
  559. }
  560.  
  561. #if defined old_amxx
  562. copy( g_sTeam_sounds[ g_nSnd[ eTeam ] ][ eTeam ], MAX_FILE_LENGTH - 1, sLeft );
  563. #else
  564. ArrayPushString( eTeam == CT ? g_lstSoundCT : g_lstSoundT, sLeft );
  565. #endif
  566.  
  567. ++g_nSnd[ eTeam ];
  568. }
  569. fclose( fp );
  570.  
  571. if( g_nSnd[ e_Team:T ] > 1 || g_nSnd[ e_Team:CT ] > 1 )
  572. {
  573. new iMax_t, iMax_ct;
  574. GetPrecacheValue( iMax_t, iMax_ct );
  575.  
  576. #if defined old_amxx
  577. UpdateArray( iMax_t, e_Team:T );
  578. UpdateArray( iMax_ct, e_Team:CT );
  579. #else
  580. p_DeleteRandomItem( iMax_t , e_Team:T , g_lstSoundT );
  581. p_DeleteRandomItem( iMax_ct, e_Team:CT, g_lstSoundCT );
  582. #endif
  583. }
  584.  
  585. log_amx( "---" );
  586.  
  587. #if defined _DEBUG
  588. log_amx( "[ Loading %d CTs Sounds ]", g_nSnd[ e_team:CT ] );
  589. #endif
  590. #if defined old_amxx
  591. PrecacheSounds( e_Team:CT );
  592. #else
  593. PrecacheSounds_n( g_lstSoundCT );
  594. #endif
  595.  
  596. #if defined _DEBUG
  597. log_amx( "[ Loading %d Ts Sounds ]", g_nSnd[ e_team:T ] );
  598. #endif
  599. #if defined old_amxx
  600. PrecacheSounds( e_Team:T );
  601. #else
  602. PrecacheSounds_n( g_lstSoundT );
  603. #endif
  604. }
  605.  
  606.  
  607. GetPrecacheValue( &iMax_t, &iMax_ct )
  608. {
  609. trim( g_sRp_value );
  610. new pos = contain( g_sRp_value, "-" );
  611.  
  612. if( pos > 0 )
  613. {
  614. iMax_ct = str_to_num( g_sRp_value[ pos + 1 ] )
  615. g_sRp_value[ pos ] = '^0';
  616. iMax_t = str_to_num( g_sRp_value );
  617. }
  618. else
  619. {
  620. iMax_t = str_to_num( g_sRp_value );
  621. iMax_ct = iMax_t;
  622. }
  623. }
  624.  
  625.  
  626. stock UpdateArray( iMax, iTeam )
  627. {
  628. new const iCnt_sound = g_nSnd[ iTeam ];
  629.  
  630. if( !iMax || iMax == iCnt_sound )
  631. return;
  632.  
  633. if( iMax >= iCnt_sound )
  634. iMax = iCnt_sound - 1;
  635.  
  636. static
  637. sTmp_sounds[ MAX_SOUNDS ][ e_Team ][ MAX_FILE_LENGTH ],
  638. iLast_number[ MAX_SOUNDS ];
  639.  
  640. new i, iRand;
  641. for( i = 0; i < iCnt_sound; i++ )
  642. {
  643. copy( sTmp_sounds[i][ iTeam ], MAX_FILE_LENGTH - 1, g_sTeam_sounds[i][ iTeam ] );
  644. g_sTeam_sounds[i][ iTeam ][0] = '^0';
  645. }
  646.  
  647. arrayset( iLast_number, 0, charsmax( iLast_number ) );
  648.  
  649. i = 0;
  650. while( i != iMax )
  651. {
  652. check:
  653. iRand = random( iCnt_sound );
  654.  
  655. if( iLast_number[ iRand ] )
  656. goto check;
  657.  
  658. copy( g_sTeam_sounds[i][ iTeam ], MAX_FILE_LENGTH - 1, sTmp_sounds[ iRand ][ iTeam ] );
  659. ++i;
  660.  
  661. iLast_number[ iRand ] = 1;
  662. }
  663.  
  664. g_nSnd[ iTeam ] = iMax;
  665. }
  666.  
  667.  
  668. stock p_DeleteRandomItem( iMax, iTeam, Array:sSound_a )
  669. {
  670. new const iCnt_sound = g_nSnd[ iTeam ];
  671.  
  672. if( !iMax || iMax == iCnt_sound )
  673. return;
  674.  
  675. if( iMax >= iCnt_sound )
  676. iMax = iCnt_sound - 1;
  677.  
  678. DeleteRandomItem( iCnt_sound - iMax, sSound_a );
  679. g_nSnd[ iTeam ] = iMax;
  680. }
  681.  
  682.  
  683. stock DeleteRandomItem( iRandom_n, Array:sSound_a )
  684. {
  685. new i;
  686.  
  687. while( i++ != iRandom_n )
  688. ArrayDeleteItem( sSound_a, random( ArraySize( sSound_a ) ) );
  689. }
  690.  
  691.  
  692. stock PrecacheSounds( iTeam )
  693. {
  694. for( new i; i < g_nSnd[ iTeam ]; i++ )
  695. {
  696. PrecacheFile( g_sTeam_sounds[i][ iTeam ] );
  697.  
  698. #if defined _DEBUG
  699. log_amx( " - %s", g_sTeam_sounds[i][ iTeam ] );
  700. #endif
  701. }
  702.  
  703. log_amx( "---" );
  704. }
  705.  
  706.  
  707. stock PrecacheSounds_n( Array:sSound_a )
  708. {
  709. static
  710. // - - - - - - - - - - - - - - - - - - -
  711. sFile[ MAX_FILE_LENGTH ],
  712. iFileLen = charsmax( sFile );
  713. // - - - - - - - - - - - - - - - - - - -
  714.  
  715. for( new i; i < ArraySize( sSound_a ); i++ )
  716. {
  717. ArrayGetString( sSound_a, i, sFile, iFileLen );
  718. PrecacheFile( sFile );
  719.  
  720. #if defined _DEBUG
  721. log_amx( " - %s", sFile );
  722. #endif
  723. }
  724.  
  725. log_amx( "---" );
  726. }
  727.  
  728.  
  729. PrecacheFile( const sound[] )
  730. {
  731. _is_wav( sound ) ?
  732.  
  733. precache_sound( sound[6] ) :
  734. precache_generic( sound );
  735. }
  736.  
  737.  
  738. ShowPrint( id, const sMsg[], { Float, Sql, Result, _ }:... )
  739. {
  740. static
  741. // - - - - - - - - -
  742. newMsg[191],
  743. message[191],
  744. // |
  745. tNewMsg;
  746. // - - - - - - - - -
  747.  
  748. tNewMsg = charsmax( newMsg );
  749. vformat( newMsg, tNewMsg, sMsg, 3 );
  750.  
  751. replace_all( newMsg, tNewMsg, "!t", "^3" );
  752. replace_all( newMsg, tNewMsg, "!g", "^4" );
  753. replace_all( newMsg, tNewMsg, "!n", "^1" );
  754.  
  755. formatex( message, charsmax( message ), "^4[ERS]^1 %s", newMsg );
  756.  
  757. emessage_begin( MSG_ONE, g_msgSayText, _, id );
  758. ewrite_byte( id );
  759. ewrite_string( message );
  760. emessage_end();
  761. }
  762.  
  763.  
  764. bool:CheckFile( const file[] )
  765. {
  766. new
  767. // - - - - - - - - - - - - - - - - -
  768. sBuffer[256],
  769. fp = fopen( file, "rt" );
  770. // - - - - - - - - - - - - - - - - -
  771.  
  772. if( !fp )
  773. return false;
  774.  
  775. while( !feof( fp ) )
  776. {
  777. fgets( fp, sBuffer, charsmax( sBuffer ) );
  778.  
  779. trim( sBuffer );
  780.  
  781. if( !sBuffer[0] || sBuffer[0] == ';' || ( sBuffer[0] == '/' && sBuffer[1] == '/' ) || sBuffer[0] != '"' )
  782. continue;
  783.  
  784. if( ( contain( sBuffer, ".mp3^"" ) != -1 || contain( sBuffer, ".wav^"" ) != -1 ) && ( contain( sBuffer, "^"T^"" ) != -1 || contain( sBuffer, "^"CT^"" ) != -1 ) )
  785. return true;
  786. }
  787. fclose( fp );
  788.  
  789. return false;
  790. }

_________________
Kép


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


Ki van itt

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