Guest User

mCoins 2.0

a guest
Dec 14th, 2017
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.09 KB | None | 0 0
  1. /*sistema feito totalmente por media
  2. não retire os créditos !
  3. Primeira release do Sistema
  4. Falta Fazer:
  5. Salvamento do Coins
  6. que está incompleto
  7. e adicionar um veículo a mas para testes
  8. */
  9. #include <a_samp>
  10. #include <zcmd>
  11. #include DOF2
  12. #include sscanf
  13. #define Pasta_Coins "Coins/%s.ini"
  14. enum mInfo
  15. {
  16. mCoins
  17. };
  18. new PlayerText:Textdraw0[MAX_PLAYERS];
  19. new PlayerInfo[MAX_PLAYERS][mInfo];
  20. #if defined FILTERSCRIPT
  21.  
  22. public OnFilterScriptInit()
  23. {
  24. print("\nSistema de mCoins Carregado com Sucesso\n");
  25. print(" Sistema feito por Media_Wallker");
  26. print("Não Retire os Créditos\n");
  27. return 1;
  28. }
  29.  
  30. public OnFilterScriptExit()
  31. {
  32. return 1;
  33. }
  34.  
  35. #else
  36.  
  37. main()
  38. {
  39. }
  40.  
  41. #endif
  42. public OnPlayerConnect(playerid)
  43. {
  44. CarregarPlayer(playerid);
  45. Textdraw0[playerid] = CreatePlayerTextDraw(playerid, 532.799865, 111.253349, "Coins: ~w~0");
  46. PlayerTextDrawLetterSize(playerid, Textdraw0[playerid], 0.449999, 1.600000);
  47. PlayerTextDrawAlignment(playerid, Textdraw0[playerid], 1);
  48. PlayerTextDrawColor(playerid, Textdraw0[playerid], 16777215);
  49. PlayerTextDrawSetShadow(playerid, Textdraw0[playerid], 0);
  50. PlayerTextDrawSetOutline(playerid, Textdraw0[playerid], 1);
  51. PlayerTextDrawBackgroundColor(playerid, Textdraw0[playerid], 51);
  52. PlayerTextDrawFont(playerid, Textdraw0[playerid], 1);
  53. PlayerTextDrawSetProportional(playerid, Textdraw0[playerid], 1);
  54. return 1;
  55. }
  56.  
  57. public OnPlayerDisconnect(playerid, reason)
  58. {
  59. SalvarPlayer(playerid);
  60. return 1;
  61. }
  62.  
  63. public OnPlayerSpawn(playerid)
  64. {
  65. SendClientMessage(playerid, -1, "{00FFFF} » {FFFFFF}Sistema Criado por Media_Wallker");
  66. SendClientMessage(playerid, -1, "{00FFFF} » {FFFFFF}Para ver os Comandos use /ajuda");
  67. PlayerTextDrawShow(playerid, Textdraw0[playerid]);
  68. return 1;
  69. }
  70. public OnPlayerUpdate(playerid)
  71. {
  72. new Coinsstr[128];
  73. format(Coinsstr,sizeof(Coinsstr),"Coins ~b~%d",PlayerInfo[playerid][mCoins]);
  74. PlayerTextDrawSetString(playerid, Textdraw0[playerid], Coinsstr);
  75. return 1;
  76. }
  77.  
  78. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  79. {
  80. if(dialogid == 2316)
  81. {
  82. if(response)
  83. {
  84. if(listitem == 0)
  85. {
  86. if(PlayerInfo[playerid][mCoins] < 1000)
  87. {
  88. SendClientMessage(playerid, -1, "Você não possui coins o suficiente");
  89. return 1;
  90. }
  91. new Float:p[4];
  92. SendClientMessage(playerid, -1, "{FF6347}Comprado:{9C9C9C}Você comprou uma Sanchez por 1.000 Coins");
  93. GetPlayerPos(playerid, p[0],p[1],p[2]);
  94. GetPlayerFacingAngle(playerid, p[3]);
  95. CreateVehicle(468, p[0],p[1],p[2],p[3], -1, -1, -1);
  96. PlayerInfo[playerid][mCoins] -= 1000;
  97. }
  98. if(listitem == 1)
  99. {
  100. if(PlayerInfo[playerid][mCoins] < 5000)
  101. {
  102. SendClientMessage(playerid, -1, "Você não possui coins o suficiente");
  103. return 1;
  104. }
  105. new Float:p[4];
  106. SendClientMessage(playerid, -1, "{FF6347}Comprado:{9C9C9C}Você comprou uma NRG-500 por 5000 Coins");
  107. GetPlayerPos(playerid, p[0],p[1],p[2]);
  108. GetPlayerFacingAngle(playerid, p[3]);
  109. CreateVehicle(522, p[0],p[1],p[2],p[3], -1, -1, -1);
  110. PlayerInfo[playerid][mCoins] -= 5000;
  111. }
  112. if(listitem == 2)
  113. {
  114. if(PlayerInfo[playerid][mCoins] < 5000)
  115. {
  116. SendClientMessage(playerid, -1, "Você não possui coins o suficiente");
  117. return 1;
  118. }
  119. new Float:p[4];
  120. SendClientMessage(playerid, -1, "{FF6347}Comprado:{9C9C9C}Você comprou um Buffalo por 5000 Coins");
  121. GetPlayerPos(playerid, p[0],p[1],p[2]);
  122. GetPlayerFacingAngle(playerid, p[3]);
  123. CreateVehicle(402, p[0],p[1],p[2],p[3], -1, -1, -1);
  124. PlayerInfo[playerid][mCoins] -= 5000;
  125. }
  126. if(listitem == 3)
  127. {
  128. if(PlayerInfo[playerid][mCoins] < 10000)
  129. {
  130. SendClientMessage(playerid, -1, "Você não possui coins o suficiente");
  131. return 1;
  132. }
  133. new Float:p[4];
  134. SendClientMessage(playerid, -1, "{FF6347}Comprado:{9C9C9C}Você comprou um Super-GT por 10000 Coins");
  135. GetPlayerPos(playerid, p[0],p[1],p[2]);
  136. GetPlayerFacingAngle(playerid, p[3]);
  137. CreateVehicle(506, p[0],p[1],p[2],p[3], -1, -1, -1);
  138. PlayerInfo[playerid][mCoins] -= 10000;
  139. }
  140. if(listitem == 4)
  141. {
  142. if(PlayerInfo[playerid][mCoins] < 9000)
  143. {
  144. SendClientMessage(playerid, -1, "Você não possui coins o suficiente");
  145. return 1;
  146. }
  147. new Float:p[4];
  148. SendClientMessage(playerid, -1, "{FF6347}Comprado:{9C9C9C}Você comprou um Turismo por 9000 Coins");
  149. GetPlayerPos(playerid, p[0],p[1],p[2]);
  150. GetPlayerFacingAngle(playerid, p[3]);
  151. CreateVehicle(451, p[0],p[1],p[2],p[3], -1, -1, -1);
  152. PlayerInfo[playerid][mCoins] -= 9000;
  153. }
  154. if(listitem == 5)
  155. {
  156. if(PlayerInfo[playerid][mCoins] < 15000)
  157. {
  158. SendClientMessage(playerid, -1, "Você não possui coins o suficiente");
  159. return 1;
  160. }
  161. SendClientMessage(playerid, -1, "{FF6347}Comprado:{9C9C9C}Você comprou um Jetpack por 15000 Coins");
  162. SetPlayerSpecialAction(playerid, 2);
  163. PlayerInfo[playerid][mCoins] -= 15000;
  164. }
  165. }
  166. }
  167. if(dialogid == 2318)
  168. {
  169. if(response)
  170. {
  171. if(listitem == 0)
  172. {
  173. ShowPlayerDialog(playerid, 2316, 5, "Comprar Veiculos",
  174. "Veiculo\tPreço(Coins)\n\
  175. Sanchez\t{33AA33}€{FFFFFF}1.000 Coins\n\
  176. NRG-500\t{33AA33}€{FFFFFF}5.000 Coins\n\
  177. Buffalo\t{33AA33}€{FFFFFF}5.000 Coins\n\
  178. Super-GT\t{33AA33}€{FFFFFF}10.000 Coins\n\
  179. Turismo\t{33AA33}€{FFFFFF}9.000 Coins\n\
  180. Jetpack\t{33AA33}€{FFFFFF}15.000 Coins", "Selecionar", "Sair");
  181. }
  182. if(listitem == 1)
  183. {
  184. ShowPlayerDialog(playerid, 2317, 5, "Comprar Armas",
  185. "Arma\tBalas\tPreço(Coins)\n\
  186. Deagle\t150\t{33AA33}€{FFFFFF}1.000 Coins\n\
  187. ShotGun\t160\t{33AA33}€{FFFFFF}2.000 Coins\n\
  188. MP5\t300\t{33AA33}€{FFFFFF}3.000 Coins\n\
  189. Ak-47\t450\t{33AA33}€{FFFFFF}4.000 Coins\n\
  190. Soco Ingês\t{FF0000}N/A\t{33AA33}€{FFFFFF}2.000 Coins", "Selecionar", "Sair");
  191. }
  192. }
  193. return 1;
  194. }
  195. if(dialogid == 2317)
  196. {
  197. if(response)
  198. {
  199. if(listitem == 0)
  200. {
  201. if(PlayerInfo[playerid][mCoins] < 1000)
  202. {
  203. SendClientMessage(playerid, -1, "Suas Coins São Insuficientes para Realizar a Compra.");
  204. return 1;
  205. }
  206. GivePlayerWeapon(playerid, 24, 150);
  207. PlayerInfo[playerid][mCoins] -= 1000;
  208. SendClientMessage(playerid, -1, "{FF6347}Comprado:{9C9C9C}Você comprou uma Deagle com 150 Balas");
  209. }
  210. if(listitem == 1)
  211. {
  212. if(PlayerInfo[playerid][mCoins] < 2000)
  213. {
  214. SendClientMessage(playerid, -1, "Suas Coins São Insuficientes para Realizar a Compra.");
  215. return 1;
  216. }
  217. GivePlayerWeapon(playerid, 25, 160);
  218. PlayerInfo[playerid][mCoins] -= 2000;
  219. SendClientMessage(playerid, -1, "{FF6347}Comprado:{9C9C9C}Você comprou uma ShotGun com 160 Balas");
  220. }
  221. if(listitem == 2)
  222. {
  223. if(PlayerInfo[playerid][mCoins] < 3000)
  224. {
  225. SendClientMessage(playerid, -1, "Suas Coins São Insuficientes para Realizar a Compra.");
  226. return 1;
  227. }
  228. GivePlayerWeapon(playerid, 29, 300);
  229. PlayerInfo[playerid][mCoins] -= 3000;
  230. SendClientMessage(playerid, -1, "{FF6347}Comprado:{9C9C9C}Você comprou uma MP5 com 300 Balas");
  231. }
  232. if(listitem == 3)
  233. {
  234. if(PlayerInfo[playerid][mCoins] < 4000)
  235. {
  236. SendClientMessage(playerid, -1, "Suas Coins São Insuficientes para Realizar a Compra.");
  237. return 1;
  238. }
  239. GivePlayerWeapon(playerid, 30, 450);
  240. PlayerInfo[playerid][mCoins] -= 4000;
  241. SendClientMessage(playerid, -1, "{FF6347}Comprado:{9C9C9C}Você comprou uma AK47 com 450 Balas");
  242. }
  243. if(listitem == 4)
  244. {
  245. if(PlayerInfo[playerid][mCoins] < 2000)
  246. {
  247. SendClientMessage(playerid, -1, "Suas Coins São Insuficientes para Realizar a Compra.");
  248. return 1;
  249. }
  250. GivePlayerWeapon(playerid, 1, 1);
  251. PlayerInfo[playerid][mCoins] -= 2000;
  252. SendClientMessage(playerid, -1, "{FF6347}Comprado:{9C9C9C}Você comprou um Soco Inglês");
  253. }
  254. }
  255. }
  256. return 1;
  257. }
  258.  
  259. stock GiveCoins(playerid,valor)
  260. {
  261. new antes = PlayerInfo[playerid][mCoins];
  262. PlayerInfo[playerid][mCoins] = antes+valor;
  263. return true;
  264. }
  265. CMD:darcoins(playerid, params[])
  266. {
  267. new para1;
  268. new level;
  269. if(sscanf(params, "ud", para1, level))
  270. {
  271. SendClientMessage(playerid, -1, "{FF6347}USE:{9C9C9C} /darcoins [id] [quantia]");
  272. return 1;
  273. }
  274. new giveplayer[MAX_PLAYER_NAME];
  275. new sendername[MAX_PLAYER_NAME];
  276. GetPlayerName(para1, giveplayer, sizeof(giveplayer));
  277. GetPlayerName(playerid, sendername, sizeof(sendername));
  278. if(IsPlayerConnected(para1))
  279. {
  280. if(IsPlayerAdmin(playerid))
  281. {
  282. if(para1 != INVALID_PLAYER_ID)
  283. {
  284. new string[128];
  285. format(string, sizeof string, "Você deu R$%d para %s", level, giveplayer);
  286. SendClientMessage(playerid, -1, string);
  287. format(string, sizeof string, "O Admin %s te deu R$%d", sendername, level);
  288. SendClientMessage(para1, -1, string);
  289. GiveCoins(para1, level);
  290. }
  291. }
  292. }
  293. return 1;
  294. }
  295. stock CarregarPlayer(playerid){
  296.  
  297. new Arquivo[50];
  298. format(Arquivo, sizeof Arquivo, "Coins/%s.ini", PlayerName(playerid));
  299.  
  300. if(DOF2_FileExists(Arquivo))
  301. {
  302. new str[22];
  303. for(new i = 0; i != MAX_PLAYERS; ++i){
  304.  
  305. format(str, sizeof str, "%d", i);
  306. PlayerInfo[playerid][mCoins] = DOF2_GetInt(Arquivo, str);
  307. }
  308. }
  309. return 1;
  310. }
  311. stock SalvarPlayer(playerid){
  312.  
  313. new Arquivo[50];
  314. format(Arquivo, sizeof Arquivo, "Coins/%s.ini", PlayerName(playerid));
  315.  
  316. new str[22];
  317. for(new i = 0; i != MAX_PLAYERS; i++)
  318. {
  319. format(str, sizeof str, "Coising = %d", i);
  320. DOF2_SetInt(Arquivo,str,PlayerInfo[playerid][mCoins]);
  321. }
  322. DOF2_SaveFile();
  323. return 1;
  324. }
  325. stock PlayerName(playerid)
  326. {
  327. new Name[MAX_PLAYER_NAME];
  328. GetPlayerName(playerid, Name, sizeof Name);
  329. return Name;
  330. }
  331. CMD:comprar(playerid)
  332. {
  333. new string[1024];
  334. format(string, sizeof string, "{00FFFF} » {FFFFFF}Comprar Veículos\n{00FFFF} » {FFFFFF}Comprar Armas");
  335. ShowPlayerDialog(playerid, 2318, DIALOG_STYLE_LIST, "Menu Coins",string,"Selecionar", "Sair");
  336. return 1;
  337. }
  338. CMD:creditos(playerid)
  339. {
  340. SendClientMessage(playerid, -1, "{00FFFF} » {FFFFFF}Media_Wallker Pela Criação do Sistema");
  341. return 1;
  342. }
  343. CMD:ajuda(playerid)
  344. {
  345. SendClientMessage(playerid, -1, "{00FFFF} » {FFFFFF}/comprar,/creditos,/darcoins");
  346. return 1;
  347. }
Advertisement
Add Comment
Please, Sign In to add comment