[AJUDA] TextDraw Diferente para cada player
#1

Pessoal, eu tenho um textdraw aqui no meu servidor que mostra quanto o jogador matou, quanto morreu, o respeito e o score. A cada um kill o jogador ganha 1 respeito. A cada 5 respeito o jogador ganha um score.
O problema й que o script ta gerando um mesmo texdraw para todos os players, se nao me engano o textdraw do id 0. E nao sei como resolver isso. Nao liguem para a formula de cada componente do textdraw, pois ela esta correta... Liguem sу pra funcionalidade dele que esta errada.

pawn Код:
new Text:Coisa;

public OnFilterScriptInit()
{
    SetTimer("Killstreak", 5000, true);
    Coisa = TextDrawCreate(160.000000, 360.000000, "__");
    TextDrawBackgroundColor(Coisa, 255);
    TextDrawFont(Coisa, 1);
    TextDrawLetterSize(Coisa, 0.300000, 1.000000);
    TextDrawColor(Coisa, -1);
    TextDrawSetOutline(Coisa, 1);
    TextDrawSetProportional(Coisa, 1);
    TextDrawUseBox(Coisa, 0);
    TextDrawBoxColor(Coisa, 255);
    TextDrawTextSize(Coisa, 620.000000, 0.000000);
    TextDrawShowForPlayer(playerid, Coisa);
    return true;
}

public OnPlayerConnect(playerid)
{
   TextDrawShowForPlayer(playerid,  Coisa);
   return true;
}

public OnFilterScriptExit()
{
   TextDrawHideForAll(Coisa);
   TextDrawDestroy(Coisa);
   return true;
}

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, str);
                return true;
        }
        return true;
    }
    return true;
}
Reply
#2

Tenta assim.

PHP код:
new Text:Coisa[MAX_PLAYERS];

public 
OnFilterScriptInit()
{
    
SetTimer("Killstreak"5000true);
    for(new 
0iMAX_PLAYERS i++)
    {
        
Coisa[i] = TextDrawCreate(160.000000360.000000"__");
        
TextDrawBackgroundColor(Coisa255);
        
TextDrawFont(Coisa[i], 1);
        
TextDrawLetterSize(Coisa[i], 0.3000001.000000);
        
TextDrawColor(Coisa[i], -1);
        
TextDrawSetOutline(Coisa[i], 1);
        
TextDrawSetProportional(Coisa[i], 1);
        
TextDrawUseBox(Coisa[i], 0);
        
TextDrawBoxColor(Coisa[i], 255);
        
TextDrawTextSize(Coisa[i], 620.0000000.000000);
        
TextDrawShowForPlayer(playeridCoisa[i]);
    }
    return 
true;
}

public 
OnPlayerConnect(playerid)
{
   
TextDrawShowForPlayer(playerid,  Coisa[playerid]);
   return 
true;
}

public 
OnFilterScriptExit()
{
   
TextDrawHideForAll(Coisa[playerid]);
   
TextDrawDestroy(Coisa[playerid]);
   return 
true;
}

forward Killstreak();
public 
Killstreak()
{
    for(new 
playerid 0playerid MAX_PLAYERSplayerid ++)
    {
        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(str128"~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);
                return 
true;
        }
        return 
true;
    }
    return 
true;

Reply
#3

Deram os seguintes erros em:

"TextDrawShowForPlayer(playerid, Coisa[i]);" error: 017: undefined symbol "playerid"

"TextDrawHideForAll(Coisa[playerid]);" error: 017: undefined symbol "playerid"

"TextDrawDestroy(Coisa[playerid]);" error: 017: undefined symbol "playerid"

Eu sу nao faзo a menor idйia como pois "playerid" faz parte da funзгo.


EDIT:
Ah outra coisa em "TextDrawBackgroundColor(Coisa, 255);" eu acresentei o [i] que vc nao tinha botado.
Reply
#4

no onfilterscriptexit tem q fazer um loop pra deletar todos os textdraws

pawn Код:
public OnFilterScriptExit()
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        TextDrawHideForAll(Coisa[i]);
        TextDrawDestroy(Coisa[i]);
        return true;
    }
}
Reply
#5

Tirou dois erros... sу que ele ainda reclama de "TextDrawShowForPlayer(playerid, Coisa[i]);": error: 017: undefined symbol "playerid"
Reply
#6

pawn Код:
TextDrawShowForPlayer(i, Coisa[i]);
Reply
#7

Pensei nisso tambem *-* vou testar aqui... Ja retorno
Reply
#8

Nao deu certo nao... O text draw apareceu apenas para o ID 0... No cуdigo original ele aparecia um mesmo textdraw para todos os players... (o textdraw do player 0)
Reply
#9

Mostre o cуdigo novamente.
Reply
#10

Cуdigo original й esse:

E o problema dele й que mostra o mesmo texdraw para todos players

pawn Код:
new Text:Coisa;

public OnFilterScriptInit()
{
    SetTimer("Killstreak", 5000, true);
    Coisa = TextDrawCreate(160.000000, 360.000000, "__");
    TextDrawBackgroundColor(Coisa, 255);
    TextDrawFont(Coisa, 1);
    TextDrawLetterSize(Coisa, 0.300000, 1.000000);
    TextDrawColor(Coisa, -1);
    TextDrawSetOutline(Coisa, 1);
    TextDrawSetProportional(Coisa, 1);
    TextDrawUseBox(Coisa, 0);
    TextDrawBoxColor(Coisa, 255);
    TextDrawTextSize(Coisa, 620.000000, 0.000000);
    TextDrawShowForPlayer(playerid, Coisa);
    return true;
}

public OnPlayerConnect(playerid)
{
   TextDrawShowForPlayer(playerid,  Coisa);
   return true;
}

public OnFilterScriptExit()
{
   TextDrawHideForAll(Coisa);
   TextDrawDestroy(Coisa);
   return true;
}

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, str);
                return true;
        }
        return true;
    }
    return true;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)