TEXTDRAW
#1

Where did I go wrong?
Because I use the command it works correctly, but at the time of being deleted over time it does not Add, it generates another that is duplicated in the corner!

Then what is on the Screen of the middle Deleta, but it was not to be the one on the left corner.

https://i.imgur.com/pVMhEgh.png

PHP код:
new Text:ANN[MAX_PLAYERS];
forward ApagarTexto(playerid); 
PHP код:
for(new i=0i<GetMaxPlayers(); i++)
    {
        
ANN[i] = TextDrawCreate(218.000000235.000000" ");
        
TextDrawBackgroundColor(ANN[i], 255);
        
TextDrawFont(ANN[i], 1);
        
TextDrawLetterSize(ANN[i], 0.5000002.099999);
        
TextDrawColor(ANN[i], -1);
        
TextDrawSetOutline(ANN[i], 1);
        
TextDrawSetProportional(ANN[i], 1);
    } 
PHP код:
    if(strcmp(cmd"/ann"true) == 0)
    {
        new 
aname[MAX_PLAYER_NAME];
        
GetPlayerName(playeridanameMAX_PLAYER_NAME);
           
format(file2sizeof(file2), PASTA_CONTASaname);
           
strmid(tmpcmdtext4strlen(cmdtext));
           
        if(!
strlen(tmp))
        {
            
SendClientMessage(playeridVermelho" | ERRO | Digite: /Ann [Texto]");
            return 
1;
         }
         
          for(new 
i=0i<MAX_PLAYERSi++)
        {
            
format(stringsizeof(string), "~r~#~w~%s ~r~#",tmp);
            
TextDrawSetString(ANN[i], string);
            
TextDrawShowForPlayer(iANN[i]);
            
SetTimerEx("ApagarTexto",5000,false,"i",i);
        }
        return 
1;
    } 
PHP код:
public ApagarTexto()
{
    foreach(
Player,i)
    {
        
TextDrawHideForPlayer(iANN[i]);
        
TextDrawShowForPlayer(iANN[i]);
    }
    return 
1;

In the server test normal operation, in the Host already I'm bugged like this!
Reply
#2

Hello Geremias1533, Let's follow the steps of your code.

1. I think you're loading TXD into OnGameModeInit, so ok.
2. In the part below, you arrow the desired text for the announcement.
PHP код:
            format(stringsizeof(string), "~r~#~w~%s ~r~#",tmp);
            
TextDrawSetString(ANN[i], string);
            
TextDrawShowForPlayer(iANN[i]);
            
SetTimerEx("ApagarTexto",5000,false,"i",i); 
3. Maybe the problem is here, your public function forwarded.
PHP код:
public ApagarTexto()
{
    foreach(
Player,i)
    {
        
TextDrawHideForPlayer(iANN[i]);
        
TextDrawShowForPlayer(iANN[i]);
    }
    return 
1;

You are hiding and showing again, this does not result in anything.
You shall use only "TextDrawHideForPlayer(i, ANN[i])"
Reply
#3

@ApolloScripter You are blind as a bat dude.

Here you go wrong.

Код:
new Text:ANN[MAX_PLAYERS];
The first line of code is incorrect. It's so incorrect it makes the rest of your code incorrect. Use player textdraws for starters then come back after you fix your code and ask about problems if you are still having them.

Just for shits and giggles.....

Setting a timer in a loop... okay but for even players that are not connected?
Код:
SetTimerEx("ApagarTexto",5000,false,"i",i);
Now you do this......
Код:
public ApagarTexto() 
{ 
    foreach(Player,i) 
    { 
        TextDrawHideForPlayer(i, ANN[i]); 
        TextDrawShowForPlayer(i, ANN[i]); 
    } 
    return 1; 
}
If MAX_PLAYERS is at 500 then that function gets called 500 times and loops 500 times for a total of 250,000 iterations. Great job!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)