Raised This Month: $ Target: $400
 0% 

Auto Create a .cfg in configs


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AntiBots
Veteran Member
Join Date: May 2008
Location: Brazil
Old 08-19-2008 , 18:37   Auto Create a .cfg in configs
Reply With Quote #1

Someone can give me an Idea to do this

thanks
__________________
AntiBots is offline
Send a message via ICQ to AntiBots Send a message via MSN to AntiBots Send a message via Skype™ to AntiBots
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-19-2008 , 18:47   Re: Auto Create a .cfg in configs
Reply With Quote #2

Code:
public plugin_init() {     new filename[64];     get_configsdir(filename, 63);     add(filename, 63, "/my_config.cfg");         if( !file_exists(filename) )     {         new f = fopen(filename);         fputs(f, "");         fclose(f);     } }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-19-2008 , 18:59   Re: Auto Create a .cfg in configs
Reply With Quote #3

Just using that is enough :

Code:
new fp = fopen( filename, "w" ); fclose( fp );
__________________
Arkshine is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 08-20-2008 , 03:41   Re: Auto Create a .cfg in configs
Reply With Quote #4

I don't know shure if it works only with "w" mode, maybe you will have to put "at+"
Alka is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-20-2008 , 03:59   Re: Auto Create a .cfg in configs
Reply With Quote #5

No.

w = Create an empty file for writing. If a file with the same name already exists its content is erased and the file is treated as a new empty file.
__________________
Arkshine is offline
Reply



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 03:14.


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