Raised This Month: $32 Target: $400
 8% 

Keyvalues saving to file


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
-.-Owned Myself-.-
Member
Join Date: Jul 2008
Old 05-25-2010 , 08:14   Keyvalues saving to file
Reply With Quote #1

I've been making a plugin (an advanced version of sm_addadmin) to parse through admins.cfg and admin_groups.cfg by using Keyvalues (since they are in that format).

I am having trouble actually changing values in the admins.cfg file though (such as the auth key). It says it manages to delete the key then I force it to be created.

I don't know how to actually save the new keyvalues to an existing file as I have only ever used keyvalues to get information, never write it.
-.-Owned Myself-.- is offline
rhelgeby
Veteran Member
Join Date: Oct 2008
Location: 0x4E6F72776179
Old 05-25-2010 , 08:31   Re: Keyvalues saving to file
Reply With Quote #2

Look at KeyValuesToFile. It will dump the kv structure to file.

Note that it doesn't preserve formatting, so everything will be written on one line, I think. Comments will be lost.
__________________
Richard Helgeby

Zombie:Reloaded | PawnUnit | Object Library
(Please don't send private messages for support, they will be ignored. Use the forum.)
rhelgeby is offline
Send a message via MSN to rhelgeby
-.-Owned Myself-.-
Member
Join Date: Jul 2008
Old 05-25-2010 , 09:20   Re: Keyvalues saving to file
Reply With Quote #3

Brilliant!

Had a few issues with it but worked them out now and everything works just like it should now (no silent errors).

For others, you need to go back to the main Key value using KvGoBack to dump all the keyvalues.
-.-Owned Myself-.- is offline
Master53
Veteran Member
Join Date: Dec 2009
Old 05-25-2010 , 11:59   Re: Keyvalues saving to file
Reply With Quote #4

you would need to create a txt saving system and you would have to save and load SteamId and Admin_Flag's cheak out
http://forums.alliedmods.net/showthread.php?t=78380
because it contains a txt saving system
__________________
Master(d)



Master53 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:58.


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