Advertisement
Guest User

Mobile Textdraw by Shabi RoxX

a guest
Apr 9th, 2012
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.52 KB | None | 0 0
  1. // This is a comment
  2. // uncomment the line below if you want to write a filterscript
  3. //#define FILTERSCRIPT
  4.  
  5. #include <a_samp>
  6. #include <zcmd>
  7.  
  8.  
  9. new MobileOn[MAX_PLAYERS];//to check if mobile is On or OFF :
  10. new MobileStats[MAX_PLAYERS];//mobile stats simply , like calling.. main or whatsever
  11. new Select[MAX_PLAYERS];
  12. new NewNum[MAX_PLAYERS][8];
  13.  
  14. new Text:Mobile[16];//Mobile textdraw
  15. new Text:MobileNum[MAX_PLAYERS];//number the player is calling,
  16. new Text:MobileMain[MAX_PLAYERS];//Stats...
  17.  
  18. public OnFilterScriptInit()
  19. {
  20. print("\n--------------------------------------");
  21. print(" Texdraws Mobile by Shabi RoxX ");
  22. print("--------------------------------------\n");
  23. //============================================
  24. // Mobile TextDraw Start #
  25. //============================================
  26. //Main BackGround With Nokai TAG
  27. Mobile[0] = TextDrawCreate(542.000000, 260.000000, "Nokia~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~");
  28. TextDrawAlignment(Mobile[0], 2);
  29. TextDrawBackgroundColor(Mobile[0], 255);
  30. TextDrawFont(Mobile[0], 1);
  31. TextDrawLetterSize(Mobile[0], 1.000000, 1.000000);
  32. TextDrawColor(Mobile[0], -1);
  33. TextDrawSetOutline(Mobile[0], 0);
  34. TextDrawSetProportional(Mobile[0], 1);
  35. TextDrawSetShadow(Mobile[0], 1);
  36. TextDrawUseBox(Mobile[0], 1);
  37. TextDrawBoxColor(Mobile[0], 2071823560);
  38. TextDrawTextSize(Mobile[0], 7.000000, 137.000000);
  39.  
  40. //screen texdraw
  41. Mobile[1] = TextDrawCreate(542.000000, 282.000000, "_~n~~n~~n~~n~~n~");
  42. TextDrawAlignment(Mobile[1], 2);
  43. TextDrawBackgroundColor(Mobile[1], 255);
  44. TextDrawFont(Mobile[1], 1);
  45. TextDrawLetterSize(Mobile[1], 0.500000, 1.000000);
  46. TextDrawColor(Mobile[1], -1);
  47. TextDrawSetOutline(Mobile[1], 0);
  48. TextDrawSetProportional(Mobile[1], 1);
  49. TextDrawSetShadow(Mobile[1], 1);
  50. TextDrawUseBox(Mobile[1], 1);
  51. TextDrawBoxColor(Mobile[1], -1296911672);
  52. TextDrawTextSize(Mobile[1], 467.000000, 125.000000);
  53.  
  54. //Button 1
  55. Mobile[2] = TextDrawCreate(493.000000, 361.000000, "1");
  56. TextDrawAlignment(Mobile[2], 2);
  57. TextDrawBackgroundColor(Mobile[2], 1504093896);
  58. TextDrawFont(Mobile[2], 1);
  59. TextDrawLetterSize(Mobile[2], 0.519999, 1.700000);
  60. TextDrawColor(Mobile[2], -1);
  61. TextDrawSetOutline(Mobile[2], 1);
  62. TextDrawSetProportional(Mobile[2], 1);
  63. TextDrawUseBox(Mobile[2], 1);
  64. TextDrawBoxColor(Mobile[2], 1431655880);
  65. TextDrawTextSize(Mobile[2], 31.000000, 18.000000);
  66.  
  67. //Button 2
  68. Mobile[3] = TextDrawCreate(543.000000, 364.000000, "2");
  69. TextDrawAlignment(Mobile[3], 2);
  70. TextDrawBackgroundColor(Mobile[3], 1504093896);
  71. TextDrawFont(Mobile[3], 1);
  72. TextDrawLetterSize(Mobile[3], 0.519999, 1.700000);
  73. TextDrawColor(Mobile[3], -1);
  74. TextDrawSetOutline(Mobile[3], 1);
  75. TextDrawSetProportional(Mobile[3], 1);
  76. TextDrawUseBox(Mobile[3], 1);
  77. TextDrawBoxColor(Mobile[3], 1431655880);
  78. TextDrawTextSize(Mobile[3], 31.000000, 18.000000);
  79.  
  80. //Button 3
  81. Mobile[4] = TextDrawCreate(592.000000, 361.000000, "3");
  82. TextDrawAlignment(Mobile[4], 2);
  83. TextDrawBackgroundColor(Mobile[4], 1504093896);
  84. TextDrawFont(Mobile[4], 1);
  85. TextDrawLetterSize(Mobile[4], 0.519999, 1.700000);
  86. TextDrawColor(Mobile[4], -1);
  87. TextDrawSetOutline(Mobile[4], 1);
  88. TextDrawSetProportional(Mobile[4], 1);
  89. TextDrawUseBox(Mobile[4], 1);
  90. TextDrawBoxColor(Mobile[4], 1431655880);
  91. TextDrawTextSize(Mobile[4], 31.000000, 18.000000);
  92.  
  93. //Button 5
  94. Mobile[5] = TextDrawCreate(543.000000, 394.000000, "5");
  95. TextDrawAlignment(Mobile[5], 2);
  96. TextDrawBackgroundColor(Mobile[5], 1504093896);
  97. TextDrawFont(Mobile[5], 1);
  98. TextDrawLetterSize(Mobile[5], 0.519999, 1.700000);
  99. TextDrawColor(Mobile[5], -1);
  100. TextDrawSetOutline(Mobile[5], 1);
  101. TextDrawSetProportional(Mobile[5], 1);
  102. TextDrawUseBox(Mobile[5], 1);
  103. TextDrawBoxColor(Mobile[5], 1431655880);
  104. TextDrawTextSize(Mobile[5], 31.000000, 18.000000);
  105.  
  106. //Button 5
  107. Mobile[6] = TextDrawCreate(493.000000, 391.000000, "4");
  108. TextDrawAlignment(Mobile[6], 2);
  109. TextDrawBackgroundColor(Mobile[6], 1504093896);
  110. TextDrawFont(Mobile[6], 1);
  111. TextDrawLetterSize(Mobile[6], 0.519999, 1.700000);
  112. TextDrawColor(Mobile[6], -1);
  113. TextDrawSetOutline(Mobile[6], 1);
  114. TextDrawSetProportional(Mobile[6], 1);
  115. TextDrawUseBox(Mobile[6], 1);
  116. TextDrawBoxColor(Mobile[6], 1431655880);
  117. TextDrawTextSize(Mobile[6], 31.000000, 18.000000);
  118.  
  119. //Button 6
  120. Mobile[7] = TextDrawCreate(592.000000, 391.000000, "6");
  121. TextDrawAlignment(Mobile[7], 2);
  122. TextDrawBackgroundColor(Mobile[7], 1504093896);
  123. TextDrawFont(Mobile[7], 1);
  124. TextDrawLetterSize(Mobile[7], 0.519999, 1.700000);
  125. TextDrawColor(Mobile[7], -1);
  126. TextDrawSetOutline(Mobile[7], 1);
  127. TextDrawSetProportional(Mobile[7], 1);
  128. TextDrawUseBox(Mobile[7], 1);
  129. TextDrawBoxColor(Mobile[7], 1431655880);
  130. TextDrawTextSize(Mobile[7], 31.000000, 18.000000);
  131.  
  132. //Button 8
  133. Mobile[8] = TextDrawCreate(543.000000, 423.000000, "8");
  134. TextDrawAlignment(Mobile[8], 2);
  135. TextDrawBackgroundColor(Mobile[8], 1504093896);
  136. TextDrawFont(Mobile[8], 1);
  137. TextDrawLetterSize(Mobile[8], 0.519999, 1.700000);
  138. TextDrawColor(Mobile[8], -1);
  139. TextDrawSetOutline(Mobile[8], 1);
  140. TextDrawSetProportional(Mobile[8], 1);
  141. TextDrawUseBox(Mobile[8], 1);
  142. TextDrawBoxColor(Mobile[8], 1431655880);
  143. TextDrawTextSize(Mobile[8], 31.000000, 18.000000);
  144.  
  145. //Button 7
  146. Mobile[9] = TextDrawCreate(493.000000, 421.000000, "7");
  147. TextDrawAlignment(Mobile[9], 2);
  148. TextDrawBackgroundColor(Mobile[9], 1504093896);
  149. TextDrawFont(Mobile[9], 1);
  150. TextDrawLetterSize(Mobile[9], 0.519999, 1.700000);
  151. TextDrawColor(Mobile[9], -1);
  152. TextDrawSetOutline(Mobile[9], 1);
  153. TextDrawSetProportional(Mobile[9], 1);
  154. TextDrawUseBox(Mobile[9], 1);
  155. TextDrawBoxColor(Mobile[9], 1431655880);
  156. TextDrawTextSize(Mobile[9], 31.000000, 18.000000);
  157.  
  158. //Button 9
  159. Mobile[10] = TextDrawCreate(592.000000, 421.000000, "9");
  160. TextDrawAlignment(Mobile[10], 2);
  161. TextDrawBackgroundColor(Mobile[10], 1504093896);
  162. TextDrawFont(Mobile[10], 1);
  163. TextDrawLetterSize(Mobile[10], 0.519999, 1.700000);
  164. TextDrawColor(Mobile[10], -1);
  165. TextDrawSetOutline(Mobile[10], 1);
  166. TextDrawSetProportional(Mobile[10], 1);
  167. TextDrawUseBox(Mobile[10], 1);
  168. TextDrawBoxColor(Mobile[10], 1431655880);
  169. TextDrawTextSize(Mobile[10], 31.000000, 18.000000);
  170.  
  171.  
  172. //UnDial Botton (Red)
  173. Mobile[11] = TextDrawCreate(589.000000, 342.000000, "=");
  174. TextDrawAlignment(Mobile[11], 2);
  175. TextDrawBackgroundColor(Mobile[11], 255);
  176. TextDrawFont(Mobile[11], 3);
  177. TextDrawLetterSize(Mobile[11], 0.519999, 0.4);
  178. TextDrawColor(Mobile[11], -16776961);
  179. TextDrawSetOutline(Mobile[11], 0);
  180. TextDrawSetProportional(Mobile[11], 1);
  181. TextDrawSetShadow(Mobile[11], 1);
  182. TextDrawUseBox(Mobile[11], 1);
  183. TextDrawBoxColor(Mobile[11], 1566399944);
  184. TextDrawTextSize(Mobile[11], 25.000000, 15.000000);
  185.  
  186. //Main Menu Button
  187. Mobile[12] = TextDrawCreate(542.000000, 342.000000, "+");
  188. TextDrawAlignment(Mobile[12], 2);
  189. TextDrawBackgroundColor(Mobile[12], 255);
  190. TextDrawFont(Mobile[12], 3);
  191. TextDrawLetterSize(Mobile[12], 0.519999, 0.4);
  192. TextDrawColor(Mobile[12], -1);
  193. TextDrawSetOutline(Mobile[12], 1);
  194. TextDrawSetProportional(Mobile[12], 1);
  195. TextDrawUseBox(Mobile[12], 1);
  196. TextDrawBoxColor(Mobile[12], 1566399944);
  197. TextDrawTextSize(Mobile[12], 25.000000, 15.000000);
  198.  
  199. //Dail Button (Green)
  200. Mobile[13] = TextDrawCreate(494.000000, 342.000000, "=");
  201. TextDrawAlignment(Mobile[13], 2);
  202. TextDrawBackgroundColor(Mobile[13], 255);
  203. TextDrawFont(Mobile[13], 3);
  204. TextDrawLetterSize(Mobile[13], 0.519999, 0.4);
  205. TextDrawColor(Mobile[13], 16711935);
  206. TextDrawSetOutline(Mobile[13], 0);
  207. TextDrawSetProportional(Mobile[13], 1);
  208. TextDrawSetShadow(Mobile[13], 1);
  209. TextDrawUseBox(Mobile[13], 1);
  210. TextDrawBoxColor(Mobile[13], 1566399944);
  211. TextDrawTextSize(Mobile[13], 25.000000, 15.000000);
  212.  
  213. //TurnoFF BUTTON
  214. Mobile[14] = TextDrawCreate(600.000000, 264.000000, "=");
  215. TextDrawAlignment(Mobile[14], 2);
  216. TextDrawBackgroundColor(Mobile[14], 255);
  217. TextDrawFont(Mobile[14], 3);
  218. TextDrawLetterSize(Mobile[14], 0.519999, 0.699998);
  219. TextDrawColor(Mobile[14], -16776961);
  220. TextDrawSetOutline(Mobile[14], 0);
  221. TextDrawSetProportional(Mobile[14], 1);
  222. TextDrawSetShadow(Mobile[14], 1);
  223. TextDrawUseBox(Mobile[14], 1);
  224. TextDrawBoxColor(Mobile[14], 1566399944);
  225. TextDrawTextSize(Mobile[14], 33.000000, 9.000000);
  226.  
  227. for(new i = 2;i < 15;i++)
  228. {
  229. TextDrawSetSelectable(Mobile[i], true);
  230. }
  231.  
  232. Mobile[15] = TextDrawCreate(562.000000, 280.000000, "Time");
  233. TextDrawBackgroundColor(Mobile[15], 255);
  234. TextDrawFont(Mobile[15], 1);
  235. TextDrawLetterSize(Mobile[15], 0.500000, 1.000000);
  236. TextDrawColor(Mobile[15], -1);
  237. TextDrawSetOutline(Mobile[15], 0);
  238. TextDrawSetProportional(Mobile[15], 1);
  239. TextDrawSetShadow(Mobile[15], 1);
  240.  
  241. for(new i = 0;i < MAX_PLAYERS;i++)
  242. {
  243.  
  244. MobileMain[i] = TextDrawCreate(490.000000, 296.000000, "_");
  245. TextDrawBackgroundColor(MobileMain[i], 255);
  246. TextDrawFont(MobileMain[i], 2);
  247. TextDrawLetterSize(MobileMain[i], 0.369999, 1.199999);
  248. TextDrawColor(MobileMain[i], 16711935);
  249. TextDrawSetOutline(MobileMain[i], 0);
  250. TextDrawSetProportional(MobileMain[i], 1);
  251. TextDrawSetShadow(MobileMain[i], 1);
  252.  
  253. MobileNum[i] = TextDrawCreate(492.000000, 313.000000, "_");
  254. TextDrawBackgroundColor(MobileNum[i], 255);
  255. TextDrawFont(MobileNum[i], 1);
  256. TextDrawLetterSize(MobileNum[i], 0.500000, 1.000000);
  257. TextDrawColor(MobileNum[i], 1721338568);
  258. TextDrawSetOutline(MobileNum[i], 0);
  259. TextDrawSetProportional(MobileNum[i], 1);
  260. TextDrawSetShadow(MobileNum[i], 1);
  261. }
  262. //============================================
  263. // Mobile TextDraw End #
  264. //============================================
  265. return 1;
  266. }
  267.  
  268.  
  269. public OnGameModeExit()
  270. {
  271. return 1;
  272. }
  273.  
  274.  
  275.  
  276. CMD:mobile(playerid,params[])
  277. {
  278. if(MobileOn[playerid] != 1)//Mobile not ON
  279. {
  280. new String[24],hour,mins,secs;
  281. MobileOn[playerid] = 1;
  282. MobileStats[playerid] = 1;
  283. gettime(hour,mins,secs);
  284. format(String,sizeof(String),"%d:%d",hour,mins);
  285. TextDrawSetString(Mobile[15],String);
  286. for(new i = 0;i < 16;i++)
  287. {
  288. TextDrawShowForPlayer(playerid,Mobile[i]);
  289. }
  290. TextDrawShowForPlayer(playerid,MobileMain[playerid]);
  291. TextDrawShowForPlayer(playerid,MobileNum[playerid]);
  292. SelectTextDraw(playerid, 0x22A5DDC8);
  293. }
  294. else if(MobileOn[playerid] == 1 && Select[playerid] == -1)
  295. {
  296. Select[playerid] = 1;
  297. SelectTextDraw(playerid, 0x22A5DDC8);
  298. }
  299. else if(MobileOn[playerid] == 1 && Select[playerid] != -1)
  300. {
  301. MobileOn[playerid] = 0;
  302. MobileStats[playerid] = 1;
  303. for(new i = 0;i < 16;i++)
  304. {
  305. TextDrawHideForPlayer(playerid,Mobile[i]);
  306. }
  307. TextDrawHideForPlayer(playerid,MobileMain[playerid]);
  308. TextDrawHideForPlayer(playerid,MobileNum[playerid]);
  309. TextDrawSetString(MobileNum[playerid],"_");
  310. CancelSelectTextDraw(playerid);
  311. }
  312. return 1;
  313. }
  314.  
  315. public OnPlayerClickTextDraw(playerid, Text:clickedid)
  316. {
  317. for(new i = 2;i <= 10;i++)
  318. {
  319. if(clickedid == Mobile[i])
  320. {
  321. switch(i)
  322. {
  323. //number response
  324. case 2:format(NewNum[playerid],10,"%s1",NewNum[playerid]);
  325. case 3:format(NewNum[playerid],10,"%s2",NewNum[playerid]);
  326. case 4:format(NewNum[playerid],10,"%s3",NewNum[playerid]);
  327. case 5:format(NewNum[playerid],10,"%s5",NewNum[playerid]);
  328. case 6:format(NewNum[playerid],10,"%s4",NewNum[playerid]);
  329. case 7:format(NewNum[playerid],10,"%s6",NewNum[playerid]);
  330. case 8:format(NewNum[playerid],10,"%s8",NewNum[playerid]);
  331. case 9:format(NewNum[playerid],10,"%s7",NewNum[playerid]);
  332. case 10:format(NewNum[playerid],10,"%s9",NewNum[playerid]);
  333. }
  334. if(MobileStats[playerid] == 1 && strlen(NewNum[playerid]) < 10)
  335. {
  336. TextDrawSetString(MobileNum[playerid],NewNum[playerid]);
  337. PlayerPlaySound(playerid, 21001, 0, 0, 0);
  338. break;
  339. }
  340. }
  341. }
  342. //Green Button
  343. if(clickedid == Mobile[13])
  344. {
  345. if(MobileStats[playerid] == 1 && !isnull(NewNum[playerid]))
  346. {
  347. MobileStats[playerid] = 2;
  348. TextDrawSetString(MobileMain[playerid],"Calling");
  349. PlayerPlaySound(playerid, 21002, 0, 0, 0);
  350. }
  351. }
  352. if(clickedid == Mobile[11])
  353. {
  354. if(MobileStats[playerid] == 2 || MobileStats[playerid] == 1 && !isnull(NewNum[playerid]))
  355. {
  356. MobileStats[playerid] = 1;
  357. NewNum[playerid] = "";
  358. TextDrawSetString(MobileNum[playerid],"_");
  359. TextDrawSetString(MobileMain[playerid],"_");
  360. PlayerPlaySound(playerid, 21002, 0, 0, 0);
  361. }
  362. }
  363. //Off button
  364. if(clickedid == Mobile[14])
  365. {
  366. Select[playerid] = -1;
  367. CancelSelectTextDraw(playerid);
  368. }
  369.  
  370. return 1;
  371. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement