Guest User

Untitled

a guest
Aug 29th, 2016
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.60 KB | None | 0 0
  1. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  2. {
  3. new sendername[MAX_PLAYER_NAME];
  4. new string[128];
  5.  
  6. // Crash Bug Fix
  7. if(strfind(inputtext, "%", true) != -1)
  8. {
  9. SendClientMessageEx(playerid, COLOR_GREY, "Invalid Character, please try again.");
  10. return 1;
  11. }
  12. if(dialogid == WELCOMEMAT)
  13. {
  14. if(response)
  15. {
  16. SendClientMessage(playerid,0x008000FF, "___PART 1____");
  17. SendClientMessage(playerid,0x008000FF, "Buy a car using your car voucher which is refunded to you.");
  18. CP[playerid] = 1;
  19. SetPlayerCheckpoint(playerid, 1647.2083, -1895.2522 ,13.5527, 3.0);
  20. }
  21. else
  22. {
  23. SendClientMessage(playerid, 0xFF0000FF, "Follow the rules and respect each other. Have a nice stay.");
  24. }
  25. }
  26. if(RegistrationStep[playerid] != 0)
  27. {
  28. if(dialogid == REGISTERSEX)
  29. {
  30. if(response)
  31. {
  32. if(listitem == 0)
  33. {
  34. PlayerInfo[playerid][pSex] = 1;
  35. SendClientMessageEx(playerid, COLOR_YELLOW2, "Alright, so you're a male.");
  36. ShowPlayerDialog(playerid, REGISTERMONTH, DIALOG_STYLE_LIST, "{FF0000}Which month was your character born?", "January\nFebruary\nMarch\nApril\nMay\nJune\nJuly\nAugust\nSeptember\nOctober\nNovember\nDecember", "Submit", "");
  37. RegistrationStep[playerid] = 2;
  38. }
  39. else
  40. {
  41. PlayerInfo[playerid][pSex] = 2;
  42. SendClientMessageEx(playerid, COLOR_YELLOW2, "Alright, so you're a female.");
  43. ShowPlayerDialog(playerid, REGISTERMONTH, DIALOG_STYLE_LIST, "{FF0000}Which month was your character born?", "January\nFebruary\nMarch\nApril\nMay\nJune\nJuly\nAugust\nSeptember\nOctober\nNovember\nDecember", "Submit", "");
  44. RegistrationStep[playerid] = 2;
  45. }
  46. }
  47. else ShowPlayerDialog(playerid, REGISTERSEX, DIALOG_STYLE_LIST, "{FF0000}Is your character male or female?", "Male\nFemale", "Submit", "");
  48. }
  49. }
  50. if(RegistrationStep[playerid] != 0 || strcmp(PlayerInfo[playerid][pBirthDate], "0000-00-00", true) == 0)
  51. {
  52. if(dialogid == REGISTERMONTH)
  53. {
  54. if(response)
  55. {
  56. new month = listitem+1;
  57. SetPVarInt(playerid, "RegisterMonth", month);
  58.  
  59. new lastdate, stringdiag[410];
  60. if(listitem == 0 || listitem == 2 || listitem == 4 || listitem == 6 || listitem == 7 || listitem == 9 || listitem == 11) lastdate = 32;
  61. else if(listitem == 3 || listitem == 5 || listitem == 8 || listitem == 10) lastdate = 31;
  62. else lastdate = 29;
  63. for(new x = 1; x < lastdate; x++)
  64. {
  65. format(stringdiag, sizeof(stringdiag), "%s%d\n", stringdiag, x);
  66. }
  67. ShowPlayerDialog(playerid, REGISTERDAY, DIALOG_STYLE_LIST, "{FF0000}Which day was your character born?", stringdiag, "Submit", "");
  68. }
  69. else ShowPlayerDialog(playerid, REGISTERMONTH, DIALOG_STYLE_LIST, "{FF0000}Which month was your character born?", "January\nFebruary\nMarch\nApril\nMay\nJune\nJuly\nAugust\nSeptember\nOctober\nNovember\nDecember", "Submit", "");
  70. }
  71. else if(dialogid == REGISTERDAY)
  72. {
  73. if(response)
  74. {
  75. new setday = listitem+1;
  76. SetPVarInt(playerid, "RegisterDay", setday);
  77.  
  78. new month, day, year, stringdiag[600];
  79. getdate(year,month,day);
  80. new startyear = year-100;
  81. for(new x = startyear; x < year; x++)
  82. {
  83. format(stringdiag, sizeof(stringdiag), "%s%d\n", stringdiag, x);
  84. }
  85. ShowPlayerDialog(playerid, REGISTERYEAR, DIALOG_STYLE_LIST, "{FF0000}Which year was your character born?", stringdiag, "Submit", "");
  86. }
  87. else ShowPlayerDialog(playerid, REGISTERMONTH, DIALOG_STYLE_LIST, "{FF0000}Which month was your character born?", "January\nFebruary\nMarch\nApril\nMay\nJune\nJuly\nAugust\nSeptember\nOctober\nNovember\nDecember", "Submit", "");
  88. }
  89. else if(dialogid == REGISTERYEAR)
  90. {
  91. new month, day, year, stringdiag[600];
  92. getdate(year,month,day);
  93. new startyear = year-100;
  94. if(response)
  95. {
  96. new setyear = listitem+startyear;
  97. format(PlayerInfo[playerid][pBirthDate], 11, "%d-%02d-%02d", setyear, GetPVarInt(playerid, "RegisterMonth"), GetPVarInt(playerid, "RegisterDay"));
  98. DeletePVar(playerid, "RegisterMonth");
  99. DeletePVar(playerid, "RegisterDay");
  100. if(RegistrationStep[playerid] != 0)
  101. {
  102. ShowPlayerDialog(playerid, REGISTERREF, DIALOG_STYLE_INPUT, "{FF0000}Referral System", "Have you been referred to our server by one of our players?\nIf so, please enter the player name below.\n\nIf you haven't been referred by anyone, you may press the skip button.\n\n{FF0000}Note: You must enter the player name with a underscore (Example: FirstName_LastName)", "Enter", "Skip");
  103. }
  104. else return SendClientMessageEx(playerid, COLOR_LIGHTRED, "Your birthdate has been successfully set.");
  105. }
  106. else
  107. {
  108. for(new x = startyear; x < year; x++)
  109. {
  110. format(stringdiag, sizeof(stringdiag), "%s%d\n", stringdiag, x);
  111. }
  112. ShowPlayerDialog(playerid, REGISTERYEAR, DIALOG_STYLE_LIST, "{FF0000}Which year was your character born?", stringdiag, "Submit", "");
  113. }
  114. }
  115. else if(dialogid == REGISTERREF)
  116. {
  117. if(response)
  118. {
  119. if(IsNumeric(inputtext))
  120. {
  121. ShowPlayerDialog(playerid, REGISTERREF, DIALOG_STYLE_INPUT, "{FF0000}Error - Invalid Roleplay Name", "That is not a roleplay name\nPlease enter a proper roleplay name.\n\nExample: FirstName_LastName", "Enter", "Skip");
  122. return 1;
  123. }
  124. if(strfind(inputtext, "_", true) == -1)
  125. {
  126. ShowPlayerDialog(playerid, REGISTERREF, DIALOG_STYLE_INPUT, "{FF0000}Error - Invalid Roleplay Name", "That is not a roleplay name\nPlease enter a proper roleplay name.\n\nExample: FirstName_LastName", "Enter", "Skip");
  127. return 1;
  128. }
  129. if(strlen(inputtext) > 20)
  130. {
  131. ShowPlayerDialog(playerid, REGISTERREF, DIALOG_STYLE_INPUT, "{FF0000}Error - Invalid Roleplay Name", "That name is too long\nPlease shorten the name.\n\nExample: FirstName_LastName (20 Characters Max)", "Enter", "Skip");
  132. return 1;
  133. }
  134. if(strcmp(inputtext, GetPlayerNameExt(playerid), true) == 0)
  135. {
  136. ShowPlayerDialog(playerid, REGISTERREF, DIALOG_STYLE_INPUT, "{FF0000}Error", "You can't add yourself as a referrer.\nPlease enter the referrer name or press 'Skip'.\n\nExample: FirstName_LastName (20 Characters Max)", "Enter", "Skip");
  137. return 1;
  138. }
  139. for(new sz = 0; sz < strlen(inputtext); sz++)
  140. {
  141. if(inputtext[sz] == ' ')
  142. {
  143. ShowPlayerDialog(playerid, REGISTERREF, DIALOG_STYLE_INPUT, "{FF0000}Error - Invalid Roleplay Name", "That is not a roleplay name\nPlease enter a proper roleplay name.\n\nExample: FirstName_LastName", "Enter", "Skip");
  144. return 1;
  145. }
  146. }
  147.  
  148. new
  149. szQuery[128], szEscape[MAX_PLAYER_NAME];
  150.  
  151. mysql_escape_string(inputtext, szEscape);
  152.  
  153. format(PlayerInfo[playerid][pReferredBy], MAX_PLAYER_NAME, "%s", szEscape);
  154.  
  155. format(szQuery, sizeof(szQuery), "SELECT `Username` FROM `accounts` WHERE `Username` = '%s'", szEscape);
  156. mysql_function_query(MainPipeline, szQuery, true, "OnQueryFinish", "iii", MAIN_REFERRAL_THREAD, playerid, g_arrQueryHandle{playerid});
  157. }
  158. else {
  159. format(string, sizeof(string), "Nobody");
  160. strmid(PlayerInfo[playerid][pReferredBy], string, 0, strlen(string), MAX_PLAYER_NAME);
  161. SendClientMessageEx(playerid, COLOR_LIGHTRED, "Thanks for filling in all the information, now you can proceed to the tutorial!");
  162. RegistrationStep[playerid] = 3;
  163. SetPlayerVirtualWorld(playerid, 0);
  164. ClearChatbox(playerid);
  165. TutStep[playerid] = 24;
  166. TextDrawShowForPlayer(playerid, txtNationSelHelper);
  167. TextDrawShowForPlayer(playerid, txtNationSelMain);
  168. PlayerNationSelection[playerid] = -1;
  169.  
  170. // Streamer_UpdateEx(playerid, 1607.0160,-1510.8218,207.4438);
  171. // SetPlayerPos(playerid, 1607.0160,-1510.8218,-10.0);
  172. // SetPlayerCameraPos(playerid, 1850.1813,-1765.7552,81.9271);
  173. // SetPlayerCameraLookAt(playerid, 1607.0160,-1510.8218,207.4438);
  174. SetPlayerVirtualWorld(playerid, 0);
  175. SetPlayerInterior(playerid, 0);
  176. Streamer_UpdateEx(playerid,1716.1129,-1880.0715,22.0264);
  177. SetPlayerPos(playerid,1716.1129,-1880.0715,-10.0);
  178. SetPlayerCameraPos(playerid,1755.0413,-1824.8710,20.2100);
  179. SetPlayerCameraLookAt(playerid,1716.1129,-1880.0715,22.0264);
  180. return 1;
  181.  
  182. }
  183. }
  184. }
  185. switch(dialogid)
  186. {
  187. // BEGIN DYNAMIC GROUP CODE
  188. case G_LOCKER_MAIN: if(response)
  189. {
  190. new iGroupID = PlayerInfo[playerid][pMember];
  191. switch(listitem)
  192. {
  193. case 0:
  194. {
  195. if(PlayerInfo[playerid][pDuty]==0)
  196. {
  197. if (IsAReporter(playerid) || IsATaxiDriver(playerid))
  198. format(string, sizeof(string), "* %s %s takes a badge from their locker.", arrGroupRanks[iGroupID][PlayerInfo[playerid][pRank]], GetPlayerNameEx(playerid));
  199. else
  200. format(string, sizeof(string), "* %s %s takes a badge and a gun from their locker.", arrGroupRanks[iGroupID][PlayerInfo[playerid][pRank]], GetPlayerNameEx(playerid));
  201.  
  202. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  203. SetPlayerHealth(playerid, 100.0);
  204. if(IsAMedic(playerid))
  205. {
  206. Medics += 1;
  207. }
  208. if(arrGroupData[iGroupID][g_iLockerStock] > 1 && arrGroupData[iGroupID][g_iLockerCostType] == 0)
  209. {
  210. SetPlayerArmor(playerid, 100);
  211. arrGroupData[iGroupID][g_iLockerStock] -= 1;
  212. new str[128], file[32];
  213. format(str, sizeof(str), "%s took a vest out of the %s locker at a cost of 1 HG Material.", GetPlayerNameEx(playerid), arrGroupData[iGroupID][g_szGroupName]);
  214. new month, day, year;
  215. getdate(year,month,day);
  216. format(file, sizeof(file), "grouppay/%d/%d-%d-%d.log", iGroupID, month, day, year);
  217. Log(file, str);
  218. }
  219. else if(arrGroupData[iGroupID][g_iLockerCostType] != 0)
  220. {
  221. SetPlayerArmor(playerid, 100.0);
  222. }
  223. else
  224. {
  225. SendClientMessageEx(playerid, COLOR_RED, "The locker doesn't have the stock for your armor vest.");
  226. SendClientMessageEx(playerid, COLOR_GRAD2, "Contact your supervisor or the SAAS and organize a crate delivery.");
  227. }
  228. PlayerInfo[playerid][pDuty] = 1;
  229. SetPlayerToTeamColor(playerid);
  230. SendClientMessageEx(playerid, COLOR_GRAD2, "You may now select your weapons from the equipment locker");
  231. }
  232. else if(PlayerInfo[playerid][pDuty]==1)
  233. {
  234. format(string, sizeof(string), "* %s %s places their badge and gun in their locker.", arrGroupRanks[iGroupID][PlayerInfo[playerid][pRank]], GetPlayerNameEx(playerid));
  235. ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
  236. if(IsAMedic(playerid))
  237. {
  238. Medics -= 1;
  239. }
  240. SetPlayerHealth(playerid, 100.0);
  241. RemoveArmor(playerid);
  242. PlayerInfo[playerid][pDuty] = 0;
  243. SetPlayerToTeamColor(playerid);
  244. }
  245. }
  246. case 1:
  247. {
  248. new
  249. szDialog[(32 + 8) * (MAX_GROUP_WEAPONS+1)];
  250.  
  251. for(new i = 0; i != MAX_GROUP_WEAPONS; ++i) {
  252. if(arrGroupData[iGroupID][g_iLockerGuns][i]) {
  253. format(szDialog, sizeof szDialog, "%s\n(%i) %s", szDialog, arrGroupData[iGroupID][g_iLockerGuns][i], Weapon_ReturnName(arrGroupData[iGroupID][g_iLockerGuns][i]));
  254. if (arrGroupData[iGroupID][g_iLockerCostType] == 2) format(szDialog, sizeof szDialog, "%s $%d", szDialog, arrGroupData[iGroupID][g_iLockerCost][i]);
  255. }
  256. else strcat(szDialog, "\n(empty)");
  257. }
  258. strcat(szDialog, "\nAccessories");
  259. format(string, sizeof(string), "%s Weapon Locker", arrGroupData[iGroupID][g_szGroupName]);
  260. ShowPlayerDialog(playerid, G_LOCKER_EQUIPMENT, DIALOG_STYLE_LIST, string, szDialog, "Purchase", "Cancel");
  261.  
  262. }
  263. case 2:
  264. {
  265. ShowPlayerDialog(playerid, G_LOCKER_UNIFORM, DIALOG_STYLE_INPUT, "Uniform","Choose a skin (by ID).", "Select", "Cancel");
  266. }
  267. case 3:
  268. {
  269. ShowPlayerDialog(playerid, G_LOCKER_CLEARSUSPECT,DIALOG_STYLE_INPUT, arrGroupData[iGroupID][g_szGroupName]," Who would you like to clear?","Clear","Return");
  270. }
  271. case 4: // LEOs - HP + Armour
  272. {
  273. if(arrGroupData[iGroupID][g_iLockerStock] > 1 && arrGroupData[iGroupID][g_iLockerCostType] == 0)
  274. {
  275. SetPlayerArmor(playerid, 100);
  276. SetPlayerHealth(playerid, 100.0);
  277. arrGroupData[iGroupID][g_iLockerStock] -= 1;
  278. new str[128], file[32];
  279. format(str, sizeof(str), "%s took a vest out of the %s locker at a cost of 1 HG Material.", GetPlayerNameEx(playerid), arrGroupData[iGroupID][g_szGroupName]);
  280. new month, day, year;
  281. getdate(year,month,day);
  282. format(file, sizeof(file), "grouppay/%d/%d-%d-%d.log", iGroupID, month, day, year);
  283. Log(file, str);
  284. }
  285. else if(arrGroupData[iGroupID][g_iLockerCostType] == 1)
  286. {
  287. if(arrGroupData[iGroupID][g_iBudget] > 2500)
  288. {
  289. SetPlayerArmor(playerid, 100);
  290. SetPlayerHealth(playerid, 100.0);
  291. arrGroupData[iGroupID][g_iBudget] -= 2500;
  292. new str[128], file[32];
  293. format(str, sizeof(str), "%s took a vest out of the %s locker at a cost of $2,500.", GetPlayerNameEx(playerid), arrGroupData[iGroupID][g_szGroupName]);
  294. new month, day, year;
  295. getdate(year,month,day);
  296. format(file, sizeof(file), "grouppay/%d/%d-%d-%d.log", iGroupID, month, day, year);
  297. Log(file, str);
  298. }
  299. else return SendClientMessageEx(playerid, COLOR_GRAD2, " Your agency cannot afford the vest. ($2,500)");
  300. }
  301. else if(arrGroupData[iGroupID][g_iLockerCostType] == 2)
  302. {
  303. if(GetPlayerCash(playerid) > 2500)
  304. {
  305. SetPlayerArmor(playerid, 100);
  306. SetPlayerHealth(playerid, 100.0);
  307. GivePlayerCash(playerid, -2500);
  308. new str[128], file[32];
  309. format(str, sizeof(str), "%s took a vest out of the %s locker at a personal cost of $2,500.", GetPlayerNameEx(playerid), arrGroupData[iGroupID][g_szGroupName]);
  310. new month, day, year;
  311. getdate(year,month,day);
  312. format(file, sizeof(file), "grouppay/%d/%d-%d-%d.log", iGroupID, month, day, year);
  313. Log(file, str);
  314. }
  315. else return SendClientMessageEx(playerid, COLOR_GRAD2, " You cannot afford the vest. ($2,500)");
  316. }
  317. else
  318. {
  319. SendClientMessageEx(playerid, COLOR_RED, "The locker doesn't have the stock for your armor vest.");
  320. SendClientMessageEx(playerid, COLOR_GRAD2, "Contact your supervisor or the SAAS and organize a crate delivery.");
  321. }
  322. }
Add Comment
Please, Sign In to add comment