Raised This Month: $ Target: $400
 0% 

Writing/Reading File Help


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
stupok
Veteran Member
Join Date: Feb 2006
Old 03-05-2006 , 17:34  
Reply With Quote #9

Thanks Suicid3! (how do you give karma points?)

I have a new idea for this plugin, I hope you can help me with it.

But before I get into that, I'd like to finish fixing this code:
Code:
    #include <amxmodx>     #include <amxmisc> public plugin_init() {     register_plugin("Ent User Management","1.0","Fluffy")     register_concmd("amx_addentuser", "addent", ADMIN_LEVEL_B, "- adds ent user. <target> <password>")     register_concmd("amx_delentuser", "delent", ADMIN_LEVEL_B, "- disables ent user. <target> <password>") } public addent(id, level, cid) {     if (!cmd_access(id, level, cid, 2))         return PLUGIN_HANDLED     new Arg1[33],Arg2[33], pName[33], pAuth[33]         read_argv(1, Arg1, 32)     read_argv(2, Arg2, 32)         pName[33] = cmd_target(id, Arg1)     pAuth[33] = get_user_authid(Arg1, pAuth, 32)         new szFile[33]     new szText[101]     format( szFile, 32, "addons/EntMod/DF_admins.txt")     format( szText , 100 , "%s;%s;1 //%s",pAuth,Arg2,pName)     write_file(szFile, szText ,-1)     return 0 }
It returns two errors:
(21)error 032: array index out of bounds (variable "pName")
(22)error 032: array index out of bounds (variable "pAuth")

I have tried a few things, but I really have no clear idea of what I should change to fix those errors.

__________________________________________

Now, about the new idea for the plugin. Instead of having it read each line and check if the user is there already, or if the user has EntMod access enabled, and then take action based on these parameters, I propose to simplify this whole thing.
I'm afraid it would be too much coding, and too complex, for me to write the complete and working plugin that checks so many variables.

How about taking all text from "addons/EntMod/DF_admins.txt" and putting it into a MOTD screen, and I'll decide whether or not the user is already in the file, and what to do from there.

And, to match that idea, instead of "format( szText , 100 , "%s;%s;1 //%s",pAuth,Arg2,pName)", how about establishing a command so I could type "amx_entusers STEAM_0:0:1234;password;1 //whatever" and this line would be appended to the file "as-is." So I could append a line with any text I want to the file.

I'd appreciate any insight into writing this plugin.
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