Raised This Month: $32 Target: $400
 8% 

Reading/Writing


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Spectral
Member
Join Date: Aug 2005
Old 10-02-2005 , 16:49   Reading/Writing
Reply With Quote #1

How I read and write to a file? I want to add steamid's to a list when someone says a certain thing and have a number behind their steamid like warnings so in like warnings.ini will have <steamid> <warnings> then when they join the server again it will load their number of warnings.
Spectral is offline
c0ldfyr3
AlliedModders Donor
Join Date: Aug 2005
Location: Ireland
Old 10-03-2005 , 10:23  
Reply With Quote #2

Code:
m_FileSystem = (IFileSystem *)((ismm->engineFactory())(FILESYSTEM_INTERFACE_VERSION, NULL));
Just use the functions Valve provide =)
__________________
c0ldfyr3 is offline
Send a message via MSN to c0ldfyr3 Send a message via Yahoo to c0ldfyr3
Drocona
Junior Member
Join Date: Oct 2005
Location: The Netherlands
Old 10-03-2005 , 10:33  
Reply With Quote #3

Can you explain that?

i've been into this plugin thingy trying to write and read from files but that line doesnt really tell me anything lol.

can you explain what it does, what it means and how it works please?
__________________
Team .Mystic - Drocona
Drocona is offline
Send a message via MSN to Drocona
c0ldfyr3
AlliedModders Donor
Join Date: Aug 2005
Location: Ireland
Old 10-03-2005 , 10:46  
Reply With Quote #4

Ok, if you look in any of the server load functions, you will see they create interfaces to the game -> m_ServerDLL etc etc.

This creates a file function interface which Valve have so generously given us to use.

So, when you add that to the Load function, and the following to your header file...

Code:
IFileSystem *m_FileSystem;
Then you can just use all the functions it has.

If your using VC 8, then once you have it working. Goto a function and type m_FileSystem->, when you hit the >, a list will appear with all the functions you can use...

PS. This is a SourceMod example, if you are using the straight server plugin example in the HL2SDK, then you need to change it around a lil but there are examples in the Load function you can use to get it working.
__________________
c0ldfyr3 is offline
Send a message via MSN to c0ldfyr3 Send a message via Yahoo to c0ldfyr3
Drocona
Junior Member
Join Date: Oct 2005
Location: The Netherlands
Old 10-03-2005 , 10:55  
Reply With Quote #5

dude thanks for help i fooled around a bit and now it works!

__________________
Team .Mystic - Drocona
Drocona is offline
Send a message via MSN to Drocona
Mani
Veteran Member
Join Date: Dec 2004
Location: UK
Old 10-04-2005 , 07:01  
Reply With Quote #6

Whatever you do, don't use filesystem->FPrintf() or you will be visiting crash city.

Mani
__________________
Installation files, documentation and help can be found at: -

www.mani-admin-plugin.com
Mani is offline
Drocona
Junior Member
Join Date: Oct 2005
Location: The Netherlands
Old 10-04-2005 , 12:49  
Reply With Quote #7

i wasnt really gonna use those but thanks lol

maybe i would've ran into it later on
__________________
Team .Mystic - Drocona
Drocona is offline
Send a message via MSN to Drocona
BAILOPAN
Join Date: Jan 2004
Old 10-04-2005 , 13:11  
Reply With Quote #8

The C library comes with all sorts of file manipulation functions. Use those, there's no reason to rely on Valve's breakity interface.
__________________
egg
BAILOPAN is offline
c0ldfyr3
AlliedModders Donor
Join Date: Aug 2005
Location: Ireland
Old 10-05-2005 , 09:32  
Reply With Quote #9

But if you do you have someone to blame
__________________
c0ldfyr3 is offline
Send a message via MSN to c0ldfyr3 Send a message via Yahoo to c0ldfyr3
Drocona
Junior Member
Join Date: Oct 2005
Location: The Netherlands
Old 10-08-2005 , 05:30  
Reply With Quote #10

ok can someone just give me an example what to put in to write a file
i'm using the empty server plugin sample from valve
i have like:



Code:
//---------------------------------------------------------------------------------
// Purpose: called when an event is fired
//---------------------------------------------------------------------------------
void CTSlogging::FireGameEvent( KeyValues * event )
{
	const char * name = event->GetName();
	
    if (FStrEq(name, "round_start"))
	{
		filesystem->Open( const char *pFileName, const char *pOptions, const char *PathID = 0 );
		filesystem->Write( const void *pInput, int size, FileHandle_t file );
		filesystem->Close( FileHandle_t file );
	}
}
i'm totally new to C++ and this plugin coding

can somebody tell me what to put in for
const char *pFileName
const char *pOptions
const char *PathID = 0
const void *pInput
int size
FileHandle_t file

and what they do etc, so i can make a start here, thanks
__________________
Team .Mystic - Drocona
Drocona is offline
Send a message via MSN to Drocona
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 20:44.


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