Raised This Month: $ Target: $400
 0% 

Help write file


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SAMURAI16
BANNED
Join Date: Sep 2006
Old 02-10-2007 , 10:16   Re: Help write file
Reply With Quote #1

ok, this is public
Code:
public add_rule(id,level,cid)
{
    if( ! cmd_access ( id , level, cid , 2) )
    return PLUGIN_HANDLED;
    
    new g_FILE[128]
    get_localinfo("amxx_configsdir",g_FILE,127)
    format(g_FILE,127,"%s/sayrules.txt",g_FILE)
    
    new text[32]
    read_argv(1,text,31)
    
    new fileh = fopen(g_FILE, "w");
    
    if ( ! fileh )
    return PLUGIN_CONTINUE
    
    fprintf(fileh, "%s", text);
    
    fclose(fileh);
    
    return PLUGIN_HANDLED;
}
Sure, i register that public, with comand amx_addrule ;
So, i used command : amx_addrulle hello all
After i use command:

1) Cleared all information from my file
2) Added only "hello" on file
SAMURAI16 is offline
Send a message via MSN to SAMURAI16
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 02-10-2007 , 10:44   Re: Help write file
Reply With Quote #2

Change "w" to "a".
Of course it only prints hello, you only read one arg. if you wanna read all use read_args()
[ --<-@ ] Black Rose 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 00:38.


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