AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Extensions (https://forums.alliedmods.net/forumdisplay.php?f=134)
-   -   [EXTENSION] Send / Request Files from clients (https://forums.alliedmods.net/showthread.php?t=233549)

dordnung 01-16-2014 12:20

[EXTENSION] Send / Request Files from clients
 
4 Attachment(s)
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

Oshizu 01-16-2014 12:39

Re: [EXTENSION] Send / Request Files from clients
 
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

dordnung 01-16-2014 12:48

Re: [EXTENSION] Send / Request Files from clients
 
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

Mitchell 01-16-2014 13:43

Re: [EXTENSION] Send / Request Files from clients
 
So can we send materials and have them precached, and be able to show them to players with out having to reconnect?

Oshizu 01-16-2014 13:52

Re: [EXTENSION] Send / Request Files from clients
 
Quote:

Originally Posted by Mitchell (Post 2086830)
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 :)

Powerlord 01-16-2014 15:04

Re: [EXTENSION] Send / Request Files from clients
 
I was under the impression that files could only be sent/received from clients when they're not actually playing (i.e. changing maps).

Drixevel 01-16-2014 15:08

Re: [EXTENSION] Send / Request Files from clients
 
Anything useful about download files from the client...? I can't think of any instance where it would be useful.

Oshizu 01-16-2014 15:12

Re: [EXTENSION] Send / Request Files from clients
 
Quote:

Originally Posted by r3dw3r3w0lf (Post 2086870)
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

Drixevel 01-16-2014 15:23

Re: [EXTENSION] Send / Request Files from clients
 
Quote:

Originally Posted by Oshizu (Post 2086874)
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.

Oshizu 01-16-2014 15:34

Re: [EXTENSION] Send / Request Files from clients
 
Quote:

Originally Posted by r3dw3r3w0lf (Post 2086878)
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


All times are GMT -4. The time now is 16:38.

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