Reading from a file
Hello, first off, I want to introduce myself from AMX, I'm Paladinrocker and I did AMX coding awhile back and made myself a few plugins. I'm returning now in AMXX, and I'm making some plugins for my clan's server in Zombie Panic, but unfortuantely I've forggoten a lot, and I've also searched the forums and didn't find anything, so here's my question. I basically want to look through a file full of steamids, and see if the person connecting matches any of the steamids in the list. And if at all possible, could you tell me how to write a steam id into the file as well, but in a skipped pattern line like:
steamid1 steamid2 steamid3 Thanks a lot. |
Re: Reading from a file
I never used the new reading/writing system thingy, so I have no idea if this works.
Also, there's a tut here: http://forums.alliedmods.net/showthread.php?t=46218 Edit: Wow, apparently what your asking for is already done in that thread. Code:
|
Re: Reading from a file
Thanks a lot, I'm looking into it.
|
Re: Reading from a file
Ok I did it, and basically I just had it display a red message if the two steam ids were equal, and green if not, but they ended up all being red. Here's the code:
Code:
public special_steamid(id) |
Re: Reading from a file
Quote:
|
Re: Reading from a file
I forgot another tidbit, this is the actual displaying part. It's when the player joins.
Code:
if(special_steamid(players[i])) |
Re: Reading from a file
Quote:
|
Re: Reading from a file
¿shouldn't you read the file into an array or another data structure? opening, closing, and sweeping through a file everytime someone connects is not efficient, unless the file is cached in memory, but you really can't depend on the OS for that.
|
Re: Reading from a file
By the way, where do I place that .txt file? Do I place it in the main mod directory, or do I place it elsewhere? I'm right in the middle of testing so I don't know if making an integer helped it.
EDIT: How would I do that facuq? Like I said, I'm still re-learning all this. |
Re: Reading from a file
Quote:
.ini, not .txt. The plugin creates it for you. Code:
Code:
|
| All times are GMT -4. The time now is 00:44. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.