17.02.2013, 14:41
pawn Код:
forward WebInfo();
public WebInfo()
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
new stringOne[250];
new Float:playerStatHealth, playerStatScore, playerStatMoney;
GetPlayerHealth(i, playerStatHealth);
playerStatScore = GetPlayerScore(i);
playerStatMoney = GetPlayerMoney(i);
format(stringOne, 250, "%s%s%sname: %s<br>%s", dini_Get("html.txt","background"), dini_Get("html.txt","Re"), dini_Get("html.txt","font1"),ReturnPlayerName(i),dini_Get("html.txt","fontend"));
format(stringOne, 250, "%s%s Money: %d<br>", stringOne, dini_Get("html.txt","font2"), playerStatMoney);
format(stringOne, 250, "%s Score: %d<br>%s", stringOne, playerStatScore);
format(stringOne, 250, "%s Health: %f<br>%s", stringOne, playerStatHealth, dini_Get("html.txt","fontend"));
format(mainInfo, 500, "%s<br>%s", mainInfo, stringOne);
if(i != 1)
{
format(pIDsWrote, 100, "%s, %d", pIDsWrote, i);
}
else if(i == 1)
{
format(pIDsWrote, 100, "%d", i);
}
printf("--\n-- Added player %d's info to file write session.\n--");
}
}
fremove(mainFile);
new File:physFile = fopen(mainFile, io_write);
if(physFile)
{
fwrite(physFile, mainInfo);
fclose(physFile);
if(strlen(pIDsWrote) == 0)
{
printf("--\n-- Successfully wrote to file \"%s\" with following player IDs:\n-- None. Server empty.\n--", mainFile, pIDsWrote);
}
else
{
printf("--\n-- Successfully wrote to file \"%s\" with following player IDs:\n-- %s\n--", mainFile, pIDsWrote);
}
}
return 1;
}