SA-MP Forums Archive
[Tutorial] Simple TextDraw with Players OnLine - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] Simple TextDraw with Players OnLine (/showthread.php?tid=168818)



Simple TextDraw with Players OnLine - Djalo - 17.08.2010

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


Re: Simple TextDraw with Players OnLine - Retardedwolf - 17.08.2010

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


Re: Simple TextDraw with Players OnLine - Djalo - 17.08.2010

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


Re: Simple TextDraw with Players OnLine - pmk1 - 17.08.2010

good job Djalo! can be usefull for beginners


Re: Simple TextDraw with Players OnLine - vital2k - 17.08.2010

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 :/


Respuesta: Simple TextDraw with Players OnLine - DarkChildren - 17.08.2010

Thanks for the input


Re: Simple TextDraw with Players OnLine - Smokey619 - 17.08.2010

Nice thank you I will use


Re: Simple TextDraw with Players OnLine - Djalo - 18.08.2010

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


Respuesta: Simple TextDraw with Players OnLine - Cacoby - 21.08.2010

good job, nice tutorial


Respuesta: Simple TextDraw with Players OnLine - DarkChildren - 21.08.2010

good job, Great