Advertisement
Guest User

Sistema de Gold [ZCMD]

a guest
Aug 19th, 2012
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.66 KB | None | 0 0
  1. #include <a_samp>
  2. #include <Dini>
  3. #include <zcmd>
  4.  
  5. //NEWS
  6. new Text:Textdraw1[MAX_PLAYERS];
  7. new Text:Textdraw0[MAX_PLAYERS];
  8. new Gold[MAX_PLAYERS];
  9. new tGold[MAX_PLAYERS];
  10. //DEFINES
  11. #define Cor 0xFF00EBFF
  12.  
  13. public OnPlayerSpawn(playerid)
  14. {
  15. SetTimerEx("Timer",60000,true,"i",playerid); //TROQUE O '10000' PELO TEMPO QUE ELE GANHA [0/3], NO CASO AQUI É 1 MINUTO, NA TEXTDRAWN TEM 0/3, E QUANDO CHEGAR A 3 MINUTOS GANHA 1 GOLD
  16. SetTimer("ActualizarTextDraws",true,60000);
  17. ///////////////////////// Gold ////////////////////////////////////////////////
  18. Textdraw0[playerid] = TextDrawCreate(551.000000, 291.000000, "Gold: 0");
  19. TextDrawBackgroundColor(Textdraw0[playerid], 255);
  20. TextDrawFont(Textdraw0[playerid], 3);
  21. TextDrawLetterSize(Textdraw0[playerid], 0.500000, 1.000000);
  22. TextDrawColor(Textdraw0[playerid], 65535);
  23. TextDrawSetOutline(Textdraw0[playerid], 0);
  24. TextDrawSetProportional(Textdraw0[playerid], 1);
  25. TextDrawSetShadow(Textdraw0[playerid], 1);
  26. //////////////////////////tGold//////////////////////////////////////////////
  27. Textdraw1[playerid] = TextDrawCreate(551.000000, 268.000000, "0/3");
  28. TextDrawBackgroundColor(Textdraw1[playerid], 255);
  29. TextDrawFont(Textdraw1[playerid], 1);
  30. TextDrawLetterSize(Textdraw1[playerid], 0.280000, 2.100000);
  31. TextDrawColor(Textdraw1[playerid], -16776961);
  32. TextDrawSetOutline(Textdraw1[playerid], 0);
  33. TextDrawSetProportional(Textdraw1[playerid], 1);
  34. TextDrawSetShadow(Textdraw1[playerid], 1);
  35. return 1;
  36. }
  37. forward ActualizarTextDraws();
  38. public ActualizarTextDraws()
  39. {
  40. new String[100];
  41.  
  42. for(new playerid = 0; playerid < MAX_PLAYERS; playerid ++)
  43. {
  44. if(IsPlayerConnected(playerid))
  45. {
  46. format(String, sizeof(String), "Gold: %d", Gold[playerid]);
  47. TextDrawSetString(Textdraw0[playerid], String);
  48. TextDrawShowForPlayer(playerid, Textdraw0[playerid]);
  49. format(String, sizeof(String), " %d / 3", tGold[playerid]);
  50. TextDrawSetString(Textdraw1[playerid], String);
  51. TextDrawShowForPlayer(playerid, Textdraw1[playerid]);
  52. }
  53. }
  54. }
  55. forward Timer(playerid);
  56. public Timer(playerid)
  57. {
  58. tGold[playerid]++;
  59. if(tGold[playerid] == 3)
  60. {
  61. Gold[playerid]++;
  62. SendClientMessage(playerid,Cor,"{FF3D3D}[INFO]{FFFFFF} Parabéns, você ganhou 1 Gold!");
  63. tGold[playerid] = 0;
  64. }
  65. return 1;
  66. }
  67. public OnPlayerConnect(playerid)
  68. {
  69. if(dini_Isset("Golds.dkn",PlayerName(playerid))) Gold[playerid] = (playerid,dini_Int("Golds.dkn",PlayerName(playerid)));
  70. return 1;
  71. }
  72. public OnPlayerDisconnect(playerid, reason)
  73. {
  74. dini_IntSet("Golds.dkn",PlayerName(playerid),Gold[playerid]);
  75. return 1;
  76. }
  77. public OnGameModeInit()
  78. {
  79. if(!fexist("Golds.dkn")) dini_Create("Golds.dkn");
  80. return 1;
  81. }
  82. stock PlayerName(playerid)
  83. {
  84. new PlayerNameGold[MAX_PLAYERS];
  85. GetPlayerName(playerid, PlayerNameGold, MAX_PLAYERS);
  86. return PlayerNameGold;
  87. }
  88.  
  89. CMD:premio(playerid)
  90. {
  91. ShowPlayerDialog(playerid, 2014, DIALOG_STYLE_LIST, "GOLD - Premio", "{7CFC00}R${F8F8FF}1.000.000,00{FFFF00} [1000 Gold's]", "Selecionar", "Fechar");
  92. return 1;
  93. }
  94.  
  95. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  96. {
  97.  
  98. if(dialogid == 2014)
  99. {
  100. if(response)
  101. {
  102. if(listitem == 0)
  103. {
  104. if(Gold[playerid] > 1000)
  105. {
  106. //COLOQUE AQUI OQUE ELE VAI GANHAR SE SELECINAR O ITEM, EXEMPLO:
  107. GivePlayerMoney(playerid, 1000000);
  108. Gold[playerid] = 0; //VAI ZERAR O GOLD
  109. }
  110. else
  111. {
  112. SendClientMessage(playerid, Cor, "{FF3D3D}[ERRO]{FFFFFF} Você não tem 1000 de Gold."); //MENSAGEM SE O PLAYER NÃO TIVER 1000 DE GOLD
  113. }
  114. }
  115. }
  116. return 1;
  117. }
  118.  
  119. return 1;
  120. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement