[HELP] TextDraw is disappearing
#1

Hello guys, i am acctualy from Brazil, but i am here for ask for your help. People in Brazil was not Able to help me with that. They tried many times but without results.

Well I have a TextDraw that shows how much a player killed ("Matou"), number of deaths ("Morreu"), respect ("Respeito") and Score. If he kill a player he won one respect. If he get 5 Respects he won 1 score and the number of respects come back to 0. The formula is correct, this is not the problem.

The problem is that this TextDraw disappears from time to time for all players and just come back restarting the server. And when the numbers are updated they get superimposed.

I do not know if it's just a matter of organization of the code, change the parts of publics. Some Brazilians have tried a few things and ended up making show the same TextDraw for all players, or just show the TextDraw to the player ID 0.

Sorry my poor english.

Here is the code:

pawn Code:
new Text:Coisa[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
SetTimer("Killstreak", 5000, true);
}


public OnPlayerSpawn(playerid)
{
    Coisa[playerid] = TextDrawCreate(160.000000, 360.000000, "__");
    TextDrawBackgroundColor(Coisa[playerid], 255);
    TextDrawFont(Coisa[playerid], 1);
    TextDrawLetterSize(Coisa[playerid], 0.300000, 1.000000);
    TextDrawColor(Coisa[playerid], -1);
    TextDrawSetOutline(Coisa[playerid], 1);
    TextDrawSetProportional(Coisa[playerid], 1);
    TextDrawUseBox(Coisa[playerid], 0);
    TextDrawBoxColor(Coisa[playerid], 255);
    TextDrawTextSize(Coisa[playerid], 620.000000, 0.000000);
    TextDrawShowForPlayer(playerid, Coisa[playerid]);

}


forward Killstreak();
public Killstreak()
{
    for(new playerid = 0; playerid < MAX_PLAYERS; playerid ++)
    {
        if(IsPlayerConnected(playerid))
        {
                new str[128];
                new lvl2;
                new lvl = (pDataInfo[playerid][Matou]+pDataInfo[playerid][Kills]-lvl2/5)/5;
                if(lvl < 0)
                {
                    lvl2=0;
                }
                else lvl2=lvl;
                format(str, 128, "~w~Info /score /vip : ~n~~g~Matou: ~w~%d ~n~~g~Morreu: ~w~%d ~n~~y~Respeito: ~w~%d ~n~~b~Score: ~w~%d" , pDataInfo[playerid][Matou]+ pDataInfo[playerid][Kills], pDataInfo[playerid][Morreu]+ pDataInfo[playerid][Deaths], pDataInfo[playerid][Matou]+ pDataInfo[playerid][Kills]-(5*lvl2), lvl2);
                TextDrawSetString(Text:Coisa[playerid], str);
        }
    }
}

Here is an image:




Hopefully you will be able to help me.
Reply
#2

Try this version:
pawn Code:
new Text:Coisa[MAX_PLAYERS];

public OnGameModeInit()
{
    SetTimer("Killstreak", 5000, true);
    return 1;
}


public OnPlayerConnect(playerid)
{
    Coisa[playerid] = TextDrawCreate(160.000000, 360.000000, "__");
    TextDrawBackgroundColor(Coisa[playerid], 255);
    TextDrawFont(Coisa[playerid], 1);
    TextDrawLetterSize(Coisa[playerid], 0.300000, 1.000000);
    TextDrawColor(Coisa[playerid], -1);
    TextDrawSetOutline(Coisa[playerid], 1);
    TextDrawSetProportional(Coisa[playerid], 1);
    TextDrawUseBox(Coisa[playerid], 0);
    TextDrawBoxColor(Coisa[playerid], 255);
    TextDrawTextSize(Coisa[playerid], 620.000000, 0.000000);

    TextDrawShowForPlayer(playerid, Coisa[playerid]);
    return 1;
}


forward Killstreak();
public Killstreak()
{
    for(new playerid = 0; playerid < MAX_PLAYERS; playerid ++)
    {
        if(IsPlayerConnected(playerid) && !IsPlayerNPC(playerid))
        {
                new str[128];
                new lvl2;
                new lvl = (pDataInfo[playerid][Matou]+pDataInfo[playerid][Kills]-lvl2/5)/5;
                if(lvl < 0)
                {
                    lvl2=0;
                }
                else lvl2=lvl;
                format(str, sizeof(str), "~w~Info /score /vip : ~n~~g~Matou: ~w~%d ~n~~g~Morreu: ~w~%d ~n~~y~Respeito: ~w~%d ~n~~b~Score: ~w~%d" , pDataInfo[playerid][Matou]+ pDataInfo[playerid][Kills], pDataInfo[playerid][Morreu]+ pDataInfo[playerid][Deaths], pDataInfo[playerid][Matou]+ pDataInfo[playerid][Kills]-(5*lvl2), lvl2);
                TextDrawSetString(Coisa[playerid], str);
        }
    }
}
Reply
#3

Dude you are just the man! Thank you very much... I am trying to fix it since last month...
Reply
#4

Hello again... well it took time but again the textdraw disapired... And now what do i do?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)