#define FUNC:%1(%2) forward %1(%2); public %1(%2)
new
Text:WebsiteURL,
Text:BlackBox,
Text:WhiteLine,
Text:TxtDate,
PlayerText:tStats[MAX_PLAYERS]
;
public OnGameModeInit()
{
BlackBox = TextDrawCreate(656.399536, 433.073364, "usebox");
TextDrawLetterSize(BlackBox, 0.000000, 1.277409);
TextDrawTextSize(BlackBox, -4.399999, 0.000000);
TextDrawAlignment(BlackBox, 1);
TextDrawColor(BlackBox, 0);
TextDrawUseBox(BlackBox, true);
TextDrawBoxColor(BlackBox, 255);
TextDrawSetShadow(BlackBox, 0);
TextDrawSetOutline(BlackBox, 0);
TextDrawBackgroundColor(BlackBox, 170);
TextDrawFont(BlackBox, 0);
TxtDate = TextDrawCreate(637.599426, 433.813323, "6/10/2014");
TextDrawLetterSize(TxtDate, 0.323600, 0.898132);
TextDrawAlignment(TxtDate, 3);
TextDrawColor(TxtDate, -1);
TextDrawSetShadow(TxtDate, 0);
TextDrawSetOutline(TxtDate, 1);
TextDrawBackgroundColor(TxtDate, 51);
TextDrawFont(TxtDate, 1);
TextDrawSetProportional(TxtDate, 1);
WhiteLine = TextDrawCreate(668.399536, 432.326568, "usebox");
TextDrawLetterSize(WhiteLine, 0.000000, -0.565554);
TextDrawTextSize(WhiteLine, -13.200004, 0.000000);
TextDrawAlignment(WhiteLine, 1);
TextDrawColor(WhiteLine, 0);
TextDrawUseBox(WhiteLine, true);
TextDrawBoxColor(WhiteLine, -1061109505);
TextDrawSetShadow(WhiteLine, 0);
TextDrawSetOutline(WhiteLine, 0);
TextDrawFont(WhiteLine, 0);
SetTimer("StatsUpdater", 1000, true);
return 1;
}
public OnPlayerConnect(playerid)
{
tStats[playerid] = CreatePlayerTextDraw(playerid, 4.799985, 433.813354, "Stats");
PlayerTextDrawLetterSize(playerid, tStats[playerid], 0.276399, 0.957865);
PlayerTextDrawAlignment(playerid, tStats[playerid], 1);
PlayerTextDrawColor(playerid, tStats[playerid], -1);
PlayerTextDrawSetShadow(playerid, tStats[playerid], 0);
PlayerTextDrawSetOutline(playerid, tStats[playerid], -1);
PlayerTextDrawBackgroundColor(playerid, tStats[playerid], 51);
PlayerTextDrawFont(playerid, tStats[playerid], 1);
PlayerTextDrawSetProportional(playerid, tStats[playerid], 1);
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
TextDrawShowForPlayer(playerid, WebsiteURL);
PlayerTextDrawShow(playerid, tStats[playerid]);
TextDrawShowForPlayer(playerid, BlackBox);
TextDrawShowForPlayer(playerid, WhiteLine);
TextDrawShowForPlayer(playerid, TxtDate);
TextDrawShowForPlayer(playerid, ZoneName[playerid]);
return 1;
}
FUNC:StatsUpdater()
{
for(new i=0; i < GetMaxPlayers(); i++) {
if(IsPlayerConnected(i)) {
new string[128], Float:health,Float:armour; GetPlayerHealth(i, health); GetPlayerArmour(i, armour);
format(string,128,"Name: %s | H: %f | A: %f | Score: %d | Kills: %d | Deaths: %d | Rank: (%d) %s",PlayerName(i),health,armour,GetPlayerScore(i),pInfo[i][Kills],pInfo[i][Deaths],pInfo[i][RankID],pInfo[i][RankName]);
PlayerTextDrawSetString(i, tStats[i], string);
PlayerTextDrawShow(i,tStats[i]);
}
}
return 1;
}
FUNC:StatsUpdater()
{
for(new i, e = GetMaxPlayers(); i != e; ++i)
{
if(IsPlayerConnected(i))
{
static
string[128],
Float:health,
Float:armour
;
GetPlayerHealth(i, health);
GetPlayerArmour(i, armour);
format(string, 128,"Name: %s | H: %f | A: %f | Score: %d | Kills: %d | Deaths: %d | Rank: (%d) %s",PlayerName(i),health,armour,GetPlayerScore(i),pInfo[i][Kills],pInfo[i][Deaths],pInfo[i][RankID],pInfo[i][RankName]);
PlayerTextDrawSetString(i, tStats[i], string);
PlayerTextDrawShow(i,tStats[i]);
// DEBUG
printf("%s", string);
}
}
return 1;
}
Debug?
pawn Код:
|
---------- Loaded log file: "server_log.txt". ---------- SA-MP Dedicated Server ---------------------- v0.3z, ©2005-2014 SA-MP Team [22:44:49] filterscripts = "" (string) [22:44:49] [22:44:49] Server Plugins [22:44:49] -------------- [22:44:49] Loading plugin: sscanf [22:44:49] [22:44:49] =============================== [22:44:49] sscanf plugin loaded. [22:44:49] Version: 2.8.1 [22:44:49] © 2012 Alex "******" Cole [22:44:49] =============================== [22:44:49] Loaded. [22:44:49] Loading plugin: whirlpool [22:44:49] [22:44:49] ================== [22:44:49] [22:44:49] Whirlpool loaded [22:44:49] [22:44:49] ================== [22:44:49] [22:44:49] Loaded. [22:44:49] Loading plugin: streamer [22:44:49] *** Streamer Plugin v2.7.2 by Incognito loaded *** [22:44:49] Loaded. [22:44:49] Loaded 3 plugins. [22:44:49] [22:44:49] Filterscripts [22:44:49] --------------- [22:44:49] Loaded 0 filterscripts. [22:44:49] [22:44:49] [22:44:49] [22:44:49] ======================================= [22:44:49] | | [22:44:49] | YSI version 3.09.0684 | [22:44:49] | By Alex "******" Cole | [22:44:49] | | [22:44:49] ======================================= [22:44:49] [22:44:49] [22:44:49] [22:44:49] ---------------------------------- [22:44:49] Dr.Lozer's BattleField SA:MP Server [22:44:49] ---------------------------------- [22:44:49] Number of vehicle models: 13 [22:44:50] [22:44:50] ========================================== [22:44:50] | | [22:44:50] | A new version (v<html> ) of YSI is | [22:44:50] | available from: | [22:44:50] | | [22:44:50] | www.y-less.com/YSI/YSI_1.0.zip | [22:44:50] | | [22:44:50] ========================================== [22:44:50] [22:45:20] Incoming connection: 127.0.0.1:57350 [22:45:20] [join] Dr.Lozer has joined the server (0:127.0.0.1) [22:45:21] Name: Dr.Lozer | H: 0.000000 | A: 0.000000 | Score: 0 | Kills: 0 | Deaths: 27 | Rank: (0) [22:45:22] Name: Dr.Lozer | H: 0.000000 | A: 0.000000 | Score: 0 | Kills: 0 | Deaths: 27 | Rank: (0) [22:45:23] Name: Dr.Lozer | H: 0.000000 | A: 0.000000 | Score: 0 | Kills: 0 | Deaths: 27 | Rank: (0) [22:45:24] Name: Dr.Lozer | H: 99.000000 | A: 99.000000 | Score: 0 | Kills: 0 | Deaths: 27 | Rank: (0) [22:45:25] Name: Dr.Lozer | H: 99.000000 | A: 99.000000 | Score: 0 | Kills: 0 | Deaths: 27 | Rank: (0) [22:45:26] Name: Dr.Lozer | H: 99.000000 | A: 99.000000 | Score: 0 | Kills: 0 | Deaths: 27 | Rank: (0) [22:45:27] Name: Dr.Lozer | H: 99.000000 | A: 99.000000 | Score: 0 | Kills: 0 | Deaths: 27 | Rank: (0) [22:45:28] Name: Dr.Lozer | H: 99.000000 | A: 99.000000 | Score: 0 | Kills: 0 | Deaths: 27 | Rank: (0) [22:45:30] Name: Dr.Lozer | H: 99.000000 | A: 99.000000 | Score: 0 | Kills: 0 | Deaths: 27 | Rank: (0) [22:45:31] Name: Dr.Lozer | H: 99.000000 | A: 99.000000 | Score: 0 | Kills: 0 | Deaths: 27 | Rank: (0) [22:45:32] Name: Dr.Lozer | H: 99.000000 | A: 99.000000 | Score: 0 | Kills: 0 | Deaths: 27 | Rank: (0) [22:45:33] Name: Dr.Lozer | H: 99.000000 | A: 99.000000 | Score: 0 | Kills: 0 | Deaths: 27 | Rank: (0) [22:45:34] Name: Dr.Lozer | H: 99.000000 | A: 99.000000 | Score: 0 | Kills: 0 | Deaths: 27 | Rank: (0) [22:45:35] Name: Dr.Lozer | H: 99.000000 | A: 99.000000 | Score: 0 | Kills: 0 | Deaths: 27 | Rank: (0) [22:45:36] Name: Dr.Lozer | H: 99.000000 | A: 99.000000 | Score: 0 | Kills: 0 | Deaths: 27 | Rank: (0)
FUNC:StatsUpdater()
{
for(new i, e = GetMaxPlayers(); i != e; ++i)
{
if(IsPlayerConnected(i))
{
static
string[128],
Float:health,
Float:armour
;
GetPlayerHealth(i, health);
GetPlayerArmour(i, armour);
format(string, 128,"Name: %s | H: %f | A: %f | Score: %d | Kills: %d | Deaths: %d | Rank: (%d) %s",PlayerName(i),health,armour,GetPlayerScore(i),pInfo[i][Kills],pInfo[i][Deaths],pInfo[i][RankID],pInfo[i][RankName]);
PlayerTextDrawSetString(i, tStats[i], string);
// PlayerTextDrawShow(i,tStats[i]);
// DEBUG
printf("%s", string);
}
}
return 1;
}
pawn Код:
|