[Duda] Textdraw
#1

Bueno, querнa saber cуmo hacer para que si el jugador no estй conectado en el textdraw salga con guiones.

Actualmente lo tengo asн:

Код:
new
			score_Text[256] = "~n~",
			player_Name[20],
			kills[256],
			deaths[256],
			pos[20]
		;

		for(new i; i < 15; ++i)
		{
          if(IsPlayerConnected(i))
            {
                new name[MAX_PLAYER_NAME+1], string[24+MAX_PLAYER_NAME+1];
                GetPlayerName(i, name, sizeof(name));
                format(pos, sizeof(pos), "%d.", i + 1);
				format(score_Text, sizeof(score_Text), "%s", name);
				format(kills, sizeof(kills), "%d", killsround);
				format(deaths, sizeof(deaths), "%d", deathsround);
		}
        }
En el textdraw sуlo salen los nombres y los datos de los jugadores conectados, y querнa hacer que en los demбs lugares salgan guiones.

Tipo asн:

Код:
Dato1                             Dato2                        Dato3
Nombre_Apellido                      87                            9
-                                    -                             -
-                                    -                             -
-                                    -                             -
-                                    -                             -
Reply
#2

Usa un else en la condicion:
pawn Код:
If(IsPlayerConnected(i))
{
// CODIGO
}
Pones algo asi:
pawn Код:
else
{
 //ACA PONES EL CODIGO , ES DECIR, INDICANDO QUE EL TEXTDRAW DEBE SER UN GUION ' - '
}
Reply
#3

Asн ya habнa probado, pero lo que pasa es que ahora en vez de aparecer los jugadores conectados y sus datos aparecen sуlo los guiones.

Asн lo puse:

Код:
new
			score_Text[256] = "~n~",
			player_Name[20],
			kills[256],
			deaths[256],
			pos[20]
		;

		for(new i; i < 15; ++i)
		{
          if(IsPlayerConnected(i))
            {
                new name[MAX_PLAYER_NAME+1], string[24+MAX_PLAYER_NAME+1];
                GetPlayerName(i, name, sizeof(name));
                format(pos, sizeof(pos), "%d.", i + 1);
				format(score_Text, sizeof(score_Text), "%s", name);
				format(kills, sizeof(kills), "%d", killsround);
				format(deaths, sizeof(deaths), "%d", deathsround);
		}
		else
		{
		new name[MAX_PLAYER_NAME+1], string[24+MAX_PLAYER_NAME+1];
                GetPlayerName(i, name, sizeof(name));
		format(pos, sizeof(pos), "%d.", i + 1);
		format(score_Text, sizeof(score_Text), "-", name);
		format(kills, sizeof(kills), "-", killsround);
		format(deaths, sizeof(deaths), "-", deathsround);
        }
        }
Reply
#4

Revivo..
Reply
#5

pawn Код:
for(new i; i < 15; ++i)
    {
        if(IsPlayerConnected(i))
        {
            new name[MAX_PLAYER_NAME+1], string[24+MAX_PLAYER_NAME+1];
            GetPlayerName(i, name, sizeof(name));
            format(pos, sizeof(pos), "%d.", i + 1);
            format(score_Text, sizeof(score_Text), "%s", name);
            format(kills, sizeof(kills), "%d", killsround);
            format(deaths, sizeof(deaths), "%d", deathsround);
        }
        else
        {
            format(pos, sizeof(pos), "%d.", i + 1);
            TextDrawSetString(TEXTID, "-");
            TextDrawSetString(TEXTID, "-");
            TextDrawSetString(TEXTID, "-");
        }
    }
Reply
#6

Nope, asн no salen los guiones..
Reply
#7

PHP код:
for(new i15; ++i)
    {
        if(
IsPlayerConnected(i))
        {
            new 
name[MAX_PLAYER_NAME+1], string[24+MAX_PLAYER_NAME+1];
            
GetPlayerName(inamesizeof(name));
            
format(possizeof(pos), "%d."1);
            
format(score_Textsizeof(score_Text), "%s"name);
            
format(killssizeof(kills), "%d"killsround);
            
format(deathssizeof(deaths), "%d"deathsround);
        }
        else
        {
            
format(possizeof(pos), "-");
            
format(score_Textsizeof(score_Text), "-");
            
format(killssizeof(kills), "-");
            
format(deathssizeof(deaths), "-");
        }
    } 
Reply
#8

Asн tampoco funciona Cйsar, de esa forma ya no muestra los datos de los conectados, sуlo aparecen guiones en su lugar.
Reply
#9

Supongo que cada textdraw (o mejor dicho "Slot del Textdraw"), lo tienes asignado con 1 variable determinada... de caso contrario cuando uses TextDrawSetString le cambiarб a todos los textdraws por igual..?
Reply
#10

No te entendн..

Igual, lo tengo asн:

Код:
new
			playerScores[MAX_PLAYERS][rankingEnum],
			index
		;
		for(new i; i != MAX_PLAYERS; ++i)
		{
			if(IsPlayerConnected(i) && !IsPlayerNPC(i))
			{
				playerScores[index][player_Score] = GetPlayerScore(i);
				playerScores[index++][player_ID] = i;
			}
		}
		GetPlayerHighestScores(playerScores, 0, index);

		new
			score_Text[256] = "~n~",
			player_Name[20],
			kills[256],
			deaths[256],
			pos[20]
		;

		for(new i; i < 15; ++i)
		{
          if(IsPlayerConnected(i))
            {
                new name[MAX_PLAYER_NAME+1], string[24+MAX_PLAYER_NAME+1];
                GetPlayerName(i, name, sizeof(name));
                format(pos, sizeof(pos), "%d.", i + 1);
				format(score_Text, sizeof(score_Text), "%s", name);
				format(kills, sizeof(kills), "%d", killsround);
				format(deaths, sizeof(deaths), "%d", deathsround);
		}
        }
		for(new i=0;i<MAX_PLAYERS;++i)
        {
        if(IsPlayerConnected(i))
        {
		TextDrawSetString(Scoreboard_2, score_Text);
		TextDrawSetString(Scoreboard_6, pos);
		TextDrawSetString(Scoreboard_3, kills);
		TextDrawSetString(Scoreboard_4, deaths);
		TextDrawShowForAll(Scoreboard_0);
		TextDrawShowForAll(Scoreboard_1);
		TextDrawShowForAll(Scoreboard_2);
		TextDrawShowForAll(Scoreboard_3);
		TextDrawShowForAll(Scoreboard_4);
		TextDrawShowForAll(Scoreboard_5);
		TextDrawShowForAll(Scoreboard_6);
		TogglePlayerSpectating(i, 1);
	    }
        }
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)