[Ajuda] probleminha com textdraw de level
#1

como o tнtulo ja diz, preciso de ajuda com um textdraw que mostra o level do player.
stats: consegui fazer.
funciona ? sim, funciona
Possui erro no pawno? nao.
tem bug? sim, um bug chato que nao consigo resolver;
cуdigo:
Topo:
pawn Код:
new Text:Textdraw0;
pawn Код:
public OnPlayerConnect(playerid)
{
    Textdraw0 = TextDrawCreate(500.000000, 100.000000, "Level:");
    TextDrawBackgroundColor(Textdraw0, -1);
    TextDrawFont(Textdraw0, 3);
    TextDrawLetterSize(Textdraw0, 0.460000, 1.100000);
    TextDrawColor(Textdraw0, 255);
    TextDrawSetOutline(Textdraw0, 1);
    TextDrawSetProportional(Textdraw0, 1);
    {
        SetTimerEx("AtualizarLevel", 1000, true, "i", playerid);
    }
pawn Код:
public AtualizarLevel(playerid)
{

    new teste[128];
    TextDrawHideForPlayer(playerid, Textdraw0);
    format(teste, sizeof(teste), "Level: %d", GetPlayerLevel1(playerid));
    TextDrawSetString(Textdraw0, teste);
    TextDrawShowForPlayer(playerid, Textdraw0);
    return 1;
}
qual o bug? ele mostra o level de todos conectados para cada player
ex:
2 players online:
player1(level 10)
player2(level 5)

a cada 1 segundo do settimer, ele fica mostra um level diferente, mostra o do player 1 e 2 para ambos.
Level: 5
1 segundo
Level: 10
1 segundo
Level: 5
[...]
Reply
#2

pawn Код:
new Text:Textdraw0[MAX_PLAYERS];
pawn Код:
public OnPlayerConnect(playerid)
{
    Textdraw0[playerid] = TextDrawCreate(500.000000, 100.000000, "Level:");
    TextDrawBackgroundColor(Textdraw0[playerid], -1);
    TextDrawFont(Textdraw0[playerid], 3);
    TextDrawLetterSize(Textdraw0[playerid], 0.460000, 1.100000);
    TextDrawColor(Textdraw0[playerid], 255);
    TextDrawSetOutline(Textdraw0[playerid], 1);
    TextDrawSetProportional(Textdraw0[playerid], 1);
    {
        SetTimerEx("AtualizarLevel", 1000, true, "i", playerid);
    }
pawn Код:
public AtualizarLevel(playerid)
{
    new teste[128];
    format(teste, sizeof(teste), "Level: %d", GetPlayerLevel1(playerid));
    TextDrawSetString(Textdraw0[playerid], teste);
    return true;
}
Reply
#3

LINHAS:

TextDrawHideForAll(Textdraw0);
TextDrawDestroy(Textdraw0);

ERRO:
Quote:

C:\Users\Home-R\Desktop\ZonaDeRiesgo[0.3c(R5)]1\filterscripts\admin.pwn(130) : error 035: argument type mismatch (argument 1)
C:\Users\Home-R\Desktop\ZonaDeRiesgo[0.3c(R5)]1\filterscripts\admin.pwn(131) : error 035: argument type mismatch (argument 1)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

Reply
#4

##up
Reply
#5

pawn Код:
TextDrawHideForAll(Textdraw0[playerid]);
TextDrawDestroy(Textdraw0[playerid]);
Reply
#6

Quote:

C:\Users\Home-R\Desktop\ZonaDeRiesgo[0.3c(R5)]1\filterscripts\admin.pwn(130) : error 017: undefined symbol "playerid"
C:\Users\Home-R\Desktop\ZonaDeRiesgo[0.3c(R5)]1\filterscripts\admin.pwn(131) : error 017: undefined symbol "playerid"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.

aih da esse erro
Reply
#7

pawn Код:
new Text:Textdraw0[MAX_PLAYERS];
forward AtualizarLevel();

public OnGameModeInit()
{
    SetTimer("Scores", 1000, true);
    return true;
}

public OnPlayerSpawn(playerid)
{
    Textdraw0[playerid] = TextDrawCreate(500.000000, 100.000000, "Level:");
    TextDrawBackgroundColor(Textdraw0[playerid], -1);
    TextDrawFont(Textdraw0[playerid], 3);
    TextDrawLetterSize(Textdraw0[playerid], 0.460000, 1.100000);
    TextDrawColor(Textdraw0[playerid], 255);
    TextDrawSetOutline(Textdraw0[playerid], 1);
    TextDrawSetProportional(Textdraw0[playerid], 1);
    TextDrawShowForPlayer(playerid, Textdraw0[playerid]);
    return true;
}

public AtualizarLevel()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
                {
                    new teste[128];
                    format(teste, sizeof(teste), "Level: %d", GetPlayerLevel1(playerid));
                    TextDrawSetString(Textdraw0[i], teste);
                }
        }
}
Tуpico Cloused..
Reply
#8

pawn Код:
public AtualizarLevel()
{
    for(new playerid = 0; playerid < GetMaxPlayers(); ++playerid)
    {
         new teste[128];
         format(teste, sizeof(teste), "Level: %d", GetPlayerLevel1(playerid));
         TextDrawSetString(Textdraw0[playerid], teste);
    }
    return true;
}
Reply
#9

for(new playerid = 0; playerid < GetMaxPlayers(); ++playerid)
se o servidor for lotado vai sumir
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)