[AJUDA]Textdraw com string nгo aparece - [BEP]AcerPilot - 03.06.2010
Bom galera, o meu problema й o seguinte:
Eu criei um textdraw simples no qual, quando o player muda o estado para PLAYER_STATE_DRIVER, aparece o textdraw com a informaзгo da quantidade de litros de combustivel que o player tem. O problema й que o textdraw nunca aparece, ja fui no Search, jб tentei um monte de coisas, mas nada funcionou. Meu cуdigo й esse:
Код:
new Text:Gasolina[MAX_PLAYERS];//topo do script
forward Speed();//para pegar a quantidade de litros
public OnGameModeInit()
{
for(new i = 0; i < MAX_PLAYERS; i++)//para mostrar para todos
{
Gasolina[i] = TextDrawCreate(481.000000, 459.000000," ");
TextDrawAlignment(Gasolina[i], 0);
TextDrawBackgroundColor(Gasolina[i], 0x000000ff);
TextDrawFont(Gasolina[i], 1);
TextDrawLetterSize(Gasolina[i], 0.599999, 1.900000);
TextDrawColor(Gasolina[i], 0xffffffff);
TextDrawSetOutline(Gasolina[i], 1);
TextDrawSetProportional(Gasolina[i], 1);
TextDrawSetShadow(Gasolina[i], 1);
}
SetTimer("Speed", 1000, 1);//seta o timer para pegar a quantidade de litros
public OnPlayerStateChange(playerid, newstate, oldstate)//para sу aparecer quando estiver dirigindo
{
if(newstate == PLAYER_STATE_DRIVER)
{
TextDrawShowForPlayer(playerid, Gasolina[playerid]);
}
return 1;
}
public Speed()//para setar a quantidade de litros no textdraw sempre que o timer mandar executб-lo
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
new string[128];
format(string,256,"~b~Combustivel: ~w~%d Litros", Petrol[i]);
if(IsPlayerInAnyVehicle(i))
{
TextDrawSetString(Gasolina[i], string);
}
}
}
}
Re: [AJUDA]Textdraw com string nгo aparece -
andmeida10 - 03.06.2010
baixa la o meu pacotao de tudo k fiz.. vai a Trabalhos>NextLifeRP.. nas ultimas linhas.. tem la um genero do que queres
Re: [AJUDA]Textdraw com string nгo aparece -
ipsBruno - 03.06.2010
Tu tens que Criar um Timer para Mudar o Text Draw
Re: [AJUDA]Textdraw com string nгo aparece - [BEP]AcerPilot - 03.06.2010
Quote:
Originally Posted by DraKoNeoN
Tu tens que Criar um Timer para Mudar o Text Draw
|
Quote:
SetTimer("Speed", 1000, 1);//seta o timer para pegar a quantidade de litros
|
Re: [AJUDA]Textdraw com string nгo aparece -
SuB_ZeRo0_ - 03.06.2010
Quote:
Originally Posted by [BEP
GeoPilot ]
Quote:
Originally Posted by DraKoNeoN
Tu tens que Criar um Timer para Mudar o Text Draw
|
Quote:
SetTimer("Speed", 1000, 1);//seta o timer para pegar a quantidade de litros
|
|
Tenta colocar o coddigo do OnGameModeInit em OnPlayerConnect, OnPlayerRequestSpawn..
Usando playerid
Re: [AJUDA]Textdraw com string nгo aparece - [BEP]AcerPilot - 03.06.2010
Quote:
Originally Posted by SuB_ZeRo0_
Quote:
Originally Posted by [BEP
GeoPilot ]
Quote:
Originally Posted by DraKoNeoN
Tu tens que Criar um Timer para Mudar o Text Draw
|
Quote:
SetTimer("Speed", 1000, 1);//seta o timer para pegar a quantidade de litros
|
|
Tenta colocar o coddigo do OnGameModeInit em OnPlayerConnect, OnPlayerRequestSpawn..
Usando playerid
|
Nгo funcionou...
Re: [AJUDA]Textdraw com string nгo aparece -
Brunin_OwnZ - 04.06.2010
Tenta:
pawn Код:
new Text:Gasolina[MAX_PLAYERS]; //topo do script
new TimerGasolina[MAX_PLAYERS];
forward Speed(playerid); //para pegar a quantidade de litros
public OnGameModeInit()
{
for(new i = 0; i < GetMaxPlayers(); i++)//para mostrar para todos
{
Gasolina[i] = TextDrawCreate(481.000000, 459.000000," ");
TextDrawAlignment(Gasolina[i], 0);
TextDrawBackgroundColor(Gasolina[i], 0x000000ff);
TextDrawFont(Gasolina[i], 1);
TextDrawLetterSize(Gasolina[i], 0.599999, 1.900000);
TextDrawColor(Gasolina[i], 0xffffffff);
TextDrawSetOutline(Gasolina[i], 1);
TextDrawSetProportional(Gasolina[i], 1);
TextDrawSetShadow(Gasolina[i], 1);
}
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate) //para sу aparecer quando estiver dirigindo
{
if(newstate == PLAYER_STATE_DRIVER)
{
TimerGasolina[playerid] = SetTimerEx("Speed", 1000, 1, "i", playerid);
}
else if(newstate == PLAYER_STATE_ONFOOT)
{
KillTimer(TimerGasolina[playerid]);
}
return 1;
}
public Speed(playerid) //para setar a quantidade de litros no textdraw sempre que o timer mandar executб-lo
{
new string[128];
format(string,256,"~b~Combustivel: ~w~%d Litros", Petrol[playerid]);
TextDrawSetString(Gasolina[playerid], string);
TextDrawShowForPlayer(playerid, Gasolina[playerid]);
}
Re: [AJUDA]Textdraw com string nгo aparece - [BEP]AcerPilot - 04.06.2010
Quote:
Originally Posted by Bruno_Mikio
Tenta:
pawn Код:
new Text:Gasolina[MAX_PLAYERS]; //topo do script new TimerGasolina[MAX_PLAYERS];
forward Speed(playerid); //para pegar a quantidade de litros
public OnGameModeInit() { for(new i = 0; i < GetMaxPlayers(); i++)//para mostrar para todos { Gasolina[i] = TextDrawCreate(481.000000, 459.000000," "); TextDrawAlignment(Gasolina[i], 0); TextDrawBackgroundColor(Gasolina[i], 0x000000ff); TextDrawFont(Gasolina[i], 1); TextDrawLetterSize(Gasolina[i], 0.599999, 1.900000); TextDrawColor(Gasolina[i], 0xffffffff); TextDrawSetOutline(Gasolina[i], 1); TextDrawSetProportional(Gasolina[i], 1); TextDrawSetShadow(Gasolina[i], 1); } return 1; }
public OnPlayerStateChange(playerid, newstate, oldstate) //para sу aparecer quando estiver dirigindo { if(newstate == PLAYER_STATE_DRIVER) { TimerGasolina[playerid] = SetTimerEx("Speed", 1000, 1, "i", playerid); }
else if(newstate == PLAYER_STATE_ONFOOT) { KillTimer(TimerGasolina[playerid]); } return 1; }
public Speed(playerid) //para setar a quantidade de litros no textdraw sempre que o timer mandar executб-lo { new string[128]; format(string,256,"~b~Combustivel: ~w~%d Litros", Petrol[playerid]); TextDrawSetString(Gasolina[playerid], string); TextDrawShowForPlayer(playerid, Gasolina[playerid]); }
|
Nada
Re: [AJUDA]Textdraw com string nгo aparece -
Brunin_OwnZ - 04.06.2010
achei o erro,
o erro estб na posiзгo do textdraw:
TextDrawCreate(481.000000, 459.000000," ");
troquei para
TextDrawCreate(400.000000, 400.000000," ");
e o textdraw apareceu
Re: [AJUDA]Textdraw com string nгo aparece - [BEP]AcerPilot - 05.06.2010
Quote:
Originally Posted by Bruno_Mikio
achei o erro,
o erro estб na posiзгo do textdraw:
TextDrawCreate(481.000000, 459.000000," ");
troquei para
TextDrawCreate(400.000000, 400.000000," ");
e o textdraw apareceu 
|
Usei a sua dica, mas nгo funcionou. Depois tentei tirar os gametexts com nomes de veнculos que apareciam quando vocк entrava em um, e funcionou!!
Entгo, dica: gametexts e textdraws na mesma public que aparecem ao mesmo tempo nгo combinam (eu acho)