Code:
if(fexist("0Admin/"))
{
#if SAVE_IN_LOGS == true
if(fexist(LOGS_LOC))
{
FileExist(VIPCHAT_LOG);
FileExist(ADMINCHAT_LOG);
FileExist(WARNS_LOG);
FileExist(PMS_LOG);
FileExist(SETRANK_LOG);
FileExist(SETLEVEL_LOG);
FileExist(SETVIP_LOG);
FileExist(KICK_LOG);
FileExist(BAN_LOG);
FileExist(RCON_LOG);
FileExist(REPORT_LOG);
}
else print("MISSING FOLDER: Folder \""#LOGS_LOC"\" doesn't exist! Please create it!"),
Fail = true;
#endif
FileExist(AKA_FILE);
if(!fexist(USER_ID))
{
printf("MISSING FILE: \""#USER_ID"\" doesn't exist, created by the system");
new File:uFile = fopen(USER_ID, io_append);
if(uFile)
{
fwrite(uFile, "Accounts_Created = 0\r\nLast_Account = None\r\nLast_Account_Date = Never");
fclose(uFile);
}
Fail = true;
}
if(!fexist(STATS_LOC))
{
print("MISSING FOLDER: Folder \""#STATS_LOC"\" doesn't exist! Please create it!");
Fail = true;
}
}else print("MISSING FOLDER: The main folder \"/0Admin/\" is missing from the \"scriptfiles\""),
Fail = true;
_DB = db_open(DATABASE_LOC);
new String[750];
strcat(String, "CREATE TABLE IF NOT EXISTS `Accounts` ", 750);
strcat(String, "(`Key` INTEGER PRIMARY KEY AUTOINCREMENT, \
`IP` TEXT, \
`Name` TEXT, \
`Password` TEXT, \
`Online` TEXT, \
`JoinDate` TEXT, \
`Level` NUMERIC, \
`VIP` NUMERIC, \
`Rank` NUMERIC, \
`Autologin` NUMERIC, \
`Money` NUMERIC, \
`Score` NUMERIC, \
`Kills` NUMERIC, \
`Deaths` NUMERIC, \
`Cookies` NUMERIC, \
`Positive` NUMERIC, \
`Negative` NUMERIC, \
`Messages` NUMERIC, \
`Commands` NUMERIC, \
`fCommands` NUMERIC, \
`Warns` NUMERIC, \
`Kicks` NUMERIC, \
`God` NUMERIC, \
`Cargod` NUMERIC,", 750);
strcat(String, " `ACCP` NUMERIC, \
`ACCPSav` TEXT, \
`BlockPM` NUMERIC, \
`Boost` NUMERIC, \
`bSpeed` NUMERIC, \
`RPassword` TEXT, \
`Question` TEXT, \
`Answer` TEXT, \
`WearTAG` NUMERIC, \
`Spin` NUMERIC, \
`Incred` NUMERIC)", 750);
DB::Query(_DB, String);
CreateTable(_DB, "Top", "(`Key` INTEGER PRIMARY KEY AUTOINCREMENT, `Name` TEXT,`Kills` NUMERIC,`Deaths` NUMERIC,`Hours` NUMERIC,`Rank` NUMERIC,`Ratio` TEXT,`Negative` NUMERIC,`Positive` NUMERIC)");
#if SAVE_MUTE == true
CreateTable(_DB, "Muted", "(`Key` INTEGER PRIMARY KEY AUTOINCREMENT, `IP` TEXT,`Muted` NUMERIC,`Time` NUMERIC,`RealName` TEXT)");
#endif
#if SAVE_JAIL == true
CreateTable(_DB, "Jailed", "(`Key` INTEGER PRIMARY KEY AUTOINCREMENT, `IP` TEXT,`Jailed` NUMERIC,`Time` NUMERIC,`RealName` TEXT)");
#endif
#if SAVE_FREEZE == true
CreateTable(_DB, "Frozen", "(`Key` INTEGER PRIMARY KEY AUTOINCREMENT, `IP` TEXT,`Frozen` NUMERIC,`RealName` TEXT)");
#endif
CreateTable(_DB, "Banlist", "(`IP` TEXT,`Name` TEXT, `Reason` TEXT, `Admin` TEXT, `BanDate` TEXT)");
CreateTable(_DB, "Positive", "(`Key` INTEGER PRIMARY KEY AUTOINCREMENT, `Name` TEXT,`Expiration` TEXT)");
CreateTable(_DB, "Negative", "(`Key` INTEGER PRIMARY KEY AUTOINCREMENT, `Name` TEXT,`Expiration` TEXT)");
CreateTable(_DB, "ServerStats", "(`Key` INTEGER PRIMARY KEY AUTOINCREMENT, `Commands`,`Messages`,`Crashes`,`Quits`,`Kicks/Bans`,`Connections`,`Uptime`)");
CreateTable(_DB, "Record", "(`Players`,`Date`,`Time`,`By`,`DateOLD`,`TimeOLD`,`ByOLD`)");
new
DBResult: R1;
R1 = DB::Query(_DB, "SELECT `Players`, `Date`, `Time`, `By` FROM `Record`");
if(R1)
{
if(DB::Valid(R1))
{
new Field[64];
DB::GetField(R1, "Players", Field, 64);
S_DATA[sRecord] = strval(Field);
DB::GetField(R1, "Date", Field, 64);
sscanf(Field, "p</>iii", S_DATA[sD], S_DATA[sM], S_DATA[sY]);
DB::GetField(R1, "Time", Field, 64);
sscanf(Field, "p<:>iii", S_DATA[sH], S_DATA[sMi], S_DATA[sS]);
DB::GetField(R1, "By", Field, 64);
format(S_DATA[RecordBy], MAX_PLAYER_NAME, "%s", Field);
DB::Free(R1);
}
else
{
DB::Free(R1);
DB::Query(_DB, "INSERT INTO `Record` VALUES('0','0/0/0','0:0:0','Nobody','0/0/0','0:0:0','Nobody')");
}
}
SetTimer("PingKick", 2000, true);
SetTimer("LowerSpam", LOW_SPAM_RATE, true);
SetTimer("GodLike", GOD_TICK_RATE, true);
INI_ParseFile(USER_ID, "ParseUserID" );
INI_ParseFile(SERVER_FILE, "LoadServerData");
if(S_DATA[Ping] < 100 && S_DATA[Ping] != 0)
{
new RandomPing = 600 + random(300);
printf("WARNING: Ping Kicker was under 100, randomly set to: %d", RandomPing);
S_DATA[Ping] = (RandomPing);
}
#if USE_RANKS == true
#if PRINT_RANKS == true
print("Ranks created succesfully!\n----------------------------");
#endif
for (new r = 0; r < sizeof(_Ranks); r++)
{
format(_RankNames[r], MAX_RANK_LEN, "%s", _Ranks[r][irName]);
#if PRINT_RANKS == true
printf("Rank: %s | Kills requiered: %d", _RankNames[r], _Ranks[r][iRank]);
#endif
}
#endif
if(Fail == true)
{
print(#\n\n\nWARNING:);
print(#----------------\n- When a file is missing","# the system will create it.);
print(#- However","# if you get a folder error","# you must create the folder on your own!);
print(#- If a folder or a file is deleted while the server runs","# problems may occur!\n\n);
}
if(fexist("/0Admin/"))
{
if(!fexist(SERVER_FILE))
{
printf("MISSING FILE: \""#SERVER_FILE"\" doesn't exist, created by the system");
print("Thew following atributions have been added to the following features:");
new INI:ServerFile = INI_Open(SERVER_FILE),
pStr[512];
print("\n==========================================");
print("||\tFeature\t\tState\tValue\t||");
print("||--------------------------------------||");
for(new i = 0; i < sizeof(INI_Server_Info); ++i)
{
INI_WriteInt(ServerFile, INI_Server_Info[i][isName], INI_Server_Info[i][isValue]);
format(pStr, sizeof (pStr), "||\t%s%s| %s%s",
INI_Server_Info[i][isName],
(i == 2 || i == 6 || i == 8 || i == 12 || i == 13 || i == 15) ? ("\t\t") : ("\t"),
(INI_Server_Info[i][isValue]) ? ((i == 2) ? (EX(INI_Server_Info[i][isValue])) : ("Yes")) : ("No"),
(INI_Server_Info[i][isValue]) ? ((i == 2) ? ("\t||") : ("\t\t||")) : ("\t\t||"));
print(pStr);
}
print("==================\t\t\t||");
print("\t\t|| Copyright Zh3r0 2011 ||");
print("\t\t==========================\n\n\n");
INI_Close(ServerFile);
INI_ParseFile(SERVER_FILE, "LoadServerData");
}
}
if(!Fail) SetTimer("Display", 800, 0);
/*new
cmdBuffer[32],
commandCount;
for(new it = 0; it < Scripting_GetPublicsCount(); it++) {
Scripting_GetPublic(it, cmdBuffer);
if(!strcmp(cmdBuffer, "cmd_", false, 4)) {
strdel(cmdBuffer, 0, 4);
strins(cmdBuffer, "/", 0);
strins(cmdBuffer, "\r\n", strlen(cmdBuffer));
printf(#%d. %s, it - 47, cmdBuffer);
new File:F = fopen("Cmds.txt", io_append);
if(F)
{
fwrite(F, cmdBuffer);
fclose(F);
}
commandCount++;
}
}
printf(#A total of %d commands, commandCount);*/
return 1;
}
stock CountZCMDCmds() {
new
cmdBuffer[32],
commandCount;
for(new it = 0; it < Scripting_GetPublicsCount(); it++) {
Scripting_GetPublic(it, cmdBuffer);
if(!strcmp(cmdBuffer, "cmd_", false, 4)) {
commandCount++;
}
}
return commandCount;
}