BR_Gustavo

TextDraw de coin.

Aug 2nd, 2020
1,587
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. new TextDrawDinheiro[100][3];
  2.  
  3. public OnPlayerConnect(playerid)
  4. {
  5.     CriarTextDrawDinheiro(playerid);
  6.     return 1;
  7. }
  8. public OnPlayerDisconnect(playerid,reason)
  9. {
  10.     PlayerTextDrawHide(playerid,TextDrawDinheiro[playerid][0]);
  11.     PlayerTextDrawHide(playerid,TextDrawDinheiro[playerid][1]);
  12.     PlayerTextDrawDestroy(playerid,TextDrawDinheiro[playerid][0]);
  13.     PlayerTextDrawDestroy(playerid,TextDrawDinheiro[playerid][1]);
  14.     return 1;
  15. }
  16. forward CriarTextDrawDinheiro(playerid);
  17. public CriarTextDrawDinheiro(playerid)
  18. {
  19.     TextDrawDinheiro[playerid][0] = CreatePlayerTextDraw(playerid, 500.519805, 80.433288, "_"); // Dinheiro
  20.     PlayerTextDrawLetterSize(playerid, TextDrawDinheiro[playerid][0], 0.476368, 1.705000);
  21.     PlayerTextDrawTextSize(playerid, TextDrawDinheiro[playerid][0], 607.000000, -0.260000);
  22.     PlayerTextDrawAlignment(playerid, TextDrawDinheiro[playerid][0], 1);
  23.     PlayerTextDrawColor(playerid, TextDrawDinheiro[playerid][0], -1);
  24.     PlayerTextDrawUseBox(playerid, TextDrawDinheiro[playerid][0], 1);
  25.     PlayerTextDrawBoxColor(playerid, TextDrawDinheiro[playerid][0], 255);
  26.     PlayerTextDrawSetShadow(playerid, TextDrawDinheiro[playerid][0], 0);
  27.     PlayerTextDrawSetOutline(playerid, TextDrawDinheiro[playerid][0], 0);
  28.     PlayerTextDrawBackgroundColor(playerid, TextDrawDinheiro[playerid][0], 255);
  29.     PlayerTextDrawFont(playerid, TextDrawDinheiro[playerid][0], 1);
  30.     PlayerTextDrawSetProportional(playerid, TextDrawDinheiro[playerid][0], 1);
  31.     PlayerTextDrawSetShadow(playerid, TextDrawDinheiro[playerid][0], 0);
  32.  
  33.     TextDrawDinheiro[playerid][1] = CreatePlayerTextDraw(playerid, 499.897552, 76.833312, "~b~$00000000");
  34.     PlayerTextDrawLetterSize(playerid, TextDrawDinheiro[playerid][1], 0.586940, 2.195000);
  35.     PlayerTextDrawAlignment(playerid, TextDrawDinheiro[playerid][1], 1);
  36.     PlayerTextDrawColor(playerid, TextDrawDinheiro[playerid][1], -5963521);
  37.     PlayerTextDrawSetShadow(playerid, TextDrawDinheiro[playerid][1], 0);
  38.     PlayerTextDrawSetOutline(playerid, TextDrawDinheiro[playerid][1], 2);
  39.     PlayerTextDrawBackgroundColor(playerid, TextDrawDinheiro[playerid][1], 255);
  40.     PlayerTextDrawFont(playerid, TextDrawDinheiro[playerid][1], 3);
  41.     PlayerTextDrawSetProportional(playerid, TextDrawDinheiro[playerid][1], 1);
  42.     PlayerTextDrawSetShadow(playerid, TextDrawDinheiro[playerid][1], 0);
  43.     return 1;
  44. }
  45. forward //Local que carrega as informações do jogador
  46. {
  47.     new TextDrawXP[100],FormatarMsg[100];
  48.     TextDrawXP="";
  49.     if(PlayerInfo[playerid][bGCoins] < 10000000){ strcat(TextDrawXP,"0");}
  50.     if(PlayerInfo[playerid][bGCoins] < 1000000){ strcat(TextDrawXP,"0");}
  51.     if(PlayerInfo[playerid][bGCoins] < 100000){ strcat(TextDrawXP,"0");}
  52.     if(PlayerInfo[playerid][bGCoins] < 10000){ strcat(TextDrawXP,"0");}
  53.     if(PlayerInfo[playerid][bGCoins] < 1000){ strcat(TextDrawXP,"0");}
  54.     if(PlayerInfo[playerid][bGCoins] < 100){ strcat(TextDrawXP,"0");}
  55.     if(PlayerInfo[playerid][bGCoins] < 10){ strcat(TextDrawXP,"0");}
  56.     format(FormatarMsg,100,"~b~$%s%d",TextDrawXP,PlayerInfo[playerid][bGCoins]);
  57.     PlayerTextDrawShow(playerid,TextDrawDinheiro[playerid][0]);
  58.     PlayerTextDrawHide(playerid,TextDrawDinheiro[playerid][1]);
  59.     PlayerTextDrawSetString(playerid,TextDrawDinheiro[playerid][1],FormatarMsg);
  60.     PlayerTextDrawShow(playerid,TextDrawDinheiro[playerid][1]);
  61.     PlayerTextDrawShow(playerid,TextDrawDinheiro[playerid][1]);
  62.  
  63.     return 1;
  64. }
  65.  
  66. public DarCoin(playerid,Quantidade)
  67. {
  68.     new AtualizarDb[150],Valor,TextDrawXP[30],MsgValor[50],FormatarMsg[100];
  69.  
  70.     format(AtualizarDb,150,"SELECT * FROM `accounts` WHERE `Name` = '%s'",Nome(playerid));
  71.     mysql_query(MysqlDb,AtualizarDb,true);
  72.     if(cache_num_rows() >=1)
  73.     {
  74.         cache_get_value_int(0,"XP",Valor);
  75.     }
  76.     Valor += Quantidade;
  77.     format(AtualizarDb,150,"UPDATE `accounts` SET `XP` = '%d' WHERE `Nome` = '%s'",Valor,Nome(playerid)); //mude para coin
  78.     mysql_query(MysqlDb,AtualizarDb,false);
  79.     if(IsPlayerConnected(playerid))
  80.     {
  81.         PlayerInfo[playerid][bGCoins] += Quantidade;
  82.         TextDrawXP="";
  83.         if(PlayerInfo[playerid][bGCoins] < 10000000){ strcat(TextDrawXP,"0");}
  84.         if(PlayerInfo[playerid][bGCoins] < 1000000){ strcat(TextDrawXP,"0");}
  85.         if(PlayerInfo[playerid][bGCoins] < 100000){ strcat(TextDrawXP,"0");}
  86.         if(PlayerInfo[playerid][bGCoins] < 10000){ strcat(TextDrawXP,"0");}
  87.         if(PlayerInfo[playerid][bGCoins] < 1000){ strcat(TextDrawXP,"0");}
  88.         if(PlayerInfo[playerid][bGCoins] < 100){ strcat(TextDrawXP,"0");}
  89.         if(PlayerInfo[playerid][bGCoins] < 10){ strcat(TextDrawXP,"0");}
  90.         format(FormatarMsg,100,"~b~$%s%d",TextDrawXP,PlayerInfo[playerid][bGCoins]);
  91.         PlayerTextDrawHide(playerid,TextDrawDinheiro[playerid][1]);
  92.         PlayerTextDrawSetString(playerid,TextDrawDinheiro[playerid][1],FormatarMsg);
  93.         PlayerTextDrawShow(playerid,TextDrawDinheiro[playerid][1]);
  94.     }
  95.     return 1;
  96. }
RAW Paste Data