30.11.2014, 23:26
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 !
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;
}
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;
}
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);
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 Код:
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! |
forward RandomTD();
new Text:TextDraw;
new Cores[][] = {
"~w~", //Branco
"~b~", //Azul
"~r~", //Vermelho
"~y~", //Amarelo
"~g~" //Verde
};
public 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);
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(playerid, TextDraw); //Mostra a TextDraw
return 1;
}
public OnPlayerSpawn(playerid) //Chamada quando entra em Spawn
{
TextDrawHideForPlayer(playerid, TextDraw); //Oculta TextDraw
return 1;
}
Simples:
PHP код:
|
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;
}