Code:
public CheckFile() {
if(!get_pcvar_num(dynamic)) return PLUGIN_HANDLED;
new szFile[64]
get_configsdir(szFile,sizeof(szFile))
trim(szFile)
format(szFile , 63 , "%s/dynamic.ini",szFile)
if(!file_exists(szFile)) {
server_print("[AMXX] Dynamic config file not found!^nCreating...")
//log_amx("[AMXX] Dynamic config file not found, Created!")
write_file(szFile,NEW_FILE);
}
new info_month[8],info_date[8],info_cvar[8],info_command[33],info_extra[8]
new readdata[200],txtlen
new str_month
new str_date
new fsize = file_size(szFile,1)
for(new line = 0; line <= fsize; line++) {
read_file(szFile,line+1,readdata,199,txtlen)
//Format: #month #date "command" "extra"
parse(readdata,info_month,7,info_date,7,info_command,32,info_extra,7)
str_month = str_to_num(info_month)
str_date = str_to_num(info_date)
server_command(info_command,str_month,str_date,info_extra);
}
return PLUGIN_HANDLED
}
public server_command(command[],file_month,file_date,extra[])
{
if(!get_pcvar_num(dynamic)) return PLUGIN_HANDLED;
get_time("%d",server_date,9) //date
get_time("%m",server_month,9) //month
new g_month = str_to_num(server_month)
new g_date = str_to_num(server_date)
if(equali(extra,"cvar")) {
if(g_month || g_date == file_month || file_date) {
server_cmd(command) //Don't use SERVER_CMD?
//set_cvar_num(command)
}
}
else
{
if(g_month || g_date == file_month || file_date) {
server_cmd(command)
//Set Non-Cvar
}
}
return PLUGIN_HANDLED
}
What i'm trying todo, is that there's a value being past threw the command(server_command function) section, now it's sometimes a value or a string (Reading from file), how can I make it so it reads if it's a value or a string and set the correct cvar value/string? I also realized that i'm using the old way of reading/writing files.