Advertisement
Guest User

Untitled

a guest
Jul 24th, 2011
476
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.63 KB | None | 0 0
  1. /*
  2. * ATM System, Script 2011..
  3. * FilterScript Creato Interamente da S&C AkA Cirs Carandente, Non rimuovere i crediti!!
  4. * Ringraziamenti: SA-MP Team Per SAMP e a_samp.inc xD
  5. * Ringraziamenti: Drac0blue per Dini.
  6. */
  7.  
  8. #include <a_samp>
  9. #include <dini>
  10.  
  11. enum ATM
  12. {
  13. ContoBancario
  14. }
  15. new Atm[MAX_PLAYERS][ATM];new file[150];
  16.  
  17. //===========VARI-DEFINE=============
  18. /*Define Percorso file*/
  19. #define PERCORSO "SCATM/%s.ini"
  20. /*Define Dialog*/
  21. #define ATMDIALOG 5
  22. #define GIVEATMMONEY 50
  23. #define BONIFICO 60
  24.  
  25.  
  26.  
  27. public OnFilterScriptInit()
  28. {
  29. print("\n--------------------------------------");
  30. print(" Blank Filterscript by your name here");
  31. print("--------------------------------------\n");
  32.  
  33. //======Object ATM Per tutta LS======
  34. CreateObject(2942, 1928.85253906, -1769.68933105, 13.18977451, 0.00000000, 0.00000000, 94.00000000);
  35. CreateObject(2942, 1737.41809082, -1863.49975586, 13.21789742, 0.00000000, 0.00000000, 175.99902344);
  36. CreateObject(2942, 1507.15856934, -1672.90502930, 13.68977451, 0.00000000, 0.00000000, 84.00000000);
  37. CreateObject(2942, 1315.14697266, -1367.85705566, 13.19184208, 0.00000000, 0.00000000, 0.00000000);
  38. CreateObject(2942, 1147.54638672, -1415.56066895, 13.31543922, 0.00000000, 0.00000000, 182.00000000);
  39. CreateObject(2942, 542.93206787, -1264.94409180, 16.32130814, 0.00000000, 0.00000000, 217.99951172);
  40. CreateObject(2942, 1034.24804688, -1339.46875000, 13.36946201, 0.00000000, 0.00000000, 182.00000000);
  41. CreateObject(2942, 2013.38476562, -1451.24255371, 13.19758701, 0.00000000, 0.00000000, 0.00000000);
  42. CreateObject(2942, 2128.33911133, -1769.59240723, 13.20264721, 0.00000000, 0.00000000, 268.00000000);
  43. CreateObject(2942, 1722.44250488, -1613.41235352, 13.18977451, 0.00000000, 0.00000000, 182.00000000);
  44. CreateObject(2942, 1415.26000977, -1693.91967773, 13.18977451, 0.00000000, 0.00000000, 69.99951172);
  45.  
  46. //======Icone Soldi Per ATM======||
  47. CreatePickup(1274, 24, 542.5908, -1264.3429, 16.6761);
  48. CreatePickup(1274, 24, 1034.1892, -1338.8004, 13.7266);
  49. CreatePickup(1274, 24, 1147.4930, -1414.8746, 13.6727);
  50. CreatePickup(1274, 24, 1315.1608, -1368.5203, 13.5577);
  51. CreatePickup(1274, 24, 1415.8967, -1694.1305, 13.5469);
  52. CreatePickup(1274, 24, 1507.8236, -1672.9354, 14.0469);
  53. CreatePickup(1274, 24, 1929.5099, -1769.5654, 13.546);
  54. CreatePickup(1274, 24, 2127.6775, -1769.5358, 13.5598);
  55. CreatePickup(1274, 24, 1737.3802, -1862.8267, 13.5758);
  56. CreatePickup(1274, 24, 1722.4089, -1612.7482, 13.5469);
  57. CreatePickup(1274, 24, 2013.3716, -1451.9055, 13.5547);
  58.  
  59. //======3D Text Label======||
  60. Create3DTextLabel("Premi ALT per aprire il menu del tuo conto bancario", 0x00ff00ff, 542.5908,-1264.3429,16.6761, 20.0,0);
  61. Create3DTextLabel("Premi ALT per aprire il menu del tuo conto bancario", 0x00ff00ff, 1034.1892,-1338.8004,13.7266, 20.0,0);
  62. Create3DTextLabel("Premi ALT per aprire il menu del tuo conto bancario", 0x00ff00ff, 1147.4930,-1414.8746,13.6727, 20.0,0);
  63. Create3DTextLabel("Premi ALT per aprire il menu del tuo conto bancario", 0x00ff00ff, 1315.1608,-1368.5203,13.5577, 20.0,0);
  64. Create3DTextLabel("Premi ALT per aprire il menu del tuo conto bancario", 0x00ff00ff, 1415.8967,-1694.1305,13.5469, 20.0,0);
  65. Create3DTextLabel("Premi ALT per aprire il menu del tuo conto bancario", 0x00ff00ff, 1507.8236,-1672.9354,14.0469, 20.0,0);
  66. Create3DTextLabel("Premi ALT per aprire il menu del tuo conto bancario", 0x00ff00ff, 1929.5099,-1769.5654,13.546, 20.0,0);
  67. Create3DTextLabel("Premi ALT per aprire il menu del tuo conto bancario", 0x00ff00ff, 2127.6775,-1769.5358,13.5598, 20.0,0);
  68. Create3DTextLabel("Premi ALT per aprire il menu del tuo conto bancario", 0x00ff00ff, 1737.3802,-1862.8267,13.5758, 20.0,0);
  69. Create3DTextLabel("Premi ALT per aprire il menu del tuo conto bancario", 0x00ff00ff, 1722.4089,-1612.7482,13.5469, 20.0,0);
  70. Create3DTextLabel("Premi ALT per aprire il menu del tuo conto bancario", 0x00ff00ff, 2013.3716,-1451.9055,13.5547, 20.0,0);
  71.  
  72. return 1;
  73. }
  74.  
  75. public OnFilterScriptExit()
  76. {
  77. return 1;
  78. }
  79.  
  80.  
  81. public OnPlayerConnect(playerid)
  82. {
  83. format(file, sizeof(file), PERCORSO, Nome(playerid));
  84. if(!dini_Exists(file))
  85. {
  86. dini_Create(file);
  87. dini_IntSet(file, "ContoBancario", 0);
  88. }
  89. Atm[playerid][ContoBancario] = dini_Int(file, "ContoBancario");
  90. return 1;
  91. }
  92.  
  93. public OnPlayerDisconnect(playerid, reason)
  94. {
  95. format(file, sizeof(file), PERCORSO, Nome(playerid));
  96. dini_IntSet(file, "ContoBancario", Atm[playerid][ContoBancario]);
  97. return 1;
  98. }
  99.  
  100. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  101. {
  102. if(newkeys == KEY_WALK)
  103. {
  104. if(AUnAtm(playerid))
  105. {
  106. ShowPlayerDialog(playerid, ATMDIALOG, DIALOG_STYLE_LIST, "Scelta", "Ritira Soldi\nDeposita Soldi\nBonifico\nBilancio Bancario", "Scegli", "Annulla");
  107. }
  108. }
  109. return 1;
  110. }
  111.  
  112. public OnPlayerCommandText(playerid, cmdtext[])
  113. {
  114. if (strcmp("/givemoney", cmdtext, true, 10) == 0)
  115. {
  116. if(!IsPlayerAdmin(playerid))return 0;
  117. ShowPlayerDialog(playerid, GIVEATMMONEY, DIALOG_STYLE_INPUT, "ID Player", "Inserisci l'Id del player a cui givare i soldi", "Giva", "Annulla");
  118. return 1;
  119. }
  120. return 0;
  121. }
  122.  
  123. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  124. {
  125. if(dialogid == ATMDIALOG && response)
  126. {
  127. switch(listitem)
  128. {
  129. case 0:ShowPlayerDialog(playerid, ATMDIALOG+1, DIALOG_STYLE_INPUT, "Ritira", "Scrivi la quantità dei soldi da ritirare", "Ritira", "Annulla");
  130. case 1:ShowPlayerDialog(playerid, ATMDIALOG+2, DIALOG_STYLE_INPUT, "Deposita", "Scrivi la quantità dei soldi da depositare", "Deposita", "Annulla");
  131. case 2:ShowPlayerDialog(playerid, BONIFICO, DIALOG_STYLE_INPUT, "ID", "Inserisci l'ID del player a cui bonificare i soldi", "Giva", "Annulla");
  132. case 3:
  133. {
  134. format(file, sizeof(file), "Attualmente, in banca hai: $%d", Atm[playerid][ContoBancario]);
  135. SendClientMessage(playerid, -1, file);
  136. format(file, sizeof(file), "Attualmente, in banca hai: $%d", Atm[playerid][ContoBancario]);
  137. ShowPlayerDialog(playerid, 999+123, DIALOG_STYLE_INPUT, "Stato", file, "Ok", "Ok");
  138. }
  139. }
  140. }
  141. if(dialogid == ATMDIALOG+1 && response)
  142. {
  143. new soldidarit = strval(inputtext);
  144. format(file, sizeof(file), PERCORSO, Nome(playerid));
  145. if(!response)return 0;
  146. if(soldidarit > Atm[playerid][ContoBancario])return ShowPlayerDialog(playerid, ATMDIALOG+1, DIALOG_STYLE_INPUT, "Ritira", "Non hai tutti questi soldi!!\nScrivi la quantità dei soldi da ritirare", "Ritira", "Annulla");
  147. if(soldidarit < 1)return ShowPlayerDialog(playerid, ATMDIALOG+1, DIALOG_STYLE_INPUT, "Ritira", "Cifra Invalida!!\nScrivi la quantità dei soldi da ritirare", "Ritira", "Annulla");
  148. GivePlayerMoney(playerid, soldidarit);
  149. Atm[playerid][ContoBancario] = Atm[playerid][ContoBancario] - soldidarit;
  150. dini_IntSet(file, "ContoBancario", Atm[playerid][ContoBancario]);
  151. format(file, sizeof(file), "Hai ritirato $%d dal tuo conto bancario", soldidarit);
  152. SendClientMessage(playerid, -1, file);
  153. }
  154. if(dialogid == ATMDIALOG+2 && response)
  155. {
  156. new soldidadep = strval(inputtext);
  157. format(file, sizeof(file), PERCORSO, Nome(playerid));
  158. if(!response)return 0;
  159. if(soldidadep > GetPlayerMoney(playerid))return ShowPlayerDialog(playerid, ATMDIALOG+1, DIALOG_STYLE_INPUT, "Ritira", "Non hai tutti questi soldi!!\nScrivi la quantità dei soldi da ritirare", "Ritira", "Annulla");
  160. if(soldidadep < 1)return ShowPlayerDialog(playerid, ATMDIALOG+1, DIALOG_STYLE_INPUT, "Ritira", "Cifra Invalida!!\nScrivi la quantità dei soldi da ritirare", "Ritira", "Annulla");
  161. GivePlayerMoney(playerid, -soldidadep);
  162. Atm[playerid][ContoBancario] = Atm[playerid][ContoBancario] + soldidadep;
  163. dini_IntSet(file, "ContoBancario", Atm[playerid][ContoBancario]);
  164. format(file, sizeof(file), "Hai depositato $%d dal tuo conto bancario", soldidadep);
  165. SendClientMessage(playerid, -1, file);
  166. }
  167. if(dialogid == GIVEATMMONEY && response)
  168. {
  169. if(!response)return 0;
  170. new ID = strval(inputtext);
  171. SetPVarInt(playerid, "IDDaGivare", ID);
  172. ShowPlayerDialog(playerid, GIVEATMMONEY+1, DIALOG_STYLE_INPUT, "Soldi", "Inserisci la quantità dei soldi da dare al player", "Giva", "Annulla");
  173. }
  174. if(dialogid == GIVEATMMONEY+1 && response)
  175. {
  176. if(!response)return 0;
  177. new Soldi = strval(inputtext);
  178. Atm[GetPVarInt(playerid, "IDDaGivare")][ContoBancario] = Atm[GetPVarInt(playerid, "IDDaGivare")][ContoBancario]+Soldi;
  179. }
  180. //============BONIFICO====================
  181. if(dialogid == BONIFICO && response)
  182. {
  183. if(!response)return 0;
  184. new ID = strval(inputtext);
  185. SetPVarInt(playerid, "IDGivare", ID);
  186. ShowPlayerDialog(playerid, BONIFICO+1, DIALOG_STYLE_INPUT, "Soldi", "Inserisci la quantità dei soldi da bonificare al player", "Bonifica", "Annulla");
  187. }
  188. if(dialogid == BONIFICO+1 && response)
  189. {
  190. new Soldi = strval(inputtext);
  191. if(!response)return 0;
  192. if(Soldi > Atm[playerid][ContoBancario])return ShowPlayerDialog(playerid, BONIFICO+2, DIALOG_STYLE_INPUT, "Soldi", "Non hai tutti questi soldi sul tuo conto bancario\nInserisci la quantità dei soldi da bonificare al player", "Bonifica", "Annulla");
  193. Atm[GetPVarInt(playerid, "IDGivare")][ContoBancario] = Atm[GetPVarInt(playerid, "IDGivare")][ContoBancario]+Soldi;
  194. Atm[playerid][ContoBancario] -= Soldi;
  195. SendClientMessage(GetPVarInt(playerid, "IDGivare"), -1, "Hai ricevuto un bonifico, vai a un qualsiasi ATM per ritirarlo");
  196. }
  197. return 1;
  198. }
  199.  
  200. stock Nome(playerid)
  201. {
  202. new Nomess[24];
  203. GetPlayerName(playerid, Nomess, sizeof(Nomess));
  204. return Nomess;
  205. }
  206.  
  207. stock AUnAtm(playerid)
  208. {
  209. if(IsPlayerInRangeOfPoint(playerid, 4.0, 542.5908,-1264.3429,16.6761) || IsPlayerInRangeOfPoint(playerid, 4.0, 1034.1892,-1338.8004,13.7266))
  210. {
  211. return 1;
  212. }
  213. else if(IsPlayerInRangeOfPoint(playerid, 4.0, 1147.4930,-1414.8746,13.6727) || IsPlayerInRangeOfPoint(playerid, 4.0, 1315.1608,-1368.5203,13.5577))
  214. {
  215. return 1;
  216. }
  217. else if(IsPlayerInRangeOfPoint(playerid, 4.0, 1415.8967,-1694.1305,13.5469) || IsPlayerInRangeOfPoint(playerid, 4.0, 1507.8236,-1672.9354,14.0469))
  218. {
  219. return 1;
  220. }
  221. else if(IsPlayerInRangeOfPoint(playerid, 4.0, 1929.5099,-1769.5654,13.546) || IsPlayerInRangeOfPoint(playerid, 4.0, 2127.6775,-1769.5358,13.5598))
  222. {
  223. return 1;
  224. }
  225. else if(IsPlayerInRangeOfPoint(playerid, 4.0, 1737.3802,-1862.8267,13.5758) || IsPlayerInRangeOfPoint(playerid, 4.0, 1722.4089,-1612.7482,13.5469))
  226. {
  227. return 1;
  228. }
  229. else if(IsPlayerInRangeOfPoint(playerid, 4.0, 2013.3716,-1451.9055,13.5547))
  230. {
  231. return 1;
  232. }
  233. return 0;
  234. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement