AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Help] How to create a config or .ini (https://forums.alliedmods.net/showthread.php?t=184914)

Napoleon_be 05-10-2012 11:29

[Help] How to create a config or .ini
 
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.

fysiks 05-10-2012 11:41

Re: [Help] How to create a config or .ini
 
A config or ini file is just a plain text file. You can just create a text file and rename it.

Napoleon_be 05-10-2012 12:16

Re: [Help] How to create a config or .ini
 
Thats my question, how to do this?

DarkGL 05-10-2012 12:20

Re: [Help] How to create a config or .ini
 
http://www.amxmodx.org/funcwiki.php?go=func&id=88

Napoleon_be 05-10-2012 15:22

Re: [Help] How to create a config or .ini
 
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?

<VeCo> 05-10-2012 15:28

Re: [Help] How to create a config or .ini
 
You can directly put the text in quotes if you don't need anything to format, else use formatex.

Napoleon_be 05-10-2012 15:33

Re: [Help] How to create a config or .ini
 
Quote:

Originally Posted by <VeCo> (Post 1706325)
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?

hornet 05-10-2012 19:58

Re: [Help] How to create a config or .ini
 
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() .


All times are GMT -4. The time now is 00:26.

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