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

[Stock] GetAppID


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 01-12-2014 , 04:25   [Stock] GetAppID
Reply With Quote #1

This simple stock returns the current game's Steam AppID (or -1 on failure). This might be useful for a plugin which interfaces with the Steam Web API to get stats or the like.

PHP Code:
stock GetAppID() {
    new 
Handle:file OpenFile("steam.inf");
    if(
file == INVALID_HANDLE) {
        return -
1;
    }
    
    
decl String:line[128], String:parts[2][64];
    while(
ReadFileLine(filelinesizeof(line))) {
        
ExplodeString(line"="partssizeof(parts), sizeof(parts[]));
        if(
StrEqual(parts[0], "appID")) {
            
CloseHandle(file);
            return 
StringToInt(parts[1]);
        }
    }
    
    
CloseHandle(file);
    return -
1;

__________________
Dr. McKay is offline
Oshizu
Veteran Member
Join Date: Nov 2012
Location: Warsaw
Old 01-12-2014 , 08:59   Re: [Stock] GetAppID
Reply With Quote #2

Userful stuff
Might be a new way to check what game plugin runs
__________________
...
Oshizu 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 07:56.


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