Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.20 KB | None | 0 0
  1. #include <a_samp>
  2. #include <irc>
  3.  
  4. #if defined MAX_PLAYERS
  5. #undef MAX_PLAYERS
  6. #endif
  7.  
  8. #define MAX_PLAYERS (200) // Slot's
  9. #define MAX_MESSAGE (20) // Max. save message
  10. #define MAX_MESSAGE_STRING (74) /* max message len + 24 nick
  11. (50 + 24 )*/
  12.  
  13. #define IRC_LIST (0) // List's ID 1
  14. #define IRC_CHANNEL_NAME (1) // List's ID 2
  15. #define IRC_CHANNEL_PASS (2) // List's ID 3
  16. #define IRC_CHANNEL_DEL (3) // List's ID 4
  17. #define IRC_CHANNEL_JOIN (4) // List's ID 5
  18. #define IRC_CHANNEL_PASS2 (5) // List's ID 6
  19. #define IRC_MESSAGE (6) // List's ID 7
  20. #define IRC_MESSAGE_SEND (7) // List's ID 8
  21. #define IRC_CHANNEL_DELETE (8) // List's ID 9
  22. #define IRC_CHANNEL_MSGBOX (9) // List's ID 10
  23. #define IRC_MESSAGE_MSGBOX (10) // List's ID 11
  24.  
  25. #define MAX_CHANNELS (21) // Max channels
  26. #define MAX_CHANNELS_NAME (10) // Max channel's name len
  27. #define MAX_CHANNELS_PASS (10) // Max channel's pass len
  28.  
  29. #define COLOR_GREEN (0x00CC00FF)
  30. #define COLOR_RED (0xCC0000FF)
  31. #define COLOR_YELLOW (0xC5FF3EFF)
  32. #define COLOR_ORANGE (0xFF9600FF)
  33.  
  34. #define Print(%1) { \
  35. print(\
  36. "\nIRC's Channel system by Gertin/\x44\x65\x73\x74\x72\x6f\x6a\x65\x72\n");}
  37.  
  38. enum pInfo
  39. {
  40. ircChannel,
  41. ircJoin,
  42. createChannel,
  43. bool:windowOpen
  44.  
  45. }
  46.  
  47. enum channels
  48. {
  49. names[MAX_CHANNELS_NAME],
  50. pass[MAX_CHANNELS_PASS],
  51. message,
  52. bool:active,
  53. bool:havePassword
  54. }
  55.  
  56. new
  57. playerInfo[MAX_PLAYERS][pInfo],
  58. ircChannels[MAX_CHANNELS][channels],
  59. chatHistory[MAX_CHANNELS][MAX_MESSAGE][MAX_MESSAGE_STRING];
  60.  
  61. stock PlayerName(playerid)
  62. {
  63. new name[24];
  64.  
  65. GetPlayerName(playerid, name, sizeof(name));
  66.  
  67. return name;
  68. }
  69.  
  70. public OnFilterScriptInit()
  71. {
  72. Print("IRC's Channel system by Gertin/Iron Smith")
  73.  
  74. return 1;
  75. }
  76.  
  77. public OnFilterScriptExit()
  78. {
  79. print("Filter Script unloaded");
  80. return 1;
  81. }
  82.  
  83. public OnPlayerDisconnect(playerid, reason)
  84. {
  85. if(playerInfo[playerid][createChannel] != 0)
  86. {
  87. ircChannels[playerInfo[playerid][createChannel]][active] = false;
  88. strdel(ircChannels[playerInfo[playerid][createChannel]][names], 0, 10);
  89. strdel(ircChannels[playerInfo[playerid][createChannel]][pass], 0, 10);
  90.  
  91. for(new i = 1; i < MAX_MESSAGE; i++)
  92. strdel(chatHistory[playerInfo[playerid][createChannel]][i], 0,
  93. MAX_MESSAGE_STRING);
  94.  
  95. for(new i, gmax = GetMaxPlayers(); i < gmax; i++)
  96. {
  97. if(!IsPlayerConnected(i))
  98. continue;
  99. if(playerInfo[i][ircChannel] == playerInfo[playerid][ircChannel])
  100. {
  101. ShowPlayerDialog(playerid, IRC_CHANNEL_MSGBOX,
  102. DIALOG_STYLE_MSGBOX,
  103. "Disconnected",
  104. "Channel was deleted!",
  105. "OK",
  106. "Close");
  107.  
  108. playerInfo[i][ircChannel] = 0;
  109. }
  110. }
  111. playerInfo[playerid][createChannel] = 0;
  112. }
  113.  
  114. playerInfo[playerid][ircChannel] = 0;
  115.  
  116. return 1;
  117. }
  118.  
  119. public OnPlayerCommandText(playerid, cmdtext[])
  120. {
  121. if (strcmp(cmdtext[1], "ircoptions", true) == 0)
  122. {
  123. #define TITLE "Select option"
  124. #define OPTIONS "Create channel\nDelete/Leave\nJoin"
  125.  
  126. ShowPlayerDialog(playerid, IRC_LIST, DIALOG_STYLE_LIST, TITLE, OPTIONS,
  127. "Next",
  128. "Close");
  129.  
  130. return 1;
  131. }
  132.  
  133. if (strcmp(cmdtext[1], "irc", true) == 0)
  134. {
  135. new strTitle[45], strChat[2500];
  136.  
  137. if(playerInfo[playerid][ircChannel] == 0)
  138. return SendClientMessage(playerid, COLOR_RED,
  139. "You are not in any irc channel!");
  140.  
  141. format(strTitle, sizeof(strTitle),
  142. "Channel #%s",
  143. ircChannels[playerInfo[playerid][ircChannel]][names]);
  144.  
  145. for(new i = 1; i < MAX_MESSAGE; i++)
  146. {
  147. if(!strlen(chatHistory[playerInfo[playerid][ircChannel]][i]))
  148. continue;
  149. strcat(strChat, chatHistory[playerInfo[playerid][ircChannel]][i],
  150. sizeof(strChat));
  151. }
  152.  
  153. if(!strlen(strChat))
  154. {
  155. ShowPlayerDialog(playerid, IRC_MESSAGE, DIALOG_STYLE_LIST, strTitle,
  156. "No message",
  157. "Write",
  158. "Hide");
  159.  
  160. return 1;
  161. }
  162.  
  163. ShowPlayerDialog(playerid, IRC_MESSAGE, DIALOG_STYLE_LIST, strTitle,
  164. strChat,
  165. "Write",
  166. "Hide");
  167.  
  168. return 1;
  169. }
  170.  
  171. return 0;
  172. }
  173.  
  174. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  175. {
  176. if(dialogid == IRC_MESSAGE_MSGBOX)
  177. {
  178. new strTitle[45], strChat[2500];
  179.  
  180. format(strTitle, sizeof(strTitle), "Channel #%s",
  181. ircChannels[playerInfo[playerid][ircChannel]][names]);
  182.  
  183. for(new i = 1; i < MAX_MESSAGE; i++)
  184. {
  185. if(!strlen(chatHistory[playerInfo[playerid][ircChannel]][i]))
  186. continue;
  187. strcat(strChat, chatHistory[playerInfo[playerid][ircChannel]][i],
  188. sizeof(strChat));
  189. }
  190.  
  191. playerInfo[playerid][windowOpen] = true;
  192.  
  193. if(!strlen(strChat))
  194. {
  195. ShowPlayerDialog(playerid, IRC_MESSAGE, DIALOG_STYLE_LIST, strTitle,
  196. "No message",
  197. "Write",
  198. "Hide");
  199.  
  200. return 1;
  201. }
  202.  
  203. ShowPlayerDialog(playerid, IRC_MESSAGE, DIALOG_STYLE_LIST, strTitle,
  204. strChat,
  205. "Write",
  206. "Hide");
  207.  
  208. return 1;
  209. }
  210.  
  211. if(response == 1)
  212. {
  213. if(dialogid == IRC_LIST)
  214. {
  215. switch(listitem)
  216. {
  217. case 0:
  218. {
  219. if(playerInfo[playerid][createChannel] != 0)
  220. /*return SendClientMessage(playerid, COLOR_RED,
  221. "You have one channel. You can not have more!");*/
  222. for(new i = 1; i < MAX_CHANNELS; i++)
  223. {
  224. if(ircChannels[i][active] == false)
  225. {
  226. ShowPlayerDialog(playerid, IRC_CHANNEL_NAME,
  227. DIALOG_STYLE_INPUT,
  228. "Name",
  229. "",
  230. "Ok",
  231. "Cancel");
  232.  
  233. playerInfo[playerid][createChannel] = i;
  234. return 1;
  235. }
  236. }
  237. }
  238. case 1:
  239. {
  240. new strChannels[220];
  241. for(new i = 1; i < MAX_CHANNELS; i++)
  242. {
  243. new str[20];
  244. format(str, sizeof(str), "\n#%s",
  245. ircChannels[i][names]);
  246.  
  247. strcat(strChannels, str, sizeof(strChannels));
  248. }
  249.  
  250. if(!strlen(ircChannels[1][names]))
  251. {
  252. ShowPlayerDialog(playerid, IRC_CHANNEL_MSGBOX,
  253. DIALOG_STYLE_MSGBOX,
  254. "Select channel",
  255. "No channels",
  256. "Ok",
  257. "Close");
  258.  
  259. return 1;
  260. }
  261.  
  262. ShowPlayerDialog(playerid, IRC_CHANNEL_DEL,
  263. DIALOG_STYLE_LIST,
  264. "Select channel",
  265. strChannels,
  266. "Delete",
  267. "Close");
  268.  
  269. return 1;
  270. }
  271. case 2:
  272. {
  273. new strChannels[220];
  274. for(new i = 1; i < MAX_CHANNELS; i++)
  275. {
  276. new str[20];
  277. format(str, sizeof(str), "\n#%s",
  278. ircChannels[i][names]);
  279.  
  280. strcat(strChannels, str, sizeof(strChannels));
  281. }
  282.  
  283. if(!strlen(ircChannels[1][names]))
  284. {
  285. ShowPlayerDialog(playerid, IRC_CHANNEL_MSGBOX,
  286. DIALOG_STYLE_MSGBOX,
  287. "Select channel",
  288. "No channels",
  289. "Ok",
  290. "Close");
  291.  
  292. return 1;
  293. }
  294.  
  295. ShowPlayerDialog(playerid, IRC_CHANNEL_JOIN,
  296. DIALOG_STYLE_LIST,
  297. "Select channel",
  298. strChannels,
  299. "Join",
  300. "Close");
  301.  
  302. return 1;
  303. }
  304. }
  305.  
  306. return 1;
  307. }
  308.  
  309. if(dialogid == IRC_CHANNEL_NAME)
  310. {
  311. if(strlen(inputtext) >= MAX_CHANNELS_NAME || strlen(inputtext) <= 1)
  312. {
  313. ShowPlayerDialog(playerid, IRC_CHANNEL_NAME, DIALOG_STYLE_INPUT,
  314. "Name",
  315. "",
  316. "Ok",
  317. "Cancel");
  318.  
  319. SendClientMessage(playerid, COLOR_RED,
  320. "Wrong name!");
  321.  
  322. return 1;
  323. }
  324.  
  325. format(ircChannels[playerInfo[playerid][createChannel]][names],
  326. MAX_CHANNELS_NAME,
  327. "%s",
  328. inputtext);
  329.  
  330. ircChannels[playerInfo[playerid][createChannel]][active] = true;
  331. ShowPlayerDialog(playerid, IRC_CHANNEL_PASS, DIALOG_STYLE_INPUT,
  332. "Password",
  333. "",
  334. "Ok",
  335. "NO PASS");
  336.  
  337. return 1;
  338. }
  339.  
  340. if(dialogid == IRC_CHANNEL_PASS)
  341. {
  342. new strInfo[45];
  343. if(strlen(inputtext) >= MAX_CHANNELS_PASS || strlen(inputtext) <= 1)
  344. {
  345. ShowPlayerDialog(playerid, IRC_CHANNEL_PASS, DIALOG_STYLE_INPUT,
  346. "Password",
  347. "",
  348. "Ok",
  349. "NO PASS");
  350.  
  351. SendClientMessage(playerid, COLOR_RED,
  352. "Wrong password");
  353.  
  354. return 1;
  355. }
  356. format(ircChannels[playerInfo[playerid][createChannel]][pass],
  357. MAX_CHANNELS_PASS,
  358. "%s",
  359. inputtext);
  360.  
  361. format(strInfo, sizeof(strInfo), "Name: %s Password: %s",
  362. ircChannels[playerInfo[playerid][createChannel]][names],
  363. ircChannels[playerInfo[playerid][createChannel]][pass]);
  364.  
  365. SendClientMessage(playerid, COLOR_GREEN, strInfo);
  366.  
  367. SendClientMessage(playerid, COLOR_YELLOW,
  368. "Use /irc to open dialog window");
  369.  
  370. playerInfo[playerid][ircChannel] = playerInfo[playerid][createChannel];
  371.  
  372. return 1;
  373. }
  374.  
  375. if(dialogid == IRC_CHANNEL_DEL)
  376. {
  377. if(ircChannels[(listitem + 1)][active] == false)
  378. {
  379. SendClientMessage(playerid, COLOR_RED,
  380. "Sorry the channel does no exist!");
  381.  
  382. return 1;
  383. }
  384. if(strlen(ircChannels[playerInfo[playerid][createChannel]][pass]))
  385. {
  386. ShowPlayerDialog(playerid, IRC_CHANNEL_DELETE,
  387. DIALOG_STYLE_INPUT,
  388. "Password",
  389. "",
  390. "Ok",
  391. "Cancel");
  392.  
  393. return 1;
  394. }
  395.  
  396. if(!strlen(ircChannels[playerInfo[playerid][createChannel]][pass])
  397. && playerInfo[playerid][createChannel] != 0)
  398. {
  399. ircChannels[playerInfo[playerid][createChannel]][active] = false;
  400. strdel(ircChannels[playerInfo[playerid][createChannel]][names],
  401. 0,
  402. 10);
  403.  
  404. strdel(ircChannels[playerInfo[playerid][createChannel]][pass],
  405. 0,
  406. 10);
  407.  
  408. for(new i = 1; i < MAX_MESSAGE; i++)
  409. strdel(chatHistory[playerInfo[playerid][createChannel]][i],
  410. 0,
  411. MAX_MESSAGE_STRING);
  412.  
  413. for(new i, gmax = GetMaxPlayers(); i < gmax; i++)
  414. {
  415. if(!IsPlayerConnected(i))
  416. continue;
  417. if(playerInfo[i][ircChannel] == playerInfo[playerid][ircChannel])
  418. {
  419. ShowPlayerDialog(playerid, IRC_CHANNEL_MSGBOX,
  420. DIALOG_STYLE_MSGBOX,
  421. "Disconnected",
  422. "Channel was deleted!",
  423. "OK",
  424. "Close");
  425.  
  426. playerInfo[i][ircChannel] = 0;
  427. }
  428. }
  429. ircChannels[playerInfo[playerid][createChannel]][active] = false;
  430. strdel(ircChannels[playerInfo[playerid][createChannel]][names],
  431. 0,
  432. 10);
  433.  
  434. strdel(ircChannels[playerInfo[playerid][createChannel]][pass],
  435. 0,
  436. 10);
  437.  
  438. playerInfo[playerid][createChannel] = 0;
  439. SendClientMessage(playerid, COLOR_GREEN,
  440. "You deleted your IRC channel");
  441.  
  442. return 1;
  443. }
  444.  
  445. ShowPlayerDialog(playerid, IRC_CHANNEL_MSGBOX, DIALOG_STYLE_MSGBOX,
  446. "Information",
  447. "You are left channel",
  448. "Ok",
  449. "Close");
  450.  
  451. playerInfo[playerid][ircChannel] = 0;
  452.  
  453. return 1;
  454. }
  455.  
  456. if(dialogid == IRC_CHANNEL_DELETE)
  457. {
  458. if(strcmp(ircChannels[playerInfo[playerid][createChannel]][pass],
  459. inputtext, false) == 0 && strlen(inputtext))
  460. {
  461. ircChannels[playerInfo[playerid][createChannel]][active] = false;
  462. strdel(ircChannels[playerInfo[playerid][createChannel]][names],
  463. 0,
  464. 10);
  465.  
  466. strdel(ircChannels[playerInfo[playerid][createChannel]][pass],
  467. 0,
  468. 10);
  469.  
  470. for(new i = 1; i < MAX_MESSAGE; i++)
  471. strdel(chatHistory[playerInfo[playerid][createChannel]][i],
  472. 0,
  473. MAX_MESSAGE_STRING);
  474.  
  475. for(new i, gmax = GetMaxPlayers(); i < gmax; i++)
  476. {
  477. if(!IsPlayerConnected(i))
  478. continue;
  479. if(playerInfo[i][ircChannel] == playerInfo[playerid][ircChannel])
  480. {
  481. ShowPlayerDialog(playerid, IRC_CHANNEL_MSGBOX,
  482. DIALOG_STYLE_MSGBOX,
  483. "Disconnected",
  484. "Channel was deleted!",
  485. "OK",
  486. "Close");
  487.  
  488. playerInfo[i][ircChannel] = 0;
  489. }
  490. }
  491.  
  492. playerInfo[playerid][createChannel] = 0;
  493.  
  494. SendClientMessage(playerid, COLOR_GREEN,
  495. "You deleted your IRC channel");
  496.  
  497. return 1;
  498. }
  499.  
  500. SendClientMessage(playerid, COLOR_RED, "Wrong password!");
  501.  
  502. return 1;
  503.  
  504. }
  505.  
  506. if(dialogid == IRC_CHANNEL_JOIN)
  507. {
  508. if(ircChannels[(listitem + 1)][active] == false)
  509. {
  510. ShowPlayerDialog(playerid, IRC_CHANNEL_MSGBOX,
  511. DIALOG_STYLE_MSGBOX,
  512. "ERROR",
  513. "Channel does not exist!",
  514. "Ok",
  515. "Close");
  516.  
  517. return 1;
  518. }
  519.  
  520. if(!strlen(ircChannels[(listitem + 1)][pass]))
  521. {
  522. new strInfo[100];
  523.  
  524. playerInfo[playerid][ircChannel] = (listitem + 1);
  525.  
  526. format(strInfo, sizeof(strInfo), "You joined to %s channel",
  527. ircChannels[playerInfo[playerid][ircChannel]][names]);
  528.  
  529. SendClientMessage(playerid, COLOR_GREEN, strInfo);
  530. format(strInfo, sizeof(strInfo), "%s joined to us",
  531. PlayerName(playerid));
  532.  
  533. SendClientMessage(playerid, COLOR_YELLOW,
  534. "Use /irc to open dialog window");
  535.  
  536. for(new i, gmax = GetMaxPlayers(); i < gmax; i++)
  537. {
  538. if(!IsPlayerConnected(i))
  539. continue;
  540. if(playerInfo[i][ircChannel] == playerInfo[playerid][ircChannel])
  541. SendClientMessage(i, COLOR_ORANGE, strInfo);
  542. }
  543.  
  544. return 1;
  545.  
  546. }
  547. if(strlen(ircChannels[(listitem + 1)][pass]))
  548. {
  549. ShowPlayerDialog(playerid, IRC_CHANNEL_PASS2, DIALOG_STYLE_INPUT,
  550. "Password",
  551. "",
  552. "Join",
  553. "Cancel");
  554.  
  555. playerInfo[playerid][ircJoin] = (listitem + 1);
  556.  
  557. return 1;
  558. }
  559.  
  560. }
  561.  
  562. if(dialogid == IRC_CHANNEL_PASS2)
  563. {
  564. if(strcmp(ircChannels[playerInfo[playerid][ircJoin]][pass],
  565. inputtext, false) == 0 && strlen(inputtext))
  566. {
  567. playerInfo[playerid][ircChannel] = playerInfo[playerid][ircJoin];
  568.  
  569. new strInfo[100];
  570.  
  571. format(strInfo, sizeof(strInfo), "You joined to %s channel",
  572. ircChannels[playerInfo[playerid][ircChannel]][names]);
  573.  
  574. SendClientMessage(playerid, COLOR_GREEN, strInfo);
  575.  
  576. format(strInfo, sizeof(strInfo), "%s joined to us",
  577. PlayerName(playerid));
  578.  
  579. SendClientMessage(playerid, COLOR_YELLOW,
  580. "Use /irc to open dialog window");
  581.  
  582. playerInfo[playerid][ircJoin] = 0;
  583.  
  584. for(new i, gmax = GetMaxPlayers(); i < gmax; i++)
  585. {
  586. if(!IsPlayerConnected(i))
  587. continue;
  588. if(playerInfo[i][ircChannel] == playerInfo[playerid][ircChannel])
  589. SendClientMessage(i, COLOR_ORANGE, strInfo);
  590. }
  591.  
  592. return 1;
  593. }
  594. }
  595.  
  596. if(dialogid == IRC_MESSAGE)
  597. {
  598. ShowPlayerDialog(playerid, IRC_MESSAGE_SEND, DIALOG_STYLE_INPUT,
  599. "Message",
  600. "",
  601. "Send",
  602. "Back");
  603.  
  604. playerInfo[playerid][windowOpen] = false;
  605.  
  606. return 1;
  607. }
  608.  
  609. if(dialogid == IRC_MESSAGE_SEND)
  610. {
  611. if(strlen(inputtext) >= 40)
  612. {
  613. ShowPlayerDialog(playerid, IRC_MESSAGE_MSGBOX,
  614. DIALOG_STYLE_MSGBOX,
  615. "Error!",
  616. "Message is to long!",
  617. "Ok",
  618. "Close");
  619.  
  620. return 1;
  621. }
  622.  
  623. if(ircChannels[playerInfo[playerid][ircChannel]][message] == 19)
  624. ircChannels[playerInfo[playerid][ircChannel]][message] = 0;
  625.  
  626. format(chatHistory[playerInfo[playerid][ircChannel]][0],
  627. MAX_MESSAGE_STRING,
  628. "%s: %s\n",
  629. PlayerName(playerid), inputtext);
  630.  
  631. for(new i = 19; i >= 1; i--)
  632. {
  633. format(chatHistory[playerInfo[playerid][ircChannel]][i],
  634. MAX_MESSAGE_STRING,
  635. "%s",
  636. chatHistory[playerInfo[playerid][ircChannel]][i - 1]);
  637. }
  638.  
  639. playerInfo[playerid][windowOpen] = true;
  640.  
  641. new strTitle[45], strChat[2500];
  642.  
  643. for(new i = 1; i < MAX_MESSAGE; i++)
  644. {
  645. if(!strlen(chatHistory[playerInfo[playerid][ircChannel]][i]))
  646. continue;
  647. strcat(strChat, chatHistory[playerInfo[playerid][ircChannel]][i],
  648. sizeof(strChat));
  649. }
  650.  
  651. format(strTitle, sizeof(strTitle), "Channel #%s",
  652. ircChannels[playerInfo[playerid][ircChannel]][names]);
  653.  
  654.  
  655. for(new i, gmax = GetMaxPlayers(); i < gmax; i++)
  656. {
  657. if(!IsPlayerConnected(i))
  658. continue;
  659. if(playerInfo[i][ircChannel] == playerInfo[playerid][ircChannel])
  660. {
  661. if(i != playerid)
  662. GameTextForPlayer(i,
  663. "~g~New message on ~r~IRC channel",
  664. 1000,
  665. 5);
  666.  
  667. if(playerInfo[i][windowOpen] == true)
  668. ShowPlayerDialog(i, IRC_MESSAGE, DIALOG_STYLE_LIST,
  669. strTitle,
  670. strChat,
  671. "Write",
  672. "Hide");
  673. }
  674. }
  675. }
  676. }
  677.  
  678. if(response == 0)
  679. {
  680.  
  681. if(dialogid == IRC_CHANNEL_NAME)
  682. {
  683. playerInfo[playerid][createChannel] = 0;
  684.  
  685. return 1;
  686. }
  687.  
  688. if(dialogid == IRC_CHANNEL_PASS)
  689. {
  690. new strInfo[45];
  691. format(strInfo, sizeof(strInfo), "Name: %s without password",
  692. ircChannels[playerInfo[playerid][createChannel]][names],
  693. ircChannels[playerInfo[playerid][createChannel]][pass]);
  694.  
  695. SendClientMessage(playerid, COLOR_GREEN, strInfo);
  696.  
  697. SendClientMessage(playerid, COLOR_YELLOW,
  698. "Use /irc to open dialog window");
  699.  
  700. playerInfo[playerid][ircChannel] = playerInfo[playerid][createChannel];
  701.  
  702. return 1;
  703. }
  704. if(dialogid == IRC_MESSAGE_SEND)
  705. {
  706. new strTitle[45], strChat[2500];
  707.  
  708. format(strTitle, sizeof(strTitle), "Channel #%s",
  709. ircChannels[playerInfo[playerid][ircChannel]][names]);
  710.  
  711. playerInfo[playerid][windowOpen] = true;
  712.  
  713. for(new i = 1; i < MAX_MESSAGE; i++)
  714. {
  715. if(!strlen(chatHistory[playerInfo[playerid][ircChannel]][i]))
  716. continue;
  717.  
  718. strcat(strChat, chatHistory[playerInfo[playerid][ircChannel]][i],
  719. sizeof(strChat));
  720. }
  721.  
  722. if(!strlen(strChat))
  723. {
  724. ShowPlayerDialog(playerid, IRC_CHANNEL_JOIN, DIALOG_STYLE_LIST,
  725. strTitle,
  726. "No Message",
  727. "Write",
  728. "Hide");
  729.  
  730. return 1;
  731. }
  732.  
  733. ShowPlayerDialog(playerid, IRC_MESSAGE, DIALOG_STYLE_LIST, strTitle,
  734. strChat,
  735. "Wtite",
  736. "Hide");
  737. }
  738. if(dialogid == IRC_MESSAGE)
  739. playerInfo[playerid][windowOpen] = false;
  740. }
  741.  
  742. return 1;
  743. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement