Raised This Month: $ Target: $400
 0% 

[Stock] GetAppID


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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 18:29.


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