Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. //------------------------------------------------------------------------------------------//
  2.  
  3. //                                  como Fazer Text-Draws                                   //
  4. //------------------------------------------------------------------------------------------//
  5.  
  6. /*
  7. Se você quiser cirar um texto em qualquer lugar (Vamos Fazer um Relogio)
  8. */
  9.  
  10. forward Clock();//crie para a callback do settimer e para atualizar o relogio.
  11. new Text:TextHora[MAX_PLAYERS];//Para poder dar efeito na hora de fazer funcionar
  12. //-------------------------------------------//
  13. //Agora, para quando o player logar ver a Text Draw vamos adicionar isso na callback:
  14. //public OnPlayerConnect
  15. public OnPlayerConnect(playerid)
  16. {
  17.     TextDrawShowForPlayer(playerid, TextHora[playerid]);
  18.     return 1;
  19. }
  20. //Agora Adicione isso na callback OnGamemodeInit, Isso server para quando o seu Gamemode //Iniciar
  21. public OnGamemodeInit()
  22. {
  23.         SetTimer("Clock", 1000, 1);//para o Relogio não se descontrolar
  24.     for(new i=0; i<MAX_PLAYERS; i++)
  25.     {
  26.         TextHora[i] = TextDrawCreate(551.000000,23.000000,"--");
  27.         TextDrawAlignment(TextHora[i],0);
  28.         TextDrawBackgroundColor(TextHora[i],0x000000FF);
  29.         TextDrawFont(TextHora[i],2);
  30.         TextDrawLetterSize(TextHora[i],0.399999,2.000000);
  31.         TextDrawColor(TextHora[i],0x000000FF);
  32.         TextDrawSetOutline(TextHora[i],1);
  33.         TextDrawSetProportional(TextHora[i],1);
  34.         TextDrawSetShadow(TextHora[i],1);
  35.         }
  36. return 1;
  37. }
  38. public Clock()//crie essa callback para o settimer funcionar e atualizar a hora
  39. {
  40.     new str[128], str2[128];
  41.     new hora, minuto, segundo;
  42.     gettime(hora, minuto, segundo);
  43.     for (new i=0; i<MAX_PLAYERS; i++)
  44.     {
  45.         format(str2, sizeof(str2), "%d:%d:%d", hora, minuto, segundo);
  46.         TextDrawSetString(TextHora[i], str2);
  47.     }
  48. }
  49.