[Ajuda] TextDraw
#1

Entгo, eu queria saber como colocar a textdraw com nome do servidor para trocar de cor, jб vi na NET. Sу achei uns em espanhol mas nгo do jeito que eu quero, somente diferente, se alguйm puder ajudar agradeзo !
Reply
#2

Use um SetTimer
Reply
#3

Nгo testei
PHP код:
forward RandomTD();
new 
Text:TextDraw;
new 
cor =0;
OnGameModeInit()
{
TextDrawTextDrawCreate(7.000000427.000000"textdraw");
TextDrawBackgroundColor(TextDraw255);
TextDrawFont(TextDraw1);
TextDrawLetterSize(TextDraw0.3799991.499999);
TextDrawColor(TextDraw, -1);
TextDrawSetOutline(TextDraw1);
TextDrawSetProportional(TextDraw1);
}
SetTimer("RandomTD",3000 ,1);// bota essa linha aonde vai comeзar a mudar a textdraw 3000 = 3segundos
public RandomTD()
{
       if(
cor == 1)TextDrawColor(TextDraw0xFF0000AA),cor=0;// vermelho
        
else TextDrawColor(TextDraw0x33AAFFFF),cor1;// azul
        
return 1;

Reply
#4

Acredito que a fуrmula acima, poderia ser simplificada apenas utilizando um Randon com os nъmeros 1 ao 5 por exemplo que identificam cores, assim iria substituindo-as aleatoriamente...
Reply
#5

forward RandomTD();
new Text:TextDraw;
new cor =0;

OnGameModeInit()
{
TextDraw= TextDrawCreate(7.000000, 427.000000, "textdraw");
TextDrawBackgroundColor(TextDraw, 255);
TextDrawFont(TextDraw, 1);
TextDrawLetterSize(TextDraw, 0.379999, 1.499999);
TextDrawColor(TextDraw, -1);
TextDrawSetOutline(TextDraw, 1);
TextDrawSetProportional(TextDraw, 1);
}

SetTimer("RandomTD",3000 ,1);// bota essa linha aonde vai comeзar a mudar a textdraw 3000 = 3segundos

public RandomTD()
{
if(cor == 1)TextDrawColor(TextDraw, 0xFF0000AA),cor=0;// vermelho
else TextDrawColor(TextDraw, 0x33AAFFFF),cor= 1;// azul
return 1;
}






Eu jб tentei fazer parecido, acabei de testar o seu, porйm nгo aparece para o player, nem no que eu fiz, nem neste seu :X
Reply
#6

pawn Код:
forward RandomTD();
new Text:TextDraw;

new Cores[4][1] = {
    0xFF0000FF,//Vermelho
    0xFFFF00FF,//Amarelo
    0x0000FFFF,//Azul
    0x00FFFFFF,//Azul Marinho

};

OnGameModeInit()
{
    TextDraw= TextDrawCreate(7.000000, 427.000000, "textdraw");
    TextDrawBackgroundColor(TextDraw, 255);
    TextDrawFont(TextDraw, 1);
    TextDrawLetterSize(TextDraw, 0.379999, 1.499999);
    TextDrawColor(TextDraw, -1);
    TextDrawSetOutline(TextDraw, 1);
    TextDrawSetProportional(TextDraw, 1);
}
     SetTimer("RandomTD",3000 ,1);// bota essa linha aonde vai comeзar a mudar a textdraw 3000 = 3segundos

public RandomTD()
{
    new rand = random(sizeof(Cores));
    TextDrawColor(TextDraw, Cores[rand][0]);
    return 1;
}

public OnPlayerConnect(playerid)
{
     TextDrawShowForPlayer(playerid, TextDraw);
     return 1;
}
public OnPlayerSpawn(playerid)
{
    TextDrawHideForPlayer(playerid, TextDraw);
    return 1;
}
Use [pawn][/*pawn] sem o "*" para colocar cуdigos, a forma de cima й um exemplo apenas.
Reply
#7

Obrigado, a textdraw apareceu, porйm nгo estб trocando a cor, mas sу uma duvida, tem como eu fazer com format ?

tipo assim?

pawn Код:
format(newtext, sizeof(newtext), "~y~Meu~g~Texto ~w~[RPG]~g~ [0.3b]     );
Trocar++;
TextDrawSetString(Textdraw18[i], newtext);


format(newtext, sizeof(newtext), "
~y~Meu~g~Texto~w~[RPG]~g~ [0.3b]   );
Trocar = 1;
TextDrawSetString(Textdraw18[i], newtext);
ele ir trocando apenas algumas letras desse modo? com " ~w~ , ~y~, ~g~ "
Vi em uma gamemode que baixei a um tempo, achei interessante e procurei o sistema, mas nгo o entendi, muito menos consegui fazer ficar aparecendo!
Reply
#8

Quote:
Originally Posted by LucasDias
Посмотреть сообщение
Obrigado, a textdraw apareceu, porйm nгo estб trocando a cor, mas sу uma duvida, tem como eu fazer com format ?

tipo assim?

pawn Код:
format(newtext, sizeof(newtext), "~y~Meu~g~Texto ~w~[RPG]~g~ [0.3b]     );
Trocar++;
TextDrawSetString(Textdraw18[i], newtext);


format(newtext, sizeof(newtext), "
~y~Meu~g~Texto~w~[RPG]~g~ [0.3b]   );
Trocar = 1;
TextDrawSetString(Textdraw18[i], newtext);
ele ir trocando apenas algumas letras desse modo? com " ~w~ , ~y~, ~g~ "
Vi em uma gamemode que baixei a um tempo, achei interessante e procurei o sistema, mas nгo o entendi, muito menos consegui fazer ficar aparecendo!
Simples:
PHP код:
forward RandomTD();
new 
Text:TextDraw;
new 
Cores[][] = {
 
"~w~"//Branco
 
"~b~"//Azul
 
"~r~"//Vermelho
 
"~y~"//Amarelo
 
"~g~" //Verde
};
public 
OnGameModeInit()
{
    
TextDrawTextDrawCreate(7.000000427.000000"textdraw");
    
TextDrawBackgroundColor(TextDraw255);
    
TextDrawFont(TextDraw1);
    
TextDrawLetterSize(TextDraw0.3799991.499999);
    
TextDrawColor(TextDraw, -1);
    
TextDrawSetOutline(TextDraw1);
    
TextDrawSetProportional(TextDraw1);
    
SetTimer("RandomTD",3000 ,1);
   return 
1;
}
public 
RandomTD()
{
 new 
String[150];  //Variavel
 /*
  No Format, ele pegarб cores aleatуrias
  Sintaxe: [Cores[random(Numero_MAXIMO)] ou Cores[random(sizeof(Cores))];
 */
 
format(String,sizeof(String),"%sIntel%sG%spics%s",Cores[random(4)],Cores[random(4)],Cores[random(4)],Cores[random(4)]);
 
TextDrawSetString(TextDraw,String);  //Seta a String na TextDraw !
 
return 1;
}
public 
OnPlayerConnect(playerid//Chamada quando player connecta
{
 
TextDrawShowForPlayer(playeridTextDraw); //Mostra a TextDraw
 
return 1;
}
public 
OnPlayerSpawn(playerid)  //Chamada quando entra em Spawn
{
  
TextDrawHideForPlayer(playeridTextDraw); //Oculta TextDraw
  
return 1;

Reply
#9

Quote:
Originally Posted by IntelGrapics
Посмотреть сообщение
Simples:
PHP код:
forward RandomTD();
new 
Text:TextDraw;
new 
Cores[][] = {
 
"~w~"//Branco
 
"~b~"//Azul
 
"~r~"//Vermelho
 
"~y~"//Amarelo
 
"~g~" //Verde
};
public 
OnGameModeInit()
{
    
TextDrawTextDrawCreate(7.000000427.000000"textdraw");
    
TextDrawBackgroundColor(TextDraw255);
    
TextDrawFont(TextDraw1);
    
TextDrawLetterSize(TextDraw0.3799991.499999);
    
TextDrawColor(TextDraw, -1);
    
TextDrawSetOutline(TextDraw1);
    
TextDrawSetProportional(TextDraw1);
    
SetTimer("RandomTD",3000 ,1);
   return 
1;
}
public 
RandomTD()
{
 new 
String[150];  //Variavel
 /*
  No Format, ele pegarб cores aleatуrias
  Sintaxe: [Cores[random(Numero_MAXIMO)] ou Cores[random(sizeof(Cores))];
 */
 
format(String,sizeof(String),"%sIntel%sG%spics%s",Cores[random(4)],Cores[random(4)],Cores[random(4)],Cores[random(4)]);
 
TextDrawSetString(TextDraw,String);  //Seta a String na TextDraw !
 
return 1;
}
public 
OnPlayerConnect(playerid//Chamada quando player connecta
{
 
TextDrawShowForPlayer(playeridTextDraw); //Mostra a TextDraw
 
return 1;
}
public 
OnPlayerSpawn(playerid)  //Chamada quando entra em Spawn
{
  
TextDrawHideForPlayer(playeridTextDraw); //Oculta TextDraw
  
return 1;

Eu poderia fazer a public da seguinte maneira?


pawn Код:
new Trocar = 1 ;
forward RandomTD(playerid);
public RandomTD(playerid)
{
    foreach(Player, i)
    {
        new string[500];

        if(Trocar == 1)
        {
            format(string, sizeof(string), "~r~M~w~EU TEXTO ~r~[RPG];
            Trocar++;
            TextDrawSetString(Textdraw18[i], string);
            TextDrawShowForPlayer(i, Textdraw18[i]);
        }
        else if(Trocar == 2)
        {
            format(string, sizeof(string), "
M~r~EU~w~TEXTO ~w~[RPG] );
            Trocar++;
            TextDrawSetString(Textdraw18[i], string);
            TextDrawShowForPlayer(i, Textdraw18[i]);
        }
        else if(Trocar == 3)
        {
            format(string, sizeof(string), "~r~MEU~w~U ~r~TEXTO);
            Trocar++;
            TextDrawSetString(Textdraw18[i], string);
            TextDrawShowForPlayer(i, Textdraw18[i]);
        }
        else if(Trocar == 4)
        {
            format(string, sizeof(string), "
M~w~EU ~w~TEXTO);
            Trocar++;
            TextDrawSetString(Textdraw18[i], string);
            TextDrawShowForPlayer(i, Textdraw18[i]);
        }
        else if(Trocar == 5)
        {
            format(newtext, sizeof(newtext), "M~g~E~w~U ~g~TE~p~XTO);
            Trocar++;
            TextDrawSetString(Textdraw18[i], newtext);
            TextDrawShowForPlayer(i, Textdraw18[i]);
        }
        else if(Trocar == 6)
        {
            format(newtext, sizeof(newtext), "
M~g~E~w~U ~w~TEXTO~g~ );
            Trocar++;
            TextDrawSetString(Textdraw18[i], newtext);
            TextDrawShowForPlayer(i, Textdraw18[i]);
        }
        else if(Trocar == 7)
        {
            format(newtext, sizeof(newtext), "M~g~EU ~g~TEXTO);
            Trocar++;
            TextDrawSetString(Textdraw18[i], newtext);
            TextDrawShowForPlayer(i, Textdraw18[i]);
        }
        else if(Trocar == 8)
        {
            format(string, sizeof(string), "
ME~b~U ~g~TEXTO);
            Trocar++;
            TextDrawSetString(Textdraw18[i], string);
            TextDrawShowForPlayer(i, Textdraw18[i]);
        }
        else if(Trocar == 9)
        {
            format(string, sizeof(string), "~y~MEU~g~TEXTO);
            Trocar = 1;
            TextDrawSetString(Textdraw18[i], string);
            TextDrawShowForPlayer(i, Textdraw18[i]);
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)