사이트 로그인
2016.04.02 18:24
#include <process.h>
#include "stdafx.h"
#include "Utilidades.h"
#include "NewsSystem.h"
#define NewFile "..\\MuData\\Mu_News.txt"
void NewsSystemClass__InsideTrigger(void * lpParam)
{
FILE *fp;
fp=fopen("..\\MuData\\Mu_News.txt","rb");
if(!fp)
{
MessageBoxA(NULL,"Mu_News.txt not found!","Error!",MB_OK);
::ExitProcess(0);
}
while(true)
{
char MSG01[58];
char MSG02[58];
char MSG03[58];
int IsNews = GetPrivateProfileIntA("General","MuIsNewsSystem",0,NewFile);
int Sections = GetPrivateProfileIntA("General","MuNewsSections",0,NewFile);
long time = GetPrivateProfileIntA("General","MuTimeBtwEachNew",0,NewFile) * 60000;
if(Sections > 5 || Sections <= 0 || IsNews == 0)
{
_endthread();
}
Sleep(time);
GetPrivateProfileStringA("News","MuNew01","This server uses MuTeam Server Files!",MSG01,58,NewFile);
GetPrivateProfileStringA("News","MuNew02","This server uses MuTeam Server Files!",MSG02,58,NewFile);
GetPrivateProfileStringA("News","MuNew03","This server uses MuTeam Server Files!",MSG03,58,NewFile);
StringSendAll(MSG01,0);
StringSendAll(MSG02,0);
StringSendAll(MSG03,0);
if(Sections >= 2)
{
Sleep(time);
GetPrivateProfileStringA("News","MuNew04","This server uses MuTeam Server Files!",MSG01,58,NewFile);
GetPrivateProfileStringA("News","MuNew05","This server uses MuTeam Server Files!",MSG02,58,NewFile);
GetPrivateProfileStringA("News","MuNew06","This server uses MuTeam Server Files!",MSG03,58,NewFile);
StringSendAll(MSG01,0);
StringSendAll(MSG02,0);
StringSendAll(MSG03,0);
}
if(Sections >= 3)
{
Sleep(time);
GetPrivateProfileStringA("News","MuNew07","This server uses MuTeam Server Files!",MSG01,58,NewFile);
GetPrivateProfileStringA("News","MuNew08","This server uses MuTeam Server Files!",MSG02,58,NewFile);
GetPrivateProfileStringA("News","MuNew09","This server uses MuTeam Server Files!",MSG03,58,NewFile);
StringSendAll(MSG01,0);
StringSendAll(MSG02,0);
StringSendAll(MSG03,0);
}
if(Sections >= 4)
{
Sleep(time);
GetPrivateProfileStringA("News","MuNew10","This server uses MuTeam Server Files!",MSG01,58,NewFile);
GetPrivateProfileStringA("News","MuNew11","This server uses MuTeam Server Files!",MSG02,58,NewFile);
GetPrivateProfileStringA("News","MuNew12","This server uses MuTeam Server Files!",MSG03,58,NewFile);
StringSendAll(MSG01,0);
StringSendAll(MSG02,0);
StringSendAll(MSG03,0);
}
if(Sections == 5)
{
Sleep(time);
GetPrivateProfileStringA("News","MuNew13","This server uses MuTeam Server Files!",MSG01,58,NewFile);
GetPrivateProfileStringA("News","MuNew14","This server uses MuTeam Server Files!",MSG02,58,NewFile);
GetPrivateProfileStringA("News","MuNew15","This server uses MuTeam Server Files!",MSG03,58,NewFile);
StringSendAll(MSG01,0);
StringSendAll(MSG02,0);
StringSendAll(MSG03,0);
}
}
_endthread();
}