Oblivion_UFF

Dialog Validation

Mar 11th, 2020
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.78 KB | None | 0 0
  1. new InDialog[MAX_PAYERS], DListitem[MAX_PLAYERS];
  2.  
  3.  
  4. public OnPlayerConnect(playerid)
  5. {
  6. InDialog[playerid] = 0;
  7. DListitem[playerid] = -1;
  8. return;
  9. }
  10.  
  11. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  12. {
  13. printf("OnDialogResponse: Playerid %i, DialogID: %i, InDialog: %i, Dialog Listitem Selected: %i", playerid,dialogid, InDialog[playerid], DListitem[playerid]);
  14.  
  15. if(dialogid == DIALOG_AUTOSKOLABG)
  16. {
  17. if(!response) return 1;
  18.  
  19. InDialog[playerid] = 1;
  20.  
  21. if(listitem == 0)
  22. {
  23. // Driving Licence
  24. SendClientMessage(playerid,-1,"Zapoceli ste polaganje Vozacke Dozvole, odgovorite tacno na pitanja!");
  25. ShowPlayerDialog(playerid, DIALOG_POLAGANJE1, DIALOG_STYLE_LIST, ""BELA"Kojom stranom se vozi u saobracaju?", ""BELA"Desnom Stranom\nLijevom Stranom\nKako god hocu\n", "Odaberi", "Izlaz");
  26.  
  27.  
  28. NovacMinus(playerid,1000);
  29. }
  30. else if(listitem == 1)
  31. {
  32. // Motor Licence
  33. SendClientMessage(playerid,-1,"Zapoceli ste polaganje Dozvole za motor, odgovorite tacno na pitanja!");
  34. NovacMinus(playerid,1000);
  35. }
  36. else if(listitem == 2)
  37. {
  38. // Airplace Lic
  39. SendClientMessage(playerid,-1,"Zapoceli ste polaganje Dozvole za avion, lokacija za polaganje vam je oznacena na mapi!");
  40. NovacMinus(playerid,1000);
  41. }
  42. else if(listitem == 3)
  43. {
  44. // Boat Lic
  45. SendClientMessage(playerid,-1,"Kupili ste dozvolu za Brod!");
  46. PlayerInfo[playerid][pDozvolaBrod] = 1;
  47. NovacMinus(playerid,15000);
  48. }
  49. return 1;
  50. }
  51.  
  52. if(dialogid == DIALOG_POLAGANJE1)
  53. {
  54. if(!response) return 1;
  55.  
  56. if(DListitem[playerid] == -1)
  57. {
  58. DListitem[playerid] = listitem;
  59. TogglePlayerControllable(playerid, 1);
  60. SetTimerEx("resetfreeze", 4500, false, "i", playerid, InDialog[playerid], DListitem[playerid]);
  61. SendClientMessage(playerid, -1, "Please wait 5 seconds, validating your answer!");
  62. return 1;
  63. }
  64.  
  65. InDialog[playerid] = 2;
  66. if(listitem == 0)
  67. {
  68. SCM(playerid,-1,"Tacan odgovor!");
  69.  
  70. /*
  71. When the traffic light is yellow, what are you going to do? Get out of the vehicle /
  72. Prepare for departure and wait for the green light/ You will only stand with the vehicle
  73. */
  74.  
  75. ShowPlayerDialog(playerid, DIALOG_POLAGANJE2, DIALOG_STYLE_LIST, ""BELA"Kada je na semaforu zuto svjetlo sta cete uraditi?", ""BELA"Izaci iz vozila\nPripremiti se za polazak i sacekati zeleno svjetlo\nSamo cete stajati sa vozilom", "Odaberi", "Izlaz");
  76. }
  77. else if(listitem == 1 || listitem == 2)
  78. {
  79. SCM(playerid,-1,"Pogresan odgovor!");
  80. PlayerInfo[playerid][pAutoSkolaPogresio] += 1;
  81. ShowPlayerDialog(playerid, DIALOG_POLAGANJE2, DIALOG_STYLE_LIST, ""BELA"Kada je na semaforu zuto svjetlo sta cete uraditi?", ""BELA"Izaci iz vozila\nPripremiti se za polazak i sacekati zeleno svjetlo\nSamo cete stajati sa vozilom", "Odaberi", "Izlaz");
  82. }
  83. return 1;
  84. }
  85.  
  86. if(dialogid == DIALOG_POLAGANJE2)
  87. {
  88. if(!response) return 1;
  89.  
  90. if(DListitem[playerid] == -1)
  91. {
  92. DListitem[playerid] = listitem;
  93. TogglePlayerControllable(playerid, 1);
  94. SetTimerEx("resetfreeze", 4500, false, "i", playerid, InDialog[playerid], DListitem[playerid]);
  95. SendClientMessage(playerid, -1, "Please wait 5 seconds, validating your answer!");
  96. return 1;
  97. }
  98.  
  99. InDialog[playerid] = 3;
  100. if(listitem == 0 || listitem == 2)
  101. {
  102. //Wrong answer!
  103. SCM(playerid,-1,"Pogresan odgovor!");
  104. PlayerInfo[playerid][pAutoSkolaPogresio] += 1;
  105.  
  106.  
  107. ShowPlayerDialog(playerid, DIALOG_POLAGANJE3, DIALOG_STYLE_LIST, ""BELA"Kada na raskrsnici dolazi vozilo sa desne strane, sta radite?", ""BELA"Propustitcu ga\nKrenucu prvi jer imam prvenstvo prolaza\nIzaci iz vozila i izlupat mu auto\n", "Odaberi", "Izlaz");
  108. }
  109. else if(listitem == 1)
  110. {
  111. // Correct Answer
  112. SCM(playerid,-1,"Tacan odgovor!");
  113.  
  114. /*
  115. When the vehicle comes to the right at the intersection, what do you do?
  116. I'm going to miss him \ I'll go first because I have a pass priority \ Get out of the car and pull out his car
  117. */
  118.  
  119. ShowPlayerDialog(playerid, DIALOG_POLAGANJE3, DIALOG_STYLE_LIST, ""BELA"Kada na raskrsnici dolazi vozilo sa desne strane, sta radite?", ""BELA"Propustitcu ga\nKrenucu prvi jer imam prvenstvo prolaza\nIzaci iz vozila i izlupat mu auto\n", "Odaberi", "Izlaz");
  120. }
  121. return 1;
  122. }
  123.  
  124. if(dialogid == DIALOG_POLAGANJE3)
  125. {
  126. if(!response) return 1;
  127.  
  128. if(DListitem[playerid] == -1)
  129. {
  130. DListitem[playerid] = listitem;
  131. TogglePlayerControllable(playerid, 1);
  132. SetTimerEx("resetfreeze", 4500, false, "i", playerid, InDialog[playerid], DListitem[playerid]);
  133. SendClientMessage(playerid, -1, "Please wait 5 seconds, validating your answer!");
  134. return 1;
  135. }
  136.  
  137. InDialog[playerid] = 4;
  138. if(listitem == 0)
  139. {
  140. SCM(playerid,-1,"Tacan odgovor!");
  141.  
  142. /* Officer regulates traffic, will you?
  143. You will do what you think you should \ Listen to the officer's orders \ You will not pay attention to the officer
  144. */
  145. ShowPlayerDialog(playerid, DIALOG_POLAGANJE4, DIALOG_STYLE_LIST, ""BELA"Policajac regulise saobracaj, vi cete?", ""BELA"Uradicete kako vi mislite da treba\nPoslusati Naredbe poliacajca\nNecete obracati paznju na policajca", "Odaberi", "Izlaz");
  146. }
  147. else if(listitem == 1 || listitem == 2)
  148. {
  149. SCM(playerid,-1,"Pogresan odgovor!");
  150. PlayerInfo[playerid][pAutoSkolaPogresio] += 1;
  151. ShowPlayerDialog(playerid, DIALOG_POLAGANJE4, DIALOG_STYLE_LIST, ""BELA"Policajac regulise saobracaj, vi cete?", ""BELA"Uradicete kako vi mislite da treba\nPoslusati Naredbe poliacajca\nNecete obracati paznju na policajca", "Odaberi", "Izlaz");
  152. }
  153. return 1;
  154.  
  155. }
  156.  
  157. if(dialogid == DIALOG_POLAGANJE4)
  158. {
  159. if(!response) return 1;
  160.  
  161. if(DListitem[playerid] == -1)
  162. {
  163. DListitem[playerid] = listitem;
  164. TogglePlayerControllable(playerid, 1);
  165. SetTimerEx("resetfreeze", 4500, false, "i", playerid, InDialog[playerid], DListitem[playerid]);
  166. SendClientMessage(playerid, -1, "Please wait 5 seconds, validating your answer!");
  167. return 1;
  168. }
  169.  
  170. InDialog[playerid] = 5;
  171. if(listitem == 0 || listitem == 2)
  172. {
  173. SCM(playerid,-1,"Pogresan odgovor!");
  174. PlayerInfo[playerid][pAutoSkolaPogresio] += 1;
  175. ShowPlayerDialog(playerid, DIALOG_POLAGANJE5, DIALOG_STYLE_LIST, ""BELA"Kada vozac i putnici moraju vezati pojas?", ""BELA"Kada vide policajca\nKada hoce\nUvijek\n", "Odaberi", "Izlaz");
  176. }
  177. else if(listitem == 1)
  178. {
  179. SCM(playerid,-1,"Tacan odgovor!");
  180.  
  181. //When does the driver and passengers have to fasten their seatbelt?
  182. // When they see a cop \ When they want \ Always
  183. ShowPlayerDialog(playerid, DIALOG_POLAGANJE5, DIALOG_STYLE_LIST, ""BELA"Kada vozac i putnici moraju vezati pojas?", ""BELA"Kada vide policajca\nKada hoce\nUvijek\n", "Odaberi", "Izlaz");
  184. }
  185. return 1;
  186. }
  187.  
  188. if(dialogid == DIALOG_POLAGANJE5)
  189. {
  190. if(!response) return 1;
  191. if(DListitem[playerid] == -1)
  192. {
  193. DListitem[playerid] = listitem;
  194. TogglePlayerControllable(playerid, 1);
  195. SetTimerEx("resetfreeze", 4500, false, "i", playerid, InDialog[playerid], DListitem[playerid]);
  196. SendClientMessage(playerid, -1, "Please wait 5 seconds, validating your answer!");
  197. return 1;
  198. }
  199. InDialog[playerid] = 0;
  200. DListitem[playerid] = -1;
  201. if(listitem == 0 || listitem == 1)
  202. {
  203. SCM(playerid,-1,"Pogresan odgovor!");
  204. PlayerInfo[playerid][pAutoSkolaPogresio] += 1;
  205. }
  206. else if(listitem == 2)
  207. {
  208. SCM(playerid,-1,"Tacan odgovor!");
  209. }
  210. ProvjerajemDozvole(playerid);
  211. return 1;
  212. }
  213.  
  214. }
  215.  
  216.  
  217.  
  218. public ProvjerajemDozvole(playerid)
  219. {
  220. if(PlayerInfo[playerid][pAutoSkolaPogresio] >= 1 || PlayerInfo[playerid][pAutoSkolaPogresio] >= 1)
  221. {
  222. new string[256];
  223. format(string, sizeof(string), "Cestitamo, uspjesno ste polozili vozacki ispit\nSada morate ici na poligon, poslije poligona slijedi gradska voznja!\nRezultat: 4/5 tacno odgovorenih pitanja.");
  224. ShowPlayerDialog(playerid,DIALOG_PROVJERATEST, DIALOG_STYLE_MSGBOX, "Best Extreme RolePlay - Server Statistika", string, "Ok", "");
  225. PlayerInfo[playerid][pAutoSkolaPoligon] = 1;
  226. PlayerInfo[playerid][pAutoSkolaPogresio] = 0;
  227. SCM(playerid,-1,"Ulaz za poligon je oznacen crvenim markerom na mapi!");
  228. SetCheckPoint(playerid, -2029.6805,-119.6247,1035.1719, 5.0);
  229. return 1;
  230. }
  231.  
  232. if(PlayerInfo[playerid][pAutoSkolaPogresio] >= 2 || PlayerInfo[playerid][pAutoSkolaPogresio] >= 2)
  233. {
  234. new string[256];
  235. format(string, sizeof(string), "Cestitamo, uspjesno ste polozili vozacki ispit\nSada morate ici na poligon, poslije poligona slijedi gradska voznja!\nRezultat: 3/5 tacno odgovorenih pitanja.");
  236. ShowPlayerDialog(playerid,DIALOG_PROVJERATEST, DIALOG_STYLE_MSGBOX, "Best Extreme RolePlay - Server Statistika", string, "Ok", "");
  237. PlayerInfo[playerid][pAutoSkolaPoligon] = 1;
  238. PlayerInfo[playerid][pAutoSkolaPogresio] = 0;
  239. SCM(playerid,-1,"Ulaz za poligon je oznacen crvenim markerom na mapi!");
  240. SetCheckPoint(playerid, -2029.6805,-119.6247,1035.1719, 5.0);
  241. return 1;
  242. }
  243.  
  244. if(PlayerInfo[playerid][pAutoSkolaPogresio] >= 3 || PlayerInfo[playerid][pAutoSkolaPogresio] >= 3)
  245. {
  246. new string[256];
  247. format(string, sizeof(string), "Pali ste vozacki ispit\nRezultat: 2/5 tacno odgovorenih.");
  248. ShowPlayerDialog(playerid,DIALOG_PROVJERATEST, DIALOG_STYLE_MSGBOX, "Best Extreme RolePlay - Server Statistika", string, "Ok", "");
  249. PlayerInfo[playerid][pAutoSkolaPogresio] = 0;
  250. SetCheckPoint(playerid, -2029.6805,-119.6247,1035.1719, 5.0);
  251. return 1;
  252. }
  253. return 1;
  254. }
  255.  
  256.  
  257. forward resetfreeze(playerid, dialogid, listitem);
  258. public resetfreeze(playerid, dialogid, listitem)
  259. {
  260. printf("ResetFreee: Playerid %i, InDialog: %i, Dialog Listitem Selected: %i", playerid, dialogid, listitem);
  261. if(IsPlayerConnected(playerid)) TogglePlayerControllable(playerid, 0);
  262. switch(dialogid)
  263. {
  264. case 1: OnDialogResponse(playerid, DIALOG_POLAGANJE1, true, listitem, "");
  265. case 2: OnDialogResponse(playerid, DIALOG_POLAGANJE2, true, listitem, "");
  266. case 3: OnDialogResponse(playerid, DIALOG_POLAGANJE3, true, listitem, "");
  267. case 4: OnDialogResponse(playerid, DIALOG_POLAGANJE4, true, listitem, "");
  268. case 5: OnDialogResponse(playerid, DIALOG_POLAGANJE5, true, listitem, "");
  269. }
  270. DListitem[playerid] = -1;
  271. return 1;
  272. }
Advertisement
Add Comment
Please, Sign In to add comment