AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   [Stock] GetAppID (https://forums.alliedmods.net/showthread.php?t=233257)

Dr. McKay 01-12-2014 04:25

[Stock] GetAppID
 
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;



Oshizu 01-12-2014 08:59

Re: [Stock] GetAppID
 
Userful stuff
Might be a new way to check what game plugin runs :D


All times are GMT -4. The time now is 18:29.

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