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

Read from file


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MacL
Member
Join Date: May 2021
Old 06-07-2021 , 16:34   Read from file
Reply With Quote #1

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 .... 
MacL is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 06-07-2021 , 19:18   Re: Read from file
Reply With Quote #2

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
__________________








CrazY. is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-07-2021 , 21:24   Re: Read from file
Reply With Quote #3

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.
__________________

Last edited by Bugsy; 06-07-2021 at 21:25.
Bugsy is offline
MacL
Member
Join Date: May 2021
Old 06-10-2021 , 19:37   Re: Read from file
Reply With Quote #4

Thank you.

Last edited by MacL; 06-12-2021 at 17:11.
MacL 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 08:19.


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