Raised This Month: $ Target: $400
 0% 

Writing/Reading File Help


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
stupok
Veteran Member
Join Date: Feb 2006
Old 03-04-2006 , 19:33   Writing/Reading File Help
Reply With Quote #1

I'm trying to write a plugin that will allow admins to add EntMod users from the console, instead of opening the txt file myself and adding a user.

I've searched for threads that might help me write the plugin, but I couldn't find sufficient info.

I would greatly appreciate any help.

______________________________________

DETAILS

"amx_addentuser" should check to see if the target's steamid is already in the DF_admins.txt file, and if the steamid is not found, or if there is a "0" after "password;", add the target to the file or change the "0" to a "1".

The format for a user in the DF_admins.txt (Ent users file) is this:
Code:
STEAM_0:0:123456;password;1 //target's name
"amx_delentuser" should check to see if the target's steamid is already in the DF_admins.txt file, and if the steamid is found, change the "1" to a "0" in the above line (steamid;password;0).
______________________________________

Here is my attempt at coding this plugin: (not nearly finished)
Code:
#include <amxmodx> #include <amxmisc> #include <file> #include <string> #define PLUGIN "Add Ent Access" #define VERSION "1.0" #define AUTHOR "Fluffy" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_clcmd("amx_addentuser", "addenter", ADMIN_LEVEL_B, "- adds an EntMod User <target> <pass>")     register_clcmd("amx_delentuser", "delenter", ADMIN_LEVEL_B, "- deletes an EntMod User") } public addenter(id, level, cid) {     if (!cmd_access(id, level, cid, 2))     return PLUGIN_HANDLED             new Player[24]         read_argv(1, Player, 23)             new Password[24]         read_argv(2, Password, 23)             new PlayerID[24] = get_user_userid(Player)         new szFile[24]         format( szFile, 23, "addons/EntMod/DF_admins.txt")     write_file(szFile,"%s;%s;1 //%s",PlayerID,Password,Player,-1) }
stupok is offline
 



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 20:16.


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