dialog_phone.pwn 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. Dialog:PhoneMenu(playerid, response, listitem, inputtext[])
  2. {
  3. if (response)
  4. {
  5. switch (listitem)
  6. {
  7. case 0:
  8. {
  9. Dialog_Show(playerid, PhoneCall, DIALOG_STYLE_INPUT, "{6688FF}Call Number", "Please specify the number you would like to call:", "Call", "Cancel");
  10. }
  11. case 1:
  12. {
  13. Dialog_Show(playerid, PhoneSMS, DIALOG_STYLE_INPUT, "{6688FF}SMS Number", "Please specify the number you would like to SMS:", "Call", "Cancel");
  14. }
  15. case 2:
  16. {
  17. ListContacts(playerid);
  18. }
  19. case 3:
  20. {
  21. SendErrorMessage(playerid, "This feature is still being developed.");
  22. }
  23. case 4:
  24. {
  25. CheckBank(playerid,playerid);
  26. }
  27. case 5:
  28. {
  29. Dialog_Show(playerid, PhoneSettings, DIALOG_STYLE_LIST, "{6688FF}Phone Settings", "Power %s\nSound Off", "Select", "Cancel", (Players[playerid][pPhoneOff]) ? ("Off") : ("On"));
  30. }
  31. }
  32. }
  33. return 1;
  34. }
  35. Dialog:PhoneSettings(playerid, response, listitem, inputtext[])
  36. {
  37. if (response)
  38. {
  39. switch (listitem)
  40. {
  41. case 0:
  42. {
  43. if (Players[playerid][pPhoneOff] == 0)
  44. Players[playerid][pPhoneOff] = 1;
  45. else
  46. Players[playerid][pPhoneOff] = 0;
  47. }
  48. }
  49. }
  50. return 1;
  51. }
  52. Dialog:PhoneSMS(playerid, response, listitem, inputtext[])
  53. {
  54. new number;
  55. if (response)
  56. {
  57. if (sscanf(inputtext, "i", number))
  58. {
  59. return Dialog_Show(playerid, PhoneSMS, DIALOG_STYLE_INPUT, "{6688FF}SMS Number", "Please specify the number you would like to SMS:", "Call", "Cancel");
  60. }
  61. else if (Players[playerid][pPhone] == number)
  62. {
  63. return Dialog_Show(playerid, PhoneSMS, DIALOG_STYLE_INPUT, "{6688FF}SMS Number", "You can't text your own number.\n\nPlease specify the number you would like to SMS:", "Call", "Cancel");
  64. }
  65. else if (number < 1)
  66. {
  67. return Dialog_Show(playerid, PhoneSMS, DIALOG_STYLE_INPUT, "{6688FF}SMS Number", "Please specify the number you would like to SMS:", "Call", "Cancel");
  68. }
  69. else
  70. {
  71. new strHead[64];
  72. format(strHead, sizeof(strHead), "{6688FF}SMS to %i", number);
  73. Players[playerid][pPhoneSMS] = number;
  74. Dialog_Show(playerid, PhoneSMStext, DIALOG_STYLE_INPUT, strHead, "Please type your message:", "Send", "Cancel");
  75. }
  76. }
  77. return 1;
  78. }
  79. Dialog:PhoneSMStext(playerid, response, listitem, inputtext[])
  80. {
  81. new text[512];
  82. new number = Players[playerid][pPhoneSMS];
  83. new strHead[64];
  84. if (response)
  85. {
  86. format(strHead, sizeof(strHead), "{6688FF}SMS to %i", number);
  87. if (sscanf(inputtext, "s[512]", text))
  88. {
  89. Dialog_Show(playerid, PhoneSMStext, DIALOG_STYLE_INPUT, strHead, "Please type your message:", "Send", "Cancel");
  90. }
  91. else
  92. {
  93. SendTextMessage(playerid, number, text);
  94. }
  95. }
  96. return 1;
  97. }
  98. Dialog:PhoneCall(playerid, response, listitem, inputtext[])
  99. {
  100. if (response)
  101. {
  102. new number;
  103. if (sscanf(inputtext, "i", number))
  104. {
  105. return Dialog_Show(playerid, PhoneCall, DIALOG_STYLE_INPUT, "{6688FF}Call Number", "Please specify the number you would like to call:", "Call", "Cancel");
  106. }
  107. else if (Players[playerid][pCalling] > 0)
  108. {
  109. return Dialog_Show(playerid, PhoneCall, DIALOG_STYLE_INPUT, "{6688FF}Call Number", "You are already on a call. Use {6688FF}/hangup{FFFFFF} to end it.\n\nPlease specify the number you would like to call:", "Call", "Cancel");
  110. }
  111. else if (Players[playerid][pPhone] == number)
  112. {
  113. return Dialog_Show(playerid, PhoneCall, DIALOG_STYLE_INPUT, "{6688FF}Call Number", "You can't dial your own number.\n\nPlease specify the number you would like to call:", "Call", "Cancel");
  114. }
  115. else if (number < 1)
  116. {
  117. return Dialog_Show(playerid, PhoneCall, DIALOG_STYLE_INPUT, "{6688FF}Call Number", "You have entered an invalid phone number.\n\nPlease specify the number you would like to call:", "Call", "Cancel");
  118. }
  119. else
  120. {
  121. CallNumber(playerid, number);
  122. }
  123. }
  124. return 1;
  125. }
  126. Dialog:PhoneCallPP(playerid, response, listitem, inputtext[])
  127. {
  128. if (response)
  129. {
  130. new number, payphone = GetClosestPayphone(playerid);
  131. if (sscanf(inputtext, "i", number))
  132. {
  133. return Dialog_Show(playerid, PhoneCall, DIALOG_STYLE_INPUT, "{6688FF}Call Number", "Please specify the number you would like to call:", "Call", "Cancel");
  134. }
  135. else if (Players[playerid][pCalling] > 0)
  136. {
  137. return Dialog_Show(playerid, PhoneCall, DIALOG_STYLE_INPUT, "{6688FF}Call Number", "You are already on a call. Use {6688FF}/hangup{FFFFFF} to end it.\n\nPlease specify the number you would like to call:", "Call", "Cancel");
  138. }
  139. else if (Players[playerid][pPhone] == number)
  140. {
  141. return Dialog_Show(playerid, PhoneCall, DIALOG_STYLE_INPUT, "{6688FF}Call Number", "You can't dial your own number.\n\nPlease specify the number you would like to call:", "Call", "Cancel");
  142. }
  143. else if (number < 1)
  144. {
  145. return Dialog_Show(playerid, PhoneCall, DIALOG_STYLE_INPUT, "{6688FF}Call Number", "You have entered an invalid phone number.\n\nPlease specify the number you would like to call:", "Call", "Cancel");
  146. }
  147. else if (IsValidPayphoneID(payphone) && number == Payphones[payphone][phNumber])
  148. {
  149. return Dialog_Show(playerid, PhoneCall, DIALOG_STYLE_INPUT, "{6688FF}Call Number", "You can't call this number as it belongs to this payphone.\n\nPlease specify the number you would like to call:", "Call", "Cancel");
  150. }
  151. else if (IsValidPayphoneID(payphone) && (Payphones[payphone][phOccupied] || Payphones[payphone][phCaller] != INVALID_PLAYER_ID))
  152. {
  153. return Dialog_Show(playerid, PhoneCall, DIALOG_STYLE_INPUT, "{6688FF}Call Number", "This payphone is already in use.\n\nPlease specify the number you would like to call:", "Call", "Cancel");
  154. }
  155. else
  156. {
  157. CallNumber(playerid, number, payphone);
  158. }
  159. }
  160. return 1;
  161. }