forked from UNLOZE/sm-plugins
batch remove trailing spaces and convert windows \r\n line endings to linux \n
i don't want to have to do this again, fix your shitty code editors @commiters !!!
This commit is contained in:
@@ -15,7 +15,7 @@ enum EUserHasLicenseForAppResult
|
||||
enum EResult
|
||||
{
|
||||
k_EResultOK = 1, // success
|
||||
k_EResultFail = 2, // generic failure
|
||||
k_EResultFail = 2, // generic failure
|
||||
k_EResultNoConnection = 3, // no/failed network connection
|
||||
// k_EResultNoConnectionRetry = 4, // OBSOLETE - removed
|
||||
k_EResultInvalidPassword = 5, // password/ticket is invalid
|
||||
@@ -80,8 +80,8 @@ enum EResult
|
||||
k_EResultCannotUseOldPassword = 64, // The requested new password is not legal
|
||||
k_EResultInvalidLoginAuthCode = 65, // account login denied due to auth code invalid
|
||||
k_EResultAccountLogonDeniedNoMail = 66, // account login denied due to 2nd factor auth failure - and no mail has been sent
|
||||
k_EResultHardwareNotCapableOfIPT = 67, //
|
||||
k_EResultIPTInitError = 68, //
|
||||
k_EResultHardwareNotCapableOfIPT = 67, //
|
||||
k_EResultIPTInitError = 68, //
|
||||
k_EResultParentalControlRestricted = 69, // operation failed due to parental control restrictions for current user
|
||||
k_EResultFacebookQueryError = 70, // Facebook query returned an error
|
||||
k_EResultExpiredLoginAuthCode = 71, // account login denied due to auth code expired
|
||||
@@ -105,7 +105,7 @@ enum EHTTPMethod
|
||||
k_EHTTPMethodDELETE,
|
||||
k_EHTTPMethodOPTIONS,
|
||||
|
||||
// The remaining HTTP methods are not yet supported, per rfc2616 section 5.1.1 only GET and HEAD are required for
|
||||
// The remaining HTTP methods are not yet supported, per rfc2616 section 5.1.1 only GET and HEAD are required for
|
||||
// a compliant general purpose server. We'll likely add more as we find uses for them.
|
||||
|
||||
// k_EHTTPMethodTRACE,
|
||||
@@ -258,7 +258,7 @@ forward SteamWorks_TokenRequested(String:sToken[], maxlen);
|
||||
|
||||
forward SteamWorks_OnClientGroupStatus(authid, groupid, bool:isMember, bool:isOfficer);
|
||||
|
||||
public Extension:__ext_SteamWorks =
|
||||
public Extension:__ext_SteamWorks =
|
||||
{
|
||||
name = "SteamWorks",
|
||||
file = "SteamWorks.ext",
|
||||
|
||||
+48
-48
@@ -95,7 +95,7 @@ typeset ListenCB
|
||||
{
|
||||
//Deleted
|
||||
function void (int entity);
|
||||
|
||||
|
||||
//Created
|
||||
function void (int entity, const char[] classname);
|
||||
};
|
||||
@@ -108,42 +108,42 @@ typeset DHookCallback
|
||||
{
|
||||
//Function Example: void Ham::Test() with this pointer ignore
|
||||
function MRESReturn ();
|
||||
|
||||
|
||||
//Function Example: void Ham::Test() with this pointer passed
|
||||
function MRESReturn (int pThis);
|
||||
|
||||
|
||||
//Function Example: void Ham::Test(int cake) with this pointer ignore
|
||||
function MRESReturn (Handle hParams);
|
||||
|
||||
|
||||
//Function Example: void Ham::Test(int cake) with this pointer passed
|
||||
function MRESReturn (int pThis, Handle hParams);
|
||||
|
||||
|
||||
//Function Example: int Ham::Test() with this pointer ignore
|
||||
function MRESReturn (Handle hReturn);
|
||||
|
||||
|
||||
//Function Example: int Ham::Test() with this pointer passed
|
||||
function MRESReturn (int pThis, Handle hReturn);
|
||||
|
||||
|
||||
//Function Example: int Ham::Test(int cake) with this pointer ignore
|
||||
function MRESReturn (Handle hReturn, Handle hParams);
|
||||
|
||||
|
||||
//Function Example: int Ham::Test(int cake) with this pointer passed
|
||||
function MRESReturn (int pThis, Handle hReturn, Handle hParams);
|
||||
|
||||
|
||||
//Address NOW
|
||||
|
||||
|
||||
//Function Example: void Ham::Test() with this pointer passed
|
||||
function MRESReturn (Address pThis);
|
||||
|
||||
|
||||
//Function Example: void Ham::Test(int cake) with this pointer passed
|
||||
function MRESReturn (Address pThis, Handle hParams);
|
||||
|
||||
|
||||
//Function Example: int Ham::Test() with this pointer passed
|
||||
function MRESReturn (Address pThis, Handle hReturn);
|
||||
|
||||
|
||||
//Function Example: int Ham::Test(int cake) with this pointer passed
|
||||
function MRESReturn (Address pThis, Handle hReturn, Handle hParams);
|
||||
|
||||
|
||||
};
|
||||
|
||||
/* Adds an entity listener hook
|
||||
@@ -171,7 +171,7 @@ native bool DHookRemoveEntityListener(ListenType type, ListenCB callback);
|
||||
* @param returntype Type type of return
|
||||
* @param thistype Type of this pointer or ignore (ignore can be used if not needed)
|
||||
* @param callback Callback function
|
||||
*
|
||||
*
|
||||
* @return Returns setup handle for the hook or INVALID_HANDLE.
|
||||
*/
|
||||
native Handle DHookCreate(int offset, HookType hooktype, ReturnType returntype, ThisPointerType thistype, DHookCallback callback);
|
||||
@@ -182,7 +182,7 @@ native Handle DHookCreate(int offset, HookType hooktype, ReturnType returntype,
|
||||
* @param type Param type
|
||||
* @param size Used for Objects (not Object ptr) to define the size of the object.
|
||||
* @param flag Used to change the pass type.
|
||||
*
|
||||
*
|
||||
* @error Invalid setup handle or too many params added (request upping the max in thread)
|
||||
* @noreturn
|
||||
*/
|
||||
@@ -190,170 +190,170 @@ native void DHookAddParam(Handle setup, HookParamType type, int size=-1, DHookPa
|
||||
//native DHookAddParam(Handle:setup, HookParamType:type);
|
||||
|
||||
/* Hook entity
|
||||
*
|
||||
*
|
||||
* @param setup Setup handle to use to add the hook.
|
||||
* @param post True to make the hook a post hook. (If you need to change the retunr value or need the return value use a post hook! If you need to change params and return use a pre and post hook!)
|
||||
* @param entity Entity index to hook on.
|
||||
* @param removalcb Callback for when the hook is removed (Entity hooks are auto-removed on entity destroyed and will call this callback)
|
||||
*
|
||||
*
|
||||
* @error Invalid setup handle, invalid entity or invalid hook type.
|
||||
* @return -1 on fail a hookid on success
|
||||
*/
|
||||
native int DHookEntity(Handle setup, bool post, int entity, DHookRemovalCB removalcb=INVALID_FUNCTION);
|
||||
|
||||
/* Hook gamerules
|
||||
*
|
||||
*
|
||||
* @param setup Setup handle to use to add the hook.
|
||||
* @param post True to make the hook a post hook. (If you need to change the retunr value or need the return value use a post hook! If you need to change params and return use a pre and post hook!)
|
||||
* @param removalcb Callback for when the hook is removed (Game rules hooks are auto-removed on map end and will call this callback)
|
||||
*
|
||||
*
|
||||
* @error Invalid setup handle, failing to get gamerules pointer or invalid hook type.
|
||||
* @return -1 on fail a hookid on success
|
||||
*/
|
||||
native int DHookGamerules(Handle setup, bool post, DHookRemovalCB removalcb=INVALID_FUNCTION);
|
||||
|
||||
/* Hook a raw pointer
|
||||
*
|
||||
*
|
||||
* @param setup Setup handle to use to add the hook.
|
||||
* @param post True to make the hook a post hook. (If you need to change the retunr value or need the return value use a post hook! If you need to change params and return use a pre and post hook!)
|
||||
* @param addr This pointer address.
|
||||
* @param removalcb Callback for when the hook is removed (Entity hooks are auto-removed on entity destroyed and will call this callback)
|
||||
*
|
||||
*
|
||||
* @error Invalid setup handle, invalid address or invalid hook type.
|
||||
* @return -1 on fail a hookid on success
|
||||
*/
|
||||
native int DHookRaw(Handle setup, bool post, Address addr, DHookRemovalCB removalcb=INVALID_FUNCTION);
|
||||
|
||||
/* Remove hook by hook id
|
||||
*
|
||||
*
|
||||
* @param hookid Hook id to remove
|
||||
*
|
||||
*
|
||||
* @return true on success false otherwise
|
||||
* @note This will not fire the removal callback!
|
||||
*/
|
||||
native bool DHookRemoveHookID(int hookid);
|
||||
|
||||
/* Get param value (Only use for: int, entity, bool or float param types)
|
||||
*
|
||||
*
|
||||
* @param hParams Handle to params structure
|
||||
* @param num Param number to get. (Example if the function has 2 params and you need the value of the first param num would be 1. 0 Will return the number of params stored)
|
||||
*
|
||||
*
|
||||
* @error Invalid handle. Invalid param number. Invalid param type.
|
||||
* @return value if num greater than 0. If 0 returns paramcount.
|
||||
*/
|
||||
native any DHookGetParam(Handle hParams, int num);
|
||||
|
||||
/* Get vector param value
|
||||
*
|
||||
*
|
||||
* @param hParams Handle to params structure
|
||||
* @param num Param number to get. (Example if the function has 2 params and you need the value of the first param num would be 1.)
|
||||
* @param vec Vector buffer to store result.
|
||||
*
|
||||
*
|
||||
* @error Invalid handle. Invalid param number. Invalid param type.
|
||||
* @noreturn
|
||||
*/
|
||||
native void DHookGetParamVector(Handle hParams, int num, float vec[3]);
|
||||
|
||||
/* Get string param value
|
||||
*
|
||||
*
|
||||
* @param hParams Handle to params structure
|
||||
* @param num Param number to get. (Example if the function has 2 params and you need the value of the first param num would be 1.)
|
||||
* @param buffer String buffer to store result
|
||||
* @param size Buffer size
|
||||
*
|
||||
*
|
||||
* @error Invalid handle. Invalid param number. Invalid param type.
|
||||
* @noreturn
|
||||
*/
|
||||
native void DHookGetParamString(Handle hParams, int num, char[] buffer, int size);
|
||||
|
||||
/* Set param value (Only use for: int, entity, bool or float param types)
|
||||
*
|
||||
*
|
||||
* @param hParams Handle to params structure
|
||||
* @params num Param number to set (Example if the function has 2 params and you need to set the value of the first param num would be 1.)
|
||||
* @param value Value to set it as (only pass int, bool, float or entity index)
|
||||
*
|
||||
*
|
||||
* @error Invalid handle. Invalid param number. Invalid param type.
|
||||
* @noreturn
|
||||
*/
|
||||
native void DHookSetParam(Handle hParams, int num, any value);
|
||||
|
||||
/* Set vector param value
|
||||
*
|
||||
*
|
||||
* @param hParams Handle to params structure
|
||||
* @params num Param number to set (Example if the function has 2 params and you need to set the value of the first param num would be 1.)
|
||||
* @param vec Value to set vector as.
|
||||
*
|
||||
*
|
||||
* @error Invalid handle. Invalid param number. Invalid param type.
|
||||
* @noreturn
|
||||
*/
|
||||
native void DHookSetParamVector(Handle hParams, int num, float vec[3]);
|
||||
|
||||
/* Set string param value
|
||||
*
|
||||
*
|
||||
* @param hParams Handle to params structure
|
||||
* @params num Param number to set (Example if the function has 2 params and you need to set the value of the first param num would be 1.)
|
||||
* @param value Value to set string as.
|
||||
*
|
||||
*
|
||||
* @error Invalid handle. Invalid param number. Invalid param type.
|
||||
* @noreturn
|
||||
*/
|
||||
native void DHookSetParamString(Handle hParams, int num, char[] value);
|
||||
|
||||
/* Get return value (Only use for: int, entity, bool or float return types)
|
||||
*
|
||||
*
|
||||
* @param hReturn Handle to return structure
|
||||
*
|
||||
*
|
||||
* @error Invalid Handle, invalid type.
|
||||
* @return Returns default value if prehook returns actual value if post hook.
|
||||
*/
|
||||
native any DHookGetReturn(Handle hReturn);
|
||||
|
||||
/* Get return vector value
|
||||
*
|
||||
*
|
||||
* @param hReturn Handle to return structure
|
||||
* @param vec Vector buffer to store result in. (In pre hooks will be default value (0.0,0.0,0.0))
|
||||
*
|
||||
*
|
||||
* @error Invalid Handle, invalid type.
|
||||
* @noreturn
|
||||
*/
|
||||
native void DHookGetReturnVector(Handle hReturn, float vec[3]);
|
||||
|
||||
/* Get return string value
|
||||
*
|
||||
*
|
||||
* @param hReturn Handle to return structure
|
||||
* @param buffer String buffer to store result in. (In pre hooks will be default value "")
|
||||
* @param size String buffer size
|
||||
*
|
||||
*
|
||||
* @error Invalid Handle, invalid type.
|
||||
* @noreturn
|
||||
*/
|
||||
native void DHookGetReturnString(Handle hReturn, char[] buffer, int size);
|
||||
|
||||
/* Set return value (Only use for: int, entity, bool or float return types)
|
||||
*
|
||||
*
|
||||
* @param hReturn Handle to return structure
|
||||
* @param value Value to set return as
|
||||
*
|
||||
*
|
||||
* @error Invalid Handle, invalid type.
|
||||
* @noreturn
|
||||
*/
|
||||
native void DHookSetReturn(Handle hReturn, any value);
|
||||
|
||||
/* Set return vector value
|
||||
*
|
||||
*
|
||||
* @param hReturn Handle to return structure
|
||||
* @param vec Value to set return vector as
|
||||
*
|
||||
*
|
||||
* @error Invalid Handle, invalid type.
|
||||
* @noreturn
|
||||
*/
|
||||
native void DHookSetReturnVector(Handle hReturn, float vec[3]);
|
||||
|
||||
/* Set return string value
|
||||
*
|
||||
*
|
||||
* @param hReturn Handle to return structure
|
||||
* @param value Value to set return string as
|
||||
*
|
||||
*
|
||||
* @error Invalid Handle, invalid type.
|
||||
* @noreturn
|
||||
*/
|
||||
|
||||
+15
-15
@@ -91,14 +91,14 @@ stock void CPrintToChatObservers(int target, const char[] message, any ...)
|
||||
|
||||
if (!g_bCFixColors)
|
||||
CFixColors();
|
||||
|
||||
|
||||
for(int client = 1; client <= MaxClients; client++)
|
||||
{
|
||||
if(IsClientInGame(client) && !IsPlayerAlive(client) && !IsFakeClient(client))
|
||||
{
|
||||
int observee = GetEntPropEnt(client, Prop_Send, "m_hObserverTarget");
|
||||
int ObserverMode = GetEntProp(client, Prop_Send, "m_iObserverMode");
|
||||
|
||||
|
||||
if(observee == target && (ObserverMode == 4 || ObserverMode == 5))
|
||||
{
|
||||
CPrintToChat(client, buffer);
|
||||
@@ -125,7 +125,7 @@ stock void CPrintToChatEx(int client, int author, const char[] message, any ...)
|
||||
|
||||
if (!g_bCFixColors)
|
||||
CFixColors();
|
||||
|
||||
|
||||
if (!IsSource2009())
|
||||
C_PrintToChatEx(client, author, "%s", buffer);
|
||||
else
|
||||
@@ -170,14 +170,14 @@ stock void CPrintToChatObserversEx(int target, const char[] message, any ...)
|
||||
|
||||
if (!g_bCFixColors)
|
||||
CFixColors();
|
||||
|
||||
|
||||
for(int client = 1; client <= MaxClients; client++)
|
||||
{
|
||||
if(IsClientInGame(client) && !IsPlayerAlive(client) && !IsFakeClient(client))
|
||||
{
|
||||
int observee = GetEntPropEnt(client, Prop_Send, "m_hObserverTarget");
|
||||
int ObserverMode = GetEntProp(client, Prop_Send, "m_iObserverMode");
|
||||
|
||||
|
||||
if(observee == target && (ObserverMode == 4 || ObserverMode == 5))
|
||||
{
|
||||
CPrintToChatEx(client, target, buffer);
|
||||
@@ -189,7 +189,7 @@ stock void CPrintToChatObserversEx(int target, const char[] message, any ...)
|
||||
|
||||
/**
|
||||
* Replies to a command with colors
|
||||
*
|
||||
*
|
||||
* @param client Client to reply to
|
||||
* @param message Message (formatting rules)
|
||||
* @noreturn
|
||||
@@ -212,7 +212,7 @@ stock void CReplyToCommand(int author, const char[] message, any ...)
|
||||
|
||||
/**
|
||||
* Replies to a command with colors
|
||||
*
|
||||
*
|
||||
* @param client Client to reply to
|
||||
* @param author Client to use for {teamcolor}
|
||||
* @param message Message (formatting rules)
|
||||
@@ -236,12 +236,12 @@ stock void CReplyToCommand(int author, const char[] message, any ...)
|
||||
|
||||
|
||||
/**
|
||||
* Displays usage of an admin command to users depending on the
|
||||
* setting of the sm_show_activity cvar.
|
||||
* Displays usage of an admin command to users depending on the
|
||||
* setting of the sm_show_activity cvar.
|
||||
*
|
||||
* This version does not display a message to the originating client
|
||||
* if used from chat triggers or menus. If manual replies are used
|
||||
* for these cases, then this function will suffice. Otherwise,
|
||||
* This version does not display a message to the originating client
|
||||
* if used from chat triggers or menus. If manual replies are used
|
||||
* for these cases, then this function will suffice. Otherwise,
|
||||
* CShowActivity2() is slightly more useful.
|
||||
* Supports color tags.
|
||||
*
|
||||
@@ -295,7 +295,7 @@ stock void CShowActivityEx(int author, const char[] tag, const char[] message, a
|
||||
|
||||
/**
|
||||
* Displays usage of an admin command to users depending on the setting of the sm_show_activity cvar.
|
||||
* All users receive a message in their chat text, except for the originating client,
|
||||
* All users receive a message in their chat text, except for the originating client,
|
||||
* who receives the message based on the current ReplySource.
|
||||
* Supports color tags.
|
||||
*
|
||||
@@ -339,7 +339,7 @@ stock void CFormatColor(char[] message, int maxlength, int author = -1)
|
||||
{
|
||||
if (author == 0)
|
||||
author = -1;
|
||||
|
||||
|
||||
C_Format(message, maxlength, author);
|
||||
}
|
||||
else
|
||||
@@ -355,7 +355,7 @@ stock void CFormatColor(char[] message, int maxlength, int author = -1)
|
||||
|
||||
/**
|
||||
* Removes color tags from a message
|
||||
*
|
||||
*
|
||||
* @param message Message to remove tags from
|
||||
* @param maxlen Maximum buffer length
|
||||
* @noreturn
|
||||
|
||||
+104
-104
@@ -5,13 +5,13 @@
|
||||
* Version: 2.0.0-MC *
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
|
||||
#if defined _colors_included
|
||||
#endinput
|
||||
#endif
|
||||
#define _colors_included
|
||||
|
||||
|
||||
#define MAX_MESSAGE_LENGTH 250
|
||||
#define MAX_COLORS 18
|
||||
|
||||
@@ -62,27 +62,27 @@ static Handle sm_show_activity = null;
|
||||
* @param client Client index.
|
||||
* @param szMessage Message (formatting rules).
|
||||
* @return No return
|
||||
*
|
||||
*
|
||||
* On error/Errors: If the client is not connected an error will be thrown.
|
||||
*/
|
||||
stock void C_PrintToChat(int client, const char[] szMessage, any ...)
|
||||
{
|
||||
if (client <= 0 || client > MaxClients)
|
||||
ThrowError("Invalid client index %d", client);
|
||||
|
||||
|
||||
if (!IsClientInGame(client))
|
||||
ThrowError("Client %d is not in game", client);
|
||||
|
||||
|
||||
char szBuffer[MAX_MESSAGE_LENGTH];
|
||||
char szCMessage[MAX_MESSAGE_LENGTH];
|
||||
|
||||
SetGlobalTransTarget(client);
|
||||
|
||||
|
||||
Format(szBuffer, sizeof(szBuffer), "\x01%s", szMessage);
|
||||
VFormat(szCMessage, sizeof(szCMessage), szBuffer, 3);
|
||||
|
||||
|
||||
int index = C_Format(szCMessage, sizeof(szCMessage));
|
||||
|
||||
|
||||
if (index == NO_INDEX)
|
||||
PrintToChat(client, "%s", szCMessage);
|
||||
else
|
||||
@@ -98,7 +98,7 @@ stock void C_PrintToChat(int client, const char[] szMessage, any ...)
|
||||
* @param szMessage Formatting rules.
|
||||
* @param ... Variable number of format parameters.
|
||||
* @return No return
|
||||
*
|
||||
*
|
||||
* On error/Errors: If the client is not connected or invalid.
|
||||
*/
|
||||
stock void C_ReplyToCommand(int client, const char[] szMessage, any ...)
|
||||
@@ -106,7 +106,7 @@ stock void C_ReplyToCommand(int client, const char[] szMessage, any ...)
|
||||
char szCMessage[MAX_MESSAGE_LENGTH];
|
||||
SetGlobalTransTarget(client);
|
||||
VFormat(szCMessage, sizeof(szCMessage), szMessage, 3);
|
||||
|
||||
|
||||
if (client == 0)
|
||||
{
|
||||
C_RemoveTags(szCMessage, sizeof(szCMessage));
|
||||
@@ -133,7 +133,7 @@ stock void C_ReplyToCommand(int client, const char[] szMessage, any ...)
|
||||
* @param szMessage Formatting rules.
|
||||
* @param ... Variable number of format parameters.
|
||||
* @return No return
|
||||
*
|
||||
*
|
||||
* On error/Errors: If the client is not connected or invalid.
|
||||
*/
|
||||
stock void C_ReplyToCommandEx(int client, int author, const char[] szMessage, any ...)
|
||||
@@ -141,7 +141,7 @@ stock void C_ReplyToCommandEx(int client, int author, const char[] szMessage, an
|
||||
char szCMessage[MAX_MESSAGE_LENGTH];
|
||||
SetGlobalTransTarget(client);
|
||||
VFormat(szCMessage, sizeof(szCMessage), szMessage, 4);
|
||||
|
||||
|
||||
if (client == 0)
|
||||
{
|
||||
C_RemoveTags(szCMessage, sizeof(szCMessage));
|
||||
@@ -169,17 +169,17 @@ stock void C_ReplyToCommandEx(int client, int author, const char[] szMessage, an
|
||||
stock void C_PrintToChatAll(const char[] szMessage, any ...)
|
||||
{
|
||||
char szBuffer[MAX_MESSAGE_LENGTH];
|
||||
|
||||
|
||||
MuCo_LoopClients(i)
|
||||
{
|
||||
if (i > 0 && IsClientInGame(i) && !IsFakeClient(i) && !C_SkipList[i])
|
||||
{
|
||||
SetGlobalTransTarget(i);
|
||||
VFormat(szBuffer, sizeof(szBuffer), szMessage, 2);
|
||||
|
||||
|
||||
C_PrintToChat(i, "%s", szBuffer);
|
||||
}
|
||||
|
||||
|
||||
C_SkipList[i] = false;
|
||||
}
|
||||
}
|
||||
@@ -192,30 +192,30 @@ stock void C_PrintToChatAll(const char[] szMessage, any ...)
|
||||
* @param author Author index whose color will be used for teamcolor tag.
|
||||
* @param szMessage Message (formatting rules).
|
||||
* @return No return
|
||||
*
|
||||
*
|
||||
* On error/Errors: If the client or author are not connected an error will be thrown.
|
||||
*/
|
||||
stock void C_PrintToChatEx(int client, int author, const char[] szMessage, any ...)
|
||||
{
|
||||
if (client <= 0 || client > MaxClients)
|
||||
ThrowError("Invalid client index %d", client);
|
||||
|
||||
|
||||
if (!IsClientInGame(client))
|
||||
ThrowError("Client %d is not in game", client);
|
||||
|
||||
|
||||
if (author < 0 || author > MaxClients)
|
||||
ThrowError("Invalid client index %d", author);
|
||||
|
||||
|
||||
char szBuffer[MAX_MESSAGE_LENGTH];
|
||||
char szCMessage[MAX_MESSAGE_LENGTH];
|
||||
|
||||
SetGlobalTransTarget(client);
|
||||
|
||||
|
||||
Format(szBuffer, sizeof(szBuffer), "\x01%s", szMessage);
|
||||
VFormat(szCMessage, sizeof(szCMessage), szBuffer, 4);
|
||||
|
||||
|
||||
int index = C_Format(szCMessage, sizeof(szCMessage), author);
|
||||
|
||||
|
||||
if (index == NO_INDEX)
|
||||
PrintToChat(client, "%s", szCMessage);
|
||||
else
|
||||
@@ -229,29 +229,29 @@ stock void C_PrintToChatEx(int client, int author, const char[] szMessage, any .
|
||||
* @param author Author index whos color will be used for teamcolor tag.
|
||||
* @param szMessage Message (formatting rules).
|
||||
* @return No return
|
||||
*
|
||||
*
|
||||
* On error/Errors: If the author is not connected an error will be thrown.
|
||||
*/
|
||||
stock void C_PrintToChatAllEx(int author, const char[] szMessage, any ...)
|
||||
{
|
||||
if (author < 0 || author > MaxClients)
|
||||
ThrowError("Invalid client index %d", author);
|
||||
|
||||
|
||||
if (!IsClientInGame(author))
|
||||
ThrowError("Client %d is not in game", author);
|
||||
|
||||
|
||||
char szBuffer[MAX_MESSAGE_LENGTH];
|
||||
|
||||
|
||||
MuCo_LoopClients(i)
|
||||
{
|
||||
if (i > 0 && IsClientInGame(i) && !IsFakeClient(i) && !C_SkipList[i])
|
||||
{
|
||||
SetGlobalTransTarget(i);
|
||||
VFormat(szBuffer, sizeof(szBuffer), szMessage, 3);
|
||||
|
||||
|
||||
C_PrintToChatEx(i, author, "%s", szBuffer);
|
||||
}
|
||||
|
||||
|
||||
C_SkipList[i] = false;
|
||||
}
|
||||
}
|
||||
@@ -266,7 +266,7 @@ stock void C_RemoveTags(char[] szMessage, int maxlength)
|
||||
{
|
||||
for (int i = 0; i < MAX_COLORS; i++)
|
||||
ReplaceString(szMessage, maxlength, C_Tag[i], "", false);
|
||||
|
||||
|
||||
ReplaceString(szMessage, maxlength, "{teamcolor}", "", false);
|
||||
}
|
||||
|
||||
@@ -281,10 +281,10 @@ stock bool C_ColorAllowed(C_Colors color)
|
||||
if (!C_EventIsHooked)
|
||||
{
|
||||
C_SetupProfile();
|
||||
|
||||
|
||||
C_EventIsHooked = true;
|
||||
}
|
||||
|
||||
|
||||
return C_Profile_Colors[color];
|
||||
}
|
||||
|
||||
@@ -301,13 +301,13 @@ stock void C_ReplaceColor(C_Colors color, C_Colors newColor)
|
||||
if (!C_EventIsHooked)
|
||||
{
|
||||
C_SetupProfile();
|
||||
|
||||
|
||||
C_EventIsHooked = true;
|
||||
}
|
||||
|
||||
|
||||
C_Profile_Colors[color] = C_Profile_Colors[newColor];
|
||||
C_Profile_TeamIndex[color] = C_Profile_TeamIndex[newColor];
|
||||
|
||||
|
||||
C_TagReqSayText2[color] = C_TagReqSayText2[newColor];
|
||||
Format(C_TagCode[color], sizeof(C_TagCode[]), C_TagCode[newColor]);
|
||||
}
|
||||
@@ -318,7 +318,7 @@ stock void C_ReplaceColor(C_Colors color, C_Colors newColor)
|
||||
* to those funcions to skip specified client when printing
|
||||
* message to all clients. After message is printed client will
|
||||
* no more be skipped.
|
||||
*
|
||||
*
|
||||
* @param client Client index
|
||||
* @return No return
|
||||
*/
|
||||
@@ -326,7 +326,7 @@ stock void C_SkipNextClient(int client)
|
||||
{
|
||||
if (client <= 0 || client > MaxClients)
|
||||
ThrowError("Invalid client index %d", client);
|
||||
|
||||
|
||||
C_SkipList[client] = true;
|
||||
}
|
||||
|
||||
@@ -336,7 +336,7 @@ stock void C_SkipNextClient(int client)
|
||||
* @param szMessage String.
|
||||
* @param maxlength Maximum length of the string buffer.
|
||||
* @return Client index that can be used for SayText2 author index
|
||||
*
|
||||
*
|
||||
* On error/Errors: If there is more then one team color is used an error will be thrown.
|
||||
*/
|
||||
stock int C_Format(char[] szMessage, int maxlength, int author = NO_INDEX)
|
||||
@@ -346,25 +346,25 @@ stock int C_Format(char[] szMessage, int maxlength, int author = NO_INDEX)
|
||||
{
|
||||
C_SetupProfile();
|
||||
HookEvent("server_spawn", C_Event_MapStart, EventHookMode_PostNoCopy);
|
||||
|
||||
|
||||
C_EventIsHooked = true;
|
||||
}
|
||||
|
||||
|
||||
int iRandomPlayer = NO_INDEX;
|
||||
|
||||
|
||||
// On CS:GO set invisible precolor
|
||||
if (GetEngineVersion() == Engine_CSGO)
|
||||
if (GetEngineVersion() == Engine_CSGO)
|
||||
{
|
||||
Format(szMessage, maxlength, " %s", szMessage);
|
||||
}
|
||||
|
||||
|
||||
/* If author was specified replace {teamcolor} tag */
|
||||
if (author != NO_INDEX)
|
||||
{
|
||||
if (C_Profile_SayText2)
|
||||
{
|
||||
ReplaceString(szMessage, maxlength, "{teamcolor}", "\x03", false);
|
||||
|
||||
|
||||
iRandomPlayer = author;
|
||||
}
|
||||
/* If saytext2 is not supported by game replace {teamcolor} with green tag */
|
||||
@@ -373,18 +373,18 @@ stock int C_Format(char[] szMessage, int maxlength, int author = NO_INDEX)
|
||||
}
|
||||
else
|
||||
ReplaceString(szMessage, maxlength, "{teamcolor}", "", false);
|
||||
|
||||
|
||||
/* For other color tags we need a loop */
|
||||
for (int i = 0; i < MAX_COLORS; i++)
|
||||
{
|
||||
/* If tag not found - skip */
|
||||
if (StrContains(szMessage, C_Tag[i], false) == -1)
|
||||
continue;
|
||||
|
||||
|
||||
/* If tag is not supported by game replace it with green tag */
|
||||
else if (!C_Profile_Colors[i])
|
||||
ReplaceString(szMessage, maxlength, C_Tag[i], C_TagCode[Color_Green], false);
|
||||
|
||||
|
||||
/* If tag doesn't need saytext2 simply replace */
|
||||
else if (!C_TagReqSayText2[i])
|
||||
ReplaceString(szMessage, maxlength, C_Tag[i], C_TagCode[i], false);
|
||||
@@ -395,16 +395,16 @@ stock int C_Format(char[] szMessage, int maxlength, int author = NO_INDEX)
|
||||
/* If saytext2 is not supported by game replace tag with green tag */
|
||||
if (!C_Profile_SayText2)
|
||||
ReplaceString(szMessage, maxlength, C_Tag[i], C_TagCode[Color_Green], false);
|
||||
|
||||
|
||||
/* Game supports saytext2 */
|
||||
else
|
||||
else
|
||||
{
|
||||
/* If random player for tag wasn't specified replace tag and find player */
|
||||
if (iRandomPlayer == NO_INDEX)
|
||||
{
|
||||
/* Searching for valid client for tag */
|
||||
iRandomPlayer = C_FindRandomPlayerByTeam(C_Profile_TeamIndex[i]);
|
||||
|
||||
|
||||
/* If player not found replace tag with green color tag */
|
||||
if (iRandomPlayer == NO_PLAYER)
|
||||
ReplaceString(szMessage, maxlength, C_Tag[i], C_TagCode[Color_Green], false);
|
||||
@@ -412,7 +412,7 @@ stock int C_Format(char[] szMessage, int maxlength, int author = NO_INDEX)
|
||||
/* If player was found simply replace */
|
||||
else
|
||||
ReplaceString(szMessage, maxlength, C_Tag[i], C_TagCode[i], false);
|
||||
|
||||
|
||||
}
|
||||
/* If found another team color tag throw error */
|
||||
else
|
||||
@@ -421,10 +421,10 @@ stock int C_Format(char[] szMessage, int maxlength, int author = NO_INDEX)
|
||||
ThrowError("Using two team colors in one message is not allowed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return iRandomPlayer;
|
||||
}
|
||||
|
||||
@@ -444,7 +444,7 @@ stock int C_FindRandomPlayerByTeam(int color_team)
|
||||
{
|
||||
if (i > 0 && IsClientInGame(i) && GetClientTeam(i) == color_team)
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NO_PLAYER;
|
||||
@@ -461,8 +461,8 @@ stock int C_FindRandomPlayerByTeam(int color_team)
|
||||
stock void C_SayText2(int client, int author, const char[] szMessage)
|
||||
{
|
||||
Handle hBuffer = StartMessageOne("SayText2", client, USERMSG_RELIABLE|USERMSG_BLOCKHOOKS);
|
||||
|
||||
if(GetFeatureStatus(FeatureType_Native, "GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf)
|
||||
|
||||
if(GetFeatureStatus(FeatureType_Native, "GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf)
|
||||
{
|
||||
PbSetInt(hBuffer, "ent_idx", author);
|
||||
PbSetBool(hBuffer, "chat", true);
|
||||
@@ -478,12 +478,12 @@ stock void C_SayText2(int client, int author, const char[] szMessage)
|
||||
BfWriteByte(hBuffer, true);
|
||||
BfWriteString(hBuffer, szMessage);
|
||||
}
|
||||
|
||||
|
||||
EndMessage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates game color profile
|
||||
* Creates game color profile
|
||||
* This function must be edited if you want to add more games support
|
||||
*
|
||||
* @return No return.
|
||||
@@ -491,7 +491,7 @@ stock void C_SayText2(int client, int author, const char[] szMessage)
|
||||
stock void C_SetupProfile()
|
||||
{
|
||||
EngineVersion engine = GetEngineVersion();
|
||||
|
||||
|
||||
if (engine == Engine_CSS)
|
||||
{
|
||||
C_Profile_Colors[Color_Lightgreen] = true;
|
||||
@@ -540,7 +540,7 @@ stock void C_SetupProfile()
|
||||
C_Profile_Colors[Color_Lightgreen] = true;
|
||||
C_Profile_Colors[Color_Red] = true;
|
||||
C_Profile_Colors[Color_Blue] = true;
|
||||
C_Profile_Colors[Color_Olive] = true;
|
||||
C_Profile_Colors[Color_Olive] = true;
|
||||
C_Profile_TeamIndex[Color_Lightgreen] = SERVER_INDEX;
|
||||
C_Profile_TeamIndex[Color_Red] = 3;
|
||||
C_Profile_TeamIndex[Color_Blue] = 2;
|
||||
@@ -590,18 +590,18 @@ stock void C_SetupProfile()
|
||||
public Action C_Event_MapStart(Event event, const char[] name, bool dontBroadcast)
|
||||
{
|
||||
C_SetupProfile();
|
||||
|
||||
|
||||
MuCo_LoopClients(i)
|
||||
C_SkipList[i] = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays usage of an admin command to users depending on the
|
||||
* setting of the sm_show_activity cvar.
|
||||
* Displays usage of an admin command to users depending on the
|
||||
* setting of the sm_show_activity cvar.
|
||||
*
|
||||
* This version does not display a message to the originating client
|
||||
* if used from chat triggers or menus. If manual replies are used
|
||||
* for these cases, then this function will suffice. Otherwise,
|
||||
* This version does not display a message to the originating client
|
||||
* if used from chat triggers or menus. If manual replies are used
|
||||
* for these cases, then this function will suffice. Otherwise,
|
||||
* C_ShowActivity2() is slightly more useful.
|
||||
* Supports color tags.
|
||||
*
|
||||
@@ -615,14 +615,14 @@ stock int C_ShowActivity(int client, const char[] format, any ...)
|
||||
{
|
||||
if (sm_show_activity == null)
|
||||
sm_show_activity = FindConVar("sm_show_activity");
|
||||
|
||||
|
||||
char tag[] = "[SM] ";
|
||||
|
||||
|
||||
char szBuffer[MAX_MESSAGE_LENGTH];
|
||||
//char szCMessage[MAX_MESSAGE_LENGTH];
|
||||
int value = GetConVarInt(sm_show_activity);
|
||||
ReplySource replyto = GetCmdReplySource();
|
||||
|
||||
|
||||
char name[MAX_NAME_LENGTH] = "Console";
|
||||
char sign[MAX_NAME_LENGTH] = "ADMIN";
|
||||
bool display_in_chat = false;
|
||||
@@ -630,7 +630,7 @@ stock int C_ShowActivity(int client, const char[] format, any ...)
|
||||
{
|
||||
if (client < 0 || client > MaxClients || !IsClientConnected(client))
|
||||
ThrowError("Client index %d is invalid", client);
|
||||
|
||||
|
||||
GetClientName(client, name, sizeof(name));
|
||||
AdminId id = GetUserAdmin(client);
|
||||
if (id == INVALID_ADMIN_ID
|
||||
@@ -638,13 +638,13 @@ stock int C_ShowActivity(int client, const char[] format, any ...)
|
||||
{
|
||||
sign = "PLAYER";
|
||||
}
|
||||
|
||||
|
||||
/* Display the message to the client? */
|
||||
if (replyto == SM_REPLY_TO_CONSOLE)
|
||||
{
|
||||
SetGlobalTransTarget(client);
|
||||
VFormat(szBuffer, sizeof(szBuffer), format, 3);
|
||||
|
||||
|
||||
C_RemoveTags(szBuffer, sizeof(szBuffer));
|
||||
PrintToConsole(client, "%s%s\n", tag, szBuffer);
|
||||
display_in_chat = true;
|
||||
@@ -654,16 +654,16 @@ stock int C_ShowActivity(int client, const char[] format, any ...)
|
||||
{
|
||||
SetGlobalTransTarget(LANG_SERVER);
|
||||
VFormat(szBuffer, sizeof(szBuffer), format, 3);
|
||||
|
||||
|
||||
C_RemoveTags(szBuffer, sizeof(szBuffer));
|
||||
PrintToServer("%s%s\n", tag, szBuffer);
|
||||
}
|
||||
|
||||
|
||||
if (!value)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
MuCo_LoopClients(i)
|
||||
{
|
||||
if (i == 0
|
||||
@@ -688,7 +688,7 @@ stock int C_ShowActivity(int client, const char[] format, any ...)
|
||||
newsign = name;
|
||||
}
|
||||
VFormat(szBuffer, sizeof(szBuffer), format, 3);
|
||||
|
||||
|
||||
C_PrintToChatEx(i, client, "%s%s: %s", tag, newsign, szBuffer);
|
||||
}
|
||||
}
|
||||
@@ -707,12 +707,12 @@ stock int C_ShowActivity(int client, const char[] format, any ...)
|
||||
newsign = name;
|
||||
}
|
||||
VFormat(szBuffer, sizeof(szBuffer), format, 3);
|
||||
|
||||
|
||||
C_PrintToChatEx(i, client, "%s%s: %s", tag, newsign, szBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -731,12 +731,12 @@ stock int C_ShowActivityEx(int client, const char[] tag, const char[] format, an
|
||||
{
|
||||
if (sm_show_activity == null)
|
||||
sm_show_activity = FindConVar("sm_show_activity");
|
||||
|
||||
|
||||
char szBuffer[MAX_MESSAGE_LENGTH];
|
||||
//char szCMessage[MAX_MESSAGE_LENGTH];
|
||||
int value = GetConVarInt(sm_show_activity);
|
||||
ReplySource replyto = GetCmdReplySource();
|
||||
|
||||
|
||||
char name[MAX_NAME_LENGTH] = "Console";
|
||||
char sign[MAX_NAME_LENGTH] = "ADMIN";
|
||||
bool display_in_chat = false;
|
||||
@@ -744,7 +744,7 @@ stock int C_ShowActivityEx(int client, const char[] tag, const char[] format, an
|
||||
{
|
||||
if (client < 0 || client > MaxClients || !IsClientConnected(client))
|
||||
ThrowError("Client index %d is invalid", client);
|
||||
|
||||
|
||||
GetClientName(client, name, sizeof(name));
|
||||
AdminId id = GetUserAdmin(client);
|
||||
if (id == INVALID_ADMIN_ID
|
||||
@@ -752,13 +752,13 @@ stock int C_ShowActivityEx(int client, const char[] tag, const char[] format, an
|
||||
{
|
||||
sign = "PLAYER";
|
||||
}
|
||||
|
||||
|
||||
/* Display the message to the client? */
|
||||
if (replyto == SM_REPLY_TO_CONSOLE)
|
||||
{
|
||||
SetGlobalTransTarget(client);
|
||||
VFormat(szBuffer, sizeof(szBuffer), format, 4);
|
||||
|
||||
|
||||
C_RemoveTags(szBuffer, sizeof(szBuffer));
|
||||
PrintToConsole(client, "%s%s\n", tag, szBuffer);
|
||||
display_in_chat = true;
|
||||
@@ -768,16 +768,16 @@ stock int C_ShowActivityEx(int client, const char[] tag, const char[] format, an
|
||||
{
|
||||
SetGlobalTransTarget(LANG_SERVER);
|
||||
VFormat(szBuffer, sizeof(szBuffer), format, 4);
|
||||
|
||||
|
||||
C_RemoveTags(szBuffer, sizeof(szBuffer));
|
||||
PrintToServer("%s%s\n", tag, szBuffer);
|
||||
}
|
||||
|
||||
|
||||
if (!value)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
MuCo_LoopClients(i)
|
||||
{
|
||||
if (i == 0
|
||||
@@ -802,7 +802,7 @@ stock int C_ShowActivityEx(int client, const char[] tag, const char[] format, an
|
||||
newsign = name;
|
||||
}
|
||||
VFormat(szBuffer, sizeof(szBuffer), format, 4);
|
||||
|
||||
|
||||
C_PrintToChatEx(i, client, "%s%s: %s", tag, newsign, szBuffer);
|
||||
}
|
||||
}
|
||||
@@ -821,18 +821,18 @@ stock int C_ShowActivityEx(int client, const char[] tag, const char[] format, an
|
||||
newsign = name;
|
||||
}
|
||||
VFormat(szBuffer, sizeof(szBuffer), format, 4);
|
||||
|
||||
|
||||
C_PrintToChatEx(i, client, "%s%s: %s", tag, newsign, szBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays usage of an admin command to users depending on the setting of the sm_show_activity cvar.
|
||||
* All users receive a message in their chat text, except for the originating client,
|
||||
* All users receive a message in their chat text, except for the originating client,
|
||||
* who receives the message based on the current ReplySource.
|
||||
* Supports color tags.
|
||||
*
|
||||
@@ -847,19 +847,19 @@ stock int C_ShowActivity2(int client, const char[] tag, const char[] format, any
|
||||
{
|
||||
if (sm_show_activity == null)
|
||||
sm_show_activity = FindConVar("sm_show_activity");
|
||||
|
||||
|
||||
char szBuffer[MAX_MESSAGE_LENGTH];
|
||||
//char szCMessage[MAX_MESSAGE_LENGTH];
|
||||
int value = GetConVarInt(sm_show_activity);
|
||||
// ReplySource replyto = GetCmdReplySource();
|
||||
|
||||
|
||||
char name[MAX_NAME_LENGTH] = "Console";
|
||||
char sign[MAX_NAME_LENGTH] = "ADMIN";
|
||||
if (client != 0)
|
||||
{
|
||||
if (client < 0 || client > MaxClients || !IsClientConnected(client))
|
||||
ThrowError("Client index %d is invalid", client);
|
||||
|
||||
|
||||
GetClientName(client, name, sizeof(name));
|
||||
AdminId id = GetUserAdmin(client);
|
||||
if (id == INVALID_ADMIN_ID
|
||||
@@ -867,30 +867,30 @@ stock int C_ShowActivity2(int client, const char[] tag, const char[] format, any
|
||||
{
|
||||
sign = "PLAYER";
|
||||
}
|
||||
|
||||
|
||||
SetGlobalTransTarget(client);
|
||||
VFormat(szBuffer, sizeof(szBuffer), format, 4);
|
||||
|
||||
/* We don't display directly to the console because the chat text
|
||||
* simply gets added to the console, so we don't want it to print
|
||||
|
||||
/* We don't display directly to the console because the chat text
|
||||
* simply gets added to the console, so we don't want it to print
|
||||
* twice.
|
||||
*/
|
||||
*/
|
||||
C_PrintToChatEx(client, client, "%s%s", tag, szBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetGlobalTransTarget(LANG_SERVER);
|
||||
VFormat(szBuffer, sizeof(szBuffer), format, 4);
|
||||
|
||||
|
||||
C_RemoveTags(szBuffer, sizeof(szBuffer));
|
||||
PrintToServer("%s%s\n", tag, szBuffer);
|
||||
}
|
||||
|
||||
|
||||
if (!value)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
MuCo_LoopClients(i)
|
||||
{
|
||||
if (i == 0
|
||||
@@ -915,7 +915,7 @@ stock int C_ShowActivity2(int client, const char[] tag, const char[] format, any
|
||||
newsign = name;
|
||||
}
|
||||
VFormat(szBuffer, sizeof(szBuffer), format, 4);
|
||||
|
||||
|
||||
C_PrintToChatEx(i, client, "%s%s: %s", tag, newsign, szBuffer);
|
||||
}
|
||||
}
|
||||
@@ -934,11 +934,11 @@ stock int C_ShowActivity2(int client, const char[] tag, const char[] format, any
|
||||
newsign = name;
|
||||
}
|
||||
VFormat(szBuffer, sizeof(szBuffer), format, 4);
|
||||
|
||||
|
||||
C_PrintToChatEx(i, client, "%s%s: %s", tag, newsign, szBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -29,11 +29,11 @@ static Handle sm_show_activity = INVALID_HANDLE;
|
||||
/**
|
||||
* Prints a message to a specific client in the chat area.
|
||||
* Supports color tags.
|
||||
*
|
||||
*
|
||||
* @param client Client index.
|
||||
* @param message Message (formatting rules).
|
||||
* @noreturn
|
||||
*
|
||||
*
|
||||
* On error/Errors: If the client is not connected an error will be thrown.
|
||||
*/
|
||||
stock void MC_PrintToChat(int client, const char[] message, any ...) {
|
||||
@@ -55,7 +55,7 @@ stock void MC_PrintToChat(int client, const char[] message, any ...) {
|
||||
/**
|
||||
* Prints a message to all clients in the chat area.
|
||||
* Supports color tags.
|
||||
*
|
||||
*
|
||||
* @param client Client index.
|
||||
* @param message Message (formatting rules).
|
||||
* @noreturn
|
||||
@@ -79,12 +79,12 @@ stock void MC_PrintToChatAll(const char[] message, any ...) {
|
||||
/**
|
||||
* Prints a message to a specific client in the chat area.
|
||||
* Supports color tags and teamcolor tag.
|
||||
*
|
||||
*
|
||||
* @param client Client index.
|
||||
* @param author Author index whose color will be used for teamcolor tag.
|
||||
* @param message Message (formatting rules).
|
||||
* @noreturn
|
||||
*
|
||||
*
|
||||
* On error/Errors: If the client or author are not connected an error will be thrown
|
||||
*/
|
||||
stock void MC_PrintToChatEx(int client, int author, const char[] message, any ...) {
|
||||
@@ -116,7 +116,7 @@ stock void MC_PrintToChatEx(int client, int author, const char[] message, any ..
|
||||
* @param author Author index whose color will be used for teamcolor tag.
|
||||
* @param message Message (formatting rules).
|
||||
* @noreturn
|
||||
*
|
||||
*
|
||||
* On error/Errors: If the author is not connected an error will be thrown.
|
||||
*/
|
||||
stock void MC_PrintToChatAllEx(int author, const char[] message, any ...) {
|
||||
@@ -143,7 +143,7 @@ stock void MC_PrintToChatAllEx(int author, const char[] message, any ...) {
|
||||
|
||||
/**
|
||||
* Sends a SayText2 usermessage
|
||||
*
|
||||
*
|
||||
* @param client Client to send usermessage to
|
||||
* @param message Message to send
|
||||
* @noreturn
|
||||
@@ -191,7 +191,7 @@ stock void MC_SendMessage(int client, const char[] message, int author = 0) {
|
||||
* MC_PrintToChatAll or MC_PrintToChatAllEx. It causes those functions
|
||||
* to skip the specified client when printing the message.
|
||||
* After printing the message, the client will no longer be skipped.
|
||||
*
|
||||
*
|
||||
* @param client Client index
|
||||
* @noreturn
|
||||
*/
|
||||
@@ -204,7 +204,7 @@ stock void MC_SkipNextClient(int client) {
|
||||
|
||||
/**
|
||||
* Checks if the colors trie is initialized and initializes it if it's not (used internally)
|
||||
*
|
||||
*
|
||||
* @return No return
|
||||
*/
|
||||
stock void MC_CheckTrie() {
|
||||
@@ -221,7 +221,7 @@ stock void MC_CheckTrie() {
|
||||
* @param removeTags Optional boolean value to determine whether we're replacing tags with colors, or just removing tags, used by MC_RemoveTags
|
||||
* @param maxlen Optional value for max buffer length, used by MC_RemoveTags
|
||||
* @noreturn
|
||||
*
|
||||
*
|
||||
* On error/Errors: If the client index passed for author is invalid or not in game.
|
||||
*/
|
||||
stock void MC_ReplaceColorCodes(char[] buffer, int author = 0, bool removeTags = false, int maxlen = MAX_BUFFER_LENGTH) {
|
||||
@@ -243,12 +243,12 @@ stock void MC_ReplaceColorCodes(char[] buffer, int author = 0, bool removeTags =
|
||||
}
|
||||
int cursor = 0;
|
||||
int value;
|
||||
char tag[32], buff[32];
|
||||
char tag[32], buff[32];
|
||||
char[] output = new char[maxlen];
|
||||
|
||||
|
||||
strcopy(output, maxlen, buffer);
|
||||
// Since the string's size is going to be changing, output will hold the replaced string and we'll search buffer
|
||||
|
||||
|
||||
Handle regex = CompileRegex("{[a-zA-Z0-9]+}");
|
||||
for(int i = 0; i < 1000; i++) { // The RegEx extension is quite flaky, so we have to loop here :/. This loop is supposed to be infinite and broken by return, but conditions have been added to be safe.
|
||||
if(MatchRegex(regex, buffer[cursor]) < 1) {
|
||||
@@ -262,11 +262,11 @@ stock void MC_ReplaceColorCodes(char[] buffer, int author = 0, bool removeTags =
|
||||
strcopy(buff, sizeof(buff), tag);
|
||||
ReplaceString(buff, sizeof(buff), "{", "");
|
||||
ReplaceString(buff, sizeof(buff), "}", "");
|
||||
|
||||
|
||||
if(!GetTrieValue(MC_Trie, buff, value)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if(removeTags) {
|
||||
ReplaceString(output, maxlen, tag, "", false);
|
||||
} else {
|
||||
@@ -279,7 +279,7 @@ stock void MC_ReplaceColorCodes(char[] buffer, int author = 0, bool removeTags =
|
||||
|
||||
/**
|
||||
* Gets a part of a string
|
||||
*
|
||||
*
|
||||
* @param input String to get the part from
|
||||
* @param output Buffer to write to
|
||||
* @param maxlen Max length of output buffer
|
||||
@@ -301,7 +301,7 @@ stock void CSubString(const char[] input, char[] output, int maxlen, int start,
|
||||
|
||||
/**
|
||||
* Converts a string to lowercase
|
||||
*
|
||||
*
|
||||
* @param buffer String to convert
|
||||
* @noreturn
|
||||
*/
|
||||
@@ -334,7 +334,7 @@ stock bool MC_AddColor(const char[] name, int color) {
|
||||
|
||||
/**
|
||||
* Removes color tags from a message
|
||||
*
|
||||
*
|
||||
* @param message Message to remove tags from
|
||||
* @param maxlen Maximum buffer length
|
||||
* @noreturn
|
||||
@@ -345,7 +345,7 @@ stock void MC_RemoveTags(char[] message, int maxlen) {
|
||||
|
||||
/**
|
||||
* Replies to a command with colors
|
||||
*
|
||||
*
|
||||
* @param client Client to reply to
|
||||
* @param message Message (formatting rules)
|
||||
* @noreturn
|
||||
@@ -364,7 +364,7 @@ stock void MC_ReplyToCommand(int client, const char[] message, any ...) {
|
||||
|
||||
/**
|
||||
* Replies to a command with colors
|
||||
*
|
||||
*
|
||||
* @param client Client to reply to
|
||||
* @param author Client to use for {teamcolor}
|
||||
* @param message Message (formatting rules)
|
||||
@@ -383,12 +383,12 @@ stock void MC_ReplyToCommandEx(int client, int author, const char[] message, any
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays usage of an admin command to users depending on the
|
||||
* setting of the sm_show_activity cvar.
|
||||
* Displays usage of an admin command to users depending on the
|
||||
* setting of the sm_show_activity cvar.
|
||||
*
|
||||
* This version does not display a message to the originating client
|
||||
* if used from chat triggers or menus. If manual replies are used
|
||||
* for these cases, then this function will suffice. Otherwise,
|
||||
* This version does not display a message to the originating client
|
||||
* if used from chat triggers or menus. If manual replies are used
|
||||
* for these cases, then this function will suffice. Otherwise,
|
||||
* MC_ShowActivity2() is slightly more useful.
|
||||
* Supports color tags.
|
||||
*
|
||||
@@ -402,14 +402,14 @@ stock int MC_ShowActivity(int client, const char[] format, any ...)
|
||||
{
|
||||
if (sm_show_activity == INVALID_HANDLE)
|
||||
sm_show_activity = FindConVar("sm_show_activity");
|
||||
|
||||
|
||||
char tag[] = "[SM] ";
|
||||
|
||||
|
||||
char szBuffer[MC_MAX_MESSAGE_LENGTH];
|
||||
//char szCMessage[MC_MAX_MESSAGE_LENGTH];
|
||||
int value = GetConVarInt(sm_show_activity);
|
||||
ReplySource replyto = GetCmdReplySource();
|
||||
|
||||
|
||||
char name[MAX_NAME_LENGTH] = "Console";
|
||||
char sign[MAX_NAME_LENGTH] = "ADMIN";
|
||||
bool display_in_chat = false;
|
||||
@@ -417,7 +417,7 @@ stock int MC_ShowActivity(int client, const char[] format, any ...)
|
||||
{
|
||||
if (client < 0 || client > MaxClients || !IsClientConnected(client))
|
||||
ThrowError("Client index %d is invalid", client);
|
||||
|
||||
|
||||
GetClientName(client, name, sizeof(name));
|
||||
AdminId id = GetUserAdmin(client);
|
||||
if (id == INVALID_ADMIN_ID
|
||||
@@ -425,13 +425,13 @@ stock int MC_ShowActivity(int client, const char[] format, any ...)
|
||||
{
|
||||
sign = "PLAYER";
|
||||
}
|
||||
|
||||
|
||||
/* Display the message to the client? */
|
||||
if (replyto == SM_REPLY_TO_CONSOLE)
|
||||
{
|
||||
SetGlobalTransTarget(client);
|
||||
VFormat(szBuffer, sizeof(szBuffer), format, 3);
|
||||
|
||||
|
||||
MC_RemoveTags(szBuffer, sizeof(szBuffer));
|
||||
PrintToConsole(client, "%s%s\n", tag, szBuffer);
|
||||
display_in_chat = true;
|
||||
@@ -441,16 +441,16 @@ stock int MC_ShowActivity(int client, const char[] format, any ...)
|
||||
{
|
||||
SetGlobalTransTarget(LANG_SERVER);
|
||||
VFormat(szBuffer, sizeof(szBuffer), format, 3);
|
||||
|
||||
|
||||
MC_RemoveTags(szBuffer, sizeof(szBuffer));
|
||||
PrintToServer("%s%s\n", tag, szBuffer);
|
||||
}
|
||||
|
||||
|
||||
if (!value)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
MuCo_LoopClients(i)
|
||||
{
|
||||
if (i == 0
|
||||
@@ -475,7 +475,7 @@ stock int MC_ShowActivity(int client, const char[] format, any ...)
|
||||
newsign = name;
|
||||
}
|
||||
VFormat(szBuffer, sizeof(szBuffer), format, 3);
|
||||
|
||||
|
||||
MC_PrintToChatEx(i, client, "%s%s: %s", tag, newsign, szBuffer);
|
||||
}
|
||||
}
|
||||
@@ -494,12 +494,12 @@ stock int MC_ShowActivity(int client, const char[] format, any ...)
|
||||
newsign = name;
|
||||
}
|
||||
VFormat(szBuffer, sizeof(szBuffer), format, 3);
|
||||
|
||||
|
||||
MC_PrintToChatEx(i, client, "%s%s: %s", tag, newsign, szBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -518,12 +518,12 @@ stock int MC_ShowActivityEx(int client, const char[] tag, const char[] format, a
|
||||
{
|
||||
if (sm_show_activity == INVALID_HANDLE)
|
||||
sm_show_activity = FindConVar("sm_show_activity");
|
||||
|
||||
|
||||
char szBuffer[MC_MAX_MESSAGE_LENGTH];
|
||||
//char szCMessage[MC_MAX_MESSAGE_LENGTH];
|
||||
int value = GetConVarInt(sm_show_activity);
|
||||
ReplySource replyto = GetCmdReplySource();
|
||||
|
||||
|
||||
char name[MAX_NAME_LENGTH] = "Console";
|
||||
char sign[MAX_NAME_LENGTH] = "ADMIN";
|
||||
bool display_in_chat = false;
|
||||
@@ -531,7 +531,7 @@ stock int MC_ShowActivityEx(int client, const char[] tag, const char[] format, a
|
||||
{
|
||||
if (client < 0 || client > MaxClients || !IsClientConnected(client))
|
||||
ThrowError("Client index %d is invalid", client);
|
||||
|
||||
|
||||
GetClientName(client, name, sizeof(name));
|
||||
AdminId id = GetUserAdmin(client);
|
||||
if (id == INVALID_ADMIN_ID
|
||||
@@ -539,13 +539,13 @@ stock int MC_ShowActivityEx(int client, const char[] tag, const char[] format, a
|
||||
{
|
||||
sign = "PLAYER";
|
||||
}
|
||||
|
||||
|
||||
/* Display the message to the client? */
|
||||
if (replyto == SM_REPLY_TO_CONSOLE)
|
||||
{
|
||||
SetGlobalTransTarget(client);
|
||||
VFormat(szBuffer, sizeof(szBuffer), format, 4);
|
||||
|
||||
|
||||
MC_RemoveTags(szBuffer, sizeof(szBuffer));
|
||||
PrintToConsole(client, "%s%s\n", tag, szBuffer);
|
||||
display_in_chat = true;
|
||||
@@ -555,16 +555,16 @@ stock int MC_ShowActivityEx(int client, const char[] tag, const char[] format, a
|
||||
{
|
||||
SetGlobalTransTarget(LANG_SERVER);
|
||||
VFormat(szBuffer, sizeof(szBuffer), format, 4);
|
||||
|
||||
|
||||
MC_RemoveTags(szBuffer, sizeof(szBuffer));
|
||||
PrintToServer("%s%s\n", tag, szBuffer);
|
||||
}
|
||||
|
||||
|
||||
if (!value)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
MuCo_LoopClients(i)
|
||||
{
|
||||
if (i == 0
|
||||
@@ -589,7 +589,7 @@ stock int MC_ShowActivityEx(int client, const char[] tag, const char[] format, a
|
||||
newsign = name;
|
||||
}
|
||||
VFormat(szBuffer, sizeof(szBuffer), format, 4);
|
||||
|
||||
|
||||
MC_PrintToChatEx(i, client, "%s%s: %s", tag, newsign, szBuffer);
|
||||
}
|
||||
}
|
||||
@@ -608,18 +608,18 @@ stock int MC_ShowActivityEx(int client, const char[] tag, const char[] format, a
|
||||
newsign = name;
|
||||
}
|
||||
VFormat(szBuffer, sizeof(szBuffer), format, 4);
|
||||
|
||||
|
||||
MC_PrintToChatEx(i, client, "%s%s: %s", tag, newsign, szBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays usage of an admin command to users depending on the setting of the sm_show_activity cvar.
|
||||
* All users receive a message in their chat text, except for the originating client,
|
||||
* All users receive a message in their chat text, except for the originating client,
|
||||
* who receives the message based on the current ReplySource.
|
||||
* Supports color tags.
|
||||
*
|
||||
@@ -634,19 +634,19 @@ stock int MC_ShowActivity2(int client, const char[] tag, const char[] format, an
|
||||
{
|
||||
if (sm_show_activity == INVALID_HANDLE)
|
||||
sm_show_activity = FindConVar("sm_show_activity");
|
||||
|
||||
|
||||
char szBuffer[MC_MAX_MESSAGE_LENGTH];
|
||||
//char szCMessage[MC_MAX_MESSAGE_LENGTH];
|
||||
int value = GetConVarInt(sm_show_activity);
|
||||
// ReplySource replyto = GetCmdReplySource();
|
||||
|
||||
|
||||
char name[MAX_NAME_LENGTH] = "Console";
|
||||
char sign[MAX_NAME_LENGTH] = "ADMIN";
|
||||
if (client != 0)
|
||||
{
|
||||
if (client < 0 || client > MaxClients || !IsClientConnected(client))
|
||||
ThrowError("Client index %d is invalid", client);
|
||||
|
||||
|
||||
GetClientName(client, name, sizeof(name));
|
||||
AdminId id = GetUserAdmin(client);
|
||||
if (id == INVALID_ADMIN_ID
|
||||
@@ -654,12 +654,12 @@ stock int MC_ShowActivity2(int client, const char[] tag, const char[] format, an
|
||||
{
|
||||
sign = "PLAYER";
|
||||
}
|
||||
|
||||
|
||||
SetGlobalTransTarget(client);
|
||||
VFormat(szBuffer, sizeof(szBuffer), format, 4);
|
||||
|
||||
/* We don't display directly to the console because the chat text
|
||||
* simply gets added to the console, so we don't want it to print
|
||||
|
||||
/* We don't display directly to the console because the chat text
|
||||
* simply gets added to the console, so we don't want it to print
|
||||
* twice.
|
||||
*/
|
||||
MC_PrintToChatEx(client, client, "%s%s", tag, szBuffer);
|
||||
@@ -668,16 +668,16 @@ stock int MC_ShowActivity2(int client, const char[] tag, const char[] format, an
|
||||
{
|
||||
SetGlobalTransTarget(LANG_SERVER);
|
||||
VFormat(szBuffer, sizeof(szBuffer), format, 4);
|
||||
|
||||
|
||||
MC_RemoveTags(szBuffer, sizeof(szBuffer));
|
||||
PrintToServer("%s%s\n", tag, szBuffer);
|
||||
}
|
||||
|
||||
|
||||
if (!value)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
MuCo_LoopClients(i)
|
||||
{
|
||||
if (i == 0
|
||||
@@ -702,7 +702,7 @@ stock int MC_ShowActivity2(int client, const char[] tag, const char[] format, an
|
||||
newsign = name;
|
||||
}
|
||||
VFormat(szBuffer, sizeof(szBuffer), format, 4);
|
||||
|
||||
|
||||
MC_PrintToChatEx(i, client, "%s%s: %s", tag, newsign, szBuffer);
|
||||
}
|
||||
}
|
||||
@@ -721,18 +721,18 @@ stock int MC_ShowActivity2(int client, const char[] tag, const char[] format, an
|
||||
newsign = name;
|
||||
}
|
||||
VFormat(szBuffer, sizeof(szBuffer), format, 4);
|
||||
|
||||
|
||||
MC_PrintToChatEx(i, client, "%s%s: %s", tag, newsign, szBuffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether a color name exists
|
||||
*
|
||||
*
|
||||
* @param color The color name to check
|
||||
* @return True if the color exists, false otherwise
|
||||
*/
|
||||
|
||||
@@ -1,48 +1,48 @@
|
||||
/**
|
||||
* Called when a player is about to be freezed by a grenade
|
||||
*
|
||||
* @param client The victim index
|
||||
* @param attacker The client index who threw the grenade
|
||||
* @param duration The freeze duration, set by reference
|
||||
* @return Plugin_Changed to apply new values, Plugin_Contninue to allow as is and >= Plugin_Handled to block
|
||||
*/
|
||||
forward Action:ZR_OnClientFreeze(client, attacker, &Float:duration);
|
||||
/**
|
||||
* Called when a player is about to be freezed by a grenade
|
||||
*
|
||||
* @param client The victim index
|
||||
* @param attacker The client index who threw the grenade
|
||||
* @param duration The freeze duration, set by reference
|
||||
* @return Plugin_Changed to apply new values, Plugin_Contninue to allow as is and >= Plugin_Handled to block
|
||||
*/
|
||||
forward Action:ZR_OnClientFreeze(client, attacker, &Float:duration);
|
||||
|
||||
/**
|
||||
* Called when a player has been freezed by a grenade
|
||||
*
|
||||
* @param client The victim index
|
||||
* @param attacker The client index who threw the grenade
|
||||
* @param duration The freeze duration
|
||||
* @noreturn
|
||||
*/
|
||||
forward ZR_OnClientFreezed(client, attacker, Float:duration);
|
||||
/**
|
||||
* Called when a player has been freezed by a grenade
|
||||
*
|
||||
* @param client The victim index
|
||||
* @param attacker The client index who threw the grenade
|
||||
* @param duration The freeze duration
|
||||
* @noreturn
|
||||
*/
|
||||
forward ZR_OnClientFreezed(client, attacker, Float:duration);
|
||||
|
||||
/**
|
||||
* Called when a player is about to be ignited by a grenade
|
||||
*
|
||||
* @param client The victim index
|
||||
* @param attacker The client index who threw the grenade
|
||||
* @param duration The ignite duration, set by reference
|
||||
* @return Plugin_Changed to apply new values, Plugin_Contninue to allow as is and >= Plugin_Handled to block
|
||||
*/
|
||||
forward Action:ZR_OnClientIgnite(client, attacker, &Float:duration);
|
||||
/**
|
||||
* Called when a player is about to be ignited by a grenade
|
||||
*
|
||||
* @param client The victim index
|
||||
* @param attacker The client index who threw the grenade
|
||||
* @param duration The ignite duration, set by reference
|
||||
* @return Plugin_Changed to apply new values, Plugin_Contninue to allow as is and >= Plugin_Handled to block
|
||||
*/
|
||||
forward Action:ZR_OnClientIgnite(client, attacker, &Float:duration);
|
||||
|
||||
/**
|
||||
* Called when a player has been ignited by a grenade
|
||||
*
|
||||
* @param client The victim index
|
||||
* @param attacker The client index who threw the grenade
|
||||
* @param duration The freeze duration
|
||||
* @noreturn
|
||||
*/
|
||||
forward ZR_OnClientIgnited(client, attacker, Float:duration);
|
||||
/**
|
||||
* Called when a player has been ignited by a grenade
|
||||
*
|
||||
* @param client The victim index
|
||||
* @param attacker The client index who threw the grenade
|
||||
* @param duration The freeze duration
|
||||
* @noreturn
|
||||
*/
|
||||
forward ZR_OnClientIgnited(client, attacker, Float:duration);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Called when a grenade will get his effect
|
||||
*
|
||||
*
|
||||
* @param client Client that throw the grenade
|
||||
* @param grenade Grenade index
|
||||
* @return Plugin_Continue to allow as is and Plugin_Handled to block effect in the grenade
|
||||
*/
|
||||
forward Action:ZR_OnGrenadeEffect(client, grenade);
|
||||
*/
|
||||
forward Action:ZR_OnGrenadeEffect(client, grenade);
|
||||
Reference in New Issue
Block a user