AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Read from file (https://forums.alliedmods.net/showthread.php?t=332909)

MacL 06-07-2021 16:34

Read from file
 
Hey alliedmodders. how can i read from a file like this:
Code:

"something" "something2" "st3" "sm4" "sm5"
so this is cfg or txt or ini file, it does not matter. i'd like to read first part of that is it possible? how? like when player open menu and see something like this:
PHP Code:

 First part of line one in filename.fileformat is thissomething
         second part is this 
something2
         
and .... 


CrazY. 06-07-2021 19:18

Re: Read from file
 
Use the file functions to open the file and "parse" to get the strings that are in between the quotes.

https://www.amxmodx.org/api/file/fopen
https://www.amxmodx.org/api/string/parse

Bugsy 06-07-2021 21:24

Re: Read from file
 
There are plenty of examples on these forums, search for "fopen parse fgets" and you'll likely find exactly what you need. This is the suggestions/requests section, do you need something written, or are you asking for help with scripting? If you need help, this should be posted in scripting help.

MacL 06-10-2021 19:37

Re: Read from file
 
Thank you.


All times are GMT -4. The time now is 19:57.

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