Question
#1

I'm wondering, OnPlayerConnect in my script i write the users name to a file. This stores all playernames of the people ever connected, i'm wondering that if the file gets really big with say like 5000 unique usernames will it still continue reading or will it not be able to find the username. ( I check if they have connected before OnPlayerConnect and say "Welcome back.")

Thanks.

Reply
#2

Quote:
Originally Posted by Seif_
fread should read the whole file. But if you really got too many lines, your server will crash because you'll be using fread in a while loop. So it's best to create a file for each user.
I thought that, just wanted to make sure.

I have another question, i'm working on a roleplay script where the character name is not the file name, but is stored in the file. When a players creating a new character i want to check if that character name is in use without creating a new file for each character, the only solution i've had so far is a Characters folder where the filename is the character name and when the player creates a character it creates the file in there and i check if that file exists to check if the character exists although the file contains no data at all. I was just wondering is there an easier/better way of doing this?
Reply
#3

Quote:
Originally Posted by Seif_
Quote:
Originally Posted by Norn
Quote:
Originally Posted by Seif_
fread should read the whole file. But if you really got too many lines, your server will crash because you'll be using fread in a while loop. So it's best to create a file for each user.
I thought that, just wanted to make sure.

I have another question, i'm working on a roleplay script where the character name is not the file name, but is stored in the file. When a players creating a new character i want to check if that character name is in use without creating a new file for each character, the only solution i've had so far is a Characters folder where the filename is the character name and when the player creates a character it creates the file in there and i check if that file exists to check if the character exists although the file contains no data at all. I was just wondering is there an easier/better way of doing this?
Not as far as I know. You can't check without opening each file or storing each name in a file(which like I said, it could be bad).
Why don't you use MySQL?
I only like using mysql with PHP, i hate using it with SA-MP it annoys the shit out of me lol.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)