Advertisement
Guest User

Untitled

a guest
Oct 18th, 2015
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.78 KB | None | 0 0
  1. #include <YSI\y_hooks>
  2. new
  3. Text:fex_TD [ 3 ],
  4. PlayerText:fex_pTD [ MAX_PLAYERS ] [ 5 ],
  5. fex_dialogid [ MAX_PLAYERS ]
  6. ;
  7.  
  8. forward OnFexDialogResponse(playerid, dialogid, response);
  9.  
  10. hook OnGameModeInit()
  11. {
  12. fex_TD [ 0 ] = TextDrawCreate(470.000000, 162.000000, "BG");
  13. TextDrawBackgroundColor(fex_TD [ 0 ], 255);
  14. TextDrawFont(fex_TD [ 0 ], 1);
  15. TextDrawLetterSize(fex_TD [ 0 ], 0.000000, 2.699999);
  16. TextDrawColor(fex_TD [ 0 ], -1);
  17. TextDrawSetOutline(fex_TD [ 0 ], 0);
  18. TextDrawSetProportional(fex_TD [ 0 ], 1);
  19. TextDrawSetShadow(fex_TD [ 0 ], 1);
  20. TextDrawUseBox(fex_TD [ 0 ], 1);
  21. TextDrawBoxColor(fex_TD [ 0 ], 1414812927);
  22. TextDrawTextSize(fex_TD [ 0 ], 169.000000, 0.000000);
  23. TextDrawSetSelectable(fex_TD [ 0 ], 0);
  24.  
  25. fex_TD [ 1 ] = TextDrawCreate(388.250000, 144.000000, "2");
  26. TextDrawBackgroundColor(fex_TD [ 1 ], 926956287);
  27. TextDrawFont(fex_TD [ 1 ], 5);
  28. TextDrawLetterSize(fex_TD [ 1 ], 0.000000, 1.000000);
  29. TextDrawColor(fex_TD [ 1 ], -1);
  30. TextDrawSetOutline(fex_TD [ 1 ], 0);
  31. TextDrawSetProportional(fex_TD [ 1 ], 1);
  32. TextDrawSetShadow(fex_TD [ 1 ], 1);
  33. TextDrawUseBox(fex_TD [ 1 ], 1);
  34. TextDrawBoxColor(fex_TD [ 1 ], 0);
  35. TextDrawTextSize(fex_TD [ 1 ], 80.000000, 15.000000);
  36. TextDrawSetPreviewModel(fex_TD [ 1 ], 1);
  37. TextDrawSetPreviewRot(fex_TD [ 1 ], -16.000000, 0.000000, -55.000000, -1.000000);
  38. TextDrawSetSelectable(fex_TD [ 1 ], 1);
  39.  
  40. fex_TD [ 2 ] = TextDrawCreate(307.250000, 144.000000, "1");
  41. TextDrawBackgroundColor(fex_TD [ 2 ], 926956287);
  42. TextDrawFont(fex_TD [ 2 ], 5);
  43. TextDrawLetterSize(fex_TD [ 2 ], 0.000000, 1.000000);
  44. TextDrawColor(fex_TD [ 2 ], -1);
  45. TextDrawSetOutline(fex_TD [ 2 ], 0);
  46. TextDrawSetProportional(fex_TD [ 2 ], 1);
  47. TextDrawSetShadow(fex_TD [ 2 ], 1);
  48. TextDrawUseBox(fex_TD [ 2 ], 1);
  49. TextDrawBoxColor(fex_TD [ 2 ], 0);
  50. TextDrawTextSize(fex_TD [ 2 ], 80.000000, 15.000000);
  51. TextDrawSetPreviewModel(fex_TD [ 2 ], 1);
  52. TextDrawSetPreviewRot(fex_TD [ 2 ], -16.000000, 0.000000, -55.000000, -1.000000);
  53. TextDrawSetSelectable(fex_TD [ 2 ], 1);
  54. return 1;
  55. }
  56.  
  57. hook OnPlayerConnect(playerid)
  58. {
  59. fex_pTD [ playerid ] [ 0 ] = CreatePlayerTextDraw(playerid, 470.000000, 177.000000, "BG");
  60. PlayerTextDrawBackgroundColor(playerid, fex_pTD [ playerid ] [ 0 ], 255);
  61. PlayerTextDrawFont(playerid, fex_pTD [ playerid ] [ 0 ], 1);
  62. PlayerTextDrawLetterSize(playerid, fex_pTD [ playerid ] [ 0 ], 0.000000, 7.500000);
  63. PlayerTextDrawColor(playerid, fex_pTD [ playerid ] [ 0 ], -1);
  64. PlayerTextDrawSetOutline(playerid, fex_pTD [ playerid ] [ 0 ], 0);
  65. PlayerTextDrawSetProportional(playerid, fex_pTD [ playerid ] [ 0 ], 1);
  66. PlayerTextDrawSetShadow(playerid, fex_pTD [ playerid ] [ 0 ], 1);
  67. PlayerTextDrawUseBox(playerid, fex_pTD [ playerid ] [ 0 ], 1);
  68. PlayerTextDrawBoxColor(playerid, fex_pTD [ playerid ] [ 0 ], 656877567);
  69. PlayerTextDrawTextSize(playerid, fex_pTD [ playerid ] [ 0 ], 169.000000, 0.000000);
  70. PlayerTextDrawSetSelectable(playerid, fex_pTD [ playerid ] [ 0 ], 0);
  71.  
  72. fex_pTD [ playerid ] [ 1 ] = CreatePlayerTextDraw(playerid, 175.000000, 163.000000, "~y~Serverio apklausa");
  73. PlayerTextDrawBackgroundColor(playerid, fex_pTD [ playerid ] [ 1 ], 656877567);
  74. PlayerTextDrawFont(playerid, fex_pTD [ playerid ] [ 1 ], 2);
  75. PlayerTextDrawLetterSize(playerid, fex_pTD [ playerid ] [ 1 ], 0.200000, 1.000000);
  76. PlayerTextDrawColor(playerid, fex_pTD [ playerid ] [ 1 ], -1);
  77. PlayerTextDrawSetOutline(playerid, fex_pTD [ playerid ] [ 1 ], 0);
  78. PlayerTextDrawSetProportional(playerid, fex_pTD [ playerid ] [ 1 ], 1);
  79. PlayerTextDrawSetShadow(playerid, fex_pTD [ playerid ] [ 1 ], 0);
  80. PlayerTextDrawSetSelectable(playerid, fex_pTD [ playerid ] [ 1 ], 0);
  81.  
  82. fex_pTD [ playerid ] [ 2 ] = CreatePlayerTextDraw(playerid, 319.500000, 193.000000, "wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww~n~wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww~n~wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww~n~wwwwwwwwwwwwwwwwwwww");
  83. PlayerTextDrawAlignment(playerid, fex_pTD [ playerid ] [ 2 ], 2);
  84. PlayerTextDrawBackgroundColor(playerid, fex_pTD [ playerid ] [ 2 ], 656877567);
  85. PlayerTextDrawFont(playerid, fex_pTD [ playerid ] [ 2 ], 2);
  86. PlayerTextDrawLetterSize(playerid, fex_pTD [ playerid ] [ 2 ], 0.200000, 1.000000);
  87. PlayerTextDrawColor(playerid, fex_pTD [ playerid ] [ 2 ], -1);
  88. PlayerTextDrawSetOutline(playerid, fex_pTD [ playerid ] [ 2 ], 0);
  89. PlayerTextDrawSetProportional(playerid, fex_pTD [ playerid ] [ 2 ], 1);
  90. PlayerTextDrawSetShadow(playerid, fex_pTD [ playerid ] [ 2 ], 0);
  91. PlayerTextDrawSetSelectable(playerid, fex_pTD [ playerid ] [ 2 ], 0);
  92.  
  93. fex_pTD [ playerid ] [ 3 ] = CreatePlayerTextDraw(playerid, 347.000000, 147.000000, "Taip");
  94. PlayerTextDrawAlignment(playerid, fex_pTD [ playerid ] [ 3 ], 2);
  95. PlayerTextDrawBackgroundColor(playerid, fex_pTD [ playerid ] [ 3 ], 656877567);
  96. PlayerTextDrawFont(playerid, fex_pTD [ playerid ] [ 3 ], 2);
  97. PlayerTextDrawLetterSize(playerid, fex_pTD [ playerid ] [ 3 ], 0.180000, 0.899999);
  98. PlayerTextDrawColor(playerid, fex_pTD [ playerid ] [ 3 ], -1);
  99. PlayerTextDrawSetOutline(playerid, fex_pTD [ playerid ] [ 3 ], 0);
  100. PlayerTextDrawSetProportional(playerid, fex_pTD [ playerid ] [ 3 ], 1);
  101. PlayerTextDrawSetShadow(playerid, fex_pTD [ playerid ] [ 3 ], 0);
  102. PlayerTextDrawSetSelectable(playerid, fex_pTD [ playerid ] [ 3 ], 0);
  103.  
  104. fex_pTD [ playerid ] [ 4 ] = CreatePlayerTextDraw(playerid, 428.000000, 147.000000, "Ne");
  105. PlayerTextDrawAlignment(playerid, fex_pTD [ playerid ] [ 4 ], 2);
  106. PlayerTextDrawBackgroundColor(playerid, fex_pTD [ playerid ] [ 4 ], 656877567);
  107. PlayerTextDrawFont(playerid, fex_pTD [ playerid ] [ 4 ], 2);
  108. PlayerTextDrawLetterSize(playerid, fex_pTD [ playerid ] [ 4 ], 0.180000, 0.899999);
  109. PlayerTextDrawColor(playerid, fex_pTD [ playerid ] [ 4 ], -1);
  110. PlayerTextDrawSetOutline(playerid, fex_pTD [ playerid ] [ 4 ], 0);
  111. PlayerTextDrawSetProportional(playerid, fex_pTD [ playerid ] [ 4 ], 1);
  112. PlayerTextDrawSetShadow(playerid, fex_pTD [ playerid ] [ 4 ], 0);
  113. PlayerTextDrawSetSelectable(playerid, fex_pTD [ playerid ] [ 4 ], 0);
  114. return 1;
  115. }
  116.  
  117. hook OnPlayerClickTextDraw(playerid, Text:clickedid)
  118. {
  119. if(clickedid == fex_TD [ 1 ]) CallLocalFunction("OnFexDialogResponse", "iii", playerid, fex_dialogid [ playerid ], 0), HideFexDialog(playerid);
  120. if(clickedid == fex_TD [ 2 ]) CallLocalFunction("OnFexDialogResponse", "iii", playerid, fex_dialogid [ playerid ], 1), HideFexDialog(playerid);
  121. return 1;
  122. }
  123.  
  124. stock ShowFexDialog(playerid, dialogid, header[], text[], button1[], button2[])
  125. {
  126. if(strlen(header) > 27 || strlen(text) > 135 || strlen(button1) > 10 || strlen(button2) > 10) return SendClientMessage(playerid, -1, "{FF0000}* Blogai suformatuota lentele!");
  127. new
  128. str [ 127 ],
  129. cat [ 54 ],
  130. Float:pos,
  131. count
  132. ;
  133. switch(strlen(text))
  134. {
  135. case 0..45: pos = 4.5, count = 1;
  136. case 46..90: pos = 5.5, count = 2;
  137. case 91..135: pos = 6.5, count = 3;
  138. }
  139. fex_dialogid [ playerid ] = dialogid, PlayerTextDrawLetterSize(playerid, fex_pTD [ playerid ] [ 0 ], 0.000000, pos); for(new i; i < count; i++) strmid(cat, text, i*45, 45+i*45), format(cat, sizeof cat, "%s~n~", cat), strcat(str, cat);
  140. PlayerTextDrawSetString(playerid, fex_pTD [ playerid ] [ 2 ], str), format(str, sizeof str, "~y~%s", header), PlayerTextDrawSetString(playerid, fex_pTD [ playerid ] [ 1 ], str), PlayerTextDrawSetString(playerid, fex_pTD [ playerid ] [ 3 ], button1), PlayerTextDrawSetString(playerid, fex_pTD [ playerid ] [ 4 ], button2);
  141. for(new TD; TD < sizeof fex_TD; TD++) TextDrawShowForPlayer(playerid, fex_TD[TD]);
  142. for(new TD; TD < 5; TD++) PlayerTextDrawShow(playerid, fex_pTD[playerid][TD]);
  143. return SelectTextDraw(playerid, 0xFFFFFF75);
  144. }
  145.  
  146. stock HideFexDialog(playerid)
  147. {
  148. for(new TD; TD < sizeof fex_TD; TD++) TextDrawHideForPlayer(playerid, fex_TD[TD]);
  149. for(new TD; TD < 5; TD++) PlayerTextDrawHide(playerid, fex_pTD[playerid][TD]);
  150. return fex_dialogid [ playerid ] = -1, CancelSelectTextDraw(playerid);
  151. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement