Guest User

SteamWorks.inc

a guest
Jun 20th, 2020
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.68 KB | None | 0 0
  1. #if defined _steamtools_included
  2. #endinput
  3. #endif
  4. #define _steamtools_included
  5.  
  6. #define USE_CUSTOM_STEAMID -1
  7.  
  8. /**
  9. * Called after SteamTools has completely finished loading.
  10. * No features are available before this point.
  11. *
  12. * @noreturn
  13. */
  14. forward Steam_FullyLoaded();
  15. forward Steam_Shutdown();
  16.  
  17.  
  18. /**
  19. * Gets the current status of VAC on the server.
  20. *
  21. * @return A bool representing the current VAC status.
  22. */
  23. native bool:Steam_IsVACEnabled();
  24.  
  25. /**
  26. * Gets the server's external IP address, as reported by Steam.
  27. *
  28. * @param octets Reference to an array to be filled with the octets of
  29. * the IP address.
  30. *
  31. * @noreturn
  32. */
  33. native Steam_GetPublicIP(octets[4]);
  34.  
  35.  
  36. /**
  37. * Is fired when the Steam master servers report that your server is
  38. * outdated
  39. *
  40. * @return Plugin_Continue to continue normal operation or Plugin_Handled
  41. * to block the regular console message.
  42. */
  43. forward Action:Steam_RestartRequested();
  44.  
  45.  
  46. /**
  47. * Requests a client's status in a Steam group.
  48. * Response is returned in Steam_GroupStatusResult forward.
  49. *
  50. * @param client Client index.
  51. * @param groupAccountID 32-bit account ID of group.
  52. *
  53. * @return A bool representing whether or not the request was sent to
  54. * Steam.
  55. */
  56. native bool:Steam_RequestGroupStatus(client, groupAccountID);
  57.  
  58. /**
  59. * Called when a response to a group status request is recieved.
  60. * This is called for all responses recieved, not just ones requested by
  61. * your plugin.
  62. *
  63. * @param client Client index.
  64. * @param groupAccountID 32-bit account ID of group. Make sure to check
  65. * this agaist the ID you are expecting.
  66. * @param groupMember Whether or not the client is a member in the
  67. * specified group.
  68. * @param groupMember Whether or not the client is an officer in the
  69. * specified group.
  70. *
  71. * @noreturn
  72. */
  73. forward Steam_GroupStatusResult(client, groupAccountID, bool:groupMember, bool:groupOfficer);
  74.  
  75. #pragma deprecated No longer operational
  76. native Steam_RequestGameplayStats();
  77. forward Steam_GameplayStats(rank, totalConnects, totalMinutesPlayed);
  78.  
  79.  
  80. native Steam_RequestServerReputation();
  81. forward Steam_Reputation(reputationScore, bool:banned, bannedIP, bannedPort, bannedGameID, banExpires);
  82.  
  83.  
  84. /**
  85. * Gets the current Steam connection state, the forwards below fire
  86. * whenever this changes.
  87. *
  88. * @return Steam connection state.
  89. */
  90. native bool:Steam_IsConnected();
  91.  
  92. /**
  93. * Fired upon a successfull connection to Steam.
  94. * Is also fired for late-loaded plugins.
  95. *
  96. * @noreturn
  97. */
  98. forward Steam_SteamServersConnected();
  99.  
  100. /**
  101. * Fired upon disconnection from Steam.
  102. * Is also fired for late-loaded plugins.
  103. *
  104. * For plugins loaded with the server, this will normally be fired right
  105. * after Steam_FullyLoaded, closly followed by Steam_SteamServersConnected
  106. * if a successfull connection is established.
  107. *
  108. * @noreturn
  109. */
  110. forward Steam_SteamServersDisconnected();
  111.  
  112. /**
  113. * Sets an entry in the server's list of rules. This list is used to
  114. * build the response to the A2S_RULES query and is generally known as
  115. * the list of public convars.
  116. *
  117. * @param key Name of the key to set, is created if it does not already
  118. * exist.
  119. * @param value Value of the key to set, the named key is removed if this
  120. * is blank.
  121. *
  122. * @noreturn
  123. */
  124. native Steam_SetRule(const String:key[], const String:value[]);
  125.  
  126. /**
  127. * Clears the server's list of rules. This list is used to build the
  128. * response to the A2S_RULES query and is generally known as the list of
  129. * public convars.
  130. *
  131. * @noreturn
  132. */
  133. native Steam_ClearRules();
  134.  
  135.  
  136. native Steam_ForceHeartbeat();
  137.  
  138. #pragma deprecated No longer operational
  139. native bool:Steam_AddMasterServer(const String:serverAddress[]);
  140. #pragma deprecated No longer operational
  141. native bool:Steam_RemoveMasterServer(const String:serverAddress[]);
  142. #pragma deprecated No longer operational
  143. native Steam_GetNumMasterServers();
  144. #pragma deprecated No longer operational
  145. native Steam_GetMasterServerAddress(server, String:serverAddress[], maxlength);
  146.  
  147. native Steam_SetGameDescription(String:gameDescription[]);
  148.  
  149. native Steam_RequestStats(client);
  150. forward Steam_StatsReceived(client);
  151. forward Steam_StatsUnloaded(client);
  152. native Steam_GetStat(client, const String:statName[]);
  153. native Float:Steam_GetStatFloat(client, const String:statName[]);
  154. native bool:Steam_IsAchieved(client, const String:achievementName[]);
  155.  
  156.  
  157. native Steam_GetNumClientSubscriptions(client);
  158. native Steam_GetClientSubscription(client, index);
  159.  
  160. native Steam_GetNumClientDLCs(client);
  161. native Steam_GetClientDLC(client, index);
  162.  
  163. stock bool:Steam_CheckClientSubscription(client, subid)
  164. {
  165. new subCount = Steam_GetNumClientSubscriptions(client);
  166. for (new x = 0; x < subCount; x++)
  167. {
  168. if (Steam_GetClientSubscription(client, x) == subid)
  169. {
  170. return true;
  171. }
  172. }
  173.  
  174. return false;
  175. }
  176.  
  177. stock bool:Steam_CheckClientDLC(client, appid)
  178. {
  179. new subCount = Steam_GetNumClientDLCs(client);
  180. for (new x = 0; x < subCount; x++)
  181. {
  182. if (Steam_GetClientDLC(client, x) == appid)
  183. {
  184. return true;
  185. }
  186. }
  187.  
  188. return false;
  189. }
  190.  
  191. native Steam_GetCSteamIDForClient(client, String:steamID[], maxlength);
  192.  
  193. native bool:Steam_SetCustomSteamID(const String:renderedID[]);
  194. native bool:Steam_GetCustomSteamID(String:renderedID[], maxlength);
  195.  
  196. native Steam_RenderedIDToCSteamID(const String:renderedID[], String:steamID[], maxlength);
  197. native Steam_CSteamIDToRenderedID(const String:steamID[], String:renderedID[], maxlength);
  198.  
  199. native Steam_GroupIDToCSteamID(groupID, String:steamID[], maxlength);
  200. native Steam_CSteamIDToGroupID(const String:steamID[]);
  201.  
  202. enum HTTPRequestHandle
  203. {
  204. INVALID_HTTP_HANDLE = 0,
  205. };
  206.  
  207. enum HTTPMethod
  208. {
  209. HTTPMethod_Invalid = 0,
  210. HTTPMethod_GET,
  211. HTTPMethod_HEAD,
  212. HTTPMethod_POST,
  213. };
  214.  
  215. enum HTTPStatusCode
  216. {
  217. HTTPStatusCode_Invalid = 0,
  218.  
  219. // Informational codes
  220. HTTPStatusCode_Continue = 100,
  221. HTTPStatusCode_SwitchingProtocols = 101,
  222.  
  223. // Success codes
  224. HTTPStatusCode_OK = 200,
  225. HTTPStatusCode_Created = 201,
  226. HTTPStatusCode_Accepted = 202,
  227. HTTPStatusCode_NonAuthoritative = 203,
  228. HTTPStatusCode_NoContent = 204,
  229. HTTPStatusCode_ResetContent = 205,
  230. HTTPStatusCode_PartialContent = 206,
  231.  
  232. // Redirection codes
  233. HTTPStatusCode_MultipleChoices = 300,
  234. HTTPStatusCode_MovedPermanently = 301,
  235. HTTPStatusCode_Found = 302,
  236. HTTPStatusCode_SeeOther = 303,
  237. HTTPStatusCode_NotModified = 304,
  238. HTTPStatusCode_UseProxy = 305,
  239. HTTPStatusCode_TemporaryRedirect = 307,
  240.  
  241. // Error codes
  242. HTTPStatusCode_BadRequest = 400,
  243. HTTPStatusCode_Unauthorized = 401,
  244. HTTPStatusCode_PaymentRequired = 402,
  245. HTTPStatusCode_Forbidden = 403,
  246. HTTPStatusCode_NotFound = 404,
  247. HTTPStatusCode_MethodNotAllowed = 405,
  248. HTTPStatusCode_NotAcceptable = 406,
  249. HTTPStatusCode_ProxyAuthRequired = 407,
  250. HTTPStatusCode_RequestTimeout = 408,
  251. HTTPStatusCode_Conflict = 409,
  252. HTTPStatusCode_Gone = 410,
  253. HTTPStatusCode_LengthRequired = 411,
  254. HTTPStatusCode_PreconditionFailed = 412,
  255. HTTPStatusCode_RequestEntityTooLarge = 413,
  256. HTTPStatusCode_RequestURITooLong = 414,
  257. HTTPStatusCode_UnsupportedMediaType = 415,
  258. HTTPStatusCode_RequestedRangeNotSatisfiable = 416,
  259. HTTPStatusCode_ExpectationFailed = 417,
  260.  
  261. // Server error codes
  262. HTTPStatusCode_InternalServerError = 500,
  263. HTTPStatusCode_NotImplemented = 501,
  264. HTTPStatusCode_BadGateway = 502,
  265. HTTPStatusCode_ServiceUnavailable = 503,
  266. HTTPStatusCode_GatewayTimeout = 504,
  267. HTTPStatusCode_HTTPVersionNotSupported = 505,
  268. };
  269.  
  270. typeset HTTPRequestComplete
  271. {
  272. function void (HTTPRequestHandle HTTPRequest, bool requestSuccessful, HTTPStatusCode statusCode);
  273. function void (HTTPRequestHandle HTTPRequest, bool requestSuccessful, HTTPStatusCode statusCode, any contextData);
  274. };
  275.  
  276. native HTTPRequestHandle:Steam_CreateHTTPRequest(HTTPMethod:HTTPRequestMethod, const String:absoluteURL[]);
  277. native Steam_SetHTTPRequestNetworkActivityTimeout(HTTPRequestHandle:HTTPRequest, timeoutSeconds);
  278. native Steam_SetHTTPRequestHeaderValue(HTTPRequestHandle:HTTPRequest, const String:headerName[], const String:headerValue[]);
  279. native Steam_SetHTTPRequestGetOrPostParameter(HTTPRequestHandle:HTTPRequest, const String:paramName[], const String:paramValue[]);
  280. native bool:Steam_SendHTTPRequest(HTTPRequestHandle:HTTPRequest, HTTPRequestComplete:callbackFunction, any:contextData = 0);
  281. native Steam_DeferHTTPRequest(HTTPRequestHandle:HTTPRequest);
  282. native Steam_PrioritizeHTTPRequest(HTTPRequestHandle:HTTPRequest);
  283. native Steam_GetHTTPResponseHeaderSize(HTTPRequestHandle:HTTPRequest, const String:headerName[]);
  284. native Steam_GetHTTPResponseHeaderValue(HTTPRequestHandle:HTTPRequest, const String:headerName[], String:headerValueBuffer[], bufferSize);
  285. native Steam_GetHTTPResponseBodySize(HTTPRequestHandle:HTTPRequest);
  286. native Steam_GetHTTPResponseBodyData(HTTPRequestHandle:HTTPRequest, String:bodyDataBuffer[], bufferSize);
  287. native Steam_WriteHTTPResponseBody(HTTPRequestHandle:HTTPRequest, const String:filePath[]);
  288. native Steam_ReleaseHTTPRequest(HTTPRequestHandle:HTTPRequest);
  289. native Float:Steam_GetHTTPDownloadProgressPercent(HTTPRequestHandle:HTTPRequest);
  290. native bool:Steam_SetHTTPRequestRawPostBody(HTTPRequestHandle:HTTPRequest, const String:data[], dataLength, const String:contentType[]="text/plain");
  291.  
  292. public Extension:__ext_SteamTools =
  293. {
  294. name = "SteamTools",
  295. file = "steamtools.ext",
  296. #if defined AUTOLOAD_EXTENSIONS
  297. autoload = 1,
  298. #else
  299. autoload = 0,
  300. #endif
  301. #if defined REQUIRE_EXTENSIONS
  302. required = 1,
  303. #else
  304. required = 0,
  305. #endif
  306. }
Add Comment
Please, Sign In to add comment