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

[EXTENSION] Send / Request Files from clients


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dordnung
Veteran Member
Join Date: Apr 2010
Old 01-16-2014 , 12:20   [EXTENSION] Send / Request Files from clients
Reply With Quote #1

While i search for a way to send files to the client while he is playing, i found two little functions to send a file to a client and request a file from a client.

The natives work pretty well, but the bad thing is: There are no real callbacks that work.

Because of that i just leave that here. If you find anything to improve this, just tell me!

Here is the include file, which should be self-explanatory

PHP Code:
/*
 * The natives work quite pretty.
 * But the forwards are really tricky, no idea when they really fire. 
 */


/**
 * Called when a file was received from a client to the server.
 * Was fired when requesting a file and it doesn't exist and was succesfulled downloaded.
 *
 * @param client          Client index.
 * @param file            File that was received.
 * @param transferID      transfer ID.
 */
forward FNM_OnFileReceived(client, const String:file[], transferID);

/**
 * Called when a client requests a file from the server.
 *
 * @param client          Client index.
 * @param file            File that was requested.
 * @param transferID      transfer ID.
 *
 * @return                Plugin_Stop to deny the request, Plugin_Continue otherwise.
 */
forward Action:FNM_OnFileRequested(client, const String:file[], transferID);

/**
 * Called when a client denies a file request from the server.
 * Was fired when requesting a file, but filed doesn't exist.
 *
 * @param client          Client index.
 * @param file            File that was denied.
 * @param transferID      transfer ID.
 */
forward FNM_OnFileDenied(client, const String:file[], transferID);

/**
 * Called when a file was sent to a client.
 * Was never fired :/
 *
 * @param client          Client index.
 * @param file            File that was sent.
 * @param transferID      transfer ID.
 */
forward FNM_OnFileSent(client, const String:file[], transferID);




/**
 * Sends a file to a client
 *
 * @param client          Client to send file.
 * @param file            File to send.
 * @param ...             Variable number of format parameters.
 *
 * @return                TransferID on success, otherwise 0.
 */
native FNM_SendFile(client, const String:file[], any:...);



/**
 * Requests a file from a client
 *
 * @param client          Client to get file from.
 * @param file            File to request.
 * @param ...             Variable number of format parameters.
 *
 * @return                TransferID of the request.
 */
native FNM_RequestFile(client, const String:file[], any:...); 
Sourcecode can be found on Github
Attached Files
File Type: zip binarys.zip (560.5 KB, 1231 views)
File Type: inc filenetmessages.inc (2.7 KB, 1080 views)
__________________

Last edited by dordnung; 10-29-2017 at 19:37.
dordnung is offline
Oshizu
Veteran Member
Join Date: Nov 2012
Location: Warsaw
Old 01-16-2014 , 12:39   Re: [EXTENSION] Send / Request Files from clients
Reply With Quote #2

Listen up folks that thing doesn't it looks a bit too harmful?
We miight be able to send files. that damn sure might override existing stuff like config.cfg
Or download files we shouldn't like C://Windows
__________________
...

Last edited by Oshizu; 01-16-2014 at 12:47.
Oshizu is offline
dordnung
Veteran Member
Join Date: Apr 2010
Old 01-16-2014 , 12:48   Re: [EXTENSION] Send / Request Files from clients
Reply With Quote #3

No, config and other stuff isn't downloadable, only things that are also with the string table "downloadables" downloadable
This is a public build in valve Function, so no fear
__________________

Last edited by dordnung; 01-16-2014 at 12:58.
dordnung is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 01-16-2014 , 13:43   Re: [EXTENSION] Send / Request Files from clients
Reply With Quote #4

So can we send materials and have them precached, and be able to show them to players with out having to reconnect?
Mitchell is offline
Oshizu
Veteran Member
Join Date: Nov 2012
Location: Warsaw
Old 01-16-2014 , 13:52   Re: [EXTENSION] Send / Request Files from clients
Reply With Quote #5

Quote:
Originally Posted by Mitchell View Post
So can we send materials and have them precached, and be able to show them to players with out having to reconnect?
Quite userful for something like Jukebox
Player's dont have to download all 250+ songs at once
They will just download it 15 sec before song plays
__________________
...
Oshizu is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 01-16-2014 , 15:04   Re: [EXTENSION] Send / Request Files from clients
Reply With Quote #6

I was under the impression that files could only be sent/received from clients when they're not actually playing (i.e. changing maps).
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Drixevel
AlliedModders Donor
Join Date: Sep 2009
Location: Somewhere headbangin'
Old 01-16-2014 , 15:08   Re: [EXTENSION] Send / Request Files from clients
Reply With Quote #7

Anything useful about download files from the client...? I can't think of any instance where it would be useful.
Drixevel is offline
Oshizu
Veteran Member
Join Date: Nov 2012
Location: Warsaw
Old 01-16-2014 , 15:12   Re: [EXTENSION] Send / Request Files from clients
Reply With Quote #8

Quote:
Originally Posted by r3dw3r3w0lf View Post
Anything useful about download files from the client...? I can't think of any instance where it would be useful.
1. Upload some encrypted data to client's with RSA example
2. Download data from client's and read it
3. Effortless stats
__________________
...
Oshizu is offline
Drixevel
AlliedModders Donor
Join Date: Sep 2009
Location: Somewhere headbangin'
Old 01-16-2014 , 15:23   Re: [EXTENSION] Send / Request Files from clients
Reply With Quote #9

Quote:
Originally Posted by Oshizu View Post
1. Upload some encrypted data to client's with RSA example
2. Download data from client's and read it
3. Effortless stats
Because knowing how many maps the person has downloaded is useful. I mean, you could check for known files that can provide the ability to see through walls with VMT and VTF edits but even that doesn't make much sense.
Drixevel is offline
Oshizu
Veteran Member
Join Date: Nov 2012
Location: Warsaw
Old 01-16-2014 , 15:34   Re: [EXTENSION] Send / Request Files from clients
Reply With Quote #10

Quote:
Originally Posted by r3dw3r3w0lf View Post
Because knowing how many maps the person has downloaded is useful. I mean, you could check for known files that can provide the ability to see through walls with VMT and VTF edits but even that doesn't make much sense.
That was just one of ideas for use of this extension
__________________
...

Last edited by Oshizu; 01-16-2014 at 15:37.
Oshizu is offline
Reply


Thread Tools
Display Modes

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 11:58.


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