Server Help

Bot Questions - Morphing Filenames

D1st0rt - Mon Dec 29, 2003 12:26 pm
Post subject: Morphing Filenames
I'm trying to use a similar file system to INVBot, with a text file for each player.

Code: Show/Hide
String fname;
fname += p->name;
fname += ".txt";

ifstream file;
file.open(fname, ios::in);

doesnt work, because fname has to be a const char*, and I can't cast fname as one or use the += operator if I change the fname to it off the bat. I also tried append and that didn't work.

Does anybody have a clue how to do this?
Cyan~Fire - Mon Dec 29, 2003 3:08 pm
Post subject:
Don't make a separate text file for each player. That's just... insane.

But if you REALLY want to, derive a class from ifstream and overload open(). That would be fun.

My suggestion would be to use the PrivateProfile Windows SDK functions. Make an INI file with a section for every player.
Anonymous - Mon Dec 29, 2003 5:00 pm
Post subject:
I agree w/ cyan ... a new file for every player is a tad much insane.. XD
ExplodyThingy - Mon Dec 29, 2003 5:59 pm
Post subject:
Youre using a String datatype when it wants a char*. Read datatypes.h and look for the string class. Find the char* that is in the class, I believe it is "msg". Use file.open(fname.msg) and you should be fine.
Cyan~Fire - Mon Dec 29, 2003 6:34 pm
Post subject:
Oops. I feel stupid now.
D1st0rt - Tue Dec 30, 2003 1:18 am
Post subject:
k thanks
D1st0rt - Tue Dec 30, 2003 11:36 am
Post subject:
Question: how do you set it up so that it only loads their data if they have data. (ie Someone enters for the first time and has no data to load)

nm, looked in the source for Rampage 2 1/2
Cyan~Fire - Tue Dec 30, 2003 12:26 pm
Post subject:
Why not just have one file?? Can you imagine how much junk this bot is going to create??
50% Packetloss - Tue Dec 30, 2003 12:37 pm
Post subject:
ROFL Rampage 2 1/2, damn i think of leet versions
D1st0rt - Tue Dec 30, 2003 5:09 pm
Post subject:
i AM using an INI, thats why I looked in rampage's source. 50% is like the King of open-source MERV Plugins
D1st0rt - Tue Dec 30, 2003 6:41 pm
Post subject:
Ok, that stuff in rampage 2 1/2 applied to tags, which I don't need. The problem I have is a new player in the INI. If they're already there, its not a problem. Is there way to check and see if a player is entered and then add them if they're not

heres the structure:
Code: Show/Hide
[Player name]
money=
exp=
level=



BTW, thanks to Splody for his iniaccess.cpp
ExplodyThingy - Thu Jan 01, 2004 2:46 pm
Post subject:
D1st0rt wrote:
i AM using an INI, thats why I looked in rampage's source. 50% is like the King of open-source MERV Plugins

Hey, all my stuff is open sourced, too, ya know.

D1st0rt wrote:
BTW, thanks to Splody for his iniaccess.cpp

Its dustpuppy's, as the info suggests in the sources. Theres a more cross- platform version of same thing in my subgame-asss converter, though it works better reading and storing to variables, than for getting one variable at a time.
CypherJF - Thu Jan 01, 2004 6:41 pm
Post subject:
Explody -- do you have a new host since sscentral.com is down?
D1st0rt - Fri Jan 02, 2004 10:46 am
Post subject:
I didn't mean nothin, splody. It's just that it seems that 50% is always releasing a new thing on the mervbot site, and all his stuff has the source (unlike some of those greedy bastards who submit plugins without the source)
SuSE - Fri Jan 02, 2004 11:45 am
Post subject:
explody.ssihosting.com
D1st0rt - Fri Jan 02, 2004 3:59 pm
Post subject:
ok, it all works now with the INI. you guys think I should upload the source once I add a few commands?
Cyan~Fire - Fri Jan 02, 2004 4:54 pm
Post subject:
D1st0rt wrote:
those greedy bastards who submit plugins without the source

Nah no need to put up the source. icon_wink.gif

Hey and those of us who don't put the source in the zip just do so not to confuse the newbies. I'll gladly give my sources away to those who ask.
D1st0rt - Fri Jan 02, 2004 4:59 pm
Post subject:
lol I just like to rant every once and a while
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group