SourceMod 1.5.0 API Changes

From AlliedModders Wiki
Revision as of 16:25, 6 August 2013 by Psychonic (talk | contribs) (Created page with "''This page is unfinished, still in progress'' ''These are just the API changes from SourceMod 1.4.7 to SourceMod 1.5.0. Click here for the full [http://wiki.alliedmods.net/S...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This page is unfinished, still in progress

These are just the API changes from SourceMod 1.4.7 to SourceMod 1.5.0. Click here for the full SourceMod 1.5.0 Release Notes.


Additions

BaseComm

The BaseComm base plugin now has a new set of global forwards to notify other plugins of its actions.

/**
 * Called when a client is muted or unmuted
 * 
 * @param	client		Client index
 * @param	muteState	True if client was muted, false otherwise
 */
 forward BaseComm_OnClientMute(client, bool:muteState);
/**
 * Called when a client is gagged or ungagged
 * 
 * @param	client		Client index
 * @param	gagState	True if client was gaged, false otherwise
 */
 forward BaseComm_OnClientGag(client, bool:gagState);

Clients

GetClientAuthString by default now is only successful if the client has fully authenticated (if the new ValidateAuthentication feature is enabled in core.cfg).

There is a new bool param, validate, which can be sent as false to bypass this and get a potentially unvalidated auth string.

A new GetSteamAccountID native also has this param with the same purpose. A Steam account ID is the lower 32 bits of the full 64-bit Steam ID (referred to as community id by some) and is unique per account.

/**
 * Returns the client's Steam account ID.
 *
 * @param client		Client Index.
 * @param validate		Check backend validation status.
 * 				DO NOT PASS FALSE UNLESS YOU UNDERSTAND THE CONSEQUENCES,
 *			        You WILL KNOW if you need to use this, MOST WILL NOT.
 * @return				Steam account ID or 0 if not available.
 * @error				If the client is not connected or the index is invalid.
 */
native GetSteamAccountID(client, bool:validate=true);

You can also now return the maximum number of non-bots that a game will allow to join, which can be lower than MaxClients.

These limits can be put into place in games starting with Left 4 Dead. L4D 1 and 2 use it to limit connecting clients to 4 (coop) or 8 (versus) depending on game mode, and Counter-Strike: Global Offensive's new "gametypes" config system will set it based on the current mode's configured MaxPlayers amount.

/**
 * Returns the maximum number of human players allowed on the server.  This is 
 * a game-specific function used on newer games to limit the number of humans
 * that can join a game and can be lower than MaxClients. It is the number often
 * reflected in the server browser or when viewing the output of the status command.
 * On unsupported games or modes without overrides, it will return the same value
 * as MaxClients.
 *
 * You should not globally cache the value to GetMaxHumanPlayers() because it can change across
 * game modes. You may still cache it locally.
 *
 * @return				Maximum number of humans allowed.
 */
native GetMaxHumanPlayers();