hlmod.hu

Magyar Half-Life Mód közösség!
Pontos idő: 2024.03.28. 23:42



Jelenlévő felhasználók

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

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

Regisztrált felhasználók: nincs regisztrált felhasználó 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ő


Lezárt fórum  A témát lezárták, nem szerkesztheted a hozzászólásaid, és nem küldhetsz új hozzászólást.  [ 6 hozzászólás ] 
Szerző Üzenet
 Hozzászólás témája: FunnySounds
HozzászólásElküldve: 2018.10.14. 18:33 
Offline
Jómunkásember
Avatar

Csatlakozott: 2016.03.03. 15:51
Hozzászólások: 453
Megköszönt másnak: 106 alkalommal
Megköszönték neki: 7 alkalommal
Sziasztok. Azthogy lehetne megoldani,hogy Tulajnak/Főadminak/Adminnak ne kelljen várni x időt hogy következő hangot játszon le de playernek x ideig kelljen várnia,hogy következő hangot játszon le

Köszönöm szépen előre a segítséget


Csatolmányok:
funny.sma [3.48 KiB]
Letöltve 99 alkalommal.

_________________
Kép
Hozzászólás jelentése
Vissza a tetejére
   
 
 Hozzászólás témája: Re: FunnySounds
HozzászólásElküldve: 2018.10.14. 19:19 
Offline
Fórum Moderátor
Avatar

Csatlakozott: 2012.07.02. 17:41
Hozzászólások: 1641
Megköszönt másnak: 121 alkalommal
Megköszönték neki: 247 alkalommal
regener @ Funny Sounds

_________________
Kép

Ők köszönték meg theglorious nek ezt a hozzászólást: DaffikiD (2018.10.14. 19:48)
  Népszerűség: 2.27%


Hozzászólás jelentése
Vissza a tetejére
   
 
 Hozzászólás témája: Re: FunnySounds
HozzászólásElküldve: 2018.10.14. 19:49 
Offline
Jómunkásember
Avatar

Csatlakozott: 2016.03.03. 15:51
Hozzászólások: 453
Megköszönt másnak: 106 alkalommal
Megköszönték neki: 7 alkalommal
theglorious írta:


beleírtam minden

  1. funny.sma(80) : warning 217: loose indentation
  2. funny.sma(85) : error 017: undefined symbol "g_iTimeExpired"
  3. funny.sma(85) : warning 215: expression has no effect
  4. funny.sma(85) : error 001: expected token: ";", but found "]"
  5. funny.sma(85) : error 029: invalid expression, assumed zero
  6. funny.sma(85) : fatal error 107: too many error messages on one line


ezzeket a hibákat dobja ki


Csatolmányok:
funny.sma [6.08 KiB]
Letöltve 100 alkalommal.

_________________
Kép
Hozzászólás jelentése
Vissza a tetejére
   
 
 Hozzászólás témája: Re: FunnySounds
HozzászólásElküldve: 2018.10.17. 16:50 
Offline
Fórum Moderátor
Avatar

