Ad Code

Responsive Advertisement

TextDraw simples com jogadores online

 Olá, hoje vou mostrar a você como fazer um TextDraw simples com jogadores online. 


Então, vamos começar 

primeiro, devemos colocar no topo do FilterScript / GameMode isto:

Código:
novo texto: jogadores;
Agora procure o Public OnGameModeInit / OnFilterScriptInit e coloque este

Código:
        // TextDraw para jogadores online
	jogadores = TextDrawCreate (54,000000, 326,000000, "_");
	TextDrawBackgroundColor (jogadores, 255);
	TextDrawFont (jogadores, 2);
	TextDrawLetterSize (jogadores, 0,500000, 1,000000);
	TextDrawColor (jogadores, -65281);
	TextDrawSetOutline (jogadores, 1);
	TextDrawSetProportional (jogadores, 1);
	
	para (novo i; i <MAX_PLAYERS; i ++)
	{
		if (IsPlayerConnected (i))
		{
			TextDrawShowForPlayer (i, jogadores);
		}
	}
OK, TextDraw criado. Mas agora devemos mostrá-lo para os jogadores, então em público OnPlayerConnect coloque isto:

Código:
        novas strings [15];
	formato (strings, 15, "% d / 50", GetOnLinePlayers ());
	TextDrawSetString (players, strings);
	TextDrawShowForPlayer (playerid, jogadores);
Em public OnGameModeExit / OnFilterScriptExit coloque o seguinte:

Código:
	TextDrawHideForAll (jogadores);
	TextDrawDestroy (jogadores);
E no final da GM / FS coloque isso:

Código:
Stock GetOnLinePlayers ()
{
	novo OnLine;
	para (novo i, g = GetMaxPlayers (); i <g; i ++)
		if (IsPlayerConnected (i))
			OnLine ++;
	return OnLine;
}
Agora estamos prontos, compile o GM / FS e divirta-se 

Resultado:

Postar um comentário

0 Comentários

© 2022 PawnScript All Rights Reversed