Writing/Reading File Help
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______________________________________ Here is my attempt at coding this plugin: (not nearly finished) Code:
|
Re: Writing/Reading File Help
Code:
Try that |
I appreciate your help, but I'm afraid I need much more help in order to write the entire plugin.
|
Then post your questions and we will help :)
|
Quote:
|
Alright, for this you are going to need to use strbreak() or some other forum of splitting a string
Ill see what I can find |
I DO NOT CLAIM OWNERSHIP TO ANY OF THE CODE BELOW
I suppose I just wasn't clear enough, or was asking for too much. Sorry about that, I'll try to ask some simpler questions. _____________________________________________ __________________ Code:
Will this code write the line below to a txt file in addons/EntMod (with strings in the place of the strings' names)? What mistakes am I making? Code:
PlayerID;Password;1 //PlayerI have more questions, but I'll stop here for now. |
Code:
|
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:
(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. :D |
Code:
|
| All times are GMT -4. The time now is 20:16. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.