Raised This Month: $ Target: $400
 0% 

Setting CVAR value


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Drak
Veteran Member
Join Date: Jul 2005
Old 01-04-2007 , 18:37   Setting CVAR value
Reply With Quote #1

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.

Last edited by Drak; 01-04-2007 at 19:11.
Drak is offline
Send a message via MSN to Drak
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:27.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode