Score dosen't show?
#7

Код:
/*
	Basic Player Stats. Shows Score and Ping in a textdraw.
	Credits - iPLEOMAX
 		      [HK]Ryder[AN]
 		      SA:MP Team
*/
#include <a_samp>
#include <foreach>
new updatetimer[MAX_PLAYERS];
//Player Textdraws:
new Text:Textdraw0[MAX_PLAYERS];
new Text:Textdraw1[MAX_PLAYERS];
forward update(playerid);
public OnGameModeInit()
{
	foreach(Player,i)
	{
	    Textdraw0[i] = TextDrawCreate(498.398, 100.799,"Score");
		TextDrawAlignment(Textdraw0[i], 1);
		TextDrawColor(Textdraw0[i], -1);
		TextDrawSetOutline(Textdraw0[i], 1);
		TextDrawBackgroundColor(Textdraw0[i], 51);
		TextDrawFont(Textdraw0[i], 2);
		TextDrawSetProportional(Textdraw0[i], 1);

		Textdraw1[i] = TextDrawCreate(497.600, 120.212, "Ping - -=- ms");
		TextDrawAlignment(Textdraw1[i], 1);
		TextDrawColor(Textdraw1[i], -1);
		TextDrawSetOutline(Textdraw1[i], 1);
		TextDrawBackgroundColor(Textdraw1[i], 51);
		TextDrawFont(Textdraw1[i], 2);
		TextDrawSetProportional(Textdraw1[i], 1);
	}
	return 1;
}
public OnPlayerConnect(playerid)
{
	// changing strings for the first time of player's textdraw
    new score[16], ping[16];
	format(score, sizeof(score), "Score - %d", GetPlayerScore(playerid));
	format(ping, sizeof(ping), "Ping - %d ms", GetPlayerPing(playerid));
	TextDrawSetString(Textdraw0[playerid], score);
	TextDrawSetString(Textdraw1[playerid], ping);
	TextDrawShowForPlayer(playerid, Textdraw0[playerid]);
	TextDrawShowForPlayer(playerid, Textdraw1[playerid]);
    updatetimer[playerid] = SetTimerEx("update", 1000, true, "d", playerid);
	return 1;
}
public update(playerid)
{
	new score[16], ping[16];
	format(score, sizeof(score), "Score - %d", GetPlayerScore(playerid));
	format(ping, sizeof(ping), "Ping - %d ms", GetPlayerPing(playerid));
	TextDrawSetString(Textdraw0[playerid], score);
	TextDrawSetString(Textdraw1[playerid], ping);
	return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
	TextDrawDestroy(Textdraw0[playerid]);

	TextDrawDestroy(Textdraw1[playerid]);

	KillTimer(updatetimer[playerid]);

	return 1;
}
Reply


Messages In This Thread
Score dosen't show? - by Tuntun - 15.11.2013, 10:25
Re: Score dosen't show? - by Tuntun - 15.11.2013, 10:48
Re: Score dosen't show? - by Sojo12 - 15.11.2013, 11:13
Re: Score dosen't show? - by Tuntun - 15.11.2013, 11:49
Re: Score dosen't show? - by dominik523 - 15.11.2013, 12:07
Re: Score dosen't show? - by Tuntun - 15.11.2013, 12:45
Re: Score dosen't show? - by dominik523 - 15.11.2013, 14:13

Forum Jump:


Users browsing this thread: 2 Guest(s)