write to file from amx menu
hello
i write a little plugin to check players nick and password. nicks and pass is in file nicks.txt i want to add new users whitout openning this file but from amx menu or from CS console. unfortunetly i dont know how it do :\ please give me some clue. sory for my english ;) |
Re: write to file from amx menu
|
Re: write to file from amx menu
ok i explain
i know that command write_file("addons/amxmodx/nicks.txt","nick pass",1) add a new line at the end of file nicks.txt but i cant use this command froma CS console question : what to do to use this command froma CS console ???? or how to add a line to file nicks.txt from CS console ???? [of coz i'm an admin ;)] PS : i know my english is poor :] |
Re: write to file from amx menu
In your plugin you have to use :
Code:
retrieve arg with Code:
Code:
Code:
dir = file directory file.txt = filename string = variable where is set the retrieved argument and -1 if you want to add the line to the end. I've just given you syntax command but not how to do it, if you need some help I will be glad to help you (not to make the code) You can check how those functions work by reading .inc files or reading other plugins or checking the doc on this website. For example - From amxmodx.inc : Code:
|
Re: write to file from amx menu
ok I write somthing like that. please somebody check this form me
i'm beginner :] public plugin_init() { register_clcmd("amx_adduser","newuseradd") return PLUGIN_CONTINUE } public newuseradd(id) { if(!is_user_admin(id)) { client_print(id,print_console,"You are not an administrator. Please refrain from using this command!") return PLUGIN_HANDLED } new player[50],pass[50] read_argv(1,player,49) read_argv(2,pass,49) new whattowrite[100] format(whattowrite,99,"%s","%s",player,pass) new target=cmd_target(id,player,9) write_file("addons/amxmodx/nicks.txt",whattowrite,-1) client_print(id,print_console,"User %s, password %s wrote to file.",player,pass) return PLUGIN_HANDLED } |
Re: write to file from amx menu
Almost. Remember you can post code in [small][/small] tags.
Minor changes: Code:
|
| All times are GMT -4. The time now is 22:25. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.