[Ajuda] Textdraws bugadas.
#1

Eu crio a textdraw sу que ela fica como se eu nгo tivesse colocado nada nela. (Tipo cor, fonte, posiзгo). E outra, o KM/H nгo aparece. Sу aparece a velocidade. Eu coloquei pra aparecer mas nada.
print de como fica: http://imgur.com/a/HvyBT
Code:
PHP код:
Topo:
new 
Text:TVelocidade[MAX_PLAYERS];
new 
Text:TKM;
OnGameModeInit:
   for(new 
0MAX_PLAYERSi++)
    {
    if(
IsPlayerConnected(i))
    {
    
// VELOCIMETRO
    
TVelocidade[i] = TextDrawCreate(143.000000367.000000"100");
    
TextDrawBackgroundColor(TVelocidade[i], 255);
    
TextDrawFont(TVelocidade[i], 2);
    
TextDrawLetterSize(TVelocidade[i], 0.3100001.900000);
    
TextDrawColor(TVelocidade[i], -1);
    
TextDrawSetOutline(TVelocidade[i], 1);
    
TextDrawSetProportional(TVelocidade[i], 1);
    
TextDrawSetSelectable(TVelocidade[i], 0);
    
TKM TextDrawCreate(171.000000367.000000"~g~~h~km/h");
    
TextDrawBackgroundColor(TKM255);
    
TextDrawFont(TKM2);
    
TextDrawLetterSize(TKM0.3100001.900000);
    
TextDrawColor(TKM, -65281);
    
TextDrawSetOutline(TKM1);
    
TextDrawSetProportional(TKM1);
    
TextDrawSetSelectable(TKM0);
    }
    }
OnPlayerStateChange:
    new 
veiculo GetPlayerVehicleID(playerid);
    if(
newstate == PLAYER_STATE_DRIVER)
    {
        foreach(
Playeri)
        {
        
SetTimer("UpdateVelocimetro"800true);
        
TextDrawShowForPlayer(playeridTVelocidade[i]);
        
TextDrawShowForPlayer(playeridTKM);
        }
        return 
1;
    }
public 
UpdateVelocimetro:
public 
UpdateVelocimetro()
{
    new 
string[200];
    foreach(
Playeri)
    {
        if(
GetPlayerState(i) == PLAYER_STATE_DRIVER)
        {
            
format(stringsizeof(string), "%02d"GetPlayerSpeed(i));
            
TextDrawSetString(Text:TVelocidade[i], string);
            
TextDrawShowForPlayer(iText:TVelocidade[i]);
            
TextDrawShowForPlayer(iText:TGasolina);
        }
    }
    return 
1;

Reply
#2

Nгo sei porquк estб usando textdraws globais quando existem player textdraws (Aqui), mas o problema й a condiзгo if(IsPlayerConnected(i)) na callback OnGameModeInit em seu loop. Como nгo vai haver jogadores conectados quando o modo iniciar, nenhuma das textdraws vгo ser criadas, entгo remova a condiзгo.
Reply
#3

Quote:
Originally Posted by Luiiiz
Посмотреть сообщение
Eu crio a textdraw sу que ela fica como se eu nгo tivesse colocado nada nela. (Tipo cor, fonte, posiзгo). E outra, o KM/H nгo aparece. Sу aparece a velocidade. Eu coloquei pra aparecer mas nada.
print de como fica: http://imgur.com/a/HvyBT
Code:
PHP код:
Topo:
new 
Text:TVelocidade[MAX_PLAYERS];
new 
Text:TKM;
OnGameModeInit:
   for(new 
0MAX_PLAYERSi++)
    {
    if(
IsPlayerConnected(i))
    {
    
// VELOCIMETRO
    
TVelocidade[i] = TextDrawCreate(143.000000367.000000"100");
    
TextDrawBackgroundColor(TVelocidade[i], 255);
    
TextDrawFont(TVelocidade[i], 2);
    
TextDrawLetterSize(TVelocidade[i], 0.3100001.900000);
    
TextDrawColor(TVelocidade[i], -1);
    
TextDrawSetOutline(TVelocidade[i], 1);
    
TextDrawSetProportional(TVelocidade[i], 1);
    
TextDrawSetSelectable(TVelocidade[i], 0);
    
TKM TextDrawCreate(171.000000367.000000"~g~~h~km/h");
    
TextDrawBackgroundColor(TKM255);
    
TextDrawFont(TKM2);
    
TextDrawLetterSize(TKM0.3100001.900000);
    
TextDrawColor(TKM, -65281);
    
TextDrawSetOutline(TKM1);
    
TextDrawSetProportional(TKM1);
    
TextDrawSetSelectable(TKM0);
    }
    }
OnPlayerStateChange:
    new 
veiculo GetPlayerVehicleID(playerid);
    if(
newstate == PLAYER_STATE_DRIVER)
    {
        foreach(
Playeri)
        {
        
SetTimer("UpdateVelocimetro"800true);
        
TextDrawShowForPlayer(playeridTVelocidade[i]);
        
TextDrawShowForPlayer(playeridTKM);
        }
        return 
1;
    }
public 
UpdateVelocimetro:
public 
UpdateVelocimetro()
{
    new 
string[200];
    foreach(
Playeri)
    {
        if(
GetPlayerState(i) == PLAYER_STATE_DRIVER)
        {
            
format(stringsizeof(string), "%02d"GetPlayerSpeed(i));
            
TextDrawSetString(Text:TVelocidade[i], string);
            
TextDrawShowForPlayer(iText:TVelocidade[i]);
            
TextDrawShowForPlayer(iText:TGasolina);
        }
    }
    return 
1;

vocк estб utilizando um text global e nгo para cada player..
Reply
#4

Quote:
Originally Posted by HoodScript
Посмотреть сообщение
vocк estб utilizando um text global e nгo para cada player..
Por isso eu usei um loop '-'
Reply
#5

Quote:
Originally Posted by Luiiiz
Посмотреть сообщение
Por isso eu usei um loop '-'
super desnecessario -.- ainda mais que MAX_PLAYERS й para o mбximo de jogadores que cada servidor suporta que й 1000
Reply
#6

@Resolvido. Criei em PlayerText e arrumou! +REP se eu conseguir dar pra vocкs.
Reply
#7

Quote:
Originally Posted by HoodScript
Посмотреть сообщение
super desnecessario -.- ainda mais que MAX_PLAYERS й para o mбximo de jogadores que cada servidor suporta que й 1000
Este valor й alterбvel. Usar loops com MAX_PLAYERS й viбvel se vocк tem um servidor taxa de jogadores de acordo com o nъmero de slots.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)