Csatlakozott: 2012.07.02. 17:41
Hozzászólások: 1641
Megköszönt másnak: 121 alkalommal
Megköszönték neki: 247 alkalommal
  1. #include <amxmodx>
  2.  
  3. new const PLUGIN[] = "Funny Sounds";
  4. new const VERSION[] = "1.0";
  5. new const AUTHOR[] = "mforce";
  6.  
  7.  
  8. new const PREFIX[] = "Funny Sounds";
  9.  
  10. #define IMMUN ADMIN_KICK            //Adminoknak nincs időlimit
  11. #define ACCESS_FLAG             ADMIN_KICK          // - Type // before # if you want it for all players.
  12. #define TIME_BETWEEN_SOUNDS     30                  // - in seconds
  13.  
  14. new Array:musicname, Array:musicpath;
  15. new g_aSize;
  16. new g_iTimeExpired[33], bool:g_iSwitchOff[33];
  17.  
  18. public plugin_init() {
  19.     register_plugin(PLUGIN, VERSION, AUTHOR);
  20.     register_dictionary("funny_sounds.txt");
  21.    
  22.     register_clcmd("say", "sayhandler");
  23.     register_clcmd("say_team", "sayhandler");
  24.     register_clcmd("say /sounds", "sound_switchoff");
  25.     register_clcmd("say /soundlist", "musicmenu");
  26.     set_task(300.0, "toswitchoff", 0, .flags="b")
  27. }
  28.  
  29. public toswitchoff() {
  30.     ChatColor(0, "^4[%s]^1 %L ^3/sounds", PREFIX, LANG_SERVER, "TO_SWTICH_OFF");
  31. }
  32.  
  33. public plugin_precache() {
  34.     musicname = ArrayCreate(32);
  35.     musicpath = ArrayCreate(64);
  36.    
  37.     new sBuffer[256], sFile[64], sSoundName[32], sSoundPath[64], pFile;
  38.  
  39.     get_localinfo("amxx_configsdir", sFile, charsmax(sFile));
  40.     format(sFile, charsmax(sFile), "%s/funny_sounds.ini", sFile);
  41.  
  42.     pFile = fopen(sFile, "rt");
  43.  
  44.     if(pFile) {    
  45.         while(!feof(pFile)) {
  46.             fgets(pFile, sBuffer, charsmax(sBuffer));
  47.             trim(sBuffer);
  48.             if(sBuffer[0] == ';' || sBuffer[0] == ' ') continue;
  49.  
  50.             parse(sBuffer, sSoundName, charsmax(sSoundName), sSoundPath, charsmax(sSoundPath));
  51.  
  52.             if(containi(sSoundPath, ".mp3") != -1 || containi(sSoundPath, ".wav") != -1) {
  53.                 precache_sound(sSoundPath);
  54.                 ArrayPushString(musicname, sSoundName);
  55.                 ArrayPushString(musicpath, sSoundPath);
  56.             }
  57.         }
  58.         fclose(pFile);
  59.         g_aSize = ArraySize(musicname);
  60.     }
  61.     else write_file(sFile, ";^"anything^" ^"any_dir/anything.mp3^"^n");
  62. }
  63.  
  64. public sayhandler(id) {
  65.     #if defined ACCESS_FLAG
  66.     if(~get_user_flags(id) & ACCESS_FLAG) return;
  67.     #endif
  68.  
  69.     new message[190]; read_args(message, charsmax(message));
  70.     remove_quotes(message);
  71.     new sSoundName[32];
  72.    
  73.     for(new i; i<g_aSize; i++) {
  74.         ArrayGetString(musicname, i, sSoundName, charsmax(sSoundName));
  75.         if(equali(message, sSoundName)) {
  76.             expirecheck(id, i);
  77.         }
  78.     }
  79. }
  80.  
  81. /*expirecheck(id, item) {
  82.     new usrtime = get_user_time(id);
  83.        
  84.     if(usrtime >= g_iTimeExpired[id]) {
  85.         playsound(item);
  86.         g_iTimeExpired[id] = (usrtime + TIME_BETWEEN_SOUNDS);
  87.     }
  88.     else
  89.         ColorChat(id, NORMAL, "^4[%s]^1 %L", PREFIX, LANG_SERVER, "YOU_HAVE_TO_WAIT" , (g_iTimeExpired[id] - usrtime));
  90. }*/
  91.  
  92. expirecheck(id, item) {
  93.     new usrtime = get_user_time(id);
  94.        
  95.     if(usrtime >= g_iTimeExpired[id]) {
  96.         playsound(item);
  97.         g_iTimeExpired[id] = (usrtime + TIME_BETWEEN_SOUNDS);
  98.     }
  99.     #if defined IMMUN
  100.     else if(get_user_flags(id) & IMMUN)
  101.     {
  102.         playsound(item);
  103.     }
  104.     #endif
  105.     else
  106.         ChatColor(id, "^4[%s]^1 %L", PREFIX, LANG_SERVER, "YOU_HAVE_TO_WAIT" , (g_iTimeExpired[id] - usrtime));
  107. }
  108.  
  109. playsound(item) {
  110.     new szSound[64]; ArrayGetString(musicpath, item, szSound, charsmax(szSound));
  111.     new makesound[128];
  112.     if(containi(szSound, ".mp3") != -1)
  113.         formatex(makesound, charsmax(makesound), "mp3 play ^"sound/%s^"", szSound);
  114.     else
  115.         formatex(makesound, charsmax(makesound), "spk ^"%s^"", szSound);
  116.  
  117.  
  118.     new players[32], num, tempid;
  119.     get_players(players, num, "c");
  120.     for(new i; i<num; i++) {
  121.         tempid = players[i];
  122.         if(!g_iSwitchOff[tempid])
  123.             client_cmd(tempid, "%s", makesound);
  124.     }
  125. }
  126.  
  127. public sound_switchoff(id) {
  128.     switch(g_iSwitchOff[id]) {
  129.         case false: {
  130.             g_iSwitchOff[id] = true;
  131.             client_cmd(id, "setinfo _funnysoundsoff 1");
  132.             ChatColor(id, "^4[%s]^3 %L", PREFIX, LANG_SERVER, "SOUNDS_SWITCHED_OFF");
  133.         }
  134.         case true: {
  135.             g_iSwitchOff[id] = false;
  136.             client_cmd(id, "setinfo _funnysoundsoff 0");
  137.             ChatColor(id, "^4[%s]^3 %L", PREFIX, LANG_SERVER, "SOUNDS_SWITCHED_ON");
  138.         }
  139.     }
  140. }
  141.  
  142. public client_putinserver(id) {
  143.     if(is_user_sounds_off(id))
  144.         g_iSwitchOff[id] = true;
  145. }
  146.  
  147. public client_disconnected(id) {
  148.     g_iTimeExpired[id] = 0;
  149.     g_iSwitchOff[id] = false;
  150. }
  151.  
  152. public plugin_end() {
  153.     ArrayDestroy(musicname);
  154.     ArrayDestroy(musicpath);
  155. }
  156.  
  157. stock bool:is_user_sounds_off(id) {
  158.     new switcher[8];
  159.     get_user_info(id, "_funnysoundsoff", switcher, charsmax(switcher));
  160.     if(equal(switcher, "1")) return true;
  161.     return false;
  162. }
  163.  
  164. public musicmenu(id) {
  165.     #if defined ACCESS_FLAG
  166.     if(~get_user_flags(id) & ACCESS_FLAG) return;
  167.     #endif
  168.    
  169.     new s_MenuName[128]; formatex(s_MenuName, charsmax(s_MenuName), "%s^nby \r%s \y", PLUGIN, AUTHOR);
  170.     new menu = menu_create(s_MenuName, "musicmenu_h");
  171.     new sSoundName[32];
  172.     for(new i; i<g_aSize;i++) {
  173.         ArrayGetString(musicname, i, sSoundName, charsmax(sSoundName));
  174.         menu_additem(menu, sSoundName, "", 0)
  175.     }
  176.     menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
  177.     menu_setprop(menu, MPROP_BACKNAME, "Vissza");
  178.     menu_setprop(menu, MPROP_NEXTNAME, "Következő");
  179.     menu_setprop(menu, MPROP_EXITNAME, "Kilépés");
  180.     menu_display(id, menu, 0);
  181. }
  182.  
  183. public musicmenu_h(id, menu, item) {
  184.     if(item == MENU_EXIT) {
  185.         menu_destroy(menu);
  186.         return PLUGIN_HANDLED;
  187.     }
  188.    
  189.     expirecheck(id, item);
  190.    
  191.     menu_destroy(menu);
  192.     return PLUGIN_HANDLED;
  193. }
  194.  
  195. stock ChatColor(const id, const szMessage[], any:...) {
  196.         static pnum, players[32], szMsg[190], IdMsg;
  197.         vformat(szMsg, charsmax(szMsg), szMessage, 3);
  198.        
  199.         if(!IdMsg) IdMsg = get_user_msgid("SayText");
  200.        
  201.         if(id) {
  202.                 if(!is_user_connected(id)) return;
  203.                 players[0] = id;
  204.                 pnum = 1;
  205.         }
  206.         else get_players(players, pnum, "ch");
  207.        
  208.         for(new i; i < pnum; i++) {
  209.                 message_begin(MSG_ONE, IdMsg, .player = players[i]);
  210.                 write_byte(players[i]);
  211.                 write_string(szMsg);
  212.                 message_end();
  213.         }
  214. }

