/*
**************************
Filtsript version v3.3 **
**************************
*/
#include <a_samp>
enum PlayerDB
{
Kills,
Deaths,
bool:Box,
}
new PlayerData[MAX_PLAYERS][PlayerDB];
forward StatsInfromation();
new Text: PlayerStats[MAX_PLAYERS];
new Text: Textdraw1;
public OnFilterScriptInit()
{
SetTimer("StatsInfromation",1000 , 1);
for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
{
PlayerStats[playerid] = TextDrawCreate(231.000000,405.000000,"-");
Textdraw1 = TextDrawCreate(260.000000,391.000000,"STATS");
TextDrawUseBox(PlayerStats[playerid],1);
TextDrawBoxColor(PlayerStats[playerid],0xffffff33);
TextDrawTextSize(PlayerStats[playerid],389.000000,119.000000);
TextDrawAlignment(PlayerStats[playerid],0);
TextDrawAlignment(Textdraw1,0);
TextDrawBackgroundColor(PlayerStats[playerid],0x000000ff);
TextDrawBackgroundColor(Textdraw1,0xff000033);
TextDrawFont(PlayerStats[playerid],2);
TextDrawLetterSize(PlayerStats[playerid],0.399999,1.200000);
TextDrawFont(Textdraw1,2);
TextDrawLetterSize(Textdraw1,0.799999,1.300000);
TextDrawColor(PlayerStats[playerid],0xffffffff);
TextDrawColor(Textdraw1,0xffffffff);
TextDrawSetOutline(PlayerStats[playerid],1);
TextDrawSetOutline(Textdraw1,1);
TextDrawSetProportional(PlayerStats[playerid],1);
TextDrawSetProportional(Textdraw1,1);
TextDrawSetShadow(PlayerStats[playerid],1);
TextDrawSetShadow(Textdraw1,1);
}
return 1;
}
//______________________________________________________________________________
public OnFilterScriptExit()
{
for(new i = 0;i < MAX_PLAYERS; i++)
{
TextDrawDestroy(PlayerStats[i]);
}
TextDrawDestroy(Textdraw1);
return 1;
}
//______________________________________________________________________________
public OnPlayerConnect(playerid)
{
TextDrawShowForPlayer(playerid, PlayerStats[playerid]);
TextDrawShowForPlayer(playerid, Textdraw1);
return 1;
}
//______________________________________________________________________________
//______________________________________________________________________________
public StatsInfromation()
{
new str[128];
for(new i=0;i<MAX_PLAYERS;i++)
{
if (IsPlayerConnected(i))
{
format(str, sizeof(str), "Kills: %d - Deaths: %d" , PlayerData[i][Kills], PlayerData[i][Deaths]);
TextDrawSetString(PlayerStats[i],str);
}
}
return 1;
}
//______________________________________________________________________________
// 2009/2010 ©
new PlayerText:Time[MAX_PLAYERS];
Time[playerid] = CreatePlayerTextDraw(playerid, 554.000000, 205.000000, "~g~05:00");
PlayerTextDrawAlignment(playerid, Time[playerid], 2);
PlayerTextDrawBackgroundColor(playerid, Time[playerid], 22);
PlayerTextDrawFont(playerid, Time[playerid], 2);
PlayerTextDrawLetterSize(playerid, Time[playerid], 0.560000, 6.100000);
PlayerTextDrawColor(playerid, Time[playerid], -1);
PlayerTextDrawSetOutline(playerid, Time[playerid], 1);
PlayerTextDrawSetProportional(playerid, Time[playerid], 1);
PlayerTextDrawSetSelectable(playerid, Time[playerid], 0);
// To update the textdraw
new string[128];
format(string, sizeof (string), "~g~%02d:%02d", minutes, seconds);
PlayerTextDrawSetString(playerid, Time[playerid], string);
|
Create per-player textdraws instead of what your doing and you don't even need to use a timer, just update the textdraw every time the stat changes.
Example: pawn Код:
|