[AJUDA]TextDraw
#1

Galera gostaria de criar um TextDraw Que aparecesse assim PlayersOn: ai aparece a quantidade de players online eu jб tenho a base de tudo mais nгo consigo fazer vou postar a Check que faiz checar quantos players tem Online feito por Shadoww5 e o TextDraw

Код:
	Textdraw07 = TextDrawCreate(515.000000, 437.000000, "    PlayersOn:");
	TextDrawBackgroundColor(Textdraw07, 255);
	TextDrawFont(Textdraw07, 1);
	TextDrawLetterSize(Textdraw07, 0.300000, 1.000000);
	TextDrawColor(Textdraw07, 16711935);
	TextDrawSetOutline(Textdraw07, 0);
	TextDrawSetProportional(Textdraw07, 1);
	TextDrawSetShadow(Textdraw07, 1);
	TextDrawUseBox(Textdraw07, 1);
	TextDrawBoxColor(Textdraw07, 255);
	TextDrawTextSize(Textdraw07, 640.000000, 3.000000);
Код:
stock Check()
{
    new players;
    for(new i = 0; i < MAX_PLAYERS; i ++)
    {
        if(IsPlayerConnected(i)) players++;
    }
    return players;
}
Reply
#2

TextDrawSetString
Reply
#3

PHP код:
public OnGameModeInit()
{
    
Textdraw07 TextDrawCreate(515.000000437.000000"    PlayersOn:");
    
TextDrawBackgroundColor(Textdraw07255);
    
TextDrawFont(Textdraw071);
    
TextDrawLetterSize(Textdraw070.3000001.000000);
    
TextDrawColor(Textdraw0716711935);
    
TextDrawSetOutline(Textdraw070);
    
TextDrawSetProportional(Textdraw071);
    
TextDrawSetShadow(Textdraw071);
    
TextDrawUseBox(Textdraw071);
    
TextDrawBoxColor(Textdraw07255);
    
TextDrawTextSize(Textdraw07640.0000003.000000);
    
SetTimer("Check"1000true);
    return 
1;
}
forward Check();
public 
Check()
{
    new 
playersstr[20];
    for(new 
0MAX_PLAYERS++)
    {
        if(
IsPlayerConnected(i)) players++;
    }
    
format(strsizeof str"    PlayersOn: %d"players);
    
TextDrawSetString(Textdraw07str);

Reply
#4

*strelinha* semrpe kiz saber comofaz saporra tbm D:
Reply
#5

Nгo й preciso mostrar a textdraw novamente apуs editб-la.

Sу й necessбrio mostrб-la quando o jogador conectar ao servidor e, se quiser, ocultб-la ao desconectar.
Reply
#6

pawn Код:
public OnGameModeInit()
{
    Textdraw07 = TextDrawCreate(515.000000, 437.000000, "    PlayersOn:");
    TextDrawBackgroundColor(Textdraw07, 255);
    TextDrawFont(Textdraw07, 1);
    TextDrawLetterSize(Textdraw07, 0.300000, 1.000000);
    TextDrawColor(Textdraw07, 16711935);
    TextDrawSetOutline(Textdraw07, 0);
    TextDrawSetProportional(Textdraw07, 1);
    TextDrawSetShadow(Textdraw07, 1);
    TextDrawUseBox(Textdraw07, 1);
    TextDrawBoxColor(Textdraw07, 255);
    TextDrawTextSize(Textdraw07, 640.000000, 3.000000);
    SetTimer("mostrarTextdraw", 1000, true);
    return 1;
}

forward mostrarTextdraw(); public mostrarTextdraw()
{
    new str[16];
    format(str, sizeof str, "PlayersOn: %d", getPlayers());
    TextDrawSetString(Textdraw07, str);
    TextDrawShowForAll(Textdraw07);
    return 1;
}

stock getPlayers() {
    new p = 0;
    for(new a, b = GetMaxPlayers(); a < b; ++a)
    {
        if(IsPlayerConnected(a) && !IsPlayerNPC(a)) ++p;
    }
    return p;
}
Reply
#7

Quote:
Originally Posted by [GangsTa]Bia
Посмотреть сообщение
testa. vocк verб que ele nгo vai se atualizar.
Aqui funciona perfeitamente.
Reply
#8

Quote:
Originally Posted by Ricop522
Посмотреть сообщение
pawn Код:
public OnGameModeInit()
{
    Textdraw07 = TextDrawCreate(515.000000, 437.000000, "    PlayersOn:");
    TextDrawBackgroundColor(Textdraw07, 255);
    TextDrawFont(Textdraw07, 1);
    TextDrawLetterSize(Textdraw07, 0.300000, 1.000000);
    TextDrawColor(Textdraw07, 16711935);
    TextDrawSetOutline(Textdraw07, 0);
    TextDrawSetProportional(Textdraw07, 1);
    TextDrawSetShadow(Textdraw07, 1);
    TextDrawUseBox(Textdraw07, 1);
    TextDrawBoxColor(Textdraw07, 255);
    TextDrawTextSize(Textdraw07, 640.000000, 3.000000);
    SetTimer("mostrarTextdraw", 1000, true);
    return 1;
}

forward mostrarTextdraw(); public mostrarTextdraw()
{
    new str[16];
    format(str, sizeof str, "PlayersOn: %d", getPlayers());
    TextDrawSetString(Textdraw07, str);
    TextDrawShowForAll(Textdraw07);
    return 1;
}

stock getPlayers() {
    new p = 0;
    for(new a, b = GetMaxPlayers(); a < b; ++a)
    {
        if(IsPlayerConnected(a) && !IsPlayerNPC(a)) ++p;
    }
    return p;
}
O problema jб nгo foi resolvido ? '-'
Reply
#9

Quote:
Originally Posted by Ricop522
Посмотреть сообщение
pawn Код:
public OnGameModeInit()
{
    Textdraw07 = TextDrawCreate(515.000000, 437.000000, "    PlayersOn:");
    TextDrawBackgroundColor(Textdraw07, 255);
    TextDrawFont(Textdraw07, 1);
    TextDrawLetterSize(Textdraw07, 0.300000, 1.000000);
    TextDrawColor(Textdraw07, 16711935);
    TextDrawSetOutline(Textdraw07, 0);
    TextDrawSetProportional(Textdraw07, 1);
    TextDrawSetShadow(Textdraw07, 1);
    TextDrawUseBox(Textdraw07, 1);
    TextDrawBoxColor(Textdraw07, 255);
    TextDrawTextSize(Textdraw07, 640.000000, 3.000000);
    SetTimer("mostrarTextdraw", 1000, true);
    return 1;
}

forward mostrarTextdraw(); public mostrarTextdraw()
{
    new str[16];
    format(str, sizeof str, "PlayersOn: %d", getPlayers());
    TextDrawSetString(Textdraw07, str);
    TextDrawShowForAll(Textdraw07);
    return 1;
}

stock getPlayers() {
    new p = 0;
    for(new a, b = GetMaxPlayers(); a < b; ++a)
    {
        if(IsPlayerConnected(a) && !IsPlayerNPC(a)) ++p;
    }
    return p;
}
Nгo precisa checar se й um NPC. Um NPC nгo й considerado conectado pelo servidor.

E tambйm nгo precisa mostrar a Textdraw toda a vez que usar a funзгo TextDrawSetString.
Reply
#10

Como se isso fosse interferir em algo. rs
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)