JuSTaR

Hidonim [Unofficial]

Sep 29th, 2020
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.40 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <dhudmessage>
  3.  
  4. // Tasks
  5. #define HidonimGamesCount 6
  6. #define task_vote 1
  7. #define task_start_hidon 2
  8. #define task_hud 3
  9.  
  10. // Paths
  11. #define AnimeDefaultPath "sound/TopDeathrun/Anime/"
  12. #define NostalgiaDefaultPath "sound/TopDeathrun/Nostalgia/"
  13. #define LogoQuizHost "http://top-clan.000webhostapp.com/LogoQuiz/"
  14.  
  15. // Config Files
  16. #define MissingLetterCfgFile "addons/amxmodx/configs/Hidonim/missingletter.txt"
  17. #define LogoQuizCfgFile "addons/amxmodx/configs/Hidonim/logoquiz.txt"
  18. #define TriviaCfgFile "addons/amxmodx/configs/Hidonim/trivia.txt"
  19. #define AnimeCfgFile "addons/amxmodx/configs/Hidonim/anime.txt"
  20. #define NostalgiaCfgFile "addons/amxmodx/configs/Hidonim/nostalgia.txt"
  21.  
  22. // Constants
  23. #define MAX_QUESTIONS 64
  24. #define MAX_QUESTIONS_LENGTH 64
  25. #define MAX_ANSWER_LENGTH 32
  26. #define MAX_SONG_NAME 32
  27. #define MAX_PATH_SIZE 64
  28. #define MAX_ML_WORD_SIZE 32
  29.  
  30. //#define USE_NATIVES
  31.  
  32. #if defined USE_NATIVES
  33. native add_user_xp(id, amount);
  34. native add_user_points(id, amount);
  35. #endif
  36.  
  37. enum _:HidonProperties
  38. {
  39. name[16],
  40. points,
  41. xp
  42. }
  43.  
  44. enum _:SongProperties
  45. {
  46. name[MAX_SONG_NAME],
  47. file_name[MAX_PATH_SIZE]
  48. }
  49.  
  50. enum _:QuestionProperties
  51. {
  52. Quest[MAX_QUESTIONS_LENGTH],
  53. Answr[MAX_ANSWER_LENGTH]
  54. }
  55.  
  56. new const Hidon[HidonimGamesCount][HidonProperties] =
  57. {
  58. { "Math", 50, 20 },
  59. { "Nostalgia", 80, 40 },
  60. { "Anime", 100, 60 },
  61. { "Trivia", 110, 65 },
  62. { "LogoQuiz", 130, 70 },
  63. { "Missing Letter", 135, 75 }
  64. }
  65.  
  66. new bool:HidonIsRunning = false;
  67. new GameCount = 0;
  68. new bool:isVoted[33];
  69. new VoteTimer = 100;
  70. new Votes[HidonimGamesCount];
  71. new ChoosenHidonId = -1;
  72. new StartHidonCD = 5;
  73. new WinnerId = -1;
  74. new WinnerName[33];
  75. new bool:ShowMsgOnce = false;
  76. new num1, num2;
  77. new HidonTimer = 60;
  78. new RndId = -1;
  79. new Answer[32];
  80. new MLWord[MAX_ML_WORD_SIZE];
  81. new ML_UpdateAmount = 0;
  82. new ML_LastIds[8] = { -1, -1, -1, -1, -1, -1 , -1 , -1 };
  83. new Float:ML_timer;
  84. new Array:MLWords_indexes;
  85. new HidonWaitingTime = 600;
  86. new sound[64];
  87.  
  88. new NostalgiaSongsLoaded = 0;
  89. new AnimeSongsLoaded = 0;
  90. new TriviaQuestionsLoaded = 0;
  91. new LogoQuizQuestionsLoaded = 0;
  92. new MLQuestionsLoaded = 0;
  93.  
  94. new MLQuestions[MAX_QUESTIONS][MAX_ML_WORD_SIZE];
  95. new LogoQuizQuestions[MAX_QUESTIONS][QuestionProperties];
  96. new TriviaQuestions[MAX_QUESTIONS][QuestionProperties];
  97. new AnimeSongs[MAX_QUESTIONS][SongProperties];
  98. new NostalgiaSongs[MAX_QUESTIONS][SongProperties];
  99.  
  100.  
  101. public plugin_init()
  102. {
  103. register_plugin("Hidonim", "v4", "JuSTaR (Original Idea by Ariel aka xBosh)");
  104.  
  105. register_clcmd("say /start_hidon", "AdminMenu", ADMIN_RCON); // Opens Hidonim start menu
  106. register_clcmd("say /stop_hidon", "ResetHidon", ADMIN_RCON); // Stop Hidon
  107. register_clcmd("say /answer", "ShowAnswer", ADMIN_RCON); // ch3ater huh?
  108.  
  109. register_clcmd("say /printAllSongsNames", "printAllSongsNames");
  110. register_clcmd("say /hidon", "NextHidon");
  111. register_clcmd("say /logo", "LogoQuiz_ShowLogo");
  112. register_clcmd("say /s", "StopMusic");
  113. register_clcmd("say /r", "ReplayMusic");
  114. register_clcmd("say", "CheckAnswer");
  115.  
  116. set_task(1.0, "HidonCD", _, _, _, "b");
  117.  
  118. LoadNostalgia();
  119. LoadAnime();
  120. LoadTriviaQuestions();
  121. LoadLogoQuiz();
  122. LoadMissingLetter();
  123. }
  124.  
  125. public printAllSongsNames(id)
  126. {
  127. new path[128];
  128.  
  129. for (new i = 0; i < NostalgiaSongsLoaded; i++)
  130. {
  131. formatex(path, charsmax(path), "^"%s%s^"", NostalgiaDefaultPath, NostalgiaSongs[i][file_name]);
  132. ColorChat(id, "%s", path);
  133. }
  134.  
  135. for (new i = 0; i < AnimeSongsLoaded; i++)
  136. {
  137. formatex(path, charsmax(path), "^"%s%s^"", AnimeDefaultPath, AnimeSongs[i][file_name]);
  138. ColorChat(id, "%s", path);
  139. }
  140.  
  141. return PLUGIN_HANDLED;
  142. }
  143.  
  144. public AdminMenu(id)
  145. {
  146. new mAdmin = menu_create("\r[\y Top Deathrun \r] \yChoose a hidon to start:", "AdminMenu_Handler");
  147.  
  148. menu_additem(mAdmin, "\yStart Hidon Vote");
  149.  
  150. for (new i = 0; i < HidonimGamesCount; i++)
  151. menu_additem(mAdmin, Hidon[i][name]);
  152.  
  153. menu_display(id, mAdmin, 0);
  154.  
  155. return PLUGIN_HANDLED;
  156. }
  157.  
  158. public AdminMenu_Handler(id, mAdmin, item)
  159. {
  160. if (item != MENU_EXIT)
  161. {
  162. ResetHidon();
  163. HidonIsRunning = true;
  164.  
  165. if (item == 0)
  166. {
  167. HidonVote();
  168. ColorChat(0, "^4%s ^1has started ^3Hidon Vote^1.", get_player_name(id));
  169. }
  170. else
  171. {
  172. ChoosenHidonId = item-1;
  173. StartHidon();
  174. ColorChat(0, "^4%s ^1has started ^3Hidon %s^1.", get_player_name(id), Hidon[item-1][name]);
  175. }
  176.  
  177. return PLUGIN_HANDLED;
  178. }
  179.  
  180. menu_destroy(mAdmin);
  181. return PLUGIN_HANDLED;
  182. }
  183.  
  184. public HidonCD()
  185. {
  186. if (HidonWaitingTime == 0)
  187. {
  188. HidonIsRunning = true;
  189. HidonVote();
  190. }
  191.  
  192. HidonWaitingTime--;
  193. }
  194.  
  195. public NextHidon(id)
  196. {
  197. if (HidonIsRunning)
  198. ColorChat(id, "A ^3Hidon ^1is already in progress.");
  199. else
  200. ColorChat(id, "^3Next Hidon ^1in: ^4%d ^1minutes and ^4%d ^1seconds.", HidonWaitingTime/60, HidonWaitingTime%60);
  201.  
  202. return PLUGIN_HANDLED;
  203. }
  204.  
  205. public ShowAnswer(id)
  206. {
  207. ColorChat(id, "Answer is: %s", Answer);
  208. return PLUGIN_HANDLED;
  209. }
  210.  
  211. public StopMusic(id)
  212. {
  213. client_cmd(id, "mp3 stop");
  214. }
  215.  
  216. public ReplayMusic(id)
  217. {
  218. if (sound[0])
  219. client_cmd(id, "mp3 play ^"%s^"", sound);
  220. }
  221.  
  222. public LogoQuiz_ShowLogo(id)
  223. {
  224. if (ChoosenHidonId != 4)
  225. return;
  226.  
  227. new path[128];
  228. formatex(path, charsmax(path), "%s%s", LogoQuizHost, LogoQuizQuestions[RndId][Quest]);
  229. show_motd(id, path, ".: [ Top Deathrun ] LogoQuiz :.");
  230. }
  231.  
  232. public plugin_precache()
  233. {
  234. precache_generic("sound/TopDeathrun/Nostalgia/pokemon_fix.mp3");
  235. precache_generic("sound/TopDeathrun/Nostalgia/marko.mp3");
  236. precache_generic("sound/TopDeathrun/Nostalgia/A_Pigamot.mp3");
  237. precache_generic("sound/TopDeathrun/Nostalgia/artur.mp3");
  238. precache_generic("sound/TopDeathrun/Nostalgia/asfor.mp3");
  239. precache_generic("sound/TopDeathrun/Nostalgia/beyblade.mp3");
  240. precache_generic("sound/TopDeathrun/Nostalgia/Bilbi.mp3");
  241. precache_generic("sound/TopDeathrun/Nostalgia/BobABanai.mp3");
  242. precache_generic("sound/TopDeathrun/Nostalgia/code_lyoko.mp3");
  243. precache_generic("sound/TopDeathrun/Nostalgia/digimon.mp3");
  244. precache_generic("sound/TopDeathrun/Nostalgia/gur_ve_oah.mp3");
  245. precache_generic("sound/TopDeathrun/Nostalgia/HaMuminim.mp3");
  246. precache_generic("sound/TopDeathrun/Nostalgia/hshminia.mp3");
  247. precache_generic("sound/TopDeathrun/Nostalgia/kirbi.mp3");
  248. precache_generic("sound/TopDeathrun/Nostalgia/kobikobi.mp3");
  249. precache_generic("sound/TopDeathrun/Nostalgia/miflezetBeTaot.mp3");
  250. precache_generic("sound/TopDeathrun/Nostalgia/MoadonWinx.mp3");
  251. precache_generic("sound/TopDeathrun/Nostalgia/nils.mp3");
  252. precache_generic("sound/TopDeathrun/Nostalgia/SamiACabai.mp3");
  253. precache_generic("sound/TopDeathrun/Nostalgia/sedrik.mp3");
  254. precache_generic("sound/TopDeathrun/Nostalgia/Shemesh.mp3");
  255. precache_generic("sound/TopDeathrun/Nostalgia/spongebob.mp3");
  256. precache_generic("sound/TopDeathrun/Nostalgia/tomy_ve_oskar.mp3");
  257. precache_generic("sound/TopDeathrun/Nostalgia/tzave_aninja.mp3");
  258. precache_generic("sound/TopDeathrun/Nostalgia/wunschpunsch.mp3");
  259. precache_generic("sound/TopDeathrun/Nostalgia/yladimgivatnapolion.mp3");
  260. precache_generic("sound/TopDeathrun/Nostalgia/yu-gi-oh1.mp3");
  261. precache_generic("sound/TopDeathrun/Nostalgia/yu-gi-oh-gx.mp3");
  262.  
  263. precache_generic("sound/TopDeathrun/Anime/Bleach_1_Fix.mp3");
  264. precache_generic("sound/TopDeathrun/Anime/dragonballgt.mp3");
  265. precache_generic("sound/TopDeathrun/Anime/dragonballz_fix.mp3");
  266. precache_generic("sound/TopDeathrun/Anime/dragonballz2_fix.mp3");
  267. precache_generic("sound/TopDeathrun/Anime/Inuyasha.mp3");
  268. precache_generic("sound/TopDeathrun/Anime/one_piece.mp3");
  269. precache_generic("sound/TopDeathrun/Anime/Sakura.mp3");
  270. precache_generic("sound/TopDeathrun/Anime/ShamanKing.mp3");
  271. precache_generic("sound/TopDeathrun/Anime/sword_art_online.mp3");
  272. precache_generic("sound/TopDeathrun/TokyoMewMew.mp3");
  273.  
  274. precache_generic("sound/TopDeathrun/CD/one.wav");
  275. precache_generic("sound/TopDeathrun/CD/two.wav");
  276. precache_generic("sound/TopDeathrun/CD/three.wav");
  277. precache_generic("sound/TopDeathrun/CD/four.wav");
  278. precache_generic("sound/TopDeathrun/CD/five.wav");
  279. }
  280.  
  281. public HidonVote()
  282. {
  283. if (GameCount == 3)
  284. {
  285. ResetHidon();
  286. return;
  287. }
  288.  
  289. if (VoteTimer < 0)
  290. {
  291. ColorChat(0, "Vote was ended");
  292. GameCount++;
  293. show_menu(0, 0, "^n", 1);
  294. ChooseHidon();
  295. return;
  296. }
  297.  
  298. new players[32], pnum;
  299. get_players(players, pnum, "ch");
  300.  
  301. new buffer[128];
  302.  
  303. for (new i = 0; i < pnum; i++)
  304. {
  305. new id = players[i]
  306.  
  307. formatex(buffer, charsmax(buffer), "\r[\y Top Deathrun \r] \yHidon Vote:^n\r// \wStatus: %s^n\r// \wTime to choose: \y%0.1f", (isVoted[id] ? "\yVoted" : "\rNot Voted"), float(VoteTimer)/10.0);
  308. new VoteMenu = menu_create(buffer, "ShowVoteMenu_Handler");
  309.  
  310. for (new i = 0; i < HidonimGamesCount; i++)
  311. {
  312. #if defined USE_NATIVES
  313. format(buffer, charsmax(buffer), "\w%s \r(\w%d \dPts \y& \w%d \dXp \r)\w \r[\w%d Votes\r]", Hidon[i][name], Hidon[i][points], Hidon[i][xp], Votes[i]);
  314. #else
  315. format(buffer, charsmax(buffer), "\w%s \r[\w%d Votes\r]", Hidon[i][name], Votes[i]);
  316. #endif
  317. menu_additem(VoteMenu, buffer);
  318. }
  319.  
  320. menu_setprop(VoteMenu, MPROP_EXIT, MEXIT_NEVER);
  321. menu_display(id, VoteMenu, 0);
  322. }
  323.  
  324. VoteTimer--;
  325. set_task(0.1, "HidonVote", task_vote);
  326.  
  327. return;
  328. }
  329.  
  330. public ShowVoteMenu_Handler(id, VoteMenu, item)
  331. {
  332. if (item == MENU_EXIT)
  333. {
  334. menu_destroy(VoteMenu);
  335. return PLUGIN_HANDLED;
  336. }
  337.  
  338. if (isVoted[id] || VoteTimer < 0)
  339. return PLUGIN_HANDLED;
  340.  
  341. Votes[item]++;
  342. isVoted[id] = true;
  343.  
  344. return PLUGIN_HANDLED;
  345. }
  346.  
  347. public ChooseHidon()
  348. {
  349. new biggestNum = Votes[0], Results = 0, Array:VotesArr;
  350. VotesArr = ArrayCreate(HidonimGamesCount);
  351.  
  352. // Find Biggest
  353. for (new i = 1; i < HidonimGamesCount; i++)
  354. if (biggestNum < Votes[i])
  355. biggestNum= Votes[i];
  356.  
  357. // Check if three is more same results
  358. for (new i = 0; i < HidonimGamesCount; i++)
  359. {
  360. if (Votes[i] == biggestNum)
  361. {
  362. ArrayPushCell(VotesArr, i);
  363. Results++;
  364. }
  365. }
  366.  
  367. if (Results > 1)
  368. {
  369. ChoosenHidonId = ArrayGetCell(VotesArr, random_num(0, ArraySize(VotesArr)-1));
  370. ColorChat(0, "Hidon ^4%s ^1was randomly choosen!", Hidon[ChoosenHidonId][name]);
  371. }
  372. else
  373. {
  374. ChoosenHidonId = ArrayGetCell(VotesArr, 0);
  375. ColorChat(0, "Hidon ^4%s ^1was choosen.", Hidon[ChoosenHidonId][name]);
  376. }
  377.  
  378. StartHidon();
  379. }
  380.  
  381. public StartHidon()
  382. {
  383. if (StartHidonCD == 0)
  384. {
  385. switch (ChoosenHidonId)
  386. {
  387. case 0: StartHidonMath();
  388. case 1: StartHidonNostalgia();
  389. case 2: StartHidonAnime();
  390. case 3: StartHidonTrivia();
  391. case 4: StartHidonLogoQuiz();
  392. case 5: StartHidonMissingLetter();
  393. }
  394. return;
  395. }
  396.  
  397. set_dhudmessage(random_num(1, 255), random_num(1, 255), random_num(1, 255), -1.0, 0.3, 0, 1.0, 1.0, 0.5, 0.0);
  398. show_dhudmessage(0, "%s Will be start in %d seconds.", Hidon[ChoosenHidonId][name], StartHidonCD);
  399.  
  400. num_to_word(StartHidonCD, sound, charsmax(sound));
  401. format(sound, charsmax(sound), "%s%s", "spk sound/TopDeathrun/CD/", sound);
  402. client_cmd(0, sound);
  403. StartHidonCD--;
  404.  
  405. set_task(1.0, "StartHidon", task_start_hidon);
  406. }
  407.  
  408. public StartHidonMath()
  409. {
  410. num1 = random_num(100, 999);
  411. num2 = random_num(100, 999);
  412.  
  413. new temp[4];
  414. num_to_str(num1+num2, temp, sizeof(temp));
  415. copy(Answer, sizeof(temp), temp);
  416. ColorChat(0, "How much is ^4%d ^3+ ^4%d ^1?", num1, num2);
  417.  
  418. set_task(0.0, "ShowHud", task_hud);
  419. }
  420.  
  421. public StartHidonNostalgia()
  422. {
  423. RndId = random_num(0, NostalgiaSongsLoaded-1);
  424. copy(Answer, sizeof(Answer), NostalgiaSongs[RndId][name]);
  425.  
  426. formatex(sound, charsmax(sound), "%s%s", NostalgiaDefaultPath, NostalgiaSongs[RndId][file_name]);
  427. client_cmd(0, "mp3 play ^"%s^"", sound);
  428.  
  429. set_task(0.0, "ShowHud", task_hud);
  430. }
  431.  
  432. public StartHidonAnime()
  433. {
  434. RndId = random_num(0, AnimeSongsLoaded-1);
  435. copy(Answer, sizeof(Answer), AnimeSongs[RndId][name]);
  436.  
  437. formatex(sound, charsmax(sound), "%s%s", AnimeDefaultPath, AnimeSongs[RndId][file_name]);
  438. client_cmd(0, "mp3 play ^"%s^"", sound);
  439.  
  440. set_task(0.0, "ShowHud", task_hud);
  441. }
  442.  
  443. public StartHidonTrivia()
  444. {
  445. RndId = random_num(0, TriviaQuestionsLoaded-1);
  446. copy(Answer, charsmax(Answer), TriviaQuestions[RndId][Answr]);
  447.  
  448. set_task(0.0, "ShowHud", task_hud);
  449. }
  450.  
  451. public StartHidonLogoQuiz()
  452. {
  453. RndId = random_num(0, LogoQuizQuestionsLoaded-1);
  454. copy(Answer, charsmax(Answer), LogoQuizQuestions[RndId][Answr]);
  455.  
  456. set_task(0.0, "ShowHud", task_hud);
  457. }
  458.  
  459. public StartHidonMissingLetter()
  460. {
  461. RndId = random_num(0, MLQuestionsLoaded-1);
  462. copy(Answer, sizeof(Answer), MLQuestions[RndId]);
  463.  
  464. MLWords_indexes = ArrayCreate(MAX_ML_WORD_SIZE);
  465.  
  466. for (new i = 0; i < strlen(Answer); i++)
  467. {
  468. ArrayPushCell(MLWords_indexes, i);
  469. format(MLWord, sizeof(MLWord), "%s%c", MLWord, "_");
  470. }
  471.  
  472. ML_UpdateAmount = strlen(MLWord)/4;
  473. ML_LastIds = { -1, -1, -1, -1, -1, -1 , -1 , -1 };
  474.  
  475. for (new i = 0; i < 3; i++)
  476. ML_AddLetter();
  477.  
  478. set_task(0.0, "ShowHud", task_hud);
  479. }
  480.  
  481. public ShowHud()
  482. {
  483. if (HidonTimer < 0)
  484. {
  485. if (WinnerId == -1)
  486. ColorChat(0, "Nobody answered right... [^4Answer ^1was:^3 %s^1]", Answer);
  487.  
  488. ResetHidon();
  489. HidonVote();
  490. return;
  491. }
  492.  
  493. set_dhudmessage(random_num(1, 255), random_num(1, 255), random_num(1, 255), -1.0, 0.30, 0, 1.0, 1.0);
  494.  
  495. if (WinnerId != -1)
  496. {
  497. #if defined USE_NATIVES
  498. show_dhudmessage(0, "The Winner is %s!!!!!!!^nAnd he wins %d Points & %d Xp", get_player_name(WinnerId), Hidon[ChoosenHidonId][points], Hidon[ChoosenHidonId][xp]);
  499. #else
  500. show_dhudmessage(0, "The Winner is %s!!!!!!!", get_player_name(WinnerId));
  501. #endif
  502.  
  503. if (ShowMsgOnce)
  504. {
  505. #if defined USE_NATIVES
  506. //add_user_xp(WinnerId, Hidon[ChoosenHidonId][xp]);
  507. add_user_points(WinnerId, Hidon[ChoosenHidonId][points]);
  508. ColorChat(0, "^1The Winner Is ^4%s ^1and he wins ^3%d ^4Points ^1& ^3%d ^4Xp ^1! [^4Answer ^1was:^3 %s^1]", WinnerName, Hidon[ChoosenHidonId][points], Hidon[ChoosenHidonId][xp], Answer);
  509. #else
  510. ColorChat(0, "^1The Winner Is ^4%s^1! [^4Answer ^1was:^3 %s^1]", WinnerName, Answer);
  511. #endif
  512. ShowMsgOnce = false;
  513. }
  514. }
  515. else
  516. {
  517. switch (ChoosenHidonId)
  518. {
  519. case 0: show_dhudmessage(0, "How much is %d + %d ?", num1, num2);
  520. case 1: show_dhudmessage(0, "The Name Of This Nosalgic Series Is???");
  521. case 2: show_dhudmessage(0, "The Name Of This Anime Series Is???");
  522. case 3: show_dhudmessage(0, "%s", TriviaQuestions[RndId][Quest]);
  523. case 4: show_dhudmessage(0, "Do you know where this logo belongs?^nType /logo in chat to view the logo.", LogoQuizQuestions[RndId][Quest]);
  524. case 5:
  525. {
  526. ML_timer = float(HidonTimer%10);
  527. show_dhudmessage(0, "(%d Letters | Next help in: %1.f)^nWhat is that Word ?^n%s", strlen(Answer), (ArraySize(MLWords_indexes) >= ML_UpdateAmount) ? ML_timer : 0.0, MLWord);
  528. ProccessMLWord();
  529. }
  530. }
  531. }
  532.  
  533. HidonTimer--;
  534. set_task(1.0, "ShowHud", task_hud);
  535. }
  536.  
  537. public ML_AddLetter()
  538. {
  539. new rnd_num = random_num(0, ArraySize(MLWords_indexes)-1);
  540. new rnd_location = ArrayGetCell(MLWords_indexes, rnd_num);
  541. MLWord[rnd_location] = Answer[rnd_location];
  542. ArrayDeleteItem(MLWords_indexes, rnd_num);
  543.  
  544. return rnd_location;
  545. }
  546.  
  547. public ProccessMLWord()
  548. {
  549. if (ML_timer == 0.0 && HidonTimer <= 50 && ArraySize(MLWords_indexes) > -1 && ArraySize(MLWords_indexes) >= ML_UpdateAmount)
  550. {
  551. for (new i = 0; i < ML_UpdateAmount; i++)
  552. ML_LastIds[i] = ML_AddLetter();
  553.  
  554. }
  555. else
  556. {
  557. if (floatround(ML_timer) >= 6 && ArraySize(MLWords_indexes) >= ML_UpdateAmount)
  558. {
  559. for (new i = 0; i < ML_UpdateAmount; i++)
  560. {
  561. if (ML_LastIds[i] == -1) continue;
  562.  
  563. if (floatround(ML_timer)%2 == 1)
  564. MLWord[ML_LastIds[i]] = '_';
  565. else
  566. MLWord[ML_LastIds[i]] = Answer[ML_LastIds[i]];
  567. }
  568. }
  569. }
  570. }
  571.  
  572. public CheckAnswer(id)
  573. {
  574. if (ChoosenHidonId == -1)
  575. return PLUGIN_CONTINUE;
  576.  
  577. new Msg[192];
  578. read_argv(1, Msg, charsmax(Msg));
  579.  
  580. if (equali(Msg, Answer) && WinnerId == -1)
  581. {
  582. WinnerId = id;
  583. get_user_name(WinnerId, WinnerName, charsmax(WinnerName));
  584. ShowMsgOnce = true;
  585. remove_task(task_hud);
  586. set_task(0.0, "ShowHud");
  587. }
  588. else if (ChoosenHidonId == 0 && WinnerId == -1)
  589. ColorChat(id, "^3Wrong Answer.");
  590.  
  591. return PLUGIN_CONTINUE;
  592. }
  593.  
  594. public ResetHidon()
  595. {
  596. if (GameCount > 3)
  597. GameCount = 0;
  598.  
  599. HidonWaitingTime = 600;
  600. HidonIsRunning = false;
  601. VoteTimer = 100;
  602. ChoosenHidonId = -1;
  603. StartHidonCD = 5;
  604. WinnerId = -1;
  605. WinnerName = "";
  606. ShowMsgOnce = false;
  607. HidonTimer = 60;
  608. RndId = -1;
  609. MLWord = "";
  610. sound[0] = '^0';
  611. remove_task(task_vote);
  612. remove_task(task_start_hidon);
  613. remove_task(task_hud);
  614.  
  615. for (new i = 0; i < HidonimGamesCount; i++)
  616. Votes[i] = 0;
  617.  
  618. for (new i = 0; i < get_maxplayers(); i++)
  619. isVoted[i] = false;
  620. }
  621.  
  622. public LoadNostalgia()
  623. {
  624. if (file_exists(NostalgiaCfgFile))
  625. {
  626. new text[128];
  627. new file = fopen(NostalgiaCfgFile, "rt");
  628.  
  629. while (!feof(file))
  630. {
  631. fgets(file, text, charsmax(text));
  632. trim(text);
  633. if (text[0] == ';' || !text[0]) continue;
  634.  
  635. parse(text, NostalgiaSongs[NostalgiaSongsLoaded][name], MAX_SONG_NAME-1, NostalgiaSongs[NostalgiaSongsLoaded][file_name], MAX_PATH_SIZE-1);
  636. replace_all(NostalgiaSongs[NostalgiaSongsLoaded][name], MAX_SONG_NAME-1, "_", " ");
  637.  
  638. NostalgiaSongsLoaded++;
  639. }
  640.  
  641. fclose(file)
  642. }
  643. else
  644. log_message("[ Hidonim ] (Error) Failed to load file nostalgia.txt.");
  645. }
  646.  
  647. public LoadAnime()
  648. {
  649. if (file_exists(AnimeCfgFile))
  650. {
  651. new text[128];
  652. new file = fopen(AnimeCfgFile, "rt");
  653.  
  654. while (!feof(file))
  655. {
  656. fgets(file, text, charsmax(text));
  657. trim(text);
  658. if (text[0] == ';' || !text[0]) continue;
  659.  
  660. parse(text, AnimeSongs[AnimeSongsLoaded][name], MAX_SONG_NAME-1, AnimeSongs[AnimeSongsLoaded][file_name], MAX_PATH_SIZE-1);
  661. replace_all(AnimeSongs[AnimeSongsLoaded][name], MAX_SONG_NAME-1, "_", " ");
  662.  
  663. AnimeSongsLoaded++;
  664. }
  665.  
  666. fclose(file)
  667. }
  668. else
  669. log_message("[ Hidonim ] (Error) Failed to load file anime.txt.");
  670. }
  671.  
  672. public LoadTriviaQuestions()
  673. {
  674. if (file_exists(TriviaCfgFile))
  675. {
  676. new text[128];
  677. new file = fopen(TriviaCfgFile, "rt");
  678.  
  679. while (!feof(file))
  680. {
  681. fgets(file, text, charsmax(text));
  682. trim(text);
  683. remove_quotes(text);
  684. if (text[0] == ';' || !text[0]) continue;
  685.  
  686. parse(text, TriviaQuestions[TriviaQuestionsLoaded][Quest], MAX_QUESTIONS_LENGTH-1, TriviaQuestions[TriviaQuestionsLoaded][Answr], MAX_ANSWER_LENGTH-1);
  687. replace_all(TriviaQuestions[TriviaQuestionsLoaded][Quest], MAX_QUESTIONS_LENGTH-1, "_", " ");
  688. replace_all(TriviaQuestions[TriviaQuestionsLoaded][Answr], MAX_ANSWER_LENGTH-1, "_", " ");
  689.  
  690. TriviaQuestionsLoaded++;
  691. }
  692.  
  693. fclose(file)
  694. }
  695. else
  696. log_message("[ Hidonim ] (Error) Failed to load file trivia.txt.");
  697. }
  698.  
  699. public LoadLogoQuiz()
  700. {
  701. if (file_exists(LogoQuizCfgFile))
  702. {
  703. new text[128];
  704. new file = fopen(LogoQuizCfgFile, "rt");
  705.  
  706. while (!feof(file))
  707. {
  708. fgets(file, text, charsmax(text));
  709. trim(text);
  710. remove_quotes(text);
  711. if (text[0] == ';' || !text[0]) continue;
  712.  
  713. parse(text, LogoQuizQuestions[LogoQuizQuestionsLoaded][Quest], MAX_QUESTIONS_LENGTH-1, LogoQuizQuestions[LogoQuizQuestionsLoaded][Answr], MAX_ANSWER_LENGTH-1);
  714. replace_all(LogoQuizQuestions[LogoQuizQuestionsLoaded][Answr], MAX_ANSWER_LENGTH-1, "_", " ");
  715.  
  716. LogoQuizQuestionsLoaded++;
  717. }
  718.  
  719. fclose(file)
  720. }
  721. else
  722. log_message("[ Hidonim ] (Error) Failed to load file logoquiz.txt.");
  723. }
  724.  
  725. public LoadMissingLetter()
  726. {
  727. if (file_exists(MissingLetterCfgFile))
  728. {
  729. new text[128];
  730. new file = fopen(MissingLetterCfgFile, "rt");
  731.  
  732. while (!feof(file))
  733. {
  734. fgets(file, text, charsmax(text));
  735. trim(text);
  736. remove_quotes(text);
  737. if (text[0] == ';' || !text[0]) continue;
  738.  
  739. copy(MLQuestions[MLQuestionsLoaded], MAX_ML_WORD_SIZE, text);
  740.  
  741. MLQuestionsLoaded++;
  742. }
  743.  
  744. fclose(file)
  745. }
  746. else
  747. log_message("[ Hidonim ] (Error) Failed to load file missingletter.txt.");
  748. }
  749.  
  750. get_player_name(id)
  751. {
  752. new szName[32];
  753. get_user_name(id, szName, charsmax(szName));
  754.  
  755. return szName;
  756. }
  757.  
  758. stock ColorChat( const client, const string[], any:... )
  759. {
  760. new msg[ 191 ], players[ 32 ], count = 1;
  761. static len; len = formatex( msg, charsmax( msg ), "^4[^1 Top Deathrun ^4]^1 " );
  762. vformat( msg[ len ], charsmax( msg ) - len, string, 3 );
  763.  
  764. if( client ) players[ 0 ] = client;
  765. else get_players( players,count,"ch" );
  766.  
  767. for ( new i = 0; i < count; i++ )
  768. {
  769. if( is_user_connected( players[ i ] ) )
  770. {
  771. message_begin( MSG_ONE_UNRELIABLE, get_user_msgid( "SayText" ), _, players[ i ] );
  772. write_byte( players[ i ] );
  773. write_string( msg );
  774. message_end( );
  775. }
  776. }
  777. return PLUGIN_HANDLED;
  778. }
Advertisement
Add Comment
Please, Sign In to add comment