Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2011
298
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.  
  23.  
  24.  
  25.  
  26. public OnFilterScriptInit()
  27. {
  28. print("\n--------------------------------------");
  29. print(" Blank Filterscript by your name here");
  30. print("--------------------------------------\n");
  31. CreateObject(2942,1928.85253906,-1769.68933105,13.18977451,0.00000000,0.00000000,94.00000000); //object(kmb_atm1) (1)
  32. CreateObject(2942,1737.41809082,-1863.49975586,13.21789742,0.00000000,0.00000000,175.99902344); //object(kmb_atm1) (2)
  33. CreateObject(2942,1507.15856934,-1672.90502930,13.68977451,0.00000000,0.00000000,84.00000000); //object(kmb_atm1) (3)
  34. CreateObject(2942,1315.14697266,-1367.85705566,13.19184208,0.00000000,0.00000000,0.00000000); //object(kmb_atm1) (4)
  35. CreateObject(2942,1147.54638672,-1415.56066895,13.31543922,0.00000000,0.00000000,182.00000000); //object(kmb_atm1) (5)
  36. CreateObject(2942,542.93206787,-1264.94409180,16.32130814,0.00000000,0.00000000,217.99951172); //object(kmb_atm1) (6)
  37. CreateObject(2942,1034.24804688,-1339.46875000,13.36946201,0.00000000,0.00000000,182.00000000); //object(kmb_atm1) (7)
  38. CreateObject(2942,2013.38476562,-1451.24255371,13.19758701,0.00000000,0.00000000,0.00000000); //object(kmb_atm1) (8)
  39. CreateObject(2942,2128.33911133,-1769.59240723,13.20264721,0.00000000,0.00000000,268.00000000); //object(kmb_atm1) (9)
  40. CreateObject(2942,1722.44250488,-1613.41235352,13.18977451,0.00000000,0.00000000,182.00000000); //object(kmb_atm1) (10)
  41. CreateObject(2942,1415.26000977,-1693.91967773,13.18977451,0.00000000,0.00000000,69.99951172); //object(kmb_atm1) (11)
  42. return 1;
  43. }
  44.  
  45. public OnFilterScriptExit()
  46. {
  47. return 1;
  48. }
  49.  
  50.  
  51. public OnPlayerConnect(playerid)
  52. {
  53. format(file, sizeof(file), PERCORSO, Nome(playerid));
  54. if(!dini_Exists(file))
  55. {
  56. dini_Create(file);
  57. dini_IntSet(file, "ContoBancario", 0);
  58. }
  59. Atm[playerid][ContoBancario] = dini_Int(file, "ContoBancario");
  60. return 1;
  61. }
  62.  
  63. public OnPlayerDisconnect(playerid, reason)
  64. {
  65. format(file, sizeof(file), PERCORSO, Nome(playerid));
  66. dini_IntSet(file, "ContoBancario", Atm[playerid][ContoBancario]);
  67. return 1;
  68. }
  69.  
  70. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  71. {
  72. if(newkeys == KEY_WALK)
  73. {
  74. if(AUnAtm(playerid))
  75. {
  76. ShowPlayerDialog(playerid, ATMDIALOG, DIALOG_STYLE_LIST, "Scelta", "Ritira Soldi\nDeposita Soldi", "Scegli", "Annulla");
  77. }
  78. }
  79. return 1;
  80. }
  81.  
  82.  
  83. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  84. {
  85. if(dialogid == ATMDIALOG && response)
  86. {
  87. switch(listitem)
  88. {
  89. case 0:ShowPlayerDialog(playerid, ATMDIALOG+1, DIALOG_STYLE_INPUT, "Ritira", "Scrivi la quantità dei soldi da ritirare", "Ritira", "Annulla");
  90. case 1:ShowPlayerDialog(playerid, ATMDIALOG+2, DIALOG_STYLE_INPUT, "Deposita", "Scrivi la quantità dei soldi da depositare", "Deposita", "Annulla");
  91. }
  92. }
  93. if(dialogid == ATMDIALOG+1 && response)
  94. {
  95. new soldidarit = strval(inputtext);
  96. format(file, sizeof(file), PERCORSO, Nome(playerid));
  97. if(!response)return 0;
  98. 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");
  99. if(soldidarit < 1)return ShowPlayerDialog(playerid, ATMDIALOG+1, DIALOG_STYLE_INPUT, "Ritira", "Cifra Invalida!!\nScrivi la quantità dei soldi da ritirare", "Ritira", "Annulla");
  100. GivePlayerMoney(playerid, soldidarit);
  101. Atm[playerid][ContoBancario] = Atm[playerid][ContoBancario] - soldidarit;
  102. dini_IntSet(file, "ContoBancario", Atm[playerid][ContoBancario]);
  103. format(file, sizeof(file), "Hai ritirato $%d dal tuo conto bancario", soldidarit);
  104. }
  105. if(dialogid == ATMDIALOG+2 && response)
  106. {
  107. new soldidadep = strval(inputtext);
  108. format(file, sizeof(file), PERCORSO, Nome(playerid));
  109. if(!response)return 0;
  110. 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");
  111. if(soldidadep < 1)return ShowPlayerDialog(playerid, ATMDIALOG+1, DIALOG_STYLE_INPUT, "Ritira", "Cifra Invalida!!\nScrivi la quantità dei soldi da ritirare", "Ritira", "Annulla");
  112. GivePlayerMoney(playerid, -soldidadep);
  113. Atm[playerid][ContoBancario] = Atm[playerid][ContoBancario] + soldidadep;
  114. dini_IntSet(file, "ContoBancario", Atm[playerid][ContoBancario]);
  115. format(file, sizeof(file), "Hai depositato $%d dal tuo conto bancario", soldidadep);
  116. }
  117. return 1;
  118. }
  119.  
  120. stock Nome(playerid)
  121. {
  122. new Nomess[24];
  123. GetPlayerName(playerid, Nomess, sizeof(Nomess));
  124. return Nomess;
  125. }
  126.  
  127. stock AUnAtm(playerid)
  128. {
  129. if(IsPlayerInRangeOfPoint(playerid, 4.0, 542.5908,-1264.3429,16.6761) || IsPlayerInRangeOfPoint(playerid, 4.0, 1034.1892,-1338.8004,13.7266))
  130. {
  131. return 1;
  132. }
  133. else if(IsPlayerInRangeOfPoint(playerid, 4.0, 1415.8967,-1694.1305,13.5469) || IsPlayerInRangeOfPoint(playerid, 4.0, 1507.8236,-1672.9354,14.0469))
  134. {
  135. return 1;
  136. }
  137. else if(IsPlayerInRangeOfPoint(playerid, 4.0, 1929.5099,-1769.5654,13.5469) || IsPlayerInRangeOfPoint(playerid, 4.0, 2127.6775,-1769.5358,13.5598))
  138. {
  139. return 1;
  140. }
  141. else if(IsPlayerInRangeOfPoint(playerid, 4.0, 1737.3802,-1862.8267,13.5758) || IsPlayerInRangeOfPoint(playerid, 4.0, 1722.4089,-1612.7482,13.5469))
  142. {
  143. return 1;
  144. }
  145. else if(IsPlayerInRangeOfPoint(playerid, 4.0, 2013.3716,-1451.9055,13.5547))
  146. {
  147. return 1;
  148. }
  149. return 0;
  150. }
Advertisement
RAW Paste Data Copied
Advertisement