Raised This Month: $51 Target: $400
 12% 

Solved [ H3LP ] Ini Read


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DarthMan
Veteran Member
Join Date: Aug 2011
Old 05-25-2017 , 11:09   [ H3LP ] Ini Read
Reply With Quote #1

Hello. So I made a say command with more arguments using strtok. My question is, when reading the ini file, how can I make it to look for only the maps that are containing the argument? So, for example, if I look for lambda and it contains more maps with lambda, it must only list all the maps containing the lambda word. I ahve tried using both contain and equal with strlen, but in both cases it listed all maps that were valid in the maps folder from the ini file. Thanks !

Last edited by DarthMan; 05-26-2017 at 06:52. Reason: Solved
DarthMan is offline
KiLLeR.
Senior Member
Join Date: Jul 2014
Location: Bulgaria
Old 05-25-2017 , 19:57   Re: [ H3LP ] Ini Read
Reply With Quote #2

Post your code, probably something is wrong with it cuz it must work with contain.
KiLLeR. is offline
DarthMan
Veteran Member
Join Date: Aug 2011
Old 05-26-2017 , 04:38   Re: [ H3LP ] Ini Read
Reply With Quote #3

Quote:
Originally Posted by KiLLeR. View Post
Post your code, probably something is wrong with it cuz it must work with contain.
Here's the reading part.

PHP Code:
new szFile[256]
get_configsdir(szFilecharsmax(szFile))
add(szFilecharsmax(szFile), "/maps.ini")
        
new 
iFile fopen(szFile"r")
        
while (!
feof(iFile))
{
    
fgets(iFileszMapNamecharsmax(szMapName))
            
    
trim(szMapName)
            
    if (
szMapName[0] == EOS || szMapName[0] == '/' || szMapName[0] == '[' || szMapName[0] == ']' || szMapName[0] == ';')
        continue;
            
    if (
equal(sMapszMapName), strlen(sMap) && is_map_valid(szMapName))
    {
        
i++;
        
client_print(idprint_console"%i. %s"iszMapName);
    }
}
client_print(idprint_chat"* A complete list of %d matching maps will be displayed in your console."i)
fclose(iFile); 

Last edited by DarthMan; 05-26-2017 at 04:40.
DarthMan is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 05-26-2017 , 04:47   Re: [ H3LP ] Ini Read
Reply With Quote #4

Closing ) too soon in the if.
__________________
HamletEagle is offline
DarthMan
Veteran Member
Join Date: Aug 2011
Old 05-26-2017 , 06:20   Re: [ H3LP ] Ini Read
Reply With Quote #5

Quote:
Originally Posted by HamletEagle View Post
Closing ) too soon in the if.
I fixed it, thanks to my one of my steam friends
DarthMan 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 22:06.


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