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

ReadFileLine & strcmp


Post New Thread Closed Thread   
 
Thread Tools Display Modes
Author Message
TheWho
AlliedModders Donor
Join Date: Jul 2012
Old 10-04-2013 , 08:03   ReadFileLine & strcmp
#1

Hello,

I just want to read all SteamIDs (each one is in a new line) from a .txt and compair it with clients steamid, and set a variable to true if his steamid is in the .txt.
But something went wrong, maybe my while loop didnt work my variable is everytime false but the steamid is listed in the .txt.

PHP Code:

    GetClientAuthString
clientgAuthIDsizeofgAuthID ) );

    new 
Handle:hndl OpenFile"addons/sourcemod/logs/xxx.txt""a" );
    if( 
hndl == INVALID_HANDLE)
    {
        return;
    }
    
    new 
String:buffer[65];

    
g_sExistClient[client] = 0;

    while(!
IsEndOfFile(hndl) && ReadFileLine(hndlbuffersizeof(buffer)))
    {
        if (
strcmp(buffergAuthIDfalse))
        {
            
g_sExistClient[client] = 1;
        }
    } 
Maybe you can help me, thanks.
TheWho is offline
xf117
Senior Member
Join Date: Mar 2010
Location: Russia
Old 10-04-2013 , 09:02   Re: ReadFileLine & strcmp
#2

Why everyone are using strcmp instead of StrEqual?
strcmp returns 0 if strings are equal.

Also it is a good idea to cache such things.
xf117 is offline
Send a message via ICQ to xf117
TheWho
AlliedModders Donor
Join Date: Jul 2012
Old 10-04-2013 , 11:34   Re: ReadFileLine & strcmp
#3

Sorry I forget to say that I used StrEqual befor strcmp but it doesnt worked too..

€dit:

I'm sure that in my while loop is something wrong

Last edited by TheWho; 10-04-2013 at 11:36.
TheWho is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 10-08-2013 , 10:41   Re: ReadFileLine & strcmp
#4

Similar request:
http://forums.alliedmods.net/showthread.php?t=214171
__________________
View my Plugins | Donate
TnTSCS is offline
TheWho
AlliedModders Donor
Join Date: Jul 2012
Old 10-08-2013 , 10:46   Re: ReadFileLine & strcmp
#5

Alright, well taken care of!
TheWho is offline
Dr. Greg House
Professional Troll,
Part-Time Asshole
Join Date: Jun 2010
Old 10-08-2013 , 10:48   Re: ReadFileLine & strcmp
#6

On a side note: I offered my personal help on this and found out he's trying to script an autoinvite bot.
__________________
Santa or Satan?

Watch out when you're paying people for private requests! Most stuff already exists and you can hardly assess the quality of what you'll get, and if it's worth the money.
Dr. Greg House is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 10-08-2013 , 11:05   Re: ReadFileLine & strcmp
#7

tsk tsk - well, hopefully not... anyways, using an array to push steamids to then checking the array for a match is faster than going through the file every time you want to check.
__________________
View my Plugins | Donate

Last edited by TnTSCS; 10-08-2013 at 11:39.
TnTSCS is offline
TheWho
AlliedModders Donor
Join Date: Jul 2012
Old 10-08-2013 , 11:43   Re: ReadFileLine & strcmp
#8

Oh my gosh, you offered your help?! I only can laugh!

I said to you that my while loop dosnt work, you wanted to get more info what iam writing on and I said to you that I list the steamids of my players, convert them to steamid64 and put www.http://steamcommunity.com/profiles/ befor the id and add them to my group manually and you child say that iam autoinviting...???! constitute what ever you want pha, you said thats illegal before i said anything,
idiotic?? go to the owners of saigns and say it to them, they do illegal shit, they fake bots to players by chopping their windows based server

I will not blame me!

Last edited by TheWho; 10-08-2013 at 11:48.
TheWho is offline
Dr. Greg House
Professional Troll,
Part-Time Asshole
Join Date: Jun 2010
Old 10-08-2013 , 11:53   Re: ReadFileLine & strcmp
#9

You lashing out won't do any difference.
Also, on a side note, before you try to alter conversations and in fact tell lies about me, keep in mind that I have a chat log backed up just in case you'd be doing that.

So here's how it went on (This is the summary of the conversation we've had in German - Well I was talking in German, he had his own flawed version of it):
-I told you I needed to see more because those few lines without any context seemed to be correct
-You did not want to supply these
-I told you to debugprint through the loop
-I also asked you why you specifically want to use a textfile and not a database
-I have given you the arrays advice regardless while telling you that you might be better off with databases
-Then I kept insisting to know what this was for because there might be better solutions (Could have been for command restrictions, etc.)
-After that you've gotten pretty aggressive (also quite cocky) while still not supplying the necessary information
(On a side note: At this point it was quite obvious there was something going on. You probably knew beforehand that those bots are not supported here and more illegal than allowed, but still wanted to manipulate friendly helping people into supplying you with answers you did not want to ask the questions for)
-It took me some time till you confessed to your agenda
-Then you got a lesson and the usual trashtalk and grayish justifications started (I mean what else to expect at that point)
-After a clever list of retorts of mine I removed you from my friendslist.
__________________
Santa or Satan?

Watch out when you're paying people for private requests! Most stuff already exists and you can hardly assess the quality of what you'll get, and if it's worth the money.

Last edited by Dr. Greg House; 10-08-2013 at 11:56.
Dr. Greg House is offline
Closed Thread



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 20:56.


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