Determine a Client's Flash Player version
This is a little bit of a hugh workaround for determining if a client has adobe's flashplayer installed and what exact version.
It works by starting a serversocket on the server listening for client connections. To determine the flash version, the client is send to a html page, which uses
some javascript to get the flashversion. The client then sends a HTTP request to the server's serversocket with the flashversion as GET parameter. The plugin parses the HTTP request's header to extract the flashversion and calls the callback in the caller's plugin.
If a client fails to do that reverse http call within x seconds, the callback is called with the error boolean set to true. Answers for already disconnected clients are discarded.
So you're guaranteed to get that callback called for connected clients.
Configuration
This plugin requires the
Sockets extension!
- sm_flashversion_timeout - How many seconds to wait for an answer before considering the request as failed? (Default: 5)
- sm_flashversion_host - Where is the flash detection html script located? (without http:// )
Upload the attached index.html (in flash_html.zip) to your webhost and change the sm_flashversion_host convar to point to that file. Leave out
http://.
The plugin tries to bind to a port in the range of (14646, 14686) randomly, so you might check your firewall accordingly.
Native
PHP Code:
/**
* Called, when the client's flash player version was detected or the detection timed out.
*
* @param client The client that was checked
* @param flashversion The flash version of the client like [0]: major, [1]: minor, [2]: release, [3]: build. All 0, if flash is not installed.
* @param error True, if the request timed out and the client didn't answer in time. This might happen, if the client has html motds disabled.
* @param data Your data, you wanted to pass through
*/
functag public FlashCB(client, flashversion[4], bool:error, any:data);
/**
* Fetch the client's adobe flash player version.
* This is done by opening a motd page on the client, which runs some javascript to detect the flash player version.
*
* @param client The client to check
* @param show Show the motd panel?
* @param callback The callback function to call, when the query finished or timed out
* @param data Any data you want to pass to the callback
* @noreturn
*/
native Flash_GetClientVersion(client, bool:show, FlashCB:callback, any:data);
The attached example provides a simple console command to test your setup.
- sm_flashversion - Shows a player's flash player version. Usage: sm_flashversion [name|steamid|#userid]
This whole quirk can be used to fetch any information available to the webkit integrated webbrowser in the motd.