_________________
Kép

Ők köszönték meg theglorious nek ezt a hozzászólást: DaffikiD (2018.10.20. 08:38)
  Népszerűség: 2.27%


Hozzászólás jelentése
Vissza a tetejére
   
 
 Hozzászólás témája: Re: FunnySounds
HozzászólásElküldve: 2018.10.20. 08:39 
Offline
Jómunkásember
Avatar

Csatlakozott: 2016.03.03. 15:51
Hozzászólások: 453
Megköszönt másnak: 106 alkalommal
Megköszönték neki: 7 alkalommal
theglorious írta:
  1. #include <amxmodx>
  2.  
  3. new const PLUGIN[] = "Funny Sounds";
  4. new const VERSION[] = "1.0";
  5. new const AUTHOR[] = "mforce";
  6.  
  7.  
  8. new const PREFIX[] = "Funny Sounds";
  9.  
  10. #define IMMUN ADMIN_KICK            //Adminoknak nincs időlimit
  11. #define ACCESS_FLAG             ADMIN_KICK          // - Type // before # if you want it for all players.
  12. #define TIME_BETWEEN_SOUNDS     30                  // - in seconds
  13.  
  14. new Array:musicname, Array:musicpath;
  15. new g_aSize;
  16. new g_iTimeExpired[33], bool:g_iSwitchOff[33];
  17.  
  18. public plugin_init() {
  19.     register_plugin(PLUGIN, VERSION, AUTHOR);
  20.     register_dictionary("funny_sounds.txt");
  21.    
  22.     register_clcmd("say", "sayhandler");
  23.     register_clcmd("say_team", "sayhandler");
  24.     register_clcmd("say /sounds", "sound_switchoff");
  25.     register_clcmd("say /soundlist", "musicmenu");
  26.     set_task(300.0, "toswitchoff", 0, .flags="b")
  27. }
  28.  
  29. public toswitchoff() {
  30.     ChatColor(0, "^4[%s]^1 %L ^3/sounds", PREFIX, LANG_SERVER, "TO_SWTICH_OFF");
  31. }
  32.  
  33. public plugin_precache() {
  34.     musicname = ArrayCreate(32);
  35.     musicpath = ArrayCreate(64);
  36.    
  37.     new sBuffer[256], sFile[64], sSoundName[32], sSoundPath[64], pFile;
  38.  
  39.     get_localinfo("amxx_configsdir", sFile, charsmax(sFile));
  40.     format(sFile, charsmax(sFile), "%s/funny_sounds.ini", sFile);
  41.  
  42.     pFile = fopen(sFile, "rt");
  43.  
  44.     if(pFile) {    
  45.         while(!feof(pFile)) {
  46.             fgets(pFile, sBuffer, charsmax(sBuffer));
  47.             trim(sBuffer);
  48.             if(sBuffer[0] == ';' || sBuffer[0] == ' ') continue;
  49.  
  50.             parse(sBuffer, sSoundName, charsmax(sSoundName), sSoundPath, charsmax(sSoundPath));
  51.  
  52.             if(containi(sSoundPath, ".mp3") != -1 || containi(sSoundPath, ".wav") != -1) {
  53.                 precache_sound(sSoundPath);
  54.                 ArrayPushString(musicname, sSoundName);
  55.                 ArrayPushString(musicpath, sSoundPath);
  56.             }
  57.         }
  58.         fclose(pFile);
  59.         g_aSize = ArraySize(musicname);
  60.     }
  61.     else write_file(sFile, ";^"anything^" ^"any_dir/anything.mp3^"^n");
  62. }
  63.  
  64. public sayhandler(id) {
  65.     #if defined ACCESS_FLAG
  66.     if(~get_user_flags(id) & ACCESS_FLAG) return;
  67.     #endif
  68.  
  69.     new message[190]; read_args(message, charsmax(message));
  70.     remove_quotes(message);
  71.     new sSoundName[32];
  72.    
  73.     for(new i; i<g_aSize; i++) {
  74.         ArrayGetString(musicname, i, sSoundName, charsmax(sSoundName));
  75.         if(equali(message, sSoundName)) {
  76.             expirecheck(id, i);
  77.         }
  78.     }
  79. }
  80.  
  81. /*expirecheck(id, item) {
  82.     new usrtime = get_user_time(id);
  83.        
  84.     if(usrtime >= g_iTimeExpired[id]) {
  85.         playsound(item);
  86.         g_iTimeExpired[id] = (usrtime + TIME_BETWEEN_SOUNDS);
  87.     }
  88.     else
  89.         ColorChat(id, NORMAL, "^4[%s]^1 %L", PREFIX, LANG_SERVER, "YOU_HAVE_TO_WAIT" , (g_iTimeExpired[id] - usrtime));
  90. }*/
  91.  
  92. expirecheck(id, item) {
  93.     new usrtime = get_user_time(id);
  94.        
  95.     if(usrtime >= g_iTimeExpired[id]) {
  96.         playsound(item);
  97.         g_iTimeExpired[id] = (usrtime + TIME_BETWEEN_SOUNDS);
  98.     }
  99.     #if defined IMMUN
  100.     else if(get_user_flags(id) & IMMUN)
  101.     {
  102.         playsound(item);
  103.     }
  104.     #endif
  105.     else
  106.         ChatColor(id, "^4[%s]^1 %L", PREFIX, LANG_SERVER, "YOU_HAVE_TO_WAIT" , (g_iTimeExpired[id] - usrtime));
  107. }
  108.  
  109. playsound(item) {
  110.     new szSound[64]; ArrayGetString(musicpath, item, szSound, charsmax(szSound));
  111.     new makesound[128];
  112.     if(containi(szSound, ".mp3") != -1)
  113.         formatex(makesound, charsmax(makesound), "mp3 play ^"sound/%s^"", szSound);
  114.     else
  115.         formatex(makesound, charsmax(makesound), "spk ^"%s^"", szSound);
  116.  
  117.  
  118.     new players[32], num, tempid;
  119.     get_players(players, num, "c");
  120.     for(new i; i<num; i++) {
  121.         tempid = players[i];
  122.         if(!g_iSwitchOff[tempid])
  123.             client_cmd(tempid, "%s", makesound);
  124.     }
  125. }
  126.  
  127. public sound_switchoff(id) {
  128.     switch(g_iSwitchOff[id]) {
  129.         case false: {
  130.             g_iSwitchOff[id] = true;
  131.             client_cmd(id, "setinfo _funnysoundsoff 1");
  132.             ChatColor(id, "^4[%s]^3 %L", PREFIX, LANG_SERVER, "SOUNDS_SWITCHED_OFF");
  133.         }
  134.         case true: {
  135.             g_iSwitchOff[id] = false;
  136.             client_cmd(id, "setinfo _funnysoundsoff 0");
  137.             ChatColor(id, "^4[%s]^3 %L", PREFIX, LANG_SERVER, "SOUNDS_SWITCHED_ON");
  138.         }
  139.     }
  140. }
  141.  
  142. public client_putinserver(id) {
  143.     if(is_user_sounds_off(id))
  144.         g_iSwitchOff[id] = true;
  145. }
  146.  
  147. public client_disconnected(id) {
  148.     g_iTimeExpired[id] = 0;
  149.     g_iSwitchOff[id] = false;
  150. }
  151.  
  152. public plugin_end() {
  153.     ArrayDestroy(musicname);
  154.     ArrayDestroy(musicpath);
  155. }
  156.  
  157. stock bool:is_user_sounds_off(id) {
  158.     new switcher[8];
  159.     get_user_info(id, "_funnysoundsoff", switcher, charsmax(switcher));
  160.     if(equal(switcher, "1")) return true;
  161.     return false;
  162. }
  163.  
  164. public musicmenu(id) {
  165.     #if defined ACCESS_FLAG
  166.     if(~get_user_flags(id) & ACCESS_FLAG) return;
  167.     #endif
  168.    
  169.     new s_MenuName[128]; formatex(s_MenuName, charsmax(s_MenuName), "%s^nby \r%s \y", PLUGIN, AUTHOR);
  170.     new menu = menu_create(s_MenuName, "musicmenu_h");
  171.     new sSoundName[32];
  172.     for(new i; i<g_aSize;i++) {
  173.         ArrayGetString(musicname, i, sSoundName, charsmax(sSoundName));
  174.         menu_additem(menu, sSoundName, "", 0)
  175.     }
  176.     menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
  177.     menu_setprop(menu, MPROP_BACKNAME, "Vissza");
  178.     menu_setprop(menu, MPROP_NEXTNAME, "Következő");
  179.     menu_setprop(menu, MPROP_EXITNAME, "Kilépés");
  180.     menu_display(id, menu, 0);
  181. }
  182.  
  183. public musicmenu_h(id, menu, item) {
  184.     if(item == MENU_EXIT) {
  185.         menu_destroy(menu);
  186.         return PLUGIN_HANDLED;
  187.     }
  188.    
  189.     expirecheck(id, item);
  190.    
  191.     menu_destroy(menu);
  192.     return PLUGIN_HANDLED;
  193. }
  194.  
  195. stock ChatColor(const id, const szMessage[], any:...) {
  196.         static pnum, players[32], szMsg[190], IdMsg;
  197.         vformat(szMsg, charsmax(szMsg), szMessage, 3);
  198.        
  199.         if(!IdMsg) IdMsg = get_user_msgid("SayText");
  200.        
  201.         if(id) {
  202.                 if(!is_user_connected(id)) return;
  203.                 players[0] = id;
  204.                 pnum = 1;
  205.         }
  206.         else get_players(players, pnum, "ch");
  207.        
  208.         for(new i; i < pnum; i++) {
  209.                 message_begin(MSG_ONE, IdMsg, .player = players[i]);
  210.                 write_byte(players[i]);
  211.                 write_string(szMsg);
  212.                 message_end();
  213.         }
  214. }


