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

How to detect server OS in-script?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AtomicStryker
Veteran Member
Join Date: Apr 2009
Location: Teutonia!!
Old 07-30-2009 , 15:34   How to detect server OS in-script?
Reply With Quote #1

This might sound like a stupid question, but how do i 'ask' Sourcemod whether the server is a windows or linux one. Googling, the wiki and the API had no answer.
AtomicStryker is offline
pRED*
Join Date: Dec 2006
Old 07-30-2009 , 16:09   Re: How to detect server OS in-script?
Reply With Quote #2

How about a answering with another question. Why do you need to know?

SourceMod scripts are supposed to be operating system independant and because of that theres no approved way of detecting the OS. It is possible if you really need it, but it's discouraged.
pRED* is offline
AtomicStryker
Veteran Member
Join Date: Apr 2009
Location: Teutonia!!
Old 07-30-2009 , 16:18   Re: How to detect server OS in-script?
Reply With Quote #3

Using Virtual Offsets in a Plugin (very much OS dependant) but without the need for a gamedata file.
AtomicStryker is offline
HiJacker
Senior Member
Join Date: Jul 2008
Location: Slovakia
Old 07-30-2009 , 16:32   Re: How to detect server OS in-script?
Reply With Quote #4

Well, OS can be detected by status, like webstatus, HLSW and so on, so server may status itself, and return value. This is just may idea.
__________________
Before you talk to me, I should warn you : Im kind of strange.
HiJacker is offline
Send a message via ICQ to HiJacker
AtomicStryker
Veteran Member
Join Date: Apr 2009
Location: Teutonia!!
Old 07-30-2009 , 16:48   Re: How to detect server OS in-script?
Reply With Quote #5

And how exactly would i run a console command with no client and hook the output?

There has to be a better way
AtomicStryker is offline
HiJacker
Senior Member
Join Date: Jul 2008
Location: Slovakia
Old 07-30-2009 , 17:57   Re: How to detect server OS in-script?
Reply With Quote #6

What about gameinfo.txt ? There must be something about it.
__________________
Before you talk to me, I should warn you : Im kind of strange.
HiJacker is offline
Send a message via ICQ to HiJacker
BAILOPAN
Join Date: Jan 2004
Old 07-31-2009 , 14:24   Re: How to detect server OS in-script?
Reply With Quote #7

use a gamedata file. they are the solution to the problem you are trying to solve.
__________________
egg
BAILOPAN is offline
AtomicStryker
Veteran Member
Join Date: Apr 2009
Location: Teutonia!!
Old 07-31-2009 , 15:20   Re: How to detect server OS in-script?
Reply With Quote #8

Why is there such a limitation????

PHP Code:
    new OS;
    
StartPrepSDKCall(SDKCall_Player);
    if (!
PrepSDKCall_SetSignature(SDKLibrary_Server"\xA1****\x83***\x57\x8B\xF9\x0F*****\x8B***\x56\x51\xE8****\x8B\xF0\x83\xC4\x04"34)) 
    {
        
OS 2// LINUX
        
PrepSDKCall_SetSignature(SDKLibrary_Server"@_ZN13CTerrorPlayer10AddUpgradeE19SurvivorUpgradeType"0);
    }
    else
    {
        
OS 1// WINDOWS
    
}
    
PrepSDKCall_AddParameter(SDKType_PlainOldDataSDKPass_ByValue);
    new 
Handle:AddUpgrade EndPrepSDKCall();
    
CloseHandle(AddUpgrade); // Its just a dummy function to determine server OS 
This is a very crude solution using some Data Adresses Fyren figured out somehow. Why can't we have a GetOS() Call for Virtual Functions? Or automate the fact Linux Offsets are 1 greater into Sourcemod????
AtomicStryker is offline
psychonic

BAFFLED
Join Date: May 2008
Old 07-31-2009 , 15:48   Re: How to detect server OS in-script?
Reply With Quote #9

Quote:
Originally Posted by AtomicStryker View Post
Why can't we have a GetOS() Call for Virtual Functions? Or automate the fact Linux Offsets are 1 greater into Sourcemod????
Because this is one of the exact purposes of gamedata files and is the correct way to do it (not to mention, it's the way other plugins do it).
psychonic is offline
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 07-31-2009 , 22:55   Re: How to detect server OS in-script?
Reply With Quote #10

Why don't you wanna use a gamedata file?
__________________
Greyscale is offline
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 17:12.


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