hlmod.hu
https://hlmod.hu/

Heti játszott idő
https://hlmod.hu/viewtopic.php?f=29&t=30383
Oldal: 1 / 1

Szerző:  Alekvar [ 2020.04.19. 17:37 ]
Hozzászólás témája:  Heti játszott idő

Sziasztok, valaki tudna nekem olyan plugin írni, hogy heti Top3 játszott idővel rendelkező játékost parancsra kimutatna motdben?

Szerző:  HellEnergY [ 2020.04.20. 02:40 ]
Hozzászólás témája:  Re: Heti játszott idő

Alekvar írta:
Sziasztok, valaki tudna nekem olyan plugin írni, hogy heti Top3 játszott idővel rendelkező játékost parancsra kimutatna motdben?


Csáó!
Nem próbáltam még ilyet csinálni, de erre jutottam.
Elvileg ez sorba rendezi nagyság szerint és utána fomálja.(Buborék rendezés c#ból) |Várom azt aki lát benne hibát|

Azt hogy a heti top3at mutassa nem tudom hogyan tudnám megoldani, így gondolatban sem jutottamel odáig xD.

  1. #include <amxmodx>
  2. #include <amxmisc>
  3.  
  4. #define PLUGIN "New Plug-In"
  5. #define VERSION "1.0"
  6. #define AUTHOR "author"
  7.  
  8. new g_iTime[33];
  9.  
  10. public plugin_init() {
  11.     register_plugin(PLUGIN, VERSION, AUTHOR);
  12.    
  13.     register_clcmd("say /asd2", "idoell");
  14.     register_clcmd("say /asd", "Idotop3");
  15. }
  16. public idoell(iId)
  17. {
  18.     new iMasodperc, iPerc, iOra
  19.     iMasodperc = g_iTime[iId] + get_user_time(iId);
  20.     iPerc = iMasodperc / 60;
  21.     iOra = iPerc / 60;
  22.     iMasodperc = iMasodperc - iPerc * 60;
  23.     iPerc = iPerc - iOra * 60;
  24.     client_print_color(iId, print_team_default, "%d ora %d perc %d masodperc", iOra, iPerc, iMasodperc)
  25. }
  26. public Idotop3(iId)
  27. {
  28.     new iPlayersn;
  29.     iPlayersn = get_maxplayers();
  30.     new j;
  31.     for(new k = iPlayersn; k > 0; k--)
  32.     {
  33.         for(j = 0; j < k; j++)
  34.         {
  35.             if(g_iTime[j] > g_iTime[j+1])
  36.             {
  37.                 new iTmp = g_iTime[j+1];
  38.                 g_iTime[j+1] = g_iTime[j];
  39.                 g_iTime[j] = iTmp;
  40.             }
  41.         }
  42.     }
  43.     iPlayersn = get_maxplayers();
  44.    
  45.     for(new  i = 0; i < iPlayersn; i++)
  46.     {
  47.         if(i == 3)
  48.         {
  49.             new motd[1024], len;   
  50.             new iMasodperc, iPerc, iOra
  51.             iMasodperc = g_iTime[j] + get_user_time(j);
  52.             iPerc = iMasodperc / 60;
  53.             iOra = iPerc / 60;
  54.             iMasodperc = iMasodperc - iPerc * 60;
  55.             iPerc = iPerc - iOra * 60;
  56.            
  57.             new sName[64];
  58.             get_user_name(j, sName, charsmax(sName));
  59.             len = format(motd, 1023,"<body bgcolor=#000000><font color=#FFB000><pre>");
  60.             len += format(motd[len], 1023-len,"%s %-22.22s %3s^n", "#", "Neve", "Jatekideje");
  61.             len += format(motd[len], 1023-len,"%d %-22.22s %d ora %d perc %d masodperc^n", j, sName, iOra, iPerc, iMasodperc);
  62.             len += format(motd[len], 1023-len,"</body></font></pre>");
  63.             show_motd(iId, motd, "Top 3 jatekido");
  64.         }
  65.     }
  66. }


UI: top3ig kell hogy mutassa.

Szerző:  Alekvar [ 2020.04.20. 21:35 ]
Hozzászólás témája:  Re: Heti játszott idő

HellEnergY írta:
Alekvar írta:
Sziasztok, valaki tudna nekem olyan plugin írni, hogy heti Top3 játszott idővel rendelkező játékost parancsra kimutatna motdben?


Csáó!
Nem próbáltam még ilyet csinálni, de erre jutottam.
Elvileg ez sorba rendezi nagyság szerint és utána fomálja.(Buborék rendezés c#ból) |Várom azt aki lát benne hibát|

Azt hogy a heti top3at mutassa nem tudom hogyan tudnám megoldani, így gondolatban sem jutottamel odáig xD.

  1. #include <amxmodx>
  2. #include <amxmisc>
  3.  
  4. #define PLUGIN "New Plug-In"
  5. #define VERSION "1.0"
  6. #define AUTHOR "author"
  7.  
  8. new g_iTime[33];
  9.  
  10. public plugin_init() {
  11.     register_plugin(PLUGIN, VERSION, AUTHOR);
  12.    
  13.     register_clcmd("say /asd2", "idoell");
  14.     register_clcmd("say /asd", "Idotop3");
  15. }
  16. public idoell(iId)
  17. {
  18.     new iMasodperc, iPerc, iOra
  19.     iMasodperc = g_iTime[iId] + get_user_time(iId);
  20.     iPerc = iMasodperc / 60;
  21.     iOra = iPerc / 60;
  22.     iMasodperc = iMasodperc - iPerc * 60;
  23.     iPerc = iPerc - iOra * 60;
  24.     client_print_color(iId, print_team_default, "%d ora %d perc %d masodperc", iOra, iPerc, iMasodperc)
  25. }
  26. public Idotop3(iId)
  27. {
  28.     new iPlayersn;
  29.     iPlayersn = get_maxplayers();
  30.     new j;
  31.     for(new k = iPlayersn; k > 0; k--)
  32.     {
  33.         for(j = 0; j < k; j++)
  34.         {
  35.             if(g_iTime[j] > g_iTime[j+1])
  36.             {
  37.                 new iTmp = g_iTime[j+1];
  38.                 g_iTime[j+1] = g_iTime[j];
  39.                 g_iTime[j] = iTmp;
  40.             }
  41.         }
  42.     }
  43.     iPlayersn = get_maxplayers();
  44.    
  45.     for(new  i = 0; i < iPlayersn; i++)
  46.     {
  47.         if(i == 3)
  48.         {
  49.             new motd[1024], len;   
  50.             new iMasodperc, iPerc, iOra
  51.             iMasodperc = g_iTime[j] + get_user_time(j);
  52.             iPerc = iMasodperc / 60;
  53.             iOra = iPerc / 60;
  54.             iMasodperc = iMasodperc - iPerc * 60;
  55.             iPerc = iPerc - iOra * 60;
  56.            
  57.             new sName[64];
  58.             get_user_name(j, sName, charsmax(sName));
  59.             len = format(motd, 1023,"<body bgcolor=#000000><font color=#FFB000><pre>");
  60.             len += format(motd[len], 1023-len,"%s %-22.22s %3s^n", "#", "Neve", "Jatekideje");
  61.             len += format(motd[len], 1023-len,"%d %-22.22s %d ora %d perc %d masodperc^n", j, sName, iOra, iPerc, iMasodperc);
  62.             len += format(motd[len], 1023-len,"</body></font></pre>");
  63.             show_motd(iId, motd, "Top 3 jatekido");
  64.         }
  65.     }
  66. }


UI: top3ig kell hogy mutassa.


Köszönöm, tesztelni fogom!

És még annyiban tudnál segíteni, hogy nekem SQL-el levannak mente a játszott idők (Jatszott_Ido tábla néven) és hogy innen a táblából kiválasztani 10 játékost és top10 játszott idővel rendelkező játékosokat sorolná fel, esetleg meglehetne ezt oldani? Megköszönném! :roll:

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