Köszönöm Szépen ment a pacsi

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 
 Hozzászólás témája: Re: FunnySounds
HozzászólásElküldve: 2019.01.13. 13:16 
Offline
Senior Tag

Csatlakozott: 2015.11.20. 17:59
Hozzászólások: 270
Megköszönt másnak: 33 alkalommal
Megköszönték neki: 2 alkalommal
theglorious írta:
  1. #include <amxmodx>
  2.  
  3. new const PLUGIN[] = "Funny Sounds";
  4. new const VERSION[] = "1.0";
  5. new const AUTHOR[] = "mforce";
  6.  
  7.  
  8. new const PREFIX[] = "Funny Sounds";
  9.  
  10. #define IMMUN ADMIN_KICK            //Adminoknak nincs időlimit
  11. #define ACCESS_FLAG             ADMIN_KICK          // - Type // before # if you want it for all players.
  12. #define TIME_BETWEEN_SOUNDS     30                  // - in seconds
  13.  
  14. new Array:musicname, Array:musicpath;
  15. new g_aSize;
  16. new g_iTimeExpired[33], bool:g_iSwitchOff[33];
  17.  
  18. public plugin_init() {
  19.     register_plugin(PLUGIN, VERSION, AUTHOR);
  20.     register_dictionary("funny_sounds.txt");
  21.    
  22.     register_clcmd("say", "sayhandler");
  23.     register_clcmd("say_team", "sayhandler");
  24.     register_clcmd("say /sounds", "sound_switchoff");
  25.     register_clcmd("say /soundlist", "musicmenu");
  26.     set_task(300.0, "toswitchoff", 0, .flags="b")
  27. }
  28.  
  29. public toswitchoff() {
  30.     ChatColor(0, "^4[%s]^1 %L ^3/sounds", PREFIX, LANG_SERVER, "TO_SWTICH_OFF");
  31. }
  32.  
  33. public plugin_precache() {
  34.     musicname = ArrayCreate(32);
  35.     musicpath = ArrayCreate(64);
  36.    
  37.     new sBuffer[256], sFile[64], sSoundName[32], sSoundPath[64], pFile;
  38.  
  39.     get_localinfo("amxx_configsdir", sFile, charsmax(sFile));
  40.     format(sFile, charsmax(sFile), "%s/funny_sounds.ini", sFile);
  41.  
  42.     pFile = fopen(sFile, "rt");
  43.  
  44.     if(pFile) {    
  45.         while(!feof(pFile)) {
  46.             fgets(pFile, sBuffer, charsmax(sBuffer));
  47.             trim(sBuffer);
  48.             if(sBuffer[0] == ';' || sBuffer[0] == ' ') continue;
  49.  
  50.             parse(sBuffer, sSoundName, charsmax(sSoundName), sSoundPath, charsmax(sSoundPath));
  51.  
  52.             if(containi(sSoundPath, ".mp3") != -1 || containi(sSoundPath, ".wav") != -1) {
  53.                 precache_sound(sSoundPath);
  54.                 ArrayPushString(musicname, sSoundName);
  55.                 ArrayPushString(musicpath, sSoundPath);
  56.             }
  57.         }
  58.         fclose(pFile);
  59.         g_aSize = ArraySize(musicname);
  60.     }
  61.     else write_file(sFile, ";^"anything^" ^"any_dir/anything.mp3^"^n");
  62. }
  63.  
  64. public sayhandler(id) {
  65.     #if defined ACCESS_FLAG
  66.     if(~get_user_flags(id) & ACCESS_FLAG) return;
  67.     #endif
  68.  
  69.     new message[190]; read_args(message, charsmax(message));
  70.     remove_quotes(message);
  71.     new sSoundName[32];
  72.    
  73.     for(new i; i<g_aSize; i++) {
  74.         ArrayGetString(musicname, i, sSoundName, charsmax(sSoundName));
  75.         if(equali(message, sSoundName)) {
  76.             expirecheck(id, i);
  77.         }
  78.     }
  79. }
  80.  
  81. /*expirecheck(id, item) {
  82.     new usrtime = get_user_time(id);
  83.        
  84.     if(usrtime >= g_iTimeExpired[id]) {
  85.         playsound(item);
  86.         g_iTimeExpired[id] = (usrtime + TIME_BETWEEN_SOUNDS);
  87.     }
  88.     else
  89.         ColorChat(id, NORMAL, "^4[%s]^1 %L", PREFIX, LANG_SERVER, "YOU_HAVE_TO_WAIT" , (g_iTimeExpired[id] - usrtime));
  90. }*/
  91.  
  92. expirecheck(id, item) {
  93.     new usrtime = get_user_time(id);
  94.        
  95.     if(usrtime >= g_iTimeExpired[id]) {
  96.         playsound(item);
  97.         g_iTimeExpired[id] = (usrtime + TIME_BETWEEN_SOUNDS);
  98.     }
  99.     #if defined IMMUN
  100.     else if(get_user_flags(id) & IMMUN)
  101.     {
  102.         playsound(item);
  103.     }
  104.     #endif
  105.     else
  106.         ChatColor(id, "^4[%s]^1 %L", PREFIX, LANG_SERVER, "YOU_HAVE_TO_WAIT" , (g_iTimeExpired[id] - usrtime));
  107. }
  108.  
  109. playsound(item) {
  110.     new szSound[64]; ArrayGetString(musicpath, item, szSound, charsmax(szSound));
  111.     new makesound[128];
  112.     if(containi(szSound, ".mp3") != -1)
  113.         formatex(makesound, charsmax(makesound), "mp3 play ^"sound/%s^"", szSound);
  114.     else
  115.         formatex(makesound, charsmax(makesound), "spk ^"%s^"", szSound);
  116.  
  117.  
  118.     new players[32], num, tempid;
  119.     get_players(players, num, "c");
  120.     for(new i; i<num; i++) {
  121.         tempid = players[i];
  122.         if(!g_iSwitchOff[tempid])
  123.             client_cmd(tempid, "%s", makesound);
  124.     }
  125. }
  126.  
  127. public sound_switchoff(id) {
  128.     switch(g_iSwitchOff[id]) {
  129.         case false: {
  130.             g_iSwitchOff[id] = true;
  131.             client_cmd(id, "setinfo _funnysoundsoff 1");
  132.             ChatColor(id, "^4[%s]^3 %L", PREFIX, LANG_SERVER, "SOUNDS_SWITCHED_OFF");
  133.         }
  134.         case true: {
  135.             g_iSwitchOff[id] = false;
  136.             client_cmd(id, "setinfo _funnysoundsoff 0");
  137.             ChatColor(id, "^4[%s]^3 %L", PREFIX, LANG_SERVER, "SOUNDS_SWITCHED_ON");
  138.         }
  139.     }
  140. }
  141.  
  142. public client_putinserver(id) {
  143.     if(is_user_sounds_off(id))
  144.         g_iSwitchOff[id] = true;
  145. }
  146.  
  147. public client_disconnected(id) {
  148.     g_iTimeExpired[id] = 0;
  149.     g_iSwitchOff[id] = false;
  150. }
  151.  
  152. public plugin_end() {
  153.     ArrayDestroy(musicname);
  154.     ArrayDestroy(musicpath);
  155. }
  156.  
  157. stock bool:is_user_sounds_off(id) {
  158.     new switcher[8];
  159.     get_user_info(id, "_funnysoundsoff", switcher, charsmax(switcher));
  160.     if(equal(switcher, "1")) return true;
  161.     return false;
  162. }
  163.  
  164. public musicmenu(id) {
  165.     #if defined ACCESS_FLAG
  166.     if(~get_user_flags(id) & ACCESS_FLAG) return;
  167.     #endif
  168.    
  169.     new s_MenuName[128]; formatex(s_MenuName, charsmax(s_MenuName), "%s^nby \r%s \y", PLUGIN, AUTHOR);
  170.     new menu = menu_create(s_MenuName, "musicmenu_h");
  171.     new sSoundName[32];
  172.     for(new i; i<g_aSize;i++) {
  173.         ArrayGetString(musicname, i, sSoundName, charsmax(sSoundName));
  174.         menu_additem(menu, sSoundName, "", 0)
  175.     }
  176.     menu_setprop(menu, MPROP_EXIT, MEXIT_ALL);
  177.     menu_setprop(menu, MPROP_BACKNAME, "Vissza");
  178.     menu_setprop(menu, MPROP_NEXTNAME, "Következő");
  179.     menu_setprop(menu, MPROP_EXITNAME, "Kilépés");
  180.     menu_display(id, menu, 0);
  181. }
  182.  
  183. public musicmenu_h(id, menu, item) {
  184.     if(item == MENU_EXIT) {
  185.         menu_destroy(menu);
  186.         return PLUGIN_HANDLED;
  187.     }
  188.    
  189.     expirecheck(id, item);
  190.    
  191.     menu_destroy(menu);
  192.     return PLUGIN_HANDLED;
  193. }
  194.  
  195. stock ChatColor(const id, const szMessage[], any:...) {
  196.         static pnum, players[32], szMsg[190], IdMsg;
  197.         vformat(szMsg, charsmax(szMsg), szMessage, 3);
  198.        
  199.         if(!IdMsg) IdMsg = get_user_msgid("SayText");
  200.        
  201.         if(id) {
  202.                 if(!is_user_connected(id)) return;
  203.                 players[0] = id;
  204.                 pnum = 1;
  205.         }
  206.         else get_players(players, pnum, "ch");
  207.        
  208.         for(new i; i < pnum; i++) {
  209.                 message_begin(MSG_ONE, IdMsg, .player = players[i]);
  210.                 write_byte(players[i]);
  211.                 write_string(szMsg);
  212.                 message_end();
  213.         }
  214. }



Szia, ebbe benne vagy hogy a tulajdonos, Főadmin,admin korlátlanul tudják használni a játékosokat meg 30 másodperc után használhatják?

_________________
Kép


Hozzászólás jelentése
Vissza a tetejére
   
 
Hozzászólások megjelenítése:  Rendezés  
Lezárt fórum  A témát lezárták, nem szerkesztheted a hozzászólásaid, és nem küldhetsz új hozzászólást.  [ 6 hozzászólás ] 


Ki van itt

Jelenlévő fórumozók: nincs regisztrált felhasználó valamint 5 vendég


Nem nyithatsz témákat ebben a fórumban.
Nem 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