hlmod.hu
https://hlmod.hu/

ML_NOTFOUND forrásból kivétele
https://hlmod.hu/viewtopic.php?f=10&t=30037
Oldal: 1 / 1

Szerző:  matkoimre [ 2019.09.07. 08:35 ]
Hozzászólás témája:  ML_NOTFOUND forrásból kivétele

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



Aki ügyes az kitudja venni nekem "ML_NOTFOUND" Részt?

Szerző:  JohanCorn [ 2019.09.07. 13:51 ]
Hozzászólás témája:  Re: ML_NOTFOUND forrásból kivétele

Minden szövegrész, amiben %L kifejezés található egy LANG fájlban található sorra hivatkozik. Ezeket kell eltávolítanod.

Látom bele lett szerkesztve, de ennek mintája alapján ki tudod magadnak szedni.

29. Sor:
  1. ChatColor(0, "^4[%s]^1 %L ^3/sounds", PREFIX, LANG_SERVER, "A chathangok ki - vagy bekapcsolásához, írd be:");

->
  1. ChatColor(0, "^4[%s]^1 A chathangok ki - vagy bekapcsolásához, írd be:^3 /sounds", PREFIX);

Szerző:  matkoimre [ 2019.09.07. 15:55 ]
Hozzászólás témája:  Re: ML_NOTFOUND forrásból kivétele

JohanCorn írta:
Minden szövegrész, amiben %L kifejezés található egy LANG fájlban található sorra hivatkozik. Ezeket kell eltávolítanod.

Látom bele lett szerkesztve, de ennek mintája alapján ki tudod magadnak szedni.

29. Sor:
  1. ChatColor(0, "^4[%s]^1 %L ^3/sounds", PREFIX, LANG_SERVER, "A chathangok ki - vagy bekapcsolásához, írd be:");

->
  1. ChatColor(0, "^4[%s]^1 A chathangok ki - vagy bekapcsolásához, írd be:^3 /sounds", PREFIX);






chathangok.sma(105) : error 001: expected token: ",", but found "-identifier-"
chathangok.sma(105) : error 017: undefined symbol "M"
chathangok.sma(105) : error 029: invalid expression, assumed zero
chathangok.sma(105) : fatal error 107: too many error messages on one line

Szerző:  HellEnergY [ 2019.09.07. 17:31 ]
Hozzászólás témája:  Re: ML_NOTFOUND forrásból kivétele

matkoimre írta:
JohanCorn írta:
Minden szövegrész, amiben %L kifejezés található egy LANG fájlban található sorra hivatkozik. Ezeket kell eltávolítanod.

Látom bele lett szerkesztve, de ennek mintája alapján ki tudod magadnak szedni.

29. Sor:
  1. ChatColor(0, "^4[%s]^1 %L ^3/sounds", PREFIX, LANG_SERVER, "A chathangok ki - vagy bekapcsolásához, írd be:");

->
  1. ChatColor(0, "^4[%s]^1 A chathangok ki - vagy bekapcsolásához, írd be:^3 /sounds", PREFIX);






chathangok.sma(105) : error 001: expected token: ",", but found "-identifier-"
chathangok.sma(105) : error 017: undefined symbol "M"
chathangok.sma(105) : error 029: invalid expression, assumed zero
chathangok.sma(105) : fatal error 107: too many error messages on one line



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


Process started (PID=5052) >>>
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2013 ITB CompuPhase, AMX Mod X Team

Header size: 1084 bytes
Code size: 5556 bytes
Data size: 3808 bytes
Stack/heap size: 16384 bytes; estimated max. usage=475 cells (1900 bytes)
Total requirements: 26832 bytes
Done.
<<< Process finished (PID=5052). (Exit code 0)
================ READY ================

Szerző:  matkoimre [ 2019.09.08. 12:40 ]
Hozzászólás témája:  Re: ML_NOTFOUND forrásból kivétele

HellEnergY írta:
matkoimre írta:
JohanCorn írta:
Minden szövegrész, amiben %L kifejezés található egy LANG fájlban található sorra hivatkozik. Ezeket kell eltávolítanod.

Látom bele lett szerkesztve, de ennek mintája alapján ki tudod magadnak szedni.

29. Sor:
  1. ChatColor(0, "^4[%s]^1 %L ^3/sounds", PREFIX, LANG_SERVER, "A chathangok ki - vagy bekapcsolásához, írd be:");

->
  1. ChatColor(0, "^4[%s]^1 A chathangok ki - vagy bekapcsolásához, írd be:^3 /sounds", PREFIX);






chathangok.sma(105) : error 001: expected token: ",", but found "-identifier-"
chathangok.sma(105) : error 017: undefined symbol "M"
chathangok.sma(105) : error 029: invalid expression, assumed zero
chathangok.sma(105) : fatal error 107: too many error messages on one line



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


Process started (PID=5052) >>>
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2013 ITB CompuPhase, AMX Mod X Team

Header size: 1084 bytes
Code size: 5556 bytes
Data size: 3808 bytes
Stack/heap size: 16384 bytes; estimated max. usage=475 cells (1900 bytes)
Total requirements: 26832 bytes
Done.
<<< Process finished (PID=5052). (Exit code 0)
================ READY ================



köszönöm,működik! :)

Oldal: 1 / 1 Minden időpont UTC+01:00 időzóna szerinti
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/