[Tutorial] Simple TextDraw with Players OnLine
#1

Hello, today i will show You, how to do a Simple TextDraw with Players Online

So Let's Start

First, we must put on the Top of the FilterScript/GameMode this:

Код:
new Text:players;
Now serach the Public OnGameModeInit/OnFilterScriptInit and put this

Код:
        // TextDraw for Players Online
	players = TextDrawCreate(54.000000, 326.000000, "_");
	TextDrawBackgroundColor(players, 255);
	TextDrawFont(players, 2);
	TextDrawLetterSize(players, 0.500000, 1.000000);
	TextDrawColor(players, -65281);
	TextDrawSetOutline(players, 1);
	TextDrawSetProportional(players, 1);
	
	for(new i; i < MAX_PLAYERS; i ++)
	{
		if(IsPlayerConnected(i))
		{
			TextDrawShowForPlayer(i, players);
		}
	}
OK, TextDraw Created But now we must show it for Players, so in public OnPlayerConnect put this:

Код:
        new strings[15];
	format(strings, 15, "%d/50",GetOnLinePlayers());
	TextDrawSetString(players, strings);
	TextDrawShowForPlayer(playerid, players);
In public OnGameModeExit/OnFilterScriptExit put this:

Код:
	TextDrawHideForAll(players);
	TextDrawDestroy(players);
And at the Finish of GM/FS put this:

Код:
stock GetOnLinePlayers()
{
	new OnLine;
	for(new i, g = GetMaxPlayers(); i < g; i++)
		if(IsPlayerConnected(i))
			OnLine++;
	return OnLine;
}
Now we are Ready, compile the GM/FS and have Fun

Result:



Sorry for my bad English :P
Reply
#2

More like a "What to copy and paste" instead of a tutorial.
Reply
#3

Ye, I know but it's good for beginners i PAWN
Reply
#4

good job Djalo! can be usefull for beginners
Reply
#5

It's usually only useful for beginners if you tell them what each thing does. Spoon feeding code usually means they will just come back and ask people to write stuff for them :/
Reply
#6

Thanks for the input
Reply
#7

Nice thank you I will use
Reply
#8

Thanks Guys

And remember :P

Код:
format(strings, 15, "%d/SLOTS OF THE SERVER :P",GetOnLinePlayers());
I put there 50, because I have a server with 50 slots, but everyone must change it
Reply
#9

good job, nice tutorial
Reply
#10

good job, Great
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)