HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2.  
  3. // Rohadtul UNATKOZTAM!!!!!!
  4. // milegyek.extra.hu <- otlet
  5.  
  6. new Fajlok[2][39], Foglalkozas[64][33], OsszesFoglalkozas[64][100], Szam
  7.  
  8. public plugin_init() {
  9. register_plugin("Idealis foglalkozas!", "1.0", "DeRoiD")
  10. register_clcmd("say /milegyek?", "Generalas")
  11. register_clcmd("say /milegyek", "Generalas")
  12. format(Fajlok[0], 38, "addons/amxmodx/configs/milegyek.cfg")
  13. format(Fajlok[1], 38, "addons/amxmodx/configs/milegyek.ini")
  14. Betoltes()
  15. }
  16. stock Betoltes()
  17. {
  18. new Fajl, Sor[64]
  19. Fajl = fopen(Fajlok[0], "rt");
  20.  
  21. while(!feof(Fajl))
  22. {
  23. fgets(Fajl, Sor, 63);
  24.  
  25. copy(OsszesFoglalkozas[Szam], 63, Sor)
  26. Szam++
  27. }
  28.  
  29. fclose(Fajl);
  30. }
  31. stock NevEllenorzes(id, const Nev[])
  32. {
  33. new Fajl, Sor[128], Adat[2][64], Volt
  34. Fajl = fopen(Fajlok[1], "rt");
  35.  
  36. while(!feof(Fajl))
  37. {
  38. fgets(Fajl, Sor, 127);
  39.  
  40. parse(Sor, Adat[0], 63, Adat[1], 63);
  41.  
  42. if(equal(Adat[0], Nev))
  43. {
  44. copy(Foglalkozas[id], 63, Adat[1])
  45. Volt = 1
  46. break;
  47. }
  48. }
  49.  
  50. fclose(Fajl);
  51.  
  52. Mutat(id, Volt, Foglalkozas[id])
  53. return 0;
  54. }
  55. public Generalas(id) {
  56. new Nev[32]
  57. get_user_name(id, Nev, 31)
  58. NevEllenorzes(id, Nev)
  59. }
  60. public Mutat(id, Letezik, const Fogl[]) {
  61. new Nev[32], rSzam
  62. get_user_name(id, Nev, 31)
  63. if(Letezik == 1)
  64. {
  65. new Motd[512]
  66. format(Motd, 511, "<html><head><body><p style=^"text-align: center;^"><strong><span style=^"font-size:18px;^">%s</span></strong></p><p style=^"text-align: center;^"><span style=^"font-size:24px;^">%s</span></p></body></html>", Nev, Fogl)
  67. show_motd(id, Motd, "Idealis foglalkozas")
  68. }
  69. else
  70. {
  71. rSzam = random_num(1, Szam)
  72. if(strlen(OsszesFoglalkozas[rSzam]) != 0)
  73. {
  74. copy(Foglalkozas[id], 63, OsszesFoglalkozas[rSzam])
  75. new Sor[256]
  76. format(Sor, 255, "^"%s^" ^"%s^"", Nev, Foglalkozas[id])
  77. write_file(Fajlok[1], Sor)
  78. Mutat(id, 1, Foglalkozas[id])
  79. print_color(0, "!t%s!y -nak/nek az idelis foglalkozs:!t %s", Nev, Foglalkozas[id])
  80. }
  81. else
  82. Mutat(id, 0, Foglalkozas[id])
  83. }
  84. }
  85. stock print_color(const id, const input[], any:...)
  86. {
  87. new count = 1, players[32]
  88. static msg[191]
  89. vformat(msg, 190, input, 3)
  90.  
  91. replace_all(msg, 190, "!g", "^4")
  92. replace_all(msg, 190, "!y", "^1")
  93. replace_all(msg, 190, "!t", "^3")
  94. replace_all(msg, 190, "", "á")
  95. replace_all(msg, 190, "", "é")
  96. replace_all(msg, 190, "", "í")
  97. replace_all(msg, 190, "", "ó")
  98. replace_all(msg, 190, "", "ö")
  99. replace_all(msg, 190, "", "ő")
  100. replace_all(msg, 190, "", "ú")
  101. replace_all(msg, 190, "", "ü")
  102. replace_all(msg, 190, "", "ű")
  103. replace_all(msg, 190, "", "Á")
  104. replace_all(msg, 190, "", "É")
  105. replace_all(msg, 190, "", "Í")
  106. replace_all(msg, 190, "", "Ó")
  107. replace_all(msg, 190, "", "Ö")
  108. replace_all(msg, 190, "", "Ő")
  109. replace_all(msg, 190, "", "Ú")
  110. replace_all(msg, 190, "", "Ü")
  111. replace_all(msg, 190, "", "Ű")
  112.  
  113. if (id) players[0] = id; else get_players(players, count, "ch")
  114. {
  115. for (new i = 0; i < count; i++)
  116. {
  117. if (is_user_connected(players[i]))
  118. {
  119. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
  120. write_byte(players[i])
  121. write_string(msg)
  122. message_end()
  123. }
  124. }
  125. }
  126. return PLUGIN_HANDLED
  127. }
  128. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  129. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1038\\ f0\\ fs16 \n\\ par }
  130. */
  131.