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(file, line, sizeof(line))) {
ExplodeString(line, "=", parts, sizeof(parts), sizeof(parts[]));
if(StrEqual(parts[0], "appID")) {
CloseHandle(file);
return StringToInt(parts[1]);
}
}
CloseHandle(file);
return -1;
}
__________________