Advertisement
Guest User

Untitled

a guest
Nov 14th, 2016
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.86 KB | None | 0 0
  1. #include <a_samp>
  2. #include <dini>
  3. #include <zcmd>
  4.  
  5. new selectedwatchslot[MAX_PLAYERS];
  6.  
  7.  
  8. public OnFilterScriptInit()
  9. {
  10. CreatePickup(1239, 1, 1471.2572,-1770.7183,18.7958, -1);
  11. Create3DTextLabel("((/buywatch))", 0x008080FF, 1471.2572,-1770.7183,19.5958, 40.0, 0, 0);
  12. return 1;
  13. }
  14.  
  15.  
  16. public OnPlayerConnect(playerid)
  17. {
  18. printf("debug");
  19. SetPlayerPos(playerid,1471.2572,-1770.7183,19.7958);
  20. new file[56];
  21. format(file,sizeof(file),"watches/%s.txt",PlayerName(playerid));
  22. if(!dini_Exists(file))
  23. {
  24. dini_Create(file);
  25. dini_IntSet(file,"watch0",0);
  26. dini_Set(file,"watchname0","None");
  27. dini_IntSet(file,"watch1",0);
  28. dini_Set(file,"watchname1","None");
  29. dini_IntSet(file,"watch2",0);
  30. dini_Set(file,"watchname2","None");
  31. dini_IntSet(file,"watch3",0);
  32. dini_Set(file,"watchname3","None");
  33. dini_IntSet(file,"watch4",0);
  34. dini_Set(file,"watchname4","None");
  35. return 1;
  36. }
  37. return 1;
  38. }
  39.  
  40. CMD:buywatch(playerid,params[])
  41. {
  42. if(IsPlayerInRangeOfPoint(playerid, 3.0, 1471.2572,-1770.7183,18.7958))
  43. {
  44. ShowPlayerDialog(playerid,457,DIALOG_STYLE_LIST,"Watches (20k)","Gold Watch\nSilver Watch\nBronze Watch\nRed Watch\nGreen Watch\nBlue Watch\nFunky Watch","Buy","Cancel");
  45. return 1;
  46. }
  47. else
  48. {
  49. SetPlayerCheckpoint(playerid, 1471.2572,-1770.7183,18.7958, 1.0);
  50. SendClientMessage(playerid,0xFFFFFFFF,"You need to go at the watch shop at Mall.");
  51. return 1;
  52. }
  53. }
  54.  
  55. CMD:watch(playerid, params[])
  56. {
  57. new file[56];
  58. format(file,sizeof(file),"watches/%s.txt",PlayerName(playerid));
  59. new messaggio[256];
  60. format(messaggio,sizeof(messaggio),"%s\n%s\n%s\n%s\n%s",dini_Get(file,"watchname0"),dini_Get(file,"watchname1"),dini_Get(file,"watchname2"),dini_Get(file,"watchname3"),dini_Get(file,"watchname4"));
  61. ShowPlayerDialog(playerid,459,DIALOG_STYLE_LIST,"Select Slot",messaggio,"Wear","Unwear");
  62. return 1;
  63. }
  64.  
  65. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  66. {
  67. if(dialogid == 457)
  68. {
  69. if(response)
  70. {
  71. if(GetPlayerMoney(playerid)<20000) return SendClientMessage(playerid,0xFFFFFFFF,"You don't have enough money!");
  72. new file[56];
  73. format(file,sizeof(file),"watches/%s.txt",PlayerName(playerid));
  74. new messaggio[256];
  75. format(messaggio,sizeof(messaggio),"%s\n%s\n%s\n%s\n%s",dini_Get(file,"watchname0"),dini_Get(file,"watchname1"),dini_Get(file,"watchname2"),dini_Get(file,"watchname3"),dini_Get(file,"watchname4"));
  76. ShowPlayerDialog(playerid,458,DIALOG_STYLE_LIST,"Select Slot",messaggio,"Replace","Cancel");
  77. selectedwatchslot[playerid]=listitem;
  78. return 1;
  79. }
  80. }
  81. if(dialogid == 458)
  82. {
  83. if(response)
  84. {
  85. new file[56];
  86. format(file,sizeof(file),"watches/%s.txt",PlayerName(playerid));
  87. if(selectedwatchslot[playerid]==0)
  88. {
  89. new stringo[56];
  90. format(stringo,sizeof(stringo),"watchname%d",listitem);
  91. dini_Set(file,stringo,"Golden Watch");
  92. new stringo2[56];
  93. format(stringo2,sizeof(stringo2),"watch%d",listitem);
  94. dini_IntSet(file,stringo2,19039);
  95. SetPlayerAttachedObject(playerid, 9, 19039, 14, 0.239999, -0.002999, -0.012000, 0.000000, 80.699989, -76.400024, 0.999000, 1.440999, 1.000000);
  96. EditAttachedObject(playerid, 9);
  97. GivePlayerMoney(playerid, -20000);
  98. }
  99. if(selectedwatchslot[playerid]==1)
  100. {
  101. new stringo[56];
  102. format(stringo,sizeof(stringo),"watchname%d",listitem);
  103. dini_Set(file,stringo,"Silver Watch");
  104. new stringo2[56];
  105. format(stringo2,sizeof(stringo2),"watch%d",listitem);
  106. dini_IntSet(file,stringo2,19040);
  107. SetPlayerAttachedObject(playerid, 9, 19040, 14, 0.239999, -0.002999, -0.012000, 0.000000, 80.699989, -76.400024, 0.999000, 1.440999, 1.000000);
  108. EditAttachedObject(playerid, 9);
  109. GivePlayerMoney(playerid, -20000);
  110. }
  111. if(selectedwatchslot[playerid]==2)
  112. {
  113. new stringo[56];
  114. format(stringo,sizeof(stringo),"watchname%d",listitem);
  115. dini_Set(file,stringo,"Bronze Watch");
  116. new stringo2[56];
  117. format(stringo2,sizeof(stringo2),"watch%d",listitem);
  118. dini_IntSet(file,stringo2,19041);
  119. SetPlayerAttachedObject(playerid, 9, 19041, 14, 0.239999, -0.002999, -0.012000, 0.000000, 80.699989, -76.400024, 0.999000, 1.440999, 1.000000);
  120. EditAttachedObject(playerid, 9);
  121. GivePlayerMoney(playerid, -20000);
  122. }
  123. if(selectedwatchslot[playerid]==3)
  124. {
  125. new stringo[56];
  126. format(stringo,sizeof(stringo),"watchname%d",listitem);
  127. dini_Set(file,stringo,"Red Watch");
  128. new stringo2[56];
  129. format(stringo2,sizeof(stringo2),"watch%d",listitem);
  130. dini_IntSet(file,stringo2,19045);
  131. SetPlayerAttachedObject(playerid, 9, 19045, 14, 0.239999, -0.002999, -0.012000, 0.000000, 80.699989, -76.400024, 0.999000, 1.440999, 1.000000);
  132. EditAttachedObject(playerid, 9);
  133. GivePlayerMoney(playerid, -20000);
  134. }
  135. if(selectedwatchslot[playerid]==4)
  136. {
  137. new stringo[56];
  138. format(stringo,sizeof(stringo),"watchname%d",listitem);
  139. dini_Set(file,stringo,"Green Watch");
  140. new stringo2[56];
  141. format(stringo2,sizeof(stringo2),"watch%d",listitem);
  142. dini_IntSet(file,stringo2,19046);
  143. SetPlayerAttachedObject(playerid, 9, 19046, 14, 0.239999, -0.002999, -0.012000, 0.000000, 80.699989, -76.400024, 0.999000, 1.440999, 1.000000);
  144. EditAttachedObject(playerid, 9);
  145. GivePlayerMoney(playerid, -20000);
  146. }
  147. if(selectedwatchslot[playerid]==5)
  148. {
  149. new stringo[56];
  150. format(stringo,sizeof(stringo),"watchname%d",listitem);
  151. dini_Set(file,stringo,"Blue Watch");
  152. new stringo2[56];
  153. format(stringo2,sizeof(stringo2),"watch%d",listitem);
  154. dini_IntSet(file,stringo2,19047);
  155. SetPlayerAttachedObject(playerid, 9, 19047, 14, 0.239999, -0.002999, -0.012000, 0.000000, 80.699989, -76.400024, 0.999000, 1.440999, 1.000000);
  156. EditAttachedObject(playerid, 9);
  157. GivePlayerMoney(playerid, -20000);
  158. }
  159. if(selectedwatchslot[playerid]==6)
  160. {
  161. new stringo[56];
  162. format(stringo,sizeof(stringo),"watchname%d",listitem);
  163. dini_Set(file,stringo,"Funky Watch");
  164. new stringo2[56];
  165. format(stringo2,sizeof(stringo2),"watch%d",listitem);
  166. dini_IntSet(file,stringo2,19049);
  167. SetPlayerAttachedObject(playerid, 9, 19049, 14, 0.239999, -0.002999, -0.012000, 0.000000, 80.699989, -76.400024, 0.999000, 1.440999, 1.000000);
  168. EditAttachedObject(playerid, 9);
  169. GivePlayerMoney(playerid, -20000);
  170. }
  171. }
  172. }
  173. if(dialogid == 459)
  174. {
  175. new file[56];
  176. format(file,sizeof(file),"watches/%s.txt",PlayerName(playerid));
  177. if(response)
  178. {
  179. if(IsPlayerAttachedObjectSlotUsed(playerid, 9))
  180. {
  181. SendClientMessage(playerid,0xFFFFFFFF,"You need to unwear the watch you are wearing to wear this one.");
  182. return 1;
  183. }
  184. new stringo[56];
  185. format(stringo,sizeof(stringo),"watch%d",listitem);
  186. if(dini_Int(file,stringo)==0) return SendClientMessage(playerid,0xFFFFFFFF,"There is no watch in this slot!");
  187. SetPlayerAttachedObject(playerid, 9, dini_Int(file,stringo), 14, 0.239999, -0.002999, -0.012000, 0.000000, 80.699989, -76.400024, 0.999000, 1.440999, 1.000000);
  188. EditAttachedObject(playerid, 9);
  189. }
  190. else
  191. {
  192. if(IsPlayerAttachedObjectSlotUsed(playerid, 9)) RemovePlayerAttachedObject(playerid, 9);
  193. return 1;
  194. }
  195. }
  196. return 1;
  197. }
  198.  
  199. stock PlayerName(playerid)
  200. {
  201. new name[MAX_PLAYER_NAME];
  202. GetPlayerName(playerid, name, MAX_PLAYER_NAME);
  203. return name;
  204. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement