Merged heads.

This commit is contained in:
Greyscale 2009-04-15 03:24:43 +02:00
commit 8bcf32a0db
62 changed files with 1439 additions and 233 deletions

Binary file not shown.

View File

@ -392,12 +392,6 @@
"ru" "ZHP (!zhp) - Показ здоровья зомби"
}
"!zclass title"
{
"en" "Zombie Class Selection:"
"ru" "Выбор Класса Зомби:"
}
"Market title"
{
"en" "Available Guns:"
@ -409,6 +403,40 @@
"en" "Rebuy"
"ru" "Купить снова"
}
// ===========================
// Class menu
// ===========================
"!zclass title"
{
"en" "Class Selection:"
}
"!zclass zombie"
{
"en" "Select Zombie Class"
}
"!zclass human"
{
"en" "Select Human Class"
}
"!zclass admin"
{
"en" "Select Admin Class"
}
"!zclass admin mode enabled"
{
"en" "Admin mode is enabled!"
}
"!zclass admin mode toggle"
{
"en" "Toggle Admin Mode"
}
// ===========================
// ZAdmin Menu

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: admin.inc 1409 2007-09-10 23:38:58Z dvander $
* Version: $Id$
*/
#if defined _admin_included

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: adminmenu.inc 1838 2008-01-04 16:05:26Z dvander $
* Version: $Id$
*/
#if defined _adminmenu_included

View File

@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: adt.inc 2093 2008-04-24 10:25:27Z damagedsoul $
* Version: $Id$
*/
#if defined _adt_included
@ -37,3 +37,4 @@
#include <adt_array>
#include <adt_trie>
#include <adt_stack>

View File

@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: adt_array.inc 2093 2008-04-24 10:25:27Z damagedsoul $
* Version: $Id$
*/
#if defined _adt_array_included
@ -85,8 +85,8 @@ native ClearArray(Handle:array);
* no relation to the original. You MUST close it.
*
* @param array Array handle to be cloned
* @return New handle to the cloned array object
* @error Invalid Handle
* @return New handle to the cloned array object
* @error Invalid Handle
*/
native Handle:CloneArray(Handle:array);

154
src/include/adt_stack.inc Normal file
View File

@ -0,0 +1,154 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
#if defined _adt_stack_included
#endinput
#endif
#define _adt_stack_included
/**
* Creates a stack structure. A stack is a LIFO (last in, first out)
* vector (array) of items. It has O(1) insertion and O(1) removal.
*
* Stacks have two operations: Push (adding an item) and Pop (removes
* items in reverse-push order).
*
* The contents of the stack are uniform; i.e. storing a string and then
* retrieving it as an integer is NOT the same as StringToInt()!
*
* The "blocksize" determines how many cells each slot has; it cannot
* be changed after creation.
*
* @param blocksize The number of cells each entry in the stack can
* hold. For example, 32 cells is equivalent to:
* new Array[X][32]
* @return New stack Handle.
*/
native Handle:CreateStack(blocksize=1);
/**
* Pushes a value onto the end of the stack, adding a new index.
*
* This may safely be used even if the stack has a blocksize
* greater than 1.
*
* @param stack Stack Handle.
* @param value Value to push.
* @noreturn
* @error Invalid Handle or out of memory.
*/
native PushStackCell(Handle:stack, any:value);
/**
* Pushes a string onto the end of a stack, truncating it if it is
* too big.
*
* @param stack Stack Handle.
* @param value String to push.
* @noreturn
* @error Invalid Handle or out of memory.
*/
native PushStackString(Handle:stack, const String:value[]);
/**
* Pushes an array of cells onto the end of a stack. The cells
* are pushed as a block (i.e. the entire array takes up one stack slot),
* rather than pushing each cell individually.
*
* @param stack Stack Handle.
* @param values Block of values to copy.
* @param size If not set, the number of elements copied from the array
* will be equal to the blocksize. If set higher than the
* blocksize, the operation will be truncated.
* @noreturn
* @error Invalid Handle or out of memory.
*/
native PushStackArray(Handle:stack, const any:values[], size=-1);
/**
* Pops a cell value from a stack.
*
* @param stack Stack Handle.
* @param value Variable to store the value.
* @param block Optionally specify which block to read from
* (useful if the blocksize > 0).
* @param asChar Optionally read as a byte instead of a cell.
* @return True on success, false if the stack is empty.
* @error Invalid Handle.
*/
native bool:PopStackCell(Handle:stack, &any:value, block=0, bool:asChar=false);
/**
* Pops a string value from a stack.
*
* @param stack Stack Handle.
* @param buffer Buffer to store string.
* @param maxlength Maximum size of the buffer.
* @return True on success, false if the stack is empty.
* @error Invalid Handle.
*/
native bool:PopStackString(Handle:stack, String:buffer[], maxlength, &written=0);
/**
* Pops an array of cells from a stack.
*
* @param stack Stack Handle.
* @param buffer Buffer to store the array in.
* @param size If not set, assumes the buffer size is equal to the
* blocksize. Otherwise, the size passed is used.
* @return True on success, false if the stack is empty.
* @error Invalid Handle.
*/
native bool:PopStackArray(Handle:stack, any:buffer[], size=-1);
/**
* Checks if a stack is empty.
*
* @param stack Stack Handle.
* @return True if empty, false if not empty.
* @error Invalid Handle.
*/
native bool:IsStackEmpty(Handle:stack);
/**
* Pops a value off a stack, ignoring it completely.
*
* @param stack Stack Handle.
* @return True if something was popped, false otherwise.
* @error Invalid Handle.
*/
stock PopStack(Handle:stack)
{
new value;
return PopStackCell(stack, value);
}

View File

@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: adt_trie.inc 2093 2008-04-24 10:25:27Z damagedsoul $
* Version: $Id$
*/
#if defined _adt_trie_included

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: banning.inc 1456 2007-09-21 14:56:18Z dvander $
* Version: $Id$
*/
#if defined _banning_included
@ -144,7 +144,7 @@ native bool:BanIdentity(const String:identity[],
*
* @param identity String to unban (ip or authstring).
* @param flags Flags (only IP and AUTHID are valid flags here).
* @param command Command strnig to identify the source. If this is left
* @param command Command string to identify the source. If this is left
* empty, then OnRemoveBan will not be called.
* @param source A source value that could be interpreted as a player
* index of any sort (not actually checked by Core).

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: bitbuffer.inc 2038 2008-04-11 17:22:19Z damagedsoul $
* Version: $Id$
*/
#if defined _bitbuffer_included

238
src/include/clientprefs.inc Normal file
View File

@ -0,0 +1,238 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
#if defined _clientprefs_included
#endinput
#endif
#define _clientprefs_included
/**
* Cookie access types for client viewing
*/
enum CookieAccess
{
CookieAccess_Public, /**< Visible and Changeable by users */
CookieAccess_Protected, /**< Read only to users */
CookieAccess_Private, /**< Completely hidden cookie */
};
/**
* Cookie Prefab menu types
*/
enum CookieMenu
{
CookieMenu_YesNo, /**< Yes/No menu with "yes"/"no" results saved into the cookie */
CookieMenu_YesNo_Int, /**< Yes/No menu with 1/0 saved into the cookie */
CookieMenu_OnOff, /**< On/Off menu with "on"/"off" results saved into the cookie */
CookieMenu_OnOff_Int, /**< On/Off menu with 1/0 saved into the cookie */
};
enum CookieMenuAction
{
/**
* An option is being drawn for a menu.
*
* INPUT : Client index and data if available.
* OUTPUT: Buffer for rendering, maxlength of buffer.
*/
CookieMenuAction_DisplayOption = 0,
/**
* A menu option has been selected.
*
* INPUT : Client index and any data if available.
*/
CookieMenuAction_SelectOption = 1,
};
/**
* Note:
*
* A successful return value/result on any client prefs native only guarantees that the local cache has been updated.
* Database connection problems can still prevent the data from being permanently saved. Connection problems will be logged as
* errors by the clientprefs extension.
*/
/**
* Creates a new Client preference cookie.
*
* @param name Name of the new preference cookie.
* @param description Optional description of the preference cookie.
* @param access What CookieAccess level to assign to this cookie.
* @return A handle to the newly created cookie. If the cookie already exists, a handle to it will still be returned.
* @error Cookie name is blank.
*/
native Handle:RegClientCookie(const String:name[], const String:description[], CookieAccess:access);
/**
* Searches for a Client preference cookie.
*
* @param name Name of cookie to find.
* @return A handle to the cookie if it is found. INVALID_HANDLE otherwise.
*/
native Handle:FindClientCookie(const String:name[]);
/**
* Set the value of a Client preference cookie.
*
* @param client Client index.
* @param cookie Client preference cookie handle.
* @param value String value to set.
* @noreturn
* @error Invalid cookie handle or invalid client index.
*/
native SetClientCookie(client, Handle:cookie, const String:value[]);
/**
* Retrieve the value of a Client preference cookie.
*
* @param client Client index.
* @param cookie Client preference cookie handle.
* @param buffer Copyback buffer for value.
* @param maxlen Maximum length of the buffer.
* @noreturn
* @error Invalid cookie handle or invalid client index.
*/
native GetClientCookie(client, Handle:cookie, String:buffer[], maxlen);
/**
* Checks if a clients cookies have been loaded from the database.
*
* @param client Client index.
* @return True if loaded, false otherwise.
* @error Invalid client index.
*/
native bool:AreClientCookiesCached(client);
/**
* Called once a client's saved cookies have been loaded from the database.
*
* @param client Client index.
*/
forward OnClientCookiesCached(client);
/**
* Cookie Menu Callback prototype
*
* @param client Client index.
* @param action CookeMenuAction being performed.
* @param data Info data passed.
* @param buffer Outbut buffer.
* @param maxlen Max length of the output buffer.
*/
functag public CookieMenuHandler(client, CookieMenuAction:action, any:info, String:buffer[], maxlen);
/**
* Add a new prefab item to the client cookie settings menu.
*
* Note: This handles everything automatically and does not require a callback
*
* @param cookie Client preference cookie handle.
* @param type A CookieMenu prefab menu type.
* @param display Text to show on the menu.
* @param handler Optional handler callback for translations and output on selection
* @param info Info data to pass to the callback.
* @noreturn
* @error Invalid cookie handle.
*/
native SetCookiePrefabMenu(Handle:cookie, CookieMenu:type, const String:display[], CookieMenuHandler:handler=CookieMenuHandler:-1, info=0);
/**
* Adds a new item to the client cookie settings menu.
*
* Note: This only adds the top level menu item. You need to handle any submenus from the callback.
*
* @param handler A MenuHandler callback function.
* @param info Data to pass to the callback.
* @param display Text to show on the menu.
* @noreturn
* @error Invalid cookie handle.
*/
native SetCookieMenuItem(CookieMenuHandler:handler, any:info, const String:display[]);
/**
* Displays the settings menu to a client.
*
* @param client Client index.
* @noreturn
*/
native ShowCookieMenu(client);
/**
* Gets a cookie iterator. Must be freed with CloseHandle().
*
* @return A new cookie iterator.
*/
native Handle:GetCookieIterator();
/**
* Reads a cookie iterator, then advances to the next cookie if any.
*
* @param iter Cookie iterator Handle.
* @param name Name buffer.
* @param nameLen Name buffer size.
* @param access Access level of the cookie.
* @param desc Cookie description buffer.
* @param descLen Cookie description buffer size.
* @param
* @return True on success, false if there are no more commands.
*/
native bool:ReadCookieIterator(Handle:iter,
String:name[],
nameLen,
&CookieAccess:access,
String:desc[]="",
descLen=0);
/**
* Returns the access level of a cookie
*
* @param cookie Client preference cookie handle.
* @return CookieAccess access level.
* @error Invalid cookie handle.
*/
native CookieAccess:GetCookieAccess(Handle:cookie);
/**
* Do not edit below this line!
*/
public Extension:__ext_clientprefs =
{
name = "Client Preferences",
file = "clientprefs.ext",
autoload = 1,
#if defined REQUIRE_EXTENSIONS
required = 1,
#else
required = 0,
#endif
};

View File

@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: clients.inc 2362 2008-07-06 00:44:56Z dvander $
* Version: $Id$
*/
#if defined _clients_included
@ -45,11 +45,23 @@ enum NetFlow
NetFlow_Both, /**< Both values added together */
};
#define MAXPLAYERS 64 /**< Maximum number of players that can be in server */
/**
* MAXPLAYERS is not the same as MaxClients.
* MAXPLAYERS is a hardcoded value as an upper limit. MaxClients changes based on the server.
*
* Both GetMaxClients() and MaxClients are only available once the map is loaded, and should
* not be used in OnPluginStart().
*/
#define MAXPLAYERS 64 /**< Maximum number of players SourceMod supports */
#define MAX_NAME_LENGTH 32 /**< Maximum buffer required to store a client name */
public const MaxClients; /**< Maximum number of players the server supports (dynamic) */
/**
* Called on client connection.
* Called on client connection. If you return true, the client will be allowed in the server.
* If you return false (or return nothing), the client will be rejected. If the client is
* rejected by this forward or any other, OnClientDisconnect will not be called.
*
* @param client Client index.
* @param rejectmsg Buffer to store the rejection message when the connection is refused.
@ -58,6 +70,14 @@ enum NetFlow
*/
forward bool:OnClientConnect(client, String:rejectmsg[], maxlen);
/**
* Called once a client successfully connects. This callback is paired with OnClientDisconnect.
*
* @param client Client index.
* @noreturn
*/
forward OnClientConnected(client);
/**
* Called when a client is entering the game.
*
@ -169,10 +189,16 @@ forward OnClientPostAdminFilter(client);
forward OnClientPostAdminCheck(client);
/**
* This function will be deprecated in a future release. Use the MaxClients variable instead.
*
* Returns the maximum number of clients allowed on the server. This may
* return 0 if called before OnMapStart(), and thus should not be called
* in OnPluginStart().
*
* You should not globally cache the value to GetMaxClients() because it can change from
* SourceTV or TF2's arena mode. Use the "MaxClients" dynamic variable documented at the
* top of this file.
*
* @return Maximum number of clients allowed.
*/
native GetMaxClients();
@ -682,3 +708,17 @@ native KickClientEx(client, const String:format[]="", any:...);
*/
native ChangeClientTeam(client, team);
/**
* Returns the clients unique serial identifier.
*
* @return Serial number.
*/
native GetClientSerial(client);
/**
* Returns the client index by its serial number.
*
* @return Client index, or 0 for invalid serial.
*/
native GetClientFromSerial(serial);

View File

@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: commandfilters.inc 2080 2008-04-19 00:44:11Z dvander $
* Version: $Id$
*/
#if defined _commandfilters_included

View File

@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: console.inc 2482 2008-09-02 03:58:23Z dvander $
* Version: $Id$
*/
#if defined _console_included
@ -286,6 +286,24 @@ native ShowActivity(client, const String:format[], any:...);
*/
native ShowActivityEx(client, const String:tag[], const String:format[], any:...);
/**
* Given an originating client and a target client, returns the string
* that describes the originating client according to the sm_show_activity cvar.
*
* For example, "ADMIN", "PLAYER", or a player's name could be placed in this buffer.
*
* @param client Originating client; may be 0 for server console.
* @param target Targeted client.
* @param namebuf Name buffer.
* @param maxlength Maximum size of the name buffer.
* @return True if activity should be shown. False otherwise. In either
* case, the name buffer is filled. The return value can be used
* to broadcast a "safe" name to all players regardless of the
* sm_show_activity filters.
* @error Invalid client index or client not connected.
*/
native FormatActivitySource(client, target, const String:namebuf[], maxlength);
/**
* Called when a server-only command is invoked.
*
@ -293,7 +311,7 @@ native ShowActivityEx(client, const String:tag[], const String:format[], any:...
* @return An Action value. Not handling the command
* means that Source will report it as "not found."
*/
functag SrvCmd Action:public(args);
functag public Action:SrvCmd(args);
/**
* Creates a server-only console command, or hooks an already existing one.
@ -317,7 +335,7 @@ native RegServerCmd(const String:cmd[], SrvCmd:callback, const String:descriptio
* @return An Action value. Not handling the command
* means that Source will report it as "not found."
*/
functag ConCmd Action:public(client, args);
functag public Action:ConCmd(client, args);
/**
* Creates a console command, or hooks an already existing one.
@ -421,7 +439,7 @@ native Handle:FindConVar(const String:name[]);
* @param newValue String containing the new value of the convar.
* @noreturn
*/
functag ConVarChanged public(Handle:convar, const String:oldValue[], const String:newValue[]);
functag public ConVarChanged(Handle:convar, const String:oldValue[], const String:newValue[]);
/**
* Creates a hook for when a console variable's value is changed.
@ -455,6 +473,10 @@ native bool:GetConVarBool(Handle:convar);
/**
* Sets the boolean value of a console variable.
*
* Note: The replicate and notify params are ignored on the engines for Episode 2/Orange Box
* and Left 4 Dead. These engines automatically replicates and notifies as soon as the convar
* is changed.
*
* @param convar Handle to the convar.
* @param value New boolean value.
* @param replicate If set to true, the new convar value will be set on all clients.
@ -479,6 +501,10 @@ native GetConVarInt(Handle:convar);
/**
* Sets the integer value of a console variable.
*
* Note: The replicate and notify params are ignored on the engines for Episode 2/Orange Box
* and Left 4 Dead. These engines automatically replicates and notifies as soon as the convar
* is changed.
*
* @param convar Handle to the convar.
* @param value New integer value.
* @param replicate If set to true, the new convar value will be set on all clients.
@ -503,6 +529,10 @@ native Float:GetConVarFloat(Handle:convar);
/**
* Sets the floating point value of a console variable.
*
* Note: The replicate and notify params are ignored on the engines for Episode 2/Orange Box
* and Left 4 Dead. These engines automatically replicates and notifies as soon as the convar
* is changed.
*
* @param convar Handle to the convar.
* @param value New floating point value.
* @param replicate If set to true, the new convar value will be set on all clients.
@ -529,6 +559,10 @@ native GetConVarString(Handle:convar, String:value[], maxlength);
/**
* Sets the string value of a console variable.
*
* Note: The replicate and notify params are ignored on the engines for Episode 2/Orange Box
* and Left 4 Dead. These engines automatically replicates and notifies as soon as the convar
* is changed.
*
* @param convar Handle to the convar.
* @param value New string value.
* @param replicate If set to true, the new convar value will be set on all clients.
@ -544,6 +578,10 @@ native SetConVarString(Handle:convar, const String:value[], bool:replicate=false
/**
* Resets the console variable to its default value.
*
* Note: The replicate and notify params are ignored on the engines for Episode 2/Orange Box
* and Left 4 Dead. These engines automatically replicates and notifies as soon as the convar
* is changed.
*
* @param convar Handle to the convar.
* @param replicate If set to true, the new convar value will be set on all clients.
* This will only work if the convar has the FCVAR_REPLICATED flag
@ -777,3 +815,23 @@ native bool:FindNextConCommand(Handle:search, String:buffer[], max_size, &bool:i
* @error Invalid client index, client not in game, or client is fake
*/
native bool:SendConVarValue(client, Handle:convar, const String:value[]);
/**
* Appends a string to Valve's sv_tags convar and makes sure it remains after mapchanges.
*
* Note: Tags are automatically removed on plugin unload
*
* @param tag Tag string to append.
* @noreturn
*/
native AddServerTag(const String:tag[]);
/**
* Removes a string from valve's sv_tags convar.
*
* Note: You can only remove tags created by you.
*
* @param tag Tag string to remove.
* @noreturn
*/
native RemoveServerTag(const String:tag[]);

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: core.inc 2243 2008-06-02 05:04:02Z dvander $
* Version: $Id$
*/
#if defined _core_included
@ -37,7 +37,9 @@
#include <version>
#define SOURCEMOD_PLUGINAPI_VERSION 3
/** If this gets changed, you need to update Core's check. */
#define SOURCEMOD_PLUGINAPI_VERSION 5
struct PlVers
{
version,
@ -136,6 +138,25 @@ struct SharedPlugin
public Float:NULL_VECTOR[3]; /**< Pass this into certain functions to act as a C++ NULL */
public const String:NULL_STRING[1]; /**< pass this into certain functions to act as a C++ NULL */
/**
* Horrible compatibility shim.
*/
public Extension:__ext_core =
{
name = "Core",
file = "core",
autoload = 0,
required = 0,
};
native VerifyCoreVersion();
public __ext_core_SetNTVOptional()
{
VerifyCoreVersion();
}
#define AUTOLOAD_EXTENSIONS
#define REQUIRE_EXTENSIONS
#define REQUIRE_PLUGIN

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: cstrike.inc 1828 2007-12-24 20:41:33Z pred $
* Version: $Id$
*/
#if defined _cstrike_included

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: datapack.inc 1336 2007-08-15 06:19:30Z damagedsoul $
* Version: $Id$
*/
#if defined _datapack_included

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: dbi.inc 1918 2008-03-02 18:01:49Z dvander $
* Version: $Id$
*/
#if defined _dbi_included
@ -115,6 +115,7 @@ native Handle:SQL_Connect(const String:confname[], bool:persistent, String:error
* @param persistent True to re-use a previous persistent connection
* if possible, false otherwise.
* @return A database connection Handle, or INVALID_HANDLE on failure.
* On failure the error buffer will be filled with a message.
*/
stock Handle:SQL_DefConnect(String:error[], maxlength, bool:persistent=true)
{
@ -122,22 +123,65 @@ stock Handle:SQL_DefConnect(String:error[], maxlength, bool:persistent=true)
}
/**
* Creates an SQL connection from specific parameters.
* Connects to a database using key value pairs containing the database info.
* The key/value pairs should match what would be in databases.cfg.
*
* @param driver Driver Handle, or INVALID_HANDLE for default.
* @param host Host name.
* @param user User name.
* @param pass User password.
* @param database Database name.
* I.e. "driver" should be "default" or a driver name (or ommitted for
* the default). For SQLite, only the "database" parameter is needed in addition.
* For drivers which require external connections, more of the parameters may be
* needed.
*
* In general it is discouraged to use this function. Connections should go through
* databases.cfg for greatest flexibility on behalf of users.
*
* @param keyvalues Key/value pairs from a KeyValues handle, describing the connection.
* @param error Error buffer.
* @param maxlength Maximum length of the error buffer.
* @param persistent True to re-use a previous persistent connection
* if possible, false otherwise.
* @param port Optional port to specify.
* @param maxTimeout Maximum timeout in seconds if applicable.
* @return A database connection Handle, or INVALID_HANDLE on failure.
* @error Invalid driver Handle other than INVALID_HANDLE.
* On failure the error buffer will be filled with a message.
* @error Invalid KeyValues handle.
*/
native Handle:SQL_ConnectCustom(Handle:keyvalues,
String:error[],
maxlength,
bool:persistent);
/**
* Grabs a handle to an SQLite database, creating one if it does not exist.
*
* Unless there are extenuating circumstances, you should consider using "sourcemod-local" as the
* database name. This provides some unification between plugins on behalf of users.
*
* As a precaution, you should always create some sort of unique prefix to your table names so
* there are no conflicts, and you should never drop or modify tables that you do not own.
*
* @param database Database name.
* @param error Error buffer.
* @param maxlength Maximum length of the error buffer.
* @return A database connection Handle, or INVALID_HANDLE on failure.
* On failure the error buffer will be filled with a message.
*/
stock Handle:SQLite_UseDatabase(const String:database[],
String:error[],
maxlength)
{
new Handle:kv, Handle:db;
kv = CreateKeyValues("");
KvSetString(kv, "driver", "sqlite");
KvSetString(kv, "database", database);
db = SQL_ConnectCustom(kv, error, maxlength, false);
CloseHandle(kv);
return db;
}
/**
* This function is deprecated. Use SQL_ConnectCustom or SQLite_UseDatabase instead.
*/
#pragma deprecated Use SQL_ConnectCustom instead.
native Handle:SQL_ConnectEx(Handle:driver,
const String:host[],
const String:user[],
@ -581,7 +625,7 @@ native SQL_UnlockDatabase(Handle:database);
* @param data Data passed in via the original threaded invocation.
* @param
*/
functag SQLTCallback public(Handle:owner, Handle:hndl, const String:error[], any:data);
functag public SQLTCallback(Handle:owner, Handle:hndl, const String:error[], any:data);
/**
* Tells whether two database handles both point to the same database

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: entity.inc 1890 2008-02-22 16:51:15Z dvander $
* Version: $Id$
*/
#if defined _entity_included
@ -273,10 +273,11 @@ native SetEntDataFloat(entity, offset, Float:value, bool:changeState=false);
* @return Entity index at the given location, or 0 if none.
* @error Invalid entity or offset out of reasonable bounds.
*/
#pragma deprecated Use GetEntDataEnt2() instead.
native GetEntDataEnt(entity, offset);
/**
* This function is deprecated. Use GetEntDataEnt2 instead, for
* This function is deprecated. Use SetEntDataEnt2 instead, for
* reasons explained in the notes.
*
* Note: This function uses 0 as an indicator to unset data, but
@ -290,6 +291,7 @@ native GetEntDataEnt(entity, offset);
* @noreturn
* @error Invalid entity or offset out of reasonable bounds.
*/
#pragma deprecated Use SetEntDataEnt2() instead.
native SetEntDataEnt(entity, offset, other, bool:changeState=false);
/**
@ -479,8 +481,7 @@ stock GetEntSendPropOffs(ent, const String:prop[], bool:actual=false)
* Retrieves an integer value from an entity's property.
*
* This function is considered safer and more robust over GetEntData,
* because it performs strict offset checking and typing rules. There is a
* very minor performance hit from this.
* because it performs strict offset checking and typing rules.
*
* @param entity Entity/edict index.
* @param type Property type.
@ -497,8 +498,7 @@ native GetEntProp(entity, PropType:type, const String:prop[], size=4);
* Sets an integer value in an entity's property.
*
* This function is considered safer and more robust over SetEntData,
* because it performs strict offset checking and typing rules. There is a
* very minor performance hit from this.
* because it performs strict offset checking and typing rules.
*
* @param entity Entity/edict index.
* @param type Property type.
@ -515,8 +515,7 @@ native SetEntProp(entity, PropType:type, const String:prop[], any:value, size=4)
* Retrieves a float value from an entity's property.
*
* This function is considered safer and more robust over GetEntDataFloat,
* because it performs strict offset checking and typing rules. There is a
* very minor performance hit from this.
* because it performs strict offset checking and typing rules.
*
* @param entity Entity/edict index.
* @param type Property type.
@ -530,8 +529,7 @@ native Float:GetEntPropFloat(entity, PropType:type, const String:prop[]);
* Sets a float value in an entity's property.
*
* This function is considered safer and more robust over SetEntDataFloat,
* because it performs strict offset checking and typing rules. There is a
* very minor performance hit from this.
* because it performs strict offset checking and typing rules.
*
* @param entity Entity/edict index.
* @param type Property type.
@ -546,8 +544,7 @@ native SetEntPropFloat(entity, PropType:type, const String:prop[], Float:value);
* Retrieves an entity index from an entity's property.
*
* This function is considered safer and more robust over GetEntDataEnt*,
* because it performs strict offset checking and typing rules. There is a
* very minor performance hit from this.
* because it performs strict offset checking and typing rules.
*
* @param entity Entity/edict index.
* @param type Property type.
@ -563,8 +560,7 @@ native GetEntPropEnt(entity, PropType:type, const String:prop[]);
* Sets an entity index in an entity's property.
*
* This function is considered safer and more robust over SetEntDataEnt*,
* because it performs strict offset checking and typing rules. There is a
* very minor performance hit from this.
* because it performs strict offset checking and typing rules.
*
* @param entity Entity/edict index.
* @param type Property type.
@ -579,8 +575,7 @@ native SetEntPropEnt(entity, PropType:type, const String:prop[], other);
* Retrieves a vector of floats from an entity, given a named network property.
*
* This function is considered safer and more robust over GetEntDataVector,
* because it performs strict offset checking and typing rules. There is a
* very minor performance hit from this.
* because it performs strict offset checking and typing rules.
*
* @param entity Entity/edict index.
* @param type Property type.
@ -596,8 +591,7 @@ native GetEntPropVector(entity, PropType:type, const String:prop[], Float:vec[3]
* Sets a vector of floats in an entity, given a named network property.
*
* This function is considered safer and more robust over SetEntDataVector,
* because it performs strict offset checking and typing rules. There is a
* very minor performance hit from this.
* because it performs strict offset checking and typing rules.
*
* @param entity Entity/edict index.
* @param type Property type.

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: entity_prop_stocks.inc 1943 2008-03-16 23:16:34Z dvander $
* Version: $Id$
*/
#if defined _entity_prop_stocks_included
@ -170,9 +170,27 @@ enum RenderFx
*/
stock GetEntityFlags(entity)
{
return GetEntProp(entity, Prop_Data, "m_fFlags");
static bool:gotconfig = false;
static String:datamap[32];
if (!gotconfig)
{
new Handle:gc = LoadGameConfigFile("core.games");
new bool:exists = GameConfGetKeyValue(gc, "m_fFlags", datamap, sizeof(datamap));
CloseHandle(gc);
if (!exists)
{
strcopy(datamap, sizeof(datamap), "m_fFlags");
}
gotconfig = true;
}
return GetEntProp(entity, Prop_Data, datamap);
}
/**
* Gets an entity's movetype.
*
@ -182,8 +200,24 @@ stock GetEntityFlags(entity)
*/
stock MoveType:GetEntityMoveType(entity)
{
new offset = GetEntSendPropOffs(entity, "movetype");
return MoveType:GetEntData(entity, offset, 1);
static bool:gotconfig = false;
static String:datamap[32];
if (!gotconfig)
{
new Handle:gc = LoadGameConfigFile("core.games");
new bool:exists = GameConfGetKeyValue(gc, "m_MoveType", datamap, sizeof(datamap));
CloseHandle(gc);
if (!exists)
{
strcopy(datamap, sizeof(datamap), "m_MoveType");
}
gotconfig = true;
}
return MoveType:GetEntProp(entity, Prop_Data, datamap);
}
/**
@ -196,8 +230,24 @@ stock MoveType:GetEntityMoveType(entity)
*/
stock SetEntityMoveType(entity, MoveType:mt)
{
new offset = GetEntSendPropOffs(entity, "movetype");
SetEntData(entity, offset, mt, 1, true);
static bool:gotconfig = false;
static String:datamap[32];
if (!gotconfig)
{
new Handle:gc = LoadGameConfigFile("core.games");
new bool:exists = GameConfGetKeyValue(gc, "m_MoveType", datamap, sizeof(datamap));
CloseHandle(gc);
if (!exists)
{
strcopy(datamap, sizeof(datamap), "m_MoveType");
}
gotconfig = true;
}
SetEntProp(entity, Prop_Data, datamap, mt);
}
/**
@ -209,7 +259,24 @@ stock SetEntityMoveType(entity, MoveType:mt)
*/
stock RenderMode:GetEntityRenderMode(entity)
{
return RenderMode:GetEntProp(entity, Prop_Send, "m_nRenderMode", 1);
static bool:gotconfig = false;
static String:prop[32];
if (!gotconfig)
{
new Handle:gc = LoadGameConfigFile("core.games");
new bool:exists = GameConfGetKeyValue(gc, "m_nRenderMode", prop, sizeof(prop));
CloseHandle(gc);
if (!exists)
{
strcopy(prop, sizeof(prop), "m_nRenderMode");
}
gotconfig = true;
}
return RenderMode:GetEntProp(entity, Prop_Send, prop, 1);
}
/**
@ -222,7 +289,24 @@ stock RenderMode:GetEntityRenderMode(entity)
*/
stock SetEntityRenderMode(entity, RenderMode:mode)
{
SetEntProp(entity, Prop_Send, "m_nRenderMode", mode, 1);
static bool:gotconfig = false;
static String:prop[32];
if (!gotconfig)
{
new Handle:gc = LoadGameConfigFile("core.games");
new bool:exists = GameConfGetKeyValue(gc, "m_nRenderMode", prop, sizeof(prop));
CloseHandle(gc);
if (!exists)
{
strcopy(prop, sizeof(prop), "m_nRenderMode");
}
gotconfig = true;
}
SetEntProp(entity, Prop_Send, prop, mode, 1);
}
/**
@ -234,7 +318,24 @@ stock SetEntityRenderMode(entity, RenderMode:mode)
*/
stock RenderFx:GetEntityRenderFx(entity)
{
return RenderFx:GetEntProp(entity, Prop_Send, "m_nRenderFX", 1);
static bool:gotconfig = false;
static String:prop[32];
if (!gotconfig)
{
new Handle:gc = LoadGameConfigFile("core.games");
new bool:exists = GameConfGetKeyValue(gc, "m_nRenderFX", prop, sizeof(prop));
CloseHandle(gc);
if (!exists)
{
strcopy(prop, sizeof(prop), "m_nRenderFX");
}
gotconfig = true;
}
return RenderFx:GetEntProp(entity, Prop_Send, prop, 1);
}
/**
@ -247,7 +348,24 @@ stock RenderFx:GetEntityRenderFx(entity)
*/
stock SetEntityRenderFx(entity, RenderFx:fx)
{
SetEntProp(entity, Prop_Send, "m_nRenderFX", fx, 1);
static bool:gotconfig = false;
static String:prop[32];
if (!gotconfig)
{
new Handle:gc = LoadGameConfigFile("core.games");
new bool:exists = GameConfGetKeyValue(gc, "m_nRenderFX", prop, sizeof(prop));
CloseHandle(gc);
if (!exists)
{
strcopy(prop, sizeof(prop), "m_nRenderFX");
}
gotconfig = true;
}
SetEntProp(entity, Prop_Send, prop, fx, 1);
}
/**
@ -263,15 +381,36 @@ stock SetEntityRenderFx(entity, RenderFx:fx)
*/
stock SetEntityRenderColor(entity, r=255, g=255, b=255, a=255)
{
new offset = GetEntSendPropOffs(entity, "m_clrRender");
static bool:gotconfig = false;
static String:prop[32];
if (!gotconfig)
{
new Handle:gc = LoadGameConfigFile("core.games");
new bool:exists = GameConfGetKeyValue(gc, "m_clrRender", prop, sizeof(prop));
CloseHandle(gc);
if (!exists)
{
strcopy(prop, sizeof(prop), "m_clrRender");
}
gotconfig = true;
}
new offset = GetEntSendPropOffs(entity, prop);
if (offset <= 0)
{
ThrowError("SetEntityRenderColor not supported by this mod");
}
SetEntData(entity, offset, r, 1, true);
SetEntData(entity, offset + 1, g, 1, true);
SetEntData(entity, offset + 2, b, 1, true);
SetEntData(entity, offset + 3, a, 1, true);
}
/* GuessSDKVersion */
/**
* Gets an entity's gravity.
*
@ -281,7 +420,24 @@ stock SetEntityRenderColor(entity, r=255, g=255, b=255, a=255)
*/
stock Float:GetEntityGravity(entity)
{
return GetEntPropFloat(entity, Prop_Data, "m_flGravity");
static bool:gotconfig = false;
static String:datamap[32];
if (!gotconfig)
{
new Handle:gc = LoadGameConfigFile("core.games");
new bool:exists = GameConfGetKeyValue(gc, "m_flGravity", datamap, sizeof(datamap));
CloseHandle(gc);
if (!exists)
{
strcopy(datamap, sizeof(datamap), "m_flGravity");
}
gotconfig = true;
}
return GetEntPropFloat(entity, Prop_Data, datamap);
}
/**
@ -294,7 +450,24 @@ stock Float:GetEntityGravity(entity)
*/
stock SetEntityGravity(entity, Float:amount)
{
SetEntPropFloat(entity, Prop_Data, "m_flGravity", amount);
static bool:gotconfig = false;
static String:datamap[32];
if (!gotconfig)
{
new Handle:gc = LoadGameConfigFile("core.games");
new bool:exists = GameConfGetKeyValue(gc, "m_flGravity", datamap, sizeof(datamap));
CloseHandle(gc);
if (!exists)
{
strcopy(datamap, sizeof(datamap), "m_flGravity");
}
gotconfig = true;
}
SetEntPropFloat(entity, Prop_Data, datamap, amount);
}
/**
@ -307,7 +480,50 @@ stock SetEntityGravity(entity, Float:amount)
*/
stock SetEntityHealth(entity, amount)
{
SetEntProp(entity, Prop_Send, "m_iHealth", amount);
static bool:gotconfig = false;
static String:prop[32];
if (!gotconfig)
{
new Handle:gc = LoadGameConfigFile("core.games");
new bool:exists = GameConfGetKeyValue(gc, "m_iHealth", prop, sizeof(prop));
CloseHandle(gc);
if (!exists)
{
strcopy(prop, sizeof(prop), "m_iHealth");
}
gotconfig = true;
}
decl String:cls[64];
new PropFieldType:type;
new offset;
if (!GetEntityNetClass(entity, cls, sizeof(cls)))
{
ThrowError("SetEntityHealth not supported by this mod: Could not get serverclass name");
return;
}
offset = FindSendPropInfo(cls, prop, type);
if (offset <= 0)
{
ThrowError("SetEntityHealth not supported by this mod");
return;
}
/* Dark Messiah uses a float for the health instead an integer */
if (type == PropField_Float)
{
SetEntDataFloat(entity, offset, float(amount));
}
else
{
SetEntProp(entity, Prop_Send, prop, amount);
}
}
/**
@ -320,5 +536,22 @@ stock SetEntityHealth(entity, amount)
*/
stock GetClientButtons(client)
{
return GetEntProp(client, Prop_Data, "m_nButtons");
static bool:gotconfig = false;
static String:datamap[32];
if (!gotconfig)
{
new Handle:gc = LoadGameConfigFile("core.games");
new bool:exists = GameConfGetKeyValue(gc, "m_nButtons", datamap, sizeof(datamap));
CloseHandle(gc);
if (!exists)
{
strcopy(datamap, sizeof(datamap), "m_nButtons");
}
gotconfig = true;
}
return GetEntProp(client, Prop_Data, datamap);
}

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: events.inc 1857 2008-01-19 20:58:10Z dvander $
* Version: $Id$
*/
#if defined _events_included

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: files.inc 1860 2008-01-22 17:04:59Z dvander $
* Version: $Id$
*/
#if defined _files_included
@ -176,11 +176,11 @@ native ReadFile(Handle:hndl, items[], num_items, size);
* @param hndl Handle to the file.
* @param buffer Buffer to store the string.
* @param max_size Maximum size of the string buffer.
* @param stop If true, reading will stop once max_size-1 bytes have
* been read. If false, reading will stop once a NUL
* terminator is reached. The buffer will simply be
* terminated in either case, the difference is in how
* the far the file position is changed.
* @param read_count If -1, reads until a null terminator is encountered in
* the file. Otherwise, read_count bytes are read
* into the buffer provided. In this case the buffer
* is not explicitly null terminated, and the buffer
* will contain any null terminators read from the file.
* @return Number of characters written to the buffer, or -1
* if an error was encountered.
* @error Invalid Handle, or read_count > max_size.
@ -353,6 +353,25 @@ native FlushFile(Handle:file);
*/
native bool:RemoveDir(const String:path[]);
#define FPERM_U_READ 0x0100 /* User can read. */
#define FPERM_U_WRITE 0x0080 /* User can write. */
#define FPERM_U_EXEC 0x0040 /* User can exec. */
#define FPERM_G_READ 0x0020 /* Group can read. */
#define FPERM_G_WRITE 0x0010 /* Group can write. */
#define FPERM_G_EXEC 0x0008 /* Group can exec. */
#define FPERM_O_READ 0x0004 /* Anyone can read. */
#define FPERM_O_WRITE 0x0002 /* Anyone can write. */
#define FPERM_O_EXEC 0x0001 /* Anyone can exec. */
/**
* Creates a directory.
*
* @param path Path to create.
* @param mode Permissions (default is o=rx,g=rx,u=rwx). Note that folders must have
* the execute bit set on Linux. On Windows, the mode is ignored.
*/
native bool:CreateDirectory(const String:path[], mode);
/**
* Returns a file timestamp as a unix timestamp.
*

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: float.inc 1942 2008-03-16 23:08:56Z dvander $
* Version: $Id$
*/
#if defined _float_included

View File

@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: functions.inc 2360 2008-07-06 00:01:40Z dvander $
* Version: $Id$
*/
#define SP_PARAMFLAG_BYREF (1<<0) /**< Internal use only. */
@ -352,7 +352,7 @@ native Call_Cancel();
* @param numParams Number of parameters passed to the native.
* @return Value for the native call to return.
*/
functag NativeCall public(Handle:plugin, numParams);
functag public NativeCall(Handle:plugin, numParams);
/**
* Creates a dynamic native. This should only be called in AskPluginLoad(), or

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: geoip.inc 1579 2007-10-15 04:27:56Z dvander $
* Version: $Id$
*/
#if defined _geoip_included

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: halflife.inc 1921 2008-03-02 23:54:38Z dvander $
* Version: $Id$
*/
#if defined _halflife_included
@ -37,8 +37,10 @@
#define SOURCE_SDK_UNKNOWN 0 /**< Could not determine the engine version */
#define SOURCE_SDK_ORIGINAL 10 /**< Original Source engine (still used by "The Ship") */
#define SOURCE_SDK_DARKMESSIAH 15 /**< Modified version of original engine used by Dark Messiah (no SDK) */
#define SOURCE_SDK_EPISODE1 20 /**< SDK+Engine released after Episode 1 */
#define SOURCE_SDK_EPISODE2 30 /**< Engine released after Episode 2 (no SDK yet) */
#define SOURCE_SDK_EPISODE2 30 /**< SDK+Engine released after Episode 2/Orange Box */
#define SOURCE_SDK_LEFT4DEAD 40 /**< Engine released after Left 4 Dead (no SDK yet) */
#define MOTDPANEL_TYPE_TEXT 0 /**< Treat msg as plain text */
#define MOTDPANEL_TYPE_INDEX 1 /**< Msg is auto determined by the engine */
@ -51,7 +53,7 @@ enum DialogType
DialogType_Menu, /**< an options menu */
DialogType_Text, /**< a richtext dialog */
DialogType_Entry, /**< an entry box */
DialogType_AskConnect /**< ask the client to connect to a specified IP */
DialogType_AskConnect /**< ask the client to connect to a specified IP */
};
/**

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: handles.inc 1771 2007-12-05 15:38:45Z dvander $
* Version: $Id$
*/
#if defined _handles_included

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: helpers.inc 1895 2008-02-22 21:01:08Z dvander $
* Version: $Id$
*/
#if defined _helpers_included

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: keyvalues.inc 1740 2007-12-01 00:37:47Z faluco $
* Version: $Id$
*/
#if defined _keyvalues_included

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: lang.inc 1336 2007-08-15 06:19:30Z damagedsoul $
* Version: $Id$
*/
#if defined _lang_included

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: logging.inc 1920 2008-03-02 19:08:27Z dvander $
* Version: $Id$
*/
#if defined _sm_logging_included
@ -134,7 +134,7 @@ forward Action:OnLogAction(Handle:source,
* @return Plugin_Handled or Plugin_Stop will prevent the message
* from being written to the log file.
*/
functag GameLogHook Action:public(const String:message[]);
functag public Action:GameLogHook(const String:message[]);
/**
* Adds a game log hook.

View File

@ -0,0 +1,99 @@
#if defined _mapchooser_included_
#endinput
#endif
#define _mapchooser_included_
enum NominateResult
{
Nominate_Added, /** The map was added to the nominate list */
Nominate_Replaced, /** A clients existing nomination was replaced */
Nominate_AlreadyInVote, /** Specified map was already in the vote */
Nominate_InvalidMap, /** Mapname specifed wasn't a valid map */
Nominate_VoteFull, /** This will only occur if force was set to false */
};
enum MapChange
{
MapChange_Instant, /** Change map as soon as the voting results have come in */
MapChange_RoundEnd, /** Change map at the end of the round */
MapChange_MapEnd, /** Change the sm_nextmap cvar */
};
/**
* Attempt to add a map to the mapchooser map list.
*
* @param map Map to add.
* @param force Should we force the map in even if it requires overwriting an existing nomination?
* @param owner Client index of the nominater. If the client disconnects the nomination will be removed. Use 0 for constant nominations
* @return Nominate Result of the outcome
*/
native NominateResult:NominateMap(const String:map[], bool:force, owner);
/**
* Gets the current list of excluded maps.
*
* @param array An ADT array handle to add the map strings to. Needs to be
* @noreturn
*/
native GetExcludeMapList(Handle:array);
/**
* Checks if MapChooser will allow a vote
*
* @return True if a vote can be held, or false if mapchooser is already holding a vote.
*/
native bool:CanMapChooserStartVote();
/**
* Initiates a MapChooser map vote
*
* Note: If no input array is specified mapchooser will use its internal list. This includes
* any nominations and excluded maps (as per mapchoosers convars).
*
* @param when MapChange consant of when the resulting mapchange should occur.
* @param inputarray ADT array list of maps to add to the vote.
*/
native InitiateMapChooserVote(MapChange:when, Handle:inputarray=INVALID_HANDLE);
/**
* Checks if MapChooser's end of map vote has completed.
*
* @return True if complete, false otherwise.
*/
native bool:HasEndOfMapVoteFinished();
/**
* Checks if MapChooser is set to run an end of map vote.
*
* @return True if enabled, false otherwise.
*/
native bool:EndOfMapVoteEnabled();
/**
* Called when mapchooser removes a nomination from its list.
* Nominations cleared on map start will not trigger this forward
*/
forward OnNominationRemoved(const String:map[], owner);
public SharedPlugin:__pl_mapchooser =
{
name = "mapchooser",
file = "mapchooser.smx",
#if defined REQUIRE_PLUGIN
required = 1,
#else
required = 0,
#endif
};
public __pl_mapchooser_SetNTVOptional()
{
MarkNativeAsOptional("NominateMap");
MarkNativeAsOptional("GetExcludeMapList");
MarkNativeAsOptional("CanMapChooserStartVote");
MarkNativeAsOptional("InitiateMapChooserVote");
MarkNativeAsOptional("HasEndOfMapVoteFinished");
MarkNativeAsOptional("EndOfMapVoteEnabled");
}

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: menus.inc 1777 2007-12-06 12:26:59Z dvander $
* Version: $Id$
*/
#if defined _menus_included
@ -149,7 +149,7 @@ enum MenuSource
* @param param2 Second action parameter (usually the item).
* @noreturn
*/
functag MenuHandler public(Handle:menu, MenuAction:action, param1, param2);
functag public MenuHandler(Handle:menu, MenuAction:action, param1, param2);
/**
* Creates a new, empty menu using the default style.
@ -513,7 +513,7 @@ stock VoteMenuToAll(Handle:menu, time)
* defines.
* @noreturn
*/
functag VoteHandler public(Handle:menu,
functag public VoteHandler(Handle:menu,
num_votes,
num_clients,
const client_info[][2],
@ -540,6 +540,28 @@ native SetVoteResultCallback(Handle:menu, VoteHandler:callback);
*/
native CheckVoteDelay();
/**
* Returns whether a client is in the pool of clients allowed
* to participate in the current vote. This is determined by
* the client list passed to StartVote().
*
* @param client Client index.
* @return True if client is allowed to vote, false otherwise.
* @error If no vote is in progress or client index is invalid.
*/
native bool:IsClientInVotePool(client);
/**
* Redraws the current vote menu to a client in the voting pool.
*
* @param client Client index.
* @return True on success, false if the client is in the vote pool
* but cannot vote again.
* @error No vote in progress, client is not in the voting pool,
* or client index is invalid.
*/
native bool:RedrawClientVoteMenu(client);
/**
* Returns a style's global Handle.
*

84
src/include/nextmap.inc Normal file
View File

@ -0,0 +1,84 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, version 3.0, as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*
* As a special exception, AlliedModders LLC gives you permission to link the
* code of this program (as well as its derivative works) to "Half-Life 2," the
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
* by the Valve Corporation. You must obey the GNU General Public License in
* all respects for all other code used. Additionally, AlliedModders LLC grants
* this exception to all derivative works. AlliedModders LLC defines further
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id$
*/
#if defined _nextmap_included_
#endinput
#endif
#define _nextmap_included_
/**
* Sets SourceMod's internal nextmap.
* Equivalent to changing sm_nextmap but with an added validity check.
*
* @param map Next map to set.
* @return True if the nextmap was set, false if map was invalid.
*/
native bool:SetNextMap(const String:map[]);
/**
* Returns SourceMod's internal nextmap.
*
* @param map Buffer to store the nextmap name.
* @param maxlen Maximum length of the map buffer.
* @return True if a Map was found and copied, false if no nextmap is set (map will be unchanged).
*/
native bool:GetNextMap(String:map[], maxlen);
/**
* Changes the current map and records the reason for the change with maphistory
*
* @param map Map to change to.
* @param reason Reason for change.
* @noreturn
*/
native ForceChangeLevel(const String:map[], const String:reason[]);
/**
* Gets the current number of maps in the map history
*
* @return Number of maps.
*/
native GetMapHistorySize();
/**
* Retrieves a map from the map history list.
*
* @param item Item number. Must be 0 or greater and less than GetMapHistorySize().
* @param map Buffer to store the map name.
* @param mapLen Length of map buffer.
* @param reason Buffer to store the change reason.
* @param reasonLen Length of the reason buffer.
* @param startTime Time the map started.
* @noreturn
* @error Invalid item number.
*/
native GetMapHistory(item, String:map[], mapLen, String:reason[], reasonLen, &startTime);

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: profiler.inc 1336 2007-08-15 06:19:30Z damagedsoul $
* Version: $Id$
*/
#if defined _profiler_included

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: regex.inc 2086 2008-04-19 10:34:56Z pred $
* Version: $Id$
*/
#if defined _regex_included

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: sdktools.inc 1990 2008-04-06 05:40:11Z dvander $
* Version: $Id$
*/
#if defined _sdktools_included

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: sdktools_engine.inc 1336 2007-08-15 06:19:30Z damagedsoul $
* Version: $Id$
*/
#if defined _sdktools_engine_included

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: sdktools_entinput.inc 1504 2007-09-28 19:56:19Z faluco $
* Version: $Id$
*/
#if defined _sdktools_entinput_included

View File

@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: sdktools_entoutput.inc 1990 2008-04-06 05:40:11Z dvander $
* Version: $Id$
*/
#if defined _sdktools_entoutput_included
@ -43,7 +43,7 @@
* @param activator Entity index of the activator.
* @param delay Delay in seconds? before the event gets fired.
*/
functag EntityOutput public(const String:output[], caller, activator, Float:delay);
functag public EntityOutput(const String:output[], caller, activator, Float:delay);
/**
* Add an entity output hook on a entity classname

View File

@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: sdktools_functions.inc 2069 2008-04-16 23:29:37Z dvander $
* Version: $Id$
*/
#if defined _sdktools_functions_included
@ -308,3 +308,15 @@ native EquipPlayerWeapon(client, weapon);
* @error Invalid entity or lack of mod support.
*/
native ActivateEntity(entity);
/**
* Sets values to client info buffer keys and notifies the engine of the change.
* The change does not get propogated to mods until the next frame.
*
* @param client Player's index.
* @param key Key string.
* @param value Value string.
* @noreturn
* @error Invalid client index, or client not connected.
*/
native SetClientInfo(client, const String:key[], const String:value[]);

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: sdktools_sound.inc 1934 2008-03-12 05:21:56Z dvander $
* Version: $Id$
*/
#if defined _sdktools_sound_included
@ -274,7 +274,7 @@ native EmitSentence(const clients[],
* @return Plugin_Continue to allow the sound to be played, Plugin_Stop to block it,
* Plugin_Changed when any parameter has been modified.
*/
functag AmbientSHook Action:public(String:sample[PLATFORM_MAX_PATH], &entity, &Float:volume, &level, &pitch, Float:pos[3], &flags, &Float:delay);
functag public Action:AmbientSHook(String:sample[PLATFORM_MAX_PATH], &entity, &Float:volume, &level, &pitch, Float:pos[3], &flags, &Float:delay);
/**
* Called when a sound is going to be emitted to one or more clients.
@ -292,7 +292,7 @@ functag AmbientSHook Action:public(String:sample[PLATFORM_MAX_PATH], &entity, &F
* @return Plugin_Continue to allow the sound to be played, Plugin_Stop to block it,
* Plugin_Changed when any parameter has been modified.
*/
functag NormalSHook Action:public(clients[64], &numClients, String:sample[PLATFORM_MAX_PATH], &entity, &channel, &Float:volume, &level, &pitch, &flags);
functag public Action:NormalSHook(clients[64], &numClients, String:sample[PLATFORM_MAX_PATH], &entity, &channel, &Float:volume, &level, &pitch, &flags);
/**
* Hooks all played ambient sounds.

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: sdktools_stocks.inc 1622 2007-10-21 00:16:46Z dvander $
* Version: $Id$
*/
#if defined _sdktools_stocks_included
@ -52,13 +52,13 @@ stock FindTeamByName(const String:name[])
new name_len = strlen(name);
new num_teams = GetTeamCount();
decl String:team_name[32];
new found_team = -1
new found_team = -1;
for (new i = 0; i < num_teams; i++)
{
GetTeamName(i, team_name, sizeof(team_name));
if (strncmp(team_name, name, name_len) == 0)
if (strncmp(team_name, name, name_len, false) == 0)
{
if (found_team >= 0)
{

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: sdktools_stringtables.inc 1336 2007-08-15 06:19:30Z damagedsoul $
* Version: $Id$
*/
#if defined _sdktools_stringtables_included

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: sdktools_tempents.inc 1336 2007-08-15 06:19:30Z damagedsoul $
* Version: $Id$
*/
#if defined _sdktools_tempents_included
@ -44,7 +44,7 @@
* @param delay Delay in seconds to send the TE.
* @return Plugin_Continue to allow the transmission of the TE, Plugin_Stop to block it.
*/
functag TEHook Action:public(const String:te_name[], const Players[], numClients, Float:delay);
functag public Action:TEHook(const String:te_name[], const Players[], numClients, Float:delay);
/**
* Hooks a temp entity.

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: sdktools_tempents_stocks.inc 1336 2007-08-15 06:19:30Z damagedsoul $
* Version: $Id$
*/
#if defined _te_stocks_included

View File

@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: sdktools_trace.inc 2208 2008-05-29 03:50:36Z dvander $
* Version: $Id$
*/
#if defined _sdktools_trace_included

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: sdktools_voice.inc 2163 2008-05-21 03:31:27Z dvander $
* Version: $Id$
*/
#if defined _sdktools_voice_included
@ -39,15 +39,11 @@
* @section voice flags.
*/
#define VOICE_NORMAL 0 /**< Allow the client to listen and speak normally. */
#define VOICE_MUTED 1 /**< Mutes the client from speaking to everyone. */
#define VOICE_MUTED 1 /**< Mutes the client from speaking to everyone. */
#define VOICE_SPEAKALL 2 /**< Allow the client to speak to everyone. */
#define VOICE_LISTENALL 4 /**< Allow the client to listen to everyone. */
#define VOICE_TEAM 8 /**< Allow the client to always speak to team, even when dead. */
#define VOICE_TEAM 8 /**< Allow the client to always speak to team, even when dead. */
#define VOICE_LISTENTEAM 16 /**< Allow the client to always hear teammates, including dead ones. */
#define LISTEN_DEFAULT 0 /**< Default action (flags or game) is taken */
#define LISTEN_NO 1 /**< Receiver cannot hear sender */
#define LISTEN_YES 2 /**< Receiver can hear sender */
/**
* @endsection
@ -57,7 +53,7 @@
* Set the client listening flags.
*
* @param client The client index
* @param flags The voice flags
* @param flags The voice flags
* @noreturn
*/
native SetClientListeningFlags(client, flags);
@ -66,27 +62,24 @@ native SetClientListeningFlags(client, flags);
* Retrieve the client current listening flags.
*
* @param client The client index
* @return The current voice flags
* @return The current voice flags
*/
native GetClientListeningFlags(client);
/**
* Set the receiver's ability to listen to the sender.
* Set the receiver ability to listen to the sender.
*
* @param receiver The listener client index.
* @param sender The sender client index.
* @param control A LISTEN_ constant describing the voice relationship.
* @noreturn
* @error If either client index is invalid or not connected.
* @param iReceiver The listener index.
* @param iSender The sender index.
* @return True if successful otherwise false.
*/
native bool:SetClientListening(receiver, sender, control);
native bool:SetClientListening(iReceiver, iSender, bool:bListen);
/**
* Retrieves if a receiver can listen to the sender.
* Retrieves if the receiver can listen to the sender.
*
* @param receiver The listener client index.
* @param sender The sender client index.
* @return A LISTEN_ constant describing the voice relationship.
* @error If either client index is invalid or not connected.
* @param iReceiver The listener index.
* @param iSender The sender index.
* @return True if successful otherwise false.
*/
native bool:GetClientListening(receiver, sender);
native bool:GetClientListening(iReceiver, iSender);

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: sorting.inc 1923 2008-03-03 06:28:41Z pred $
* Version: $Id$
*/
@ -98,7 +98,7 @@ native SortStrings(String:array[][], num_strings, SortOrder:order = Sort_Ascendi
* 0 if first is equal to second
* 1 if first should go after second
*/
functag SortFunc1D public(elem1, elem2, const array[], Handle:hndl);
functag public SortFunc1D(elem1, elem2, const array[], Handle:hndl);
/**
* Sorts a custom 1D array. You must pass in a comparison function.
@ -163,7 +163,7 @@ native SortADTArray(Handle:array, SortOrder:order, SortType:type);
* 0 if first is equal to second
* 1 if first should go after second
*/
functag SortFuncADTArray public(index1, index2, Handle:array, Handle:hndl);
functag public SortFuncADTArray(index1, index2, Handle:array, Handle:hndl);
/**
* Custom sorts an ADT Array. You must pass in a comparison function.

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: sourcemod.inc 2212 2008-05-29 03:55:31Z dvander $
* Version: $Id$
*/
#if defined _sourcemod_included
@ -57,6 +57,7 @@ struct Plugin
#include <logging>
#include <timers>
#include <admin>
#include <keyvalues>
#include <dbi>
#include <lang>
#include <sorting>
@ -66,12 +67,12 @@ struct Plugin
#include <events>
#include <bitbuffer>
#include <usermessages>
#include <keyvalues>
#include <menus>
#include <halflife>
#include <adt>
#include <banning>
#include <commandfilters>
#include <nextmap>
/**
* Declare this as a struct in your plugin to expose its information.

View File

@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: string.inc 2206 2008-05-29 03:46:42Z dvander $
* Version: $Id$
*/
#if defined _string_included
@ -284,9 +284,10 @@ native SplitString(const String:source[], const String:split[], String:part[], p
* @param maxlength Maximum length of the string buffer.
* @param search String to search for.
* @param replace String to replace the search string with.
* @param caseSensitive If true (default), search is case sensitive.
* @return Number of replacements that were performed.
*/
native ReplaceString(String:text[], maxlength, const String:search[], const String:replace[]);
native ReplaceString(String:text[], maxlength, const String:search[], const String:replace[], bool:caseSensitive=true);
/**
* Given a string, replaces the first occurrence of a search string with a
@ -300,11 +301,12 @@ native ReplaceString(String:text[], maxlength, const String:search[], const Stri
* a strlen() call on the search parameter.
* @param replaceLen If higher than -1, its value will be used instead of
* a strlen() call on the replace parameter.
* @param caseSensitive If true (default), search is case sensitive.
* @return Index into the buffer (relative to the start) from where
* the last replacement ended, or -1 if no replacements were
* made.
*/
native ReplaceStringEx(String:text[], maxlength, const String:search[], const String:replace[], searchLen=-1, replaceLen=-1);
native ReplaceStringEx(String:text[], maxlength, const String:search[], const String:replace[], searchLen=-1, replaceLen=-1, bool:caseSensitive=true);
/**
* Returns the number of bytes a character is using. This is

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: textparse.inc 1336 2007-08-15 06:19:30Z damagedsoul $
* Version: $Id$
*/
#if defined _textparse_included
@ -108,7 +108,7 @@ native bool:SMC_GetErrorString(SMCError:error, String:buffer[], buf_max);
* @param smc The SMC Parse Handle.
* @noreturn
*/
functag SMC_ParseStart public(Handle:smc);
functag public SMC_ParseStart(Handle:smc);
/**
* Sets the SMC_ParseStart function of a parse Handle.
@ -128,7 +128,7 @@ native SMC_SetParseStart(Handle:smc, SMC_ParseStart:func);
* @param failed True if parsing failed, false otherwise.
* @noreturn
*/
functag SMC_ParseEnd public(Handle:smc, bool:halted, bool:failed);
functag public SMC_ParseEnd(Handle:smc, bool:halted, bool:failed);
/**
* Sets the SMC_ParseEnd of a parse handle.
@ -149,7 +149,7 @@ native SMC_SetParseEnd(Handle:smc, SMC_ParseEnd:func);
* @param opt_quotes True if the section name was quote-enclosed in the file.
* @return An SMCResult action to take.
*/
functag SMC_NewSection SMCResult:public(Handle:smc, const String:name[], bool:opt_quotes);
functag public SMCResult:SMC_NewSection(Handle:smc, const String:name[], bool:opt_quotes);
/**
* Called when the parser finds a new key/value pair.
@ -162,7 +162,7 @@ functag SMC_NewSection SMCResult:public(Handle:smc, const String:name[], bool:op
* @param value_quotes Whether or not the value was enclosed in quotes.
* @return An SMCResult action to take.
*/
functag SMC_KeyValue SMCResult:public(Handle:smc, const String:key[], const String:value[], bool:key_quotes, bool:value_quotes);
functag public SMCResult:SMC_KeyValue(Handle:smc, const String:key[], const String:value[], bool:key_quotes, bool:value_quotes);
/**
* Called when the parser finds the end of the current section.
@ -170,7 +170,7 @@ functag SMC_KeyValue SMCResult:public(Handle:smc, const String:key[], const Stri
* @param smc The SMC Parse Handle.
* @return An SMCResult action to take.
*/
functag SMC_EndSection SMCResult:public(Handle:smc);
functag public SMCResult:SMC_EndSection(Handle:smc);
/**
* Sets the three main reader functions.
@ -191,7 +191,7 @@ native SMC_SetReaders(Handle:smc, SMC_NewSection:ns, SMC_KeyValue:kv, SMC_EndSec
* @param lineno The line number it occurs on.
* @return An SMCResult action to take.
*/
functag SMC_RawLine SMCResult:public(Handle:smc, const String:line[], lineno);
functag public SMCResult:SMC_RawLine(Handle:smc, const String:line[], lineno);
/**
* Sets a raw line reader on an SMC parser Handle.

View File

@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: tf2.inc 2215 2008-05-29 04:06:16Z dvander $
* Version: $Id$
*/
#if defined _tf2_included
@ -104,6 +104,23 @@ native TF2_GetResourceEntity();
*/
native TFClassType:TF2_GetClass(const String:classname[]);
/**
* Called on weapon fire to decide if the current shot should be critical.
* Return Plugin_Continue to let the original calculation or return a higher
* action to override the decision with the value of 'result'
*
* @note Since critical shots are also calculated client side any changes made with
* this will not show for the shooter. Projectile weapons such as the rocketlauncher
* and demoman weapons will show a critical bullet but no critical sound effect.
* Bullet hits should appear as expected.
*
* @param client Client Index.
* @param weapon Weapon entity Index.
* @param weaponname Classname of the weapon.
* @param result Buffer param for the result of the decision.
*/
forward Action:TF2_CalcIsAttackCritical(client, weapon, String:weaponname[], &bool:result);
/**
* Do not edit below this line!
*/
@ -118,4 +135,3 @@ public Extension:__ext_tf2 =
required = 0,
#endif
};

View File

@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: tf2_stocks.inc 2236 2008-05-31 22:30:57Z damagedsoul $
* Version: $Id$
*/
#if defined _tf2_stocks_included
@ -86,8 +86,7 @@ static const String:TFResourceNames[TFResourceType][] =
* Get's a Clients current class.
*
* @param client Player's index.
* @param class TFClassType to change to.
* @noreturn
* @return Current TFClassType of player.
* @error Invalid client index.
*/
stock TFClassType:TF2_GetPlayerClass(client)
@ -217,3 +216,4 @@ stock TF2_RemoveAllWeapons(client)
TF2_RemoveWeaponSlot(client, i);
}
}

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: timers.inc 2213 2008-05-29 03:59:00Z dvander $
* Version: $Id$
*/
#if defined _timers_included
@ -39,7 +39,8 @@
#define TIMER_REPEAT (1<<0) /**< Timer will repeat until it returns Plugin_Stop */
#define TIMER_FLAG_NO_MAPCHANGE (1<<1) /**< Timer will not carry over mapchanges */
#define TIMER_HNDL_CLOSE (1<<9) /**< Timer will automatically call CloseHandle() on its value when finished */
#define TIMER_HNDL_CLOSE (1<<9) /**< Deprecated define, replaced by below */
#define TIMER_DATA_HNDL_CLOSE (1<<9) /**< Timer will automatically call CloseHandle() on its data when finished */
/**
* Any of the following prototypes will work for a timed function.
@ -50,7 +51,7 @@ funcenum Timer
* Called when the timer interval has elapsed.
*
* @param timer Handle to the timer object.
* @param hndl Handle passed when the timer was created.
* @param hndl Handle passed to CreateTimer() when timer was created.
* @return Plugin_Stop to stop a repeating timer, any other value for
* default behavior.
*/
@ -60,11 +61,11 @@ funcenum Timer
* Called when the timer interval has elapsed.
*
* @param timer Handle to the timer object.
* @param value Value passed when the timer was created.
* @param data Data passed to CreateTimer() when timer was created.
* @return Plugin_Stop to stop a repeating timer, any other value for
* default behavior.
*/
Action:public(Handle:timer, any:value),
Action:public(Handle:timer, any:data),
/**
* Called when the timer interval has elapsed.
@ -81,18 +82,18 @@ funcenum Timer
*
* @param interval Interval from the current game time to execute the given function.
* @param func Function to execute once the given interval has elapsed.
* @param value Handle or value to give to the timer function.
* @param data Handle or value to pass through to the timer callback function.
* @param flags Flags to set (such as repeatability or auto-Handle closing).
* @return Handle to the timer object. You do not need to call CloseHandle().
* If the timer could not be created, INVALID_HANDLE will be returned.
*/
native Handle:CreateTimer(Float:interval, Timer:func, any:value=INVALID_HANDLE, flags=0);
native Handle:CreateTimer(Float:interval, Timer:func, any:data=INVALID_HANDLE, flags=0);
/**
* Kills a timer. Use this instead of CloseHandle() if you need more options.
*
* @param autoClose If autoClose is true, the timer's value will be
* closed as a handle if TIMER_HNDL_CLOSE was not specified.
* @param autoClose If autoClose is true, the data that was passed to CreateTimer() will
* be closed as a handle if TIMER_DATA_HNDL_CLOSE was not specified.
* @noreturn
*/
native KillTimer(Handle:timer, bool:autoClose=false);
@ -189,20 +190,21 @@ forward OnMapTimeLeftChanged();
native bool:IsServerProcessing();
/**
* Creates a timer associated with a new data pack, and returns the datapack.
* Creates a timer associated with a new datapack, and returns the datapack.
* @note The datapack is automatically freed when the timer ends.
* @note The position of the datapack is not reset or changed for the timer function.
*
* @param interval Interval from the current game time to execute the given function.
* @param func Function to execute once the given interval has elapsed.
* @param data The newly created datapack is passed though this by-reference parameter.
* @param datapack The newly created datapack is passed though this by-reference
* parameter to the timer callback function.
* @param flags Timer flags.
* @return Handle to the timer object. You do not need to call CloseHandle().
*/
stock Handle:CreateDataTimer(Float:interval, Timer:func, &Handle:data, flags=0)
stock Handle:CreateDataTimer(Float:interval, Timer:func, &Handle:datapack, flags=0)
{
data = CreateDataPack();
flags |= TIMER_HNDL_CLOSE;
return CreateTimer(interval, func, data, flags);
datapack = CreateDataPack();
flags |= TIMER_DATA_HNDL_CLOSE;
return CreateTimer(interval, func, datapack, flags);
}

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: topmenus.inc 2086 2008-04-19 10:34:56Z pred $
* Version: $Id$
*/
#if defined _topmenus_included
@ -127,7 +127,7 @@ enum TopMenuObject
* @param maxlength Output buffer (if used).
* @noreturn
*/
functag TopMenuHandler public(Handle:topmenu,
functag public TopMenuHandler(Handle:topmenu,
TopMenuAction:action,
TopMenuObject:object_id,
param,

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: usermessages.inc 1943 2008-03-16 23:16:34Z dvander $
* Version: $Id$
*/
#if defined _eventsmsgs_included
@ -83,7 +83,8 @@ native bool:GetUserMessageName(UserMsg:msg_id, String:msg[], maxlength);
* @param flags Optional flags to set.
* @return A handle to a bf_write bit packing structure, or
* INVALID_HANDLE on failure.
* @error Invalid message name or unable to start a message.
* @error Invalid message name, unable to start a message, invalid client,
* or client not connected.
*/
native Handle:StartMessage(String:msgname[], clients[], numClients, flags=0);
@ -98,7 +99,8 @@ native Handle:StartMessage(String:msgname[], clients[], numClients, flags=0);
* @param flags Optional flags to set.
* @return A handle to a bf_write bit packing structure, or
* INVALID_HANDLE on failure.
* @error Invalid message name or unable to start a message.
* @error Invalid message name, unable to start a message, invalid client,
* or client not connected.
*/
native Handle:StartMessageEx(UserMsg:msg, clients[], numClients, flags=0);
@ -122,14 +124,15 @@ native EndMessage();
* blocks the message from being sent, and Plugin_Continue
* resumes normal functionality.
*/
functag MsgHook Action:public(UserMsg:msg_id, Handle:bf, const players[], playersNum, bool:reliable, bool:init);
functag public Action:MsgHook(UserMsg:msg_id, Handle:bf, const players[], playersNum, bool:reliable, bool:init);
/**
* Called when a message is finished sending.
* Called when a message hook has completed.
*
* @param msg_id Message index.
* @param sent True if message was sent, false if blocked.
*/
functag MsgSentNotify public(UserMsg:msg_id);
functag public MsgPostHook(UserMsg:msg_id, bool:sent);
/**
* Hooks a user message.
@ -143,7 +146,7 @@ functag MsgSentNotify public(UserMsg:msg_id);
* @noreturn
* @error Invalid message index.
*/
native HookUserMessage(UserMsg:msg_id, MsgHook:hook, bool:intercept=false, MsgSentNotify:notify=MsgSentNotify:-1);
native HookUserMessage(UserMsg:msg_id, MsgHook:hook, bool:intercept=false, MsgPostHook:post=MsgPostHook:-1);
/**
* Removes one usermessage hook.

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: vector.inc 1336 2007-08-15 06:19:30Z damagedsoul $
* Version: $Id$
*/
#if defined _vector_included

View File

@ -27,7 +27,7 @@
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
* or <http://www.sourcemod.net/license.php>.
*
* Version: $Id: version.inc 2534 2008-09-14 05:13:21Z dvander $
* Version: $Id$
*/
#if defined _version_included
@ -36,7 +36,7 @@
#define _version_included
#define SOURCEMOD_V_MAJOR 1 /**< SourceMod Major version */
#define SOURCEMOD_V_MINOR 0 /**< SourceMod Minor version */
#define SOURCEMOD_V_RELEASE 4 /**< SourceMod Release version */
#define SOURCEMOD_V_MINOR 2 /**< SourceMod Minor version */
#define SOURCEMOD_V_RELEASE 0 /**< SourceMod Release version */
#define SOURCEMOD_VERSION "1.0.4" /**< SourceMod version string (major.minor.release.build) */
#define SOURCEMOD_VERSION "1.2.0" /**< SourceMod version string (major.minor.release.build) */

View File

@ -122,7 +122,7 @@ bool:ClassGetTeamDefault(index, cachetype = ZR_CLASS_CACHE_MODIFIED)
*
* @param index Index of the class in a class cache or a client index,
* depending on the cache type specified.
* @param name The destination string buffer.
* @param buffer The destination string buffer.
* @param maxlen The length of the destination string buffer.
* @param cachetype Optional. Specifies what class cache to read from. Options:
* ZR_CLASS_CACHE_ORIGINAL - Unchanced class data.
@ -131,21 +131,21 @@ bool:ClassGetTeamDefault(index, cachetype = ZR_CLASS_CACHE_MODIFIED)
* is used, index will be used as a client index.
* @return Number of cells written. -1 on error.
*/
ClassGetName(index, String:name[], maxlen, cachetype = ZR_CLASS_CACHE_PLAYER)
ClassGetName(index, String:buffer[], maxlen, cachetype = ZR_CLASS_CACHE_PLAYER)
{
switch (cachetype)
{
case ZR_CLASS_CACHE_ORIGINAL:
{
return strcopy(name, maxlen, ClassData[index][class_name]);
return strcopy(buffer, maxlen, ClassData[index][class_name]);
}
case ZR_CLASS_CACHE_MODIFIED:
{
return strcopy(name, maxlen, ClassDataCache[index][class_name]);
return strcopy(buffer, maxlen, ClassDataCache[index][class_name]);
}
case ZR_CLASS_CACHE_PLAYER:
{
return strcopy(name, maxlen, ClassPlayerCache[index][class_name]);
return strcopy(buffer, maxlen, ClassPlayerCache[index][class_name]);
}
}

View File

@ -0,0 +1,130 @@
/*
* ============================================================================
*
* Zombie:Reloaded
*
* File: classmenus.inc
* Description: Provides functions for managing class menus.
* Author: Richard Helgeby, Greyscale
*
* ============================================================================
*/
/*
Menu layouts
---------------------------------------
Class selection:
Admin mode is enabled!
1. Select Zombie Class
- Classic
2. Select Human Class
- Regular Human
3. Select Admin Class <-- Only active for admins
- Hidden Admin
(spacer)
4. Toggle Admin Mode
- Disabled
0. Exit
---------------------------------------
*/
/**
* Displays the main class menu with the players class settings.
*/
ClassMenuMain(client)
{
new Handle:classmenu = CreateMenu(ClassMenuMainHandle);
SetGlobalTransTarget(client);
SetMenuTitle(classmenu, "%t\n", "!zclass title");
decl String:zombieclass[128];
decl String:humanclass[128];
decl String:adminclass[128];
decl String:zombieselect[128];
decl String:humanselect[128];
decl String:adminselect[128];
decl String:inadminmnode[128];
decl String:adminmnode[128];
decl String:toggleadminmnode[128];
// Check if the player is in admin mode.
if (ClassPlayerInAdminMode(client))
{
// Notify the player.
Format(adminmode, sizeof(adminmode), "%t\n", "!zclass admin mode enabled");
AddMenuItem(classmenu, "", adminmode, ITEMDRAW_RAWLINE);
}
// List zombie class options.
ClassGetName(ClassSelected[client][ZR_CLASS_TEAM_ZOMBIES, zombieclass, sizeof(zombieclass), ZR_CLASS_CACHE_MODIFIED);
Format(zombieselect, sizeof(zombieselect), "%t\n-%s", "!zclass zombie", zombieclass);
AddMenuItem(classmenu, "", zombieselect);
// List human class options.
ClassGetName(client, humanclass, sizeof(zombieclass));
Format(zombieselect, sizeof(zombieselect), "%t\n-%s", "!zclass human", humanclass);
AddMenuItem(classmenu, "", zombieselect);
// List admin class options.
ClassGetName(client, adminclass, sizeof(adminclass));
Format(adminselect, sizeof(adminselect), "%t\n-%s", "!zclass admin", adminclass);
AddMenuItem(classmenu, "", adminselect);
if (IsClientAdmin(client))
{
// Show admin mode toggle option.
AddMenuItem(classmenu, "", " ", ITEMDRAW_SPACER);
// TODO: Translate or use core phrases!
if (ClassPlayerAdminMode[client])
{
Format(adminmnode, sizeof(adminmnode), "Enabled");
}
else
{
Format(adminmnode, sizeof(adminmnode), "Disabled");
}
Format(toggleadminmode, sizeof(toggleadminmode), "%t\n-%s", "!zclass admin mode toggle", adminmode);
}
/*for (new x = 0; x < classCount; x++)
{
GetClassName(x, display, sizeof(display));
GetClassMenuDescription(x, menu_description, sizeof(menu_description));
if (pNextClass[client] == -1)
{
if (x == pClass[client])
{
Format(display, sizeof(display), "%s (current)", display);
}
}
else if (x == pNextClass[client])
{
Format(display, sizeof(display), "%s (current)", display);
}
Format(display, sizeof(display), "%s\n %s", display, menu_description);
AddMenuItem(menu_classes, "", display);
}
SetMenuExitBackButton(menu_classes, true);*/
DisplayMenu(classmenu, client, MENU_TIME_FOREVER);
}
ClassMenuMainHandle(Handle:classmenu, MenuAction:action, client, slot)
{
}

View File

@ -232,6 +232,16 @@ new ClassCount;
*/
new ClassSelected[MAXPLAYERS + 1][ZR_CLASS_TEAMCOUNT];
/**
* Specifies whether a player is currently in admin mode.
*/
new bool:ClassPlayerInAdminMode[MAXPLAYERS + 1];
/**
* Specifies whether a player is set to be in admin mode next spawn.
*/
new bool:ClassPlayerAdminMode[MAXPLAYERS + 1];
#include "zr/playerclasses/filtertools"
#include "zr/playerclasses/attributes"
#include "zr/playerclasses/apply"