Raised This Month: $ Target: $400
 0% 

Read, write, compare cfg file


Post New Thread Reply   
 
Thread Tools Display Modes
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-23-2010 , 13:46   Re: Read, write, compare cfg file
Reply With Quote #31

Remove the g_tSteamIDs = and copy() lines from your load function and place them at the bottom of plugin_init before your load call. Im on my phone now so i cant do it for you.
__________________
Bugsy is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 03-23-2010 , 14:09   Re: Read, write, compare cfg file
Reply With Quote #32

it works, tnx thanks bugsy.
The plugin is now in test state.
If it is stable, i'll release it.
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Conan1018
Member
Join Date: Oct 2010
Old 04-16-2011 , 08:03   Re: Read, write, compare cfg file
Reply With Quote #33

hate to revive a 1 year old thread but i need help with the code on post #13 by Bugsy. Can someone edit that code so that i can put inline comment? Meanings, it will ony read a line until it found a " " or ";" or "//"
Conan1018 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-16-2011 , 13:16   Re: Read, write, compare cfg file
Reply With Quote #34

Quote:
Originally Posted by Conan1018 View Post
hate to revive a 1 year old thread but i need help with the code on post #13 by Bugsy. Can someone edit that code so that i can put inline comment? Meanings, it will ony read a line until it found a " " or ";" or "//"
The code to check that is already there. It will skip any line that doesn't have anything or starts with ";" or "//".
__________________
fysiks is offline
Conan1018
Member
Join Date: Oct 2010
Old 04-16-2011 , 16:57   Re: Read, write, compare cfg file
Reply With Quote #35

the first character in a line is szData[0]. but whats the character after the steamid? i really dont know. should it be szData[16]? but not all steamid has 16 characters.
Conan1018 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-16-2011 , 19:55   Re: Read, write, compare cfg file
Reply With Quote #36

Quote:
Originally Posted by Conan1018 View Post
the first character in a line is szData[0]. but whats the character after the steamid? i really dont know. should it be szData[16]? but not all steamid has 16 characters.
Oh, you want to put a comment on the same line as data. All you need to do is use parse() with just the first argument (requires the SteamID to be in quotes).
__________________
fysiks is offline
Conan1018
Member
Join Date: Oct 2010
Old 04-16-2011 , 20:09   Re: Read, write, compare cfg file
Reply With Quote #37

nevermind, after comparing 5 plugins i think i got it. yes i used parse method. still, thanks fysiks for replying

here's what i did

Code:
    .... new parsedsteamid[33]
    
    while(!feof(f))
    {
        fgets(f, szData, charsmax(szData));

        //trim(szData);

        parse(szData, parsedsteamid, 32)

        if(!szData[0] || szData[0] == ';' || szData[0] == '/' && szData[1] == '/')
            continue;

        TrieSetCell(g_tSteamIDs, parsedsteamid, 1);
    }
tho i am not sure whether should i comment "trim" or not cause from what i red on wiki, trim will remove spaces etc
Conan1018 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-16-2011 , 20:51   Re: Read, write, compare cfg file
Reply With Quote #38

Quote:
Originally Posted by Conan1018 View Post
nevermind, after comparing 5 plugins i think i got it. yes i used parse method. still, thanks fysiks for replying

here's what i did

Code:
    .... new parsedsteamid[33]
    
    while(!feof(f))
    {
        fgets(f, szData, charsmax(szData));

        //trim(szData);

        parse(szData, parsedsteamid, 32)

        if(!szData[0] || szData[0] == ';' || szData[0] == '/' && szData[1] == '/')
            continue;

        TrieSetCell(g_tSteamIDs, parsedsteamid, 1);
    }
tho i am not sure whether should i comment "trim" or not cause from what i red on wiki, trim will remove spaces etc
trim() removes whitespace from the begining and end of the string (never any spaces in the middle).

If you remove trim, the !szData[0] etc. might not work. I would leave trim there and move the parse to after the comment check.
__________________
fysiks is offline
Conan1018
Member
Join Date: Oct 2010
Old 04-16-2011 , 21:16   Re: Read, write, compare cfg file
Reply With Quote #39

but then trim will remove spaces between steamid and the comment part. then parse will detect the whole line (steamid + comment) as parsedsteamid. hope you get what i mean

EDIT: i think !szData[0] will still work because on any empty line, there's no spaces. its just empty empty line

EDIT2: oh i didnt notice you said "....(never any spaces in the middle)". so i guess i will do as you said. thanks.

Last edited by Conan1018; 04-16-2011 at 21:22.
Conan1018 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-16-2011 , 23:44   Re: Read, write, compare cfg file
Reply With Quote #40

Quote:
Originally Posted by Conan1018 View Post
EDIT: i think !szData[0] will still work because on any empty line, there's no spaces. its just empty empty line
No, it will not be empty. It will contain the non-printable characters: carriage return and new line characters (\r\n). IIRC
__________________
fysiks 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 10:30.


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