Advertisement
Guest User

Untitled

a guest
Jun 17th, 2012
396
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.79 KB | None | 0 0
  1. /*
  2.  
  3. ----- Kniha přání a stížností v2.0 -----
  4. by Mort
  5. */
  6.  
  7. #include <a_samp>
  8.  
  9. #define MISTO_STIZNOSTI "Kniha/Stiznosti.txt"
  10. #define MISTO_PRANI "Kniha/Prani.txt"
  11.  
  12. #define DIAL_1 100
  13. #define DIAL_2 101
  14. #define DIAL_3 102
  15.  
  16. stock GetName(playerid)
  17. {
  18. new name[MAX_PLAYER_NAME];
  19. GetPlayerName(playerid,name,sizeof(name));
  20. return name;
  21. }
  22.  
  23.  
  24. public OnPlayerCommandText(playerid,cmdtext[])
  25. {
  26. if(strcmp(cmdtext[1],"kniha",true)==0)
  27. {
  28. ShowPlayerDialog(playerid,DIAL_1,DIALOG_STYLE_LIST,"Zvol typ","{33FF00}Přání\n{FF0000}Stížnost","Zvolit","Zrušit");
  29. return 1;
  30. }
  31. return 0;
  32. }
  33.  
  34. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  35. {
  36. if(response)
  37. {
  38. if(dialogid == DIAL_1)
  39. {
  40. switch(listitem)
  41. {
  42. case 0:
  43. {
  44. ShowPlayerDialog(playerid,DIAL_2,DIALOG_STYLE_INPUT,"Napiš přání","Napiš, co by jsi chtěl na serveru","Odeslat","Zrušit");
  45. }
  46. case 1:
  47. {
  48. ShowPlayerDialog(playerid,DIAL_3,DIALOG_STYLE_INPUT,"Napiš štížnost","Napiš, co se ti na serveru nelíbí","Odeslat","Zrušit");
  49. }
  50. }
  51. }
  52. if(dialogid == DIAL_2)
  53. {
  54. if(!inputtext[0]) return ShowPlayerDialog(playerid,DIAL_2,DIALOG_STYLE_INPUT,"Napiš přání","Napiš, co by jsi chtěl na serveru","Odeslat","Zrušit");
  55. // vytvoření řetězce pro zapisování do souboru
  56. new string[150];
  57. new Year,Month,Day,Hour,Minute,Second;
  58. getdate(Year,Month,Day);
  59. gettime(Hour,Minute,Second);
  60. format(string,sizeof(string),"[%d/%d/%d][%02d/%02d/%02d] %s: %s\r\n",Day,Month,Year,Hour,Minute,Second,GetName(playerid),inputtext);
  61. // zapsání řetězce do souboru
  62. new File:file = fopen(MISTO_PRANI,io_append);
  63. if(file)
  64. {
  65. fwrite(file,string);
  66. }
  67. fclose(file);
  68. //
  69. SendClientMessage(playerid,-1,"Děkujeme za Váš názor");
  70. }
  71. if(dialogid == DIAL_3)
  72. {
  73. if(!inputtext[0]) return ShowPlayerDialog(playerid,DIAL_2,DIALOG_STYLE_INPUT,"Napiš přání","Napiš, co by jsi chtěl na serveru","Odeslat","Zrušit");
  74. // vytvoření řetězce pro zapisování do souboru
  75. new string[150];
  76. new Year,Month,Day,Hour,Minute,Second;
  77. getdate(Year,Month,Day);
  78. gettime(Hour,Minute,Second);
  79. format(string,sizeof(string),"[%d/%d/%d][%02d/%02d/%02d] %s: %s\r\n",Day,Month,Year,Hour,Minute,Second,GetName(playerid),inputtext);
  80. // zapsání řetězce do souboru
  81. new File:file = fopen(MISTO_STIZNOSTI,io_append);
  82. if(file)
  83. {
  84. fwrite(file,string);
  85. }
  86. fclose(file);
  87. //
  88. SendClientMessage(playerid,-1,"Děkujeme za Váš názor");
  89. }
  90. }
  91. return 1;
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement