02.05.2016, 02:59
pwn(1027) : error 017: undefined symbol "WriteLog"
stock WriteLog()
{
// resto das funзгo
return 1;
}
stock WriteLog(log[], string[])
{
new File:handler;
new buffer[512];
new tmp[128];
new bool:found;
static wlday, wlmonth, wlyear;
new day, month, year, hour, minute, second, weekday;
new fname[128];
getdate(year, month, day);
gettime(hour, minute, second);
weekday = getweekday(year, month, day) - 1;
format(fname, 128, "biologicalwar/logs/%s.log", log);
if(!fexist(fname))
{
handler = fopen(fname, io_write);
printf("Server Log '%s' created!", log);
format(buffer, 512, "@ Biological Warfare - %s log @\r\n\r\n\t ·-=-· %s, %s %d%s, %d ·-=-· \r\n\r\n[%02d:%02d:%02d] %s\r\n", log, WeekdayName[weekday], MonthName[month-1], day, GetOrdinalNumber(day), year, hour, minute, second, string);
fwrite(handler, buffer);
fclose(handler);
wlyear = year, wlmonth = month, wlday = day;
return true;
}
else
{
if(wlyear == year && wlmonth == month && wlday == day)
{
handler = fopen(fname, io_append);
format(buffer, 512, "[%02d:%02d:%02d] %s\r\n", hour, minute, second, string);
fwrite(handler, buffer);
fclose(handler);
return true;
}
else
{
handler = fopen(fname, io_read);
format(tmp, 128, "%s, %s %d%s, %d", WeekdayName[weekday], MonthName[month-1], day, GetOrdinalNumber(day), year);
while(fread(handler, buffer))
{
if(strfind(buffer, tmp) >= 0)
{
found = true;
break;
}
}
fclose(handler);
handler = fopen(fname, io_append);
if(found)
{
format(buffer, 512, "[%02d:%02d:%02d] %s\r\n", hour, minute, second, string);
fwrite(handler, buffer);
fclose(handler);
wlyear = year, wlmonth = month, wlday = day;
return true;
}
else
{
format(buffer, 512, "\r\n\t ·-=-· %s, %s %d%s, %d ·-=-· \r\n\r\n[%02d:%02d:%02d] %s\r\n", WeekdayName[weekday], MonthName[month-1], day, GetOrdinalNumber(day), year, hour, minute, second, string);
fwrite(handler, buffer);
fclose(handler);
wlyear = year, wlmonth = month, wlday = day;
return true;
}
}
}
}