Raised This Month: $7 Target: $400
 1% 

Determine a Client's OS


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GoD-Tony
Veteran Member
Join Date: Jul 2005
Old 06-19-2013 , 14:16   Determine a Client's OS
Reply With Quote #1

By using QueryClientConVar and checking if these unique convars exist on a client, you can determine which operating system the client is running. Useful for building statistics and other creative ideas.
  • Windows - "windows_speaker_config"
  • Linux - "sdl_double_click_size"
  • Mac - "gl_can_mix_shader_gammas"
See the attached gamedata for the latest cvars known to work. Edit: Dr.Mckay's updated gamedata can be found here.

I've attached an example that I was playing around with. Thanks to psychonic for providing a Mac cvarlist to work with.
Attached Files
File Type: sp Get Plugin or Get Source (detect_os.sp - 930 views - 3.0 KB)
File Type: txt detect_os.games.txt (421 Bytes, 380 views)
__________________

Last edited by GoD-Tony; 05-27-2015 at 10:52.
GoD-Tony is offline
API
Veteran Member
Join Date: May 2006
Old 06-19-2013 , 14:21   Re: Determine a Client's OS
Reply With Quote #2

Really cool! I'll be using this!
__________________
API is offline
Send a message via AIM to API
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 06-19-2013 , 17:01   Re: Determine a Client's OS
Reply With Quote #3

That's far nicer than using javascript in a motd! Thank you!
__________________
Peace-Maker is offline
mcpan313
Senior Member
Join Date: Mar 2010
Old 06-19-2013 , 21:41   Re: Determine a Client's OS
Reply With Quote #4

Nice job, very useful!
__________________
sorry, for my poor english.
mcpan313 is offline
Send a message via MSN to mcpan313
BAILOPAN
Join Date: Jan 2004
Old 06-19-2013 , 23:58   Re: Determine a Client's OS
Reply With Quote #5

Why are people doing OS-specific stuff in SourcePawn? Are you insane?
__________________
egg
BAILOPAN is offline
API
Veteran Member
Join Date: May 2006
Old 06-20-2013 , 00:44   Re: Determine a Client's OS
Reply With Quote #6

It's really just for fun in my case Printing a message to clients about percentage of players which use Mac.
__________________
API is offline
Send a message via AIM to API
GoD-Tony
Veteran Member
Join Date: Jul 2005
Old 06-20-2013 , 01:35   Re: Determine a Client's OS
Reply With Quote #7

Quote:
Originally Posted by BAILOPAN View Post
Why are people doing OS-specific stuff in SourcePawn? Are you insane?
It's about determining the OS of the clients connected to the server, presumably to be used for trivial plugin features. Something like OS-specific usermessages isn't what we're after.
__________________

Last edited by GoD-Tony; 06-20-2013 at 01:36.
GoD-Tony is offline
BAILOPAN
Join Date: Jan 2004
Old 06-20-2013 , 01:53   Re: Determine a Client's OS
Reply With Quote #8

Oh god what kind of plugin features
__________________
egg
BAILOPAN is offline
Zephyrus
Cool Pig B)
Join Date: Jun 2010
Location: Hungary
Old 06-20-2013 , 03:28   Re: Determine a Client's OS
Reply With Quote #9

banning macosx ppl for example and rewarding linux players
__________________
Taking private C++/PHP/SourcePawn requests, PM me.
Zephyrus is offline
napalm00
Veteran Member
Join Date: Jun 2011
Location: Italy, sadly
Old 06-20-2013 , 03:58   Re: Determine a Client's OS
Reply With Quote #10

Quote:
Originally Posted by Zephyrus View Post
banning macosx ppl for example and rewarding linux players
lool
__________________
napalm00 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 22:56.


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