Raised This Month: $ Target: $400
 0% 

[Help] How to create a config or .ini


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 05-10-2012 , 11:29   [Help] How to create a config or .ini
Reply With Quote #1

How to create a config or .ini saved in the addons/configs folder where it saves the information like this using nvault: mapname, totalvotes, average and votenumber.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-10-2012 , 11:41   Re: [Help] How to create a config or .ini
Reply With Quote #2

A config or ini file is just a plain text file. You can just create a text file and rename it.
__________________
fysiks is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 05-10-2012 , 12:16   Re: [Help] How to create a config or .ini
Reply With Quote #3

Thats my question, how to do this?
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
DarkGL
Senior Member
Join Date: Aug 2010
Location: Warsaw, Poland
Old 05-10-2012 , 12:20   Re: [Help] How to create a config or .ini
Reply With Quote #4

http://www.amxmodx.org/funcwiki.php?go=func&id=88
__________________
DarkGL is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 05-10-2012 , 15:22   Re: [Help] How to create a config or .ini
Reply With Quote #5

I'm trying to add the second argument as a variable, but it seems it has to be an array. How to fix this with a variable? Should i use formatex?
EDIT:
PHP Code:
new config[33] = "votemap.cfg" 
PHP Code:
public Cmd_WriteFile() {
    new 
szTemp[555 char]
    
formatex(szTempcharsmax(szTemp), "TotalVotes: %i"iTotalVotes)
    
write_file(configszTemp, -1)
    
formatex(szTempcharsmax(szTemp), "Average of Total Votes: %i/5"Average)
    
write_file(configszTemp, -1)
    
formatex(szTempcharsmax(szTemp), "Map: %s"szMap)
    
write_file(configszTemp, -1)

Something like this or can i optimize this a lot more?
__________________

Last edited by Napoleon_be; 05-10-2012 at 15:32.
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-10-2012 , 15:28   Re: [Help] How to create a config or .ini
Reply With Quote #6

You can directly put the text in quotes if you don't need anything to format, else use formatex.
__________________
<VeCo> is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 05-10-2012 , 15:33   Re: [Help] How to create a config or .ini
Reply With Quote #7

Quote:
Originally Posted by <VeCo> View Post
You can directly put the text in quotes if you don't need anything to format, else use formatex.
Can you look at my previous post and check if it's alright, or can i optimize this?
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 05-10-2012 , 19:58   Re: [Help] How to create a config or .ini
Reply With Quote #8

I think he's saying that you don't need to save any excess string information to your file, only the actual data.

EDIT: Also you may prefer to put your config file with the rest of the configs. You can use get_configsdir() .
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.

Last edited by hornet; 05-10-2012 at 20:35.
hornet 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:26.


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