GammixSAMP

dialogs.inc R2 BETA - Description labels version - By Gammix

May 30th, 2015
494
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 33.30 KB | None | 0 0
  1. /*
  2. Dialogs Include (dialogs2.inc) - Description label version
  3. * New dialog functions and NEW Model-Preview dialog, now within SAMP "ShowPlayerDialog", a new style!
  4. * Just add a new style: DIALOG_STYLE_PREVMODEL
  5. * The output size will be quiet large because the code uses 3D array (gPlayerListDesc[MAX_PLAYERS][MAX_DIALOG_MODELS][MAX_DIALOG_DESC_LENGTH]) and theres no way i can prevent this!
  6. * This version supports both PREVMODEL (without description) and PREVMODEL_DESC!
  7.  
  8. Author: (creator)
  9. * Gammix
  10. * Y_Less - ceildiv macro, and connection check suggest
  11.  
  12. (c) Copyright 2015
  13. * This file is provided as is (no warranties).
  14. */
  15.  
  16. /*
  17. FUNCTIONS:
  18. native ShowPlayerDialog(playerid, dialogid, style, caption[], info[], button1[], button2[] = "", infosize = sizeof(info));
  19. native HidePlayerDialog(playerid);
  20. native GetPlayerDialogID(playerid);
  21. native GetPlayerDialogStyle(playerid);
  22. native SetupPrevModelDialog(Float:mx, Float:my, Float:mz, Float:mzoom = 1.0, mbgcolor = 0x4A5A6BFF, hovercolor = 0x8B0000FF, selectcolor = 0x8B0000FF);
  23. native ShowPlayerPrevModelDialog(playerid, dialogid, caption[], info[], desc[][MAX_DIALOG_DESC_LENGTH], button1[], button2[] = "", infosize = sizeof(info), descsize = sizeof(desc));
  24.  
  25. CALLBACKS:
  26. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]);
  27. */
  28.  
  29. #if !defined INVALID_DIALOG_ID
  30. #define INVALID_DIALOG_ID -1//make sure the INVALID_DIALOG_ID is '-1' only!
  31. #endif
  32.  
  33. #define MAX_DIALOG_MODELS 300//maximum number of listitems a PREVIEW MODEL Dialog can have
  34.  
  35. #define MAX_DIALOG_DESC_LENGTH 15//maximum string length of a model's description
  36.  
  37. #define DIALOG_STYLE_PREVMODEL 6//the new dialog style id, you may change if not suitable or for future usage! This may effect HidePlayerDialog.
  38. #define DIALOG_STYLE_PREVMODEL_DESC 7//the new dialog style id (description one), you may change if not suitable or for future usage! This may effect HidePlayerDialog.
  39.  
  40. #define MODELS_PER_LINE 6//Max models that can be displayed in a line
  41.  
  42. #define MODELS_PER_PAGE MODELS_PER_LINE * 3//Max models that can be displayed in a page
  43.  
  44. //Dialog Textdraws
  45. static PlayerText:gPlayerButtonsTD[MAX_PLAYERS][2];
  46. static PlayerText:gPlayerHeaderTD[MAX_PLAYERS];
  47. static PlayerText:gPlayerPageTD[MAX_PLAYERS];
  48. static PlayerText:gPlayerModelTD[MAX_PLAYERS][MODELS_PER_PAGE];
  49. static PlayerText:gPlayerModelDescTD[MAX_PLAYERS][MODELS_PER_PAGE];
  50. //
  51. static Text:gBackgroundTD;
  52. static Text:gContentBoxTD[2];
  53. static Text:gButtonsTD[14];
  54.  
  55. static gPlayerList[MAX_PLAYERS][MAX_DIALOG_MODELS];
  56. static gPlayerListDesc[MAX_PLAYERS][MAX_DIALOG_MODELS][MAX_DIALOG_DESC_LENGTH];
  57. static gPlayerTotalModels[MAX_PLAYERS];
  58. static gPlayerTotalModelsDesc[MAX_PLAYERS];
  59.  
  60. enum DialogEnum
  61. {
  62. E_DIALOG_ID,
  63. E_DIALOG_TYPE,
  64. E_DIALOG_PAGE,
  65. E_DIALOG_SELECTED_ITEM,
  66. E_DIALOG_CLICK_TICK,
  67. E_DIALOG_HIDE_TIMER
  68. }
  69. static gPlayerDialog[MAX_PLAYERS][DialogEnum];
  70.  
  71. enum SetupDialogEnum
  72. {
  73. Float:E_MODEL_X,
  74. Float:E_MODEL_Y,
  75. Float:E_MODEL_Z,
  76. Float:E_MODEL_ZOOM,
  77. E_MODEL_BACKGROUND_COLOR,
  78. E_MODEL_HOVER_COLOR,
  79. E_MODEL_SELECT_COLOR
  80. }
  81. static gSetupDialog[SetupDialogEnum];
  82.  
  83. stock GetPlayerDialogID(playerid)
  84. {
  85. if(! IsPlayerConnected(playerid)) return false;
  86. return gPlayerDialog[playerid][E_DIALOG_ID];
  87. }
  88.  
  89. stock GetPlayerDialogStyle(playerid)
  90. {
  91. if(! IsPlayerConnected(playerid)) return false;
  92. return gPlayerDialog[playerid][E_DIALOG_TYPE];
  93. }
  94.  
  95. stock SetupPrevModelDialog(Float:mx, Float:my, Float:mz, Float:mzoom = 1.0, mbgcolor = 0x00FFFF10, hovercolor = 0x8B0000FF, selectcolor = 0x8B0000FF)
  96. {
  97. gSetupDialog[E_MODEL_X] = mx;
  98. gSetupDialog[E_MODEL_Y] = my;
  99. gSetupDialog[E_MODEL_Z] = mz;
  100. gSetupDialog[E_MODEL_ZOOM] = mzoom;
  101. gSetupDialog[E_MODEL_BACKGROUND_COLOR] = mbgcolor;
  102. gSetupDialog[E_MODEL_HOVER_COLOR] = hovercolor;
  103. gSetupDialog[E_MODEL_SELECT_COLOR] = selectcolor;
  104. return true;
  105. }
  106.  
  107. #define ceildiv(%0,%1) (((%0)-1)/(%1)+1)//thansk to Y_Less
  108. Dialog_TotalPages(playerid)
  109. {
  110. if(! IsPlayerConnected(playerid)) return false;
  111. return ceildiv(gPlayerTotalModels[playerid], MODELS_PER_PAGE);
  112. }
  113.  
  114. //----Internal functions
  115.  
  116. static Text:Dialog_TextDrawAdd(Float:posX, Float:posY, string[], bgcolor, font, Float:lettersizeX, Float:lettersizeY, textcolor, allign = 0, outline = 1, bool:proportional = true, shadow = 1, bool:usebox = false, boxcolor = 0, Float:textsizeX = -1.0, Float:textsizeY = -1.0, model = 0, Float:rotX = 0.0, Float:rotY = 0.0, Float:rotZ = 0.0, Float:zoom = 1.0)
  117. {
  118. static Text:gTextDraw;
  119. gTextDraw = TextDrawCreate(posX, posY, string);
  120. TextDrawBackgroundColor(gTextDraw, bgcolor);
  121. TextDrawFont(gTextDraw, font);
  122. TextDrawLetterSize(gTextDraw, lettersizeX, lettersizeY);
  123. TextDrawColor(gTextDraw, textcolor);
  124. TextDrawAlignment(gTextDraw, allign);
  125. TextDrawSetOutline(gTextDraw, outline);
  126. TextDrawSetProportional(gTextDraw, proportional);
  127. TextDrawSetShadow(gTextDraw, shadow);
  128. TextDrawUseBox(gTextDraw, usebox);
  129. if(usebox) TextDrawBoxColor(gTextDraw, boxcolor);
  130. if(textsizeX != -1.0 && textsizeY != -1.0) TextDrawTextSize(gTextDraw, textsizeX, textsizeY);
  131. if(font == 5)
  132. {
  133. TextDrawSetPreviewModel(gTextDraw, model);
  134. TextDrawSetPreviewRot(gTextDraw, rotX, rotY, rotZ, zoom);
  135. }
  136. return gTextDraw;
  137. }
  138.  
  139. static PlayerText:Dialog_PlayerTextDrawAdd(playerid, Float:posX, Float:posY, string[], bgcolor, font, Float:lettersizeX, Float:lettersizeY, textcolor, allign = 0, outline = 1, bool:proportional = true, shadow = 1, bool:usebox = false, boxcolor = 0, Float:textsizeX = -1.0, Float:textsizeY = -1.0, model = 0, Float:rotX = 0.0, Float:rotY = 0.0, Float:rotZ = 0.0, Float:zoom = 1.0, selectable = 0)
  140. {
  141. static PlayerText:gTextDraw;
  142. gTextDraw = CreatePlayerTextDraw(playerid, posX, posY, string);
  143. PlayerTextDrawBackgroundColor(playerid, gTextDraw, bgcolor);
  144. PlayerTextDrawFont(playerid, gTextDraw, font);
  145. PlayerTextDrawLetterSize(playerid, gTextDraw, lettersizeX, lettersizeY);
  146. PlayerTextDrawColor(playerid, gTextDraw, textcolor);
  147. PlayerTextDrawAlignment(playerid, gTextDraw, allign);
  148. PlayerTextDrawSetOutline(playerid, gTextDraw, outline);
  149. PlayerTextDrawSetProportional(playerid, gTextDraw, proportional);
  150. PlayerTextDrawSetShadow(playerid, gTextDraw, shadow);
  151. PlayerTextDrawUseBox(playerid, gTextDraw, usebox);
  152. if(usebox) PlayerTextDrawBoxColor(playerid, gTextDraw, boxcolor);
  153. if(textsizeX != -1.0 && textsizeY != -1.0) PlayerTextDrawTextSize(playerid, gTextDraw, textsizeX, textsizeY);
  154. if(font == 5)
  155. {
  156. PlayerTextDrawSetPreviewModel(playerid, gTextDraw, model);
  157. PlayerTextDrawSetPreviewRot(playerid, gTextDraw, rotX, rotY, rotZ, zoom);
  158. }
  159. PlayerTextDrawSetSelectable(playerid, gTextDraw, selectable);
  160. return gTextDraw;
  161. }
  162.  
  163. static Dialog_isnumeric(str[])
  164. {
  165. new ch, i;
  166. while ((ch = str[i++])) if (!('0' <= ch <= '9')) return false;
  167. return true;
  168. }
  169.  
  170. static Dialog_CreateGlobalTD()
  171. {
  172. gBackgroundTD = Dialog_TextDrawAdd(132.000000, 123.000000, "BACKGROUND", 255, 1, 0.000000, 25.000000, -1, 0, false, true, 0, true, 150, 500.000000, 0.000000);
  173. gContentBoxTD[0] = Dialog_TextDrawAdd(137.000000, 131.000000, "BOX", 255, 1, 0.000000, 20.900007, -156, 0, false, true, 0, true, -156, 493.000000, 0.000000);
  174. gContentBoxTD[1] = Dialog_TextDrawAdd(138.000000, 132.000000, "BOX", 255, 1, 0.000000, 20.700010, -1, 0, false, true, 0, true, 230, 492.000000, 0.000000);
  175. return true;
  176. }
  177.  
  178. static Dialog_DestroyGlobalTD()
  179. {
  180. TextDrawHideForAll(gBackgroundTD);
  181. TextDrawDestroy(gBackgroundTD);
  182. TextDrawHideForAll(gContentBoxTD[0]);
  183. TextDrawDestroy(gContentBoxTD[0]);
  184. TextDrawHideForAll(gContentBoxTD[1]);
  185. TextDrawDestroy(gContentBoxTD[1]);
  186. return true;
  187. }
  188.  
  189. static Dialog_CreateGlobalButtonsTD()
  190. {
  191. gButtonsTD[0] = Dialog_TextDrawAdd(200.000000, 329.000000, "BUTTON1", 255, 1, 0.000000, 1.300007, -1, 0, false, true, 0, true, -156, 256.000000, 27.000000);
  192. gButtonsTD[1] = Dialog_TextDrawAdd(197.000000, 328.000000, "LD_OTB2:butnA", 255, 4, 0.000000, 1.300008, 255, 0, false, true, 0, true, 255, 63.000000, 18.000000, 0, 0.0, 0.0, 0.0, 1);
  193. TextDrawSetSelectable(gButtonsTD[1], 1);//i have to do this seperately, idk why its not set to selectable when in the funcion Dialog_TextDrawAdd. Though it works in the case of player texts!
  194. gButtonsTD[2] = Dialog_TextDrawAdd(194.000000, 322.000000, "( )", 255, 1, 0.389999, 2.299999, -131, 0, false, true, 0, false);
  195.  
  196. gButtonsTD[3] = Dialog_TextDrawAdd(284.000000, 329.000000, "BUTTON2", 255, 1, 0.000000, 1.300007, -1, 0, false, true, 0, true, -156, 340.000000, 27.000000);
  197. gButtonsTD[4] = Dialog_TextDrawAdd(280.000000, 328.000000, "LD_OTB2:butnA", 255, 4, 0.000000, 1.300008, 255, 0, false, true, 0, true, 255, 65.000000, 18.000000, 0, 0.0, 0.0, 0.0, 1);
  198. TextDrawSetSelectable(gButtonsTD[4], 1);
  199. gButtonsTD[5] = Dialog_TextDrawAdd(278.000000, 322.000000, "( )", 255, 1, 0.389999, 2.299999, -131, 0, false, true, 0, false);
  200.  
  201. gButtonsTD[6] = Dialog_TextDrawAdd(371.000000, 329.000000, "BUTTON3", 255, 1, 0.000000, 1.300007, -1, 0, false, true, 0, true, -156, 386.000000, 27.000000);
  202. gButtonsTD[7] = Dialog_TextDrawAdd(367.000000, 328.000000, "LD_OTB2:butnA", 255, 4, 0.000000, 1.300008, 255, 0, false, true, 0, true, 255, 23.000000, 18.000000, 0, 0.0, 0.0, 0.0, 1);
  203. TextDrawSetSelectable(gButtonsTD[7], 1);
  204. gButtonsTD[8] = Dialog_TextDrawAdd(365.000000, 322.000000, "( )", 255, 1, 0.389999, 2.299999, -131, 0, false, true, 0, false);
  205. gButtonsTD[9] = Dialog_TextDrawAdd(378.000000, 328.000000, "<", 0, 1, 0.269999, 1.299999, -56, 2, false, true, 0, false);
  206.  
  207. gButtonsTD[10] = Dialog_TextDrawAdd(402.000000, 329.000000, "BUTTON4", 255, 1, 0.000000, 1.300007, -1, 0, false, true, 0, true, -156, 417.000000, 27.000000);
  208. gButtonsTD[11] = Dialog_TextDrawAdd(399.000000, 328.000000, "LD_OTB2:butnA", 255, 4, 0.000000, 1.300008, 255, 0, false, true, 0, true, 255, 21.000000, 18.000000, 0, 0.0, 0.0, 0.0, 1);
  209. TextDrawSetSelectable(gButtonsTD[11], 1);
  210. gButtonsTD[12] = Dialog_TextDrawAdd(396.000000, 322.000000, "( )", 255, 1, 0.389999, 2.299999, -131, 0, false, true, 0, false);
  211. gButtonsTD[13] = Dialog_TextDrawAdd(410.000000, 328.000000, ">", 0, 1, 0.269999, 1.299999, -56, 2, false, true, 0, false);
  212. return true;
  213. }
  214.  
  215. static Dialog_DestroyGlobalButtonsTD()
  216. {
  217. for(new i; i != 14;i++)
  218. {
  219. TextDrawHideForAll(gButtonsTD[i]);
  220. TextDrawDestroy(gButtonsTD[i]);
  221. }
  222. return true;
  223. }
  224.  
  225. static Dialog_Update(playerid, selected = 0, bool:desc = false)
  226. {
  227. new Float:BASE_X = 140.0;
  228. new Float:BASE_Y = 132.0;
  229. new bgcolor = 0;
  230. new switch_line = 0;
  231. new current_items = ((gPlayerDialog[playerid][E_DIALOG_PAGE]) * MODELS_PER_PAGE);
  232.  
  233. //destroy model player:textdraws
  234.  
  235. for(new i; i != MODELS_PER_PAGE; i++)
  236. {
  237. if(gPlayerModelTD[playerid][i] != PlayerText:INVALID_TEXT_DRAW)
  238. {
  239. PlayerTextDrawHide(playerid, gPlayerModelTD[playerid][i]);
  240. PlayerTextDrawDestroy(playerid, gPlayerModelTD[playerid][i]);
  241. gPlayerModelTD[playerid][i] = PlayerText:INVALID_TEXT_DRAW;
  242. }
  243. if(gPlayerModelDescTD[playerid][i] != PlayerText:INVALID_TEXT_DRAW)
  244. {
  245. PlayerTextDrawHide(playerid, gPlayerModelDescTD[playerid][i]);
  246. PlayerTextDrawDestroy(playerid, gPlayerModelDescTD[playerid][i]);
  247. gPlayerModelDescTD[playerid][i] = PlayerText:INVALID_TEXT_DRAW;
  248. }
  249. }
  250.  
  251. for(new i; i != MODELS_PER_PAGE; i++)
  252. {
  253. if(current_items >= (gPlayerTotalModels[playerid])) break;
  254.  
  255. if(i == selected)
  256. {
  257. gPlayerDialog[playerid][E_DIALOG_SELECTED_ITEM] = current_items;
  258. bgcolor = gSetupDialog[E_MODEL_SELECT_COLOR];
  259. }
  260. else bgcolor = gSetupDialog[E_MODEL_BACKGROUND_COLOR];
  261.  
  262. gPlayerModelTD[playerid][i] = Dialog_PlayerTextDrawAdd(playerid, BASE_X, BASE_Y, "model", bgcolor, 5, 0.500000, 1.000000, -1, 0, false, true, 0, true, 0, 56.000000, 61.000000, gPlayerList[playerid][current_items], gSetupDialog[E_MODEL_X], gSetupDialog[E_MODEL_Y], gSetupDialog[E_MODEL_Z], gSetupDialog[E_MODEL_ZOOM], true);
  263. PlayerTextDrawShow(playerid, gPlayerModelTD[playerid][i]);
  264.  
  265. if(desc)
  266. {
  267. if(current_items < (gPlayerTotalModelsDesc[playerid]))
  268. {
  269. if(strlen(gPlayerListDesc[playerid][current_items]) > 0)
  270. {
  271. gPlayerModelDescTD[playerid][i] = Dialog_PlayerTextDrawAdd(playerid, (BASE_X + 2), (BASE_Y + 48), gPlayerListDesc[playerid][current_items], 255, 1, 0.230000, 1.100000, -1, 1);
  272. PlayerTextDrawShow(playerid, gPlayerModelDescTD[playerid][i]);
  273. }
  274. }
  275. }
  276.  
  277. BASE_X += 57.0;
  278. switch_line += 1;
  279. if(switch_line == MODELS_PER_LINE)
  280. {
  281. switch_line = 0;
  282. BASE_Y += 62.0;
  283. BASE_X = 140.0;
  284. }
  285. current_items += 1;
  286. }
  287. return true;
  288. }
  289.  
  290. static Dialog_UpdatePage(playerid)
  291. {
  292. new string[10];
  293. if( GetPlayerDialogStyle(playerid) == DIALOG_STYLE_PREVMODEL ||
  294. GetPlayerDialogStyle(playerid) == DIALOG_STYLE_PREVMODEL_DESC)
  295. {
  296. format(string, sizeof(string), "%d/%d", (gPlayerDialog[playerid][E_DIALOG_PAGE] + 1), Dialog_TotalPages(playerid));
  297. PlayerTextDrawSetString(playerid, gPlayerPageTD[playerid], string);
  298. }
  299. return true;
  300. }
  301.  
  302. //Note: if you use this in a filterscript, please define "FILTERSCRIPT" in your script
  303. #if defined FILTERSCRIPT// if used in a filterscript
  304.  
  305. public OnFilterScriptInit()
  306. {
  307. Dialog_CreateGlobalTD();
  308. Dialog_CreateGlobalButtonsTD();
  309.  
  310. SetupPrevModelDialog(0.0, 0.0, 0.0);
  311.  
  312. #if defined Dialog_OnFilterScriptInit
  313. return Dialog_OnFilterScriptInit();
  314. #else
  315. return 1;
  316. #endif
  317. }
  318. #if defined _ALS_OnFilterScriptInit
  319. #undef OnFilterScriptInit
  320. #else
  321. #define _ALS_OnFilterScriptInit
  322. #endif
  323. #define OnFilterScriptInit Dialog_OnFilterScriptInit
  324. #if defined Dialog_OnFilterScriptInit
  325. forward Dialog_OnFilterScriptInit();
  326. #endif
  327.  
  328. public OnFilterScriptExit()
  329. {
  330. Dialog_DestroyGlobalTD();
  331. Dialog_DestroyGlobalButtonsTD();
  332.  
  333. #if defined Dialog_OnFilterScriptExit
  334. return Dialog_OnFilterScriptExit();
  335. #else
  336. return 1;
  337. #endif
  338. }
  339. #if defined _ALS_OnFilterScriptExit
  340. #undef OnFilterScriptExit
  341. #else
  342. #define _ALS_OnFilterScriptExit
  343. #endif
  344. #define OnFilterScriptExit Dialog_OnFilterScriptExit
  345. #if defined Dialog_OnFilterScriptExit
  346. forward Dialog_OnFilterScriptExit();
  347. #endif
  348.  
  349. #else// if used in a gamemode
  350.  
  351. public OnGameModeInit()
  352. {
  353. Dialog_CreateGlobalTD();
  354. Dialog_CreateGlobalButtonsTD();
  355.  
  356. SetupPrevModelDialog(0.0, 0.0, 0.0);
  357.  
  358. #if defined Dialog_OnGameModeInit
  359. return Dialog_OnGameModeInit();
  360. #else
  361. return 1;
  362. #endif
  363. }
  364. #if defined _ALS_OnGameModeInit
  365. #undef OnGameModeInit
  366. #else
  367. #define _ALS_OnGameModeInit
  368. #endif
  369. #define OnGameModeInit Dialog_OnGameModeInit
  370. #if defined Dialog_OnGameModeInit
  371. forward Dialog_OnGameModeInit();
  372. #endif
  373.  
  374. public OnGameModeExit()
  375. {
  376. Dialog_DestroyGlobalTD();
  377. Dialog_DestroyGlobalButtonsTD();
  378.  
  379. #if defined Dialog_OnGameModeExit
  380. return Dialog_OnGameModeExit();
  381. #else
  382. return 1;
  383. #endif
  384. }
  385. #if defined _ALS_OnGameModeExit
  386. #undef OnGameModeExit
  387. #else
  388. #define _ALS_OnGameModeExit
  389. #endif
  390. #define OnGameModeExit Dialog_OnGameModeExit
  391. #if defined Dialog_OnGameModeExit
  392. forward Dialog_OnGameModeExit();
  393. #endif
  394.  
  395. #endif
  396.  
  397. public OnPlayerConnect(playerid)
  398. {
  399. for(new i; i != 2; i++) gPlayerButtonsTD[playerid][i] = PlayerText:INVALID_TEXT_DRAW;
  400.  
  401. gPlayerHeaderTD[playerid] = PlayerText:INVALID_TEXT_DRAW;
  402. gPlayerPageTD[playerid] = PlayerText:INVALID_TEXT_DRAW;
  403.  
  404. for(new i; i != MODELS_PER_PAGE; i++)
  405. {
  406. gPlayerModelTD[playerid][i] = PlayerText:INVALID_TEXT_DRAW;
  407. gPlayerModelDescTD[playerid][i] = PlayerText:INVALID_TEXT_DRAW;
  408. }
  409.  
  410. gPlayerDialog[playerid][E_DIALOG_ID] = INVALID_DIALOG_ID;
  411. gPlayerDialog[playerid][E_DIALOG_TYPE] = -1;
  412. gPlayerDialog[playerid][E_DIALOG_PAGE] = 0;
  413. gPlayerDialog[playerid][E_DIALOG_SELECTED_ITEM] = 0;
  414. gPlayerDialog[playerid][E_DIALOG_CLICK_TICK] = 0;
  415. gPlayerDialog[playerid][E_DIALOG_HIDE_TIMER] = -1;
  416.  
  417. #if defined Dialog_OnPlayerConnect
  418. return Dialog_OnPlayerConnect(playerid);
  419. #else
  420. return 1;
  421. #endif
  422. }
  423. #if defined _ALS_OnPlayerConnect
  424. #undef OnPlayerConnect
  425. #else
  426. #define _ALS_OnPlayerConnect
  427. #endif
  428. #define OnPlayerConnect Dialog_OnPlayerConnect
  429. #if defined Dialog_OnPlayerConnect
  430. forward Dialog_OnPlayerConnect(playerid);
  431. #endif
  432.  
  433. public OnPlayerDisconnect(playerid, reason)
  434. {
  435. gPlayerPageTD[playerid] = PlayerText:INVALID_TEXT_DRAW;
  436. gPlayerHeaderTD[playerid] = PlayerText:INVALID_TEXT_DRAW;
  437. for(new i; i != 2; i++) gPlayerButtonsTD[playerid][i] = PlayerText:INVALID_TEXT_DRAW;
  438. for(new i; i != MODELS_PER_PAGE; i++) gPlayerModelTD[playerid][i] = PlayerText:INVALID_TEXT_DRAW;
  439.  
  440. if(gPlayerDialog[playerid][E_DIALOG_HIDE_TIMER] != -1) KillTimer(gPlayerDialog[playerid][E_DIALOG_HIDE_TIMER]);
  441.  
  442. #if defined Dialog_OnPlayerDisconnect
  443. return Dialog_OnPlayerDisconnect(playerid, reason);
  444. #else
  445. return 1;
  446. #endif
  447. }
  448. #if defined _ALS_OnPlayerDisconnect
  449. #undef OnPlayerDisconnect
  450. #else
  451. #define _ALS_OnPlayerDisconnect
  452. #endif
  453. #define OnPlayerDisconnect Dialog_OnPlayerDisconnect
  454. #if defined Dialog_OnPlayerDisconnect
  455. forward Dialog_OnPlayerDisconnect(playerid, reason);
  456. #endif
  457.  
  458. stock HidePlayerDialog(playerid)
  459. {
  460. if(! IsPlayerConnected(playerid)) return false;
  461.  
  462. if(GetPlayerDialogID(playerid) != INVALID_DIALOG_ID)
  463. {
  464. if( GetPlayerDialogStyle(playerid) == DIALOG_STYLE_PREVMODEL ||
  465. GetPlayerDialogStyle(playerid) == DIALOG_STYLE_PREVMODEL_DESC)
  466. {
  467. //hide the base buttons textdraws
  468. for(new i; i != 14; i++) TextDrawHideForPlayer(playerid, gButtonsTD[i]);
  469.  
  470. //hide dialog base textdraws
  471. TextDrawHideForPlayer(playerid, gBackgroundTD);
  472. TextDrawHideForPlayer(playerid, gContentBoxTD[0]);
  473. TextDrawHideForPlayer(playerid, gContentBoxTD[1]);
  474.  
  475. //destroy dialog page player:textdraw
  476. PlayerTextDrawHide(playerid, gPlayerPageTD[playerid]);
  477. PlayerTextDrawDestroy(playerid, gPlayerPageTD[playerid]);
  478. gPlayerPageTD[playerid] = PlayerText:INVALID_TEXT_DRAW;
  479.  
  480. //destroy dialog header player:textdraw
  481. PlayerTextDrawHide(playerid, gPlayerHeaderTD[playerid]);
  482. PlayerTextDrawDestroy(playerid, gPlayerHeaderTD[playerid]);
  483. gPlayerHeaderTD[playerid] = PlayerText:INVALID_TEXT_DRAW;
  484.  
  485. //destroy dialog buttons player:textdraw
  486. for(new i; i != 2; i++)
  487. {
  488. PlayerTextDrawHide(playerid, gPlayerButtonsTD[playerid][i]);
  489. PlayerTextDrawDestroy(playerid, gPlayerButtonsTD[playerid][i]);
  490. gPlayerButtonsTD[playerid][i] = PlayerText:INVALID_TEXT_DRAW;
  491. }
  492.  
  493. //destroy model player:textdraws
  494. for(new i; i != MODELS_PER_PAGE; i++)
  495. {
  496. if(gPlayerModelTD[playerid][i] != PlayerText:INVALID_TEXT_DRAW)
  497. {
  498. PlayerTextDrawHide(playerid, gPlayerModelTD[playerid][i]);
  499. PlayerTextDrawDestroy(playerid, gPlayerModelTD[playerid][i]);
  500. gPlayerModelTD[playerid][i] = PlayerText:INVALID_TEXT_DRAW;
  501. }
  502.  
  503. if(gPlayerModelDescTD[playerid][i] != PlayerText:INVALID_TEXT_DRAW)
  504. {
  505. PlayerTextDrawHide(playerid, gPlayerModelDescTD[playerid][i]);
  506. PlayerTextDrawDestroy(playerid, gPlayerModelDescTD[playerid][i]);
  507. gPlayerModelDescTD[playerid][i] = PlayerText:INVALID_TEXT_DRAW;
  508. }
  509. }
  510.  
  511. CancelSelectTextDraw(playerid);
  512. }
  513. else
  514. {
  515. ShowPlayerDialog(playerid, -1, DIALOG_STYLE_MSGBOX, "hide", "hide", "hide", "");
  516. }
  517. }
  518. gPlayerDialog[playerid][E_DIALOG_ID] = INVALID_DIALOG_ID;
  519. gPlayerDialog[playerid][E_DIALOG_TYPE] = -1;
  520. gPlayerDialog[playerid][E_DIALOG_PAGE] = 0;
  521. gPlayerDialog[playerid][E_DIALOG_SELECTED_ITEM] = 0;
  522. gPlayerDialog[playerid][E_DIALOG_CLICK_TICK] = 0;
  523. return true;
  524. }
  525.  
  526. stock Dialog_Show(playerid, dialogid, style, caption[], info[], button1[], button2[] = "", infosize = sizeof(info))
  527. {
  528. if(! IsPlayerConnected(playerid)) return false;
  529.  
  530. gPlayerDialog[playerid][E_DIALOG_ID] = dialogid;
  531. gPlayerDialog[playerid][E_DIALOG_TYPE] = style;
  532. gPlayerDialog[playerid][E_DIALOG_CLICK_TICK] = GetTickCount();
  533.  
  534. if(dialogid == INVALID_DIALOG_ID) return HidePlayerDialog(playerid);
  535.  
  536. if(style == DIALOG_STYLE_PREVMODEL_DESC) return false;
  537.  
  538. switch(style)
  539. {
  540. case DIALOG_STYLE_PREVMODEL:
  541. {
  542. if(infosize > MAX_DIALOG_MODELS)
  543. {
  544. infosize = MAX_DIALOG_MODELS;
  545. print("WARNING: Max dialog models limit reached, please increase \"MAX_DIALOG_MODELS\" to increase the index from <dialogs.inc>.");
  546. }
  547.  
  548. if(infosize > 0)
  549. {
  550. for(new i = 0; i < infosize; i++)
  551. {
  552. gPlayerList[playerid][i] = info[i];
  553. }
  554. gPlayerDialog[playerid][E_DIALOG_PAGE] = 0;
  555. gPlayerTotalModels[playerid] = infosize;
  556. gPlayerTotalModelsDesc[playerid] = 0;
  557. gPlayerDialog[playerid][E_DIALOG_SELECTED_ITEM] = 0;
  558.  
  559. //Show the dialog base textdraws
  560. TextDrawShowForPlayer(playerid, gBackgroundTD);
  561. TextDrawShowForPlayer(playerid, gContentBoxTD[0]);
  562. TextDrawShowForPlayer(playerid, gContentBoxTD[1]);
  563.  
  564. Dialog_Update(playerid, 0);
  565.  
  566. //Show the buttons base textdraws
  567. for(new i = 0; i != 14; i++) TextDrawShowForPlayer(playerid, gButtonsTD[i]);
  568.  
  569. //Creating the header player:textdraw
  570. if(gPlayerHeaderTD[playerid] != PlayerText:INVALID_TEXT_DRAW) PlayerTextDrawDestroy(playerid, gPlayerHeaderTD[playerid]);
  571. gPlayerHeaderTD[playerid] = Dialog_PlayerTextDrawAdd(playerid, 132.000000, 112.000000, caption, 255, 1, 0.270000, 1.100000, -1, 0, false, true, 0, true, 255, 500.000000, 0.000000);
  572. PlayerTextDrawShow(playerid, gPlayerHeaderTD[playerid]);
  573.  
  574. //Creating the button 1 player:textdraw
  575. if(gPlayerButtonsTD[playerid][0] != PlayerText:INVALID_TEXT_DRAW) PlayerTextDrawDestroy(playerid, gPlayerButtonsTD[playerid][0]);
  576. gPlayerButtonsTD[playerid][0] = Dialog_PlayerTextDrawAdd(playerid, 229.000000, 328.000000, button1, 0, 1, 0.269999, 1.299999, -56, 2, false, true, 0);
  577. PlayerTextDrawShow(playerid, gPlayerButtonsTD[playerid][0]);
  578.  
  579. //Creating the button 2 player:textdraw
  580. if(gPlayerButtonsTD[playerid][1] != PlayerText:INVALID_TEXT_DRAW) PlayerTextDrawDestroy(playerid, gPlayerButtonsTD[playerid][1]);
  581. gPlayerButtonsTD[playerid][1] = Dialog_PlayerTextDrawAdd(playerid, 313.000000, 328.000000, button2, 0, 1, 0.269999, 1.299999, -56, 2, false, true, 0);
  582. PlayerTextDrawShow(playerid, gPlayerButtonsTD[playerid][1]);
  583.  
  584. //Creating the page player:textdraw
  585. new string[10];
  586. format(string, sizeof(string), "1/%d", Dialog_TotalPages(playerid));
  587. if(gPlayerPageTD[playerid] != PlayerText:INVALID_TEXT_DRAW) PlayerTextDrawDestroy(playerid, gPlayerPageTD[playerid]);
  588. gPlayerPageTD[playerid] = Dialog_PlayerTextDrawAdd(playerid, 500.000000, 112.000000, string, 255, 1, 0.270000, 1.100000, -1, 3, false, true);
  589. PlayerTextDrawShow(playerid, gPlayerPageTD[playerid]);
  590.  
  591. return SelectTextDraw(playerid, gSetupDialog[E_MODEL_HOVER_COLOR]);
  592. }
  593. }
  594. default:
  595. {
  596. if(GetPlayerDialogStyle(playerid) == DIALOG_STYLE_PREVMODEL) HidePlayerDialog(playerid);
  597.  
  598. return ShowPlayerDialog(playerid, dialogid, style, caption, info, button1, button2);
  599. }
  600. }
  601. return false;
  602. }
  603. #if defined _ALS_ShowPlayerDialog
  604. #undef ShowPlayerDialog
  605. #else
  606. #define _ALS_ShowPlayerDialog
  607. #endif
  608. #define ShowPlayerDialog Dialog_Show
  609.  
  610. stock ShowPlayerPrevModelDialog(playerid, dialogid, caption[], info[], desc[][MAX_DIALOG_DESC_LENGTH], button1[], button2[] = "", infosize = sizeof(info), descsize = sizeof(desc))
  611. {
  612. if(! IsPlayerConnected(playerid)) return false;
  613.  
  614. gPlayerDialog[playerid][E_DIALOG_ID] = dialogid;
  615. gPlayerDialog[playerid][E_DIALOG_TYPE] = DIALOG_STYLE_PREVMODEL_DESC;
  616.  
  617. if(dialogid == INVALID_DIALOG_ID) return HidePlayerDialog(playerid);
  618.  
  619. if(infosize > MAX_DIALOG_MODELS)
  620. {
  621. infosize = MAX_DIALOG_MODELS;
  622. print("WARNING: Max dialog models limit reached, please increase \"MAX_DIALOG_MODELS\" to increase the index from <dialogs.inc>.");
  623. }
  624.  
  625. if(infosize > 0)
  626. {
  627. for(new i = 0; i < infosize; i++)
  628. {
  629. gPlayerList[playerid][i] = info[i];
  630. }
  631. for(new i = 0; i < descsize; i++)
  632. {
  633. if(strlen(desc[i]) > 0) format(gPlayerListDesc[playerid][i], MAX_DIALOG_DESC_LENGTH, desc[i]);
  634. else format(gPlayerListDesc[playerid][i], MAX_DIALOG_DESC_LENGTH, "");
  635. }
  636. gPlayerDialog[playerid][E_DIALOG_PAGE] = 0;
  637. gPlayerTotalModels[playerid] = infosize;
  638. gPlayerTotalModelsDesc[playerid] = descsize;
  639. gPlayerDialog[playerid][E_DIALOG_SELECTED_ITEM] = 0;
  640.  
  641. //Show the dialog base textdraws
  642. TextDrawShowForPlayer(playerid, gBackgroundTD);
  643. TextDrawShowForPlayer(playerid, gContentBoxTD[0]);
  644. TextDrawShowForPlayer(playerid, gContentBoxTD[1]);
  645.  
  646. Dialog_Update(playerid, 0, true);
  647.  
  648. //Show the buttons base textdraws
  649. for(new i = 0; i != 14; i++) TextDrawShowForPlayer(playerid, gButtonsTD[i]);
  650.  
  651. //Creating the header player:textdraw
  652. if(gPlayerHeaderTD[playerid] != PlayerText:INVALID_TEXT_DRAW) PlayerTextDrawDestroy(playerid, gPlayerHeaderTD[playerid]);
  653. gPlayerHeaderTD[playerid] = Dialog_PlayerTextDrawAdd(playerid, 132.000000, 112.000000, caption, 255, 1, 0.270000, 1.100000, -1, 0, false, true, 0, true, 255, 500.000000, 0.000000);
  654. PlayerTextDrawShow(playerid, gPlayerHeaderTD[playerid]);
  655.  
  656. //Creating the button 1 player:textdraw
  657. if(gPlayerButtonsTD[playerid][0] != PlayerText:INVALID_TEXT_DRAW) PlayerTextDrawDestroy(playerid, gPlayerButtonsTD[playerid][0]);
  658. gPlayerButtonsTD[playerid][0] = Dialog_PlayerTextDrawAdd(playerid, 229.000000, 328.000000, button1, 0, 1, 0.269999, 1.299999, -56, 2, false, true, 0);
  659. PlayerTextDrawShow(playerid, gPlayerButtonsTD[playerid][0]);
  660.  
  661. //Creating the button 2 player:textdraw
  662. if(gPlayerButtonsTD[playerid][1] != PlayerText:INVALID_TEXT_DRAW) PlayerTextDrawDestroy(playerid, gPlayerButtonsTD[playerid][1]);
  663. gPlayerButtonsTD[playerid][1] = Dialog_PlayerTextDrawAdd(playerid, 313.000000, 328.000000, button2, 0, 1, 0.269999, 1.299999, -56, 2, false, true, 0);
  664. PlayerTextDrawShow(playerid, gPlayerButtonsTD[playerid][1]);
  665.  
  666. //Creating the page player:textdraw
  667. new string[10];
  668. format(string, sizeof(string), "1/%d", Dialog_TotalPages(playerid));
  669. if(gPlayerPageTD[playerid] != PlayerText:INVALID_TEXT_DRAW) PlayerTextDrawDestroy(playerid, gPlayerPageTD[playerid]);
  670. gPlayerPageTD[playerid] = Dialog_PlayerTextDrawAdd(playerid, 500.000000, 112.000000, string, 255, 1, 0.270000, 1.100000, -1, 3, false, true);
  671. PlayerTextDrawShow(playerid, gPlayerPageTD[playerid]);
  672.  
  673. return SelectTextDraw(playerid, gSetupDialog[E_MODEL_HOVER_COLOR]);
  674. }
  675. return false;
  676. }
  677.  
  678. #define BUTTON_1 gButtonsTD[1]//button 1, clickable TD; gives you response = 0
  679. #define BUTTON_2 gButtonsTD[4]//button 2, clickable TD; gives you response = 1
  680. #define BUTTON_PREVIOUS gButtonsTD[7]//button <, clickable TD; gives you previous page
  681. #define BUTTON_NEXT gButtonsTD[11]//button >, clickable TD; gives you next page
  682.  
  683. public OnPlayerClickTextDraw(playerid, Text:clickedid)
  684. {
  685. if( GetPlayerDialogStyle(playerid) == DIALOG_STYLE_PREVMODEL ||
  686. GetPlayerDialogStyle(playerid) == DIALOG_STYLE_PREVMODEL_DESC)
  687. {
  688. new model[15] = "Unknown";
  689. if(Dialog_isnumeric(gPlayerList[playerid][gPlayerDialog[playerid][E_DIALOG_SELECTED_ITEM]])) format(model, sizeof(model), "%d", gPlayerList[playerid][gPlayerDialog[playerid][E_DIALOG_SELECTED_ITEM]]);
  690.  
  691. if(gPlayerDialog[playerid][E_DIALOG_SELECTED_ITEM] < 0) gPlayerDialog[playerid][E_DIALOG_SELECTED_ITEM] = 0;
  692.  
  693.  
  694. if(clickedid == Text:INVALID_TEXT_DRAW)//if pressed ESC key
  695. {
  696. if(! CallLocalFunction("OnDialogResponse", "dddds", playerid, gPlayerDialog[playerid][E_DIALOG_ID], 0, gPlayerDialog[playerid][E_DIALOG_SELECTED_ITEM], model))
  697. {
  698. CallRemoteFunction("OnDialogResponse", "dddds", playerid, gPlayerDialog[playerid][E_DIALOG_ID], 0, gPlayerDialog[playerid][E_DIALOG_SELECTED_ITEM], model);
  699. }
  700. return 1;
  701. }
  702.  
  703. if(clickedid == BUTTON_1)//if clicked 'BUTTON1'
  704. {
  705. if(! CallLocalFunction("OnDialogResponse", "dddds", playerid, gPlayerDialog[playerid][E_DIALOG_ID], 1, gPlayerDialog[playerid][E_DIALOG_SELECTED_ITEM], model))
  706. {
  707. CallRemoteFunction("OnDialogResponse", "dddds", playerid, gPlayerDialog[playerid][E_DIALOG_ID], 1, gPlayerDialog[playerid][E_DIALOG_SELECTED_ITEM], model);
  708. }
  709. return 1;
  710. }
  711.  
  712. if(clickedid == BUTTON_2)//if clicked 'BUTTON2'
  713. {
  714. if(! CallLocalFunction("OnDialogResponse", "dddds", playerid, gPlayerDialog[playerid][E_DIALOG_ID], 0, gPlayerDialog[playerid][E_DIALOG_SELECTED_ITEM], model))
  715. {
  716. CallRemoteFunction("OnDialogResponse", "dddds", playerid, gPlayerDialog[playerid][E_DIALOG_ID], 0, gPlayerDialog[playerid][E_DIALOG_SELECTED_ITEM], model);
  717. }
  718. return 1;
  719. }
  720.  
  721. if(clickedid == BUTTON_NEXT)//if clicked '>' - next page
  722. {
  723. if(gPlayerDialog[playerid][E_DIALOG_PAGE] < (Dialog_TotalPages(playerid) - 1))
  724. {
  725. gPlayerDialog[playerid][E_DIALOG_PAGE] += 1;
  726. if(GetPlayerDialogStyle(playerid) == DIALOG_STYLE_PREVMODEL_DESC) Dialog_Update(playerid, 0, true);
  727. else Dialog_Update(playerid, 0, false);
  728. Dialog_UpdatePage(playerid);
  729. }
  730. else
  731. {
  732. PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
  733. }
  734. }
  735.  
  736. if(clickedid == BUTTON_PREVIOUS)//if clicked '<' - previous page
  737. {
  738. if(gPlayerDialog[playerid][E_DIALOG_PAGE] > 0)
  739. {
  740. gPlayerDialog[playerid][E_DIALOG_PAGE] -= 1;
  741. if(GetPlayerDialogStyle(playerid) == DIALOG_STYLE_PREVMODEL_DESC) Dialog_Update(playerid, 0, true);
  742. else Dialog_Update(playerid, 0, false);
  743. Dialog_UpdatePage(playerid);
  744. }
  745. else
  746. {
  747. PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0);
  748. }
  749. }
  750. }
  751.  
  752. #if defined Dialog_OnPlayerClickTextDraw
  753. return Dialog_OnPlayerClickTextDraw(playerid, Text:clickedid);
  754. #else
  755. return 1;
  756. #endif
  757. }
  758. #if defined _ALS_OnPlayerClickTextDraw
  759. #undef OnPlayerClickTextDraw
  760. #else
  761. #define _ALS_OnPlayerClickTextDraw
  762. #endif
  763. #define OnPlayerClickTextDraw Dialog_OnPlayerClickTextDraw
  764. #if defined Dialog_OnPlayerClickTextDraw
  765. forward Dialog_OnPlayerClickTextDraw(playerid, Text:clickedid);
  766. #endif
  767.  
  768. public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
  769. {
  770. if(GetPlayerDialogStyle(playerid) == DIALOG_STYLE_PREVMODEL)
  771. {
  772. //clicks on a model
  773. for(new x = 0; x < MODELS_PER_PAGE; x++)
  774. {
  775. //double click
  776. if((GetTickCount() - gPlayerDialog[playerid][E_DIALOG_CLICK_TICK]) < 200)
  777. {
  778. if(playertextid == gPlayerModelTD[playerid][x])
  779. {
  780. new model[15] = "Unknown";
  781. if(Dialog_isnumeric(gPlayerList[playerid][gPlayerDialog[playerid][E_DIALOG_SELECTED_ITEM]])) format(model, sizeof(model), "%d", gPlayerList[playerid][gPlayerDialog[playerid][E_DIALOG_SELECTED_ITEM]]);
  782.  
  783. if(gPlayerDialog[playerid][E_DIALOG_SELECTED_ITEM] < 0) gPlayerDialog[playerid][E_DIALOG_SELECTED_ITEM] = 0;
  784.  
  785. if(! CallLocalFunction("OnDialogResponse", "dddds", playerid, gPlayerDialog[playerid][E_DIALOG_ID], 1, gPlayerDialog[playerid][E_DIALOG_SELECTED_ITEM], model))
  786. {
  787. CallRemoteFunction("OnDialogResponse", "dddds", playerid, gPlayerDialog[playerid][E_DIALOG_ID], 1, gPlayerDialog[playerid][E_DIALOG_SELECTED_ITEM], model);
  788. }
  789. return 1;
  790. }
  791. }
  792. //single click (just highlight the listitem)
  793. else
  794. {
  795. if(playertextid == gPlayerModelTD[playerid][x])
  796. {
  797. gPlayerDialog[playerid][E_DIALOG_CLICK_TICK] = GetTickCount();
  798. if(GetPlayerDialogStyle(playerid) == DIALOG_STYLE_PREVMODEL_DESC) return Dialog_Update(playerid, x, true);
  799. else return Dialog_Update(playerid, x, false);
  800. }
  801. }
  802. }
  803. }
  804. #if defined Dialog_OnPlayerClickPlayerTD
  805. return Dialog_OnPlayerClickPlayerTD(playerid, PlayerText:playertextid);
  806. #else
  807. return 1;
  808. #endif
  809. }
  810. #if defined _ALS_OnPlayerClickPlayerTD
  811. #undef OnPlayerClickPlayerTextDraw
  812. #else
  813. #define _ALS_OnPlayerClickPlayerTD
  814. #endif
  815. #define OnPlayerClickPlayerTextDraw Dialog_OnPlayerClickPlayerTD
  816. #if defined Dialog_OnPlayerClickPlayerTD
  817. forward Dialog_OnPlayerClickPlayerTD(playerid, PlayerText:playertextid);
  818. #endif
  819.  
  820. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  821. {
  822. if( GetPlayerDialogStyle(playerid) == DIALOG_STYLE_PREVMODEL &&
  823. GetPlayerDialogStyle(playerid) == DIALOG_STYLE_PREVMODEL_DESC)
  824. {
  825. if(gPlayerDialog[playerid][E_DIALOG_HIDE_TIMER] != -1) KillTimer(gPlayerDialog[playerid][E_DIALOG_HIDE_TIMER]);
  826. gPlayerDialog[playerid][E_DIALOG_HIDE_TIMER] = SetTimerEx("Dialog_HidePlayerDialog", 350, true, "i", playerid);
  827.  
  828. gPlayerDialog[playerid][E_DIALOG_ID] = (INVALID_DIALOG_ID - 1);
  829. }
  830. else
  831. {
  832. gPlayerDialog[playerid][E_DIALOG_ID] = INVALID_DIALOG_ID;
  833. gPlayerDialog[playerid][E_DIALOG_TYPE] = -1;
  834. gPlayerDialog[playerid][E_DIALOG_PAGE] = 0;
  835. gPlayerDialog[playerid][E_DIALOG_SELECTED_ITEM] = 0;
  836. gPlayerDialog[playerid][E_DIALOG_CLICK_TICK] = GetTickCount();
  837. }
  838.  
  839. #if defined Dialog_OnDialogResponse
  840. return Dialog_OnDialogResponse(playerid, dialogid, response, listitem, inputtext);
  841. #else
  842. return 1;
  843. #endif
  844. }
  845. #if defined _ALS_OnDialogResponse
  846. #undef OnDialogResponse
  847. #else
  848. #define _ALS_OnDialogResponse
  849. #endif
  850. #define OnDialogResponse Dialog_OnDialogResponse
  851. #if defined Dialog_OnDialogResponse
  852. forward Dialog_OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]);
  853. #endif
  854.  
  855. forward Dialog_HidePlayerDialog(playerid);
  856. public Dialog_HidePlayerDialog(playerid)
  857. {
  858. if(GetPlayerDialogID(playerid) == (INVALID_DIALOG_ID - 1))
  859. {
  860. HidePlayerDialog(playerid);
  861. }
  862. KillTimer(gPlayerDialog[playerid][E_DIALOG_HIDE_TIMER]);
  863. return 1;
  864. }
Advertisement
Add Comment
Please, Sign In to add comment