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:
BotoX 2018-08-09 19:35:44 +02:00
parent ff970b8d5f
commit eefb23882b
30 changed files with 1992 additions and 1992 deletions

View File

@ -2,5 +2,5 @@
#endinput
#endif
#define _AntiBhopCheat_Included
forward void AntiBhopCheat_OnClientDetected(int client, char[] sReason, char[] sStats);

View File

@ -1,221 +1,221 @@
#pragma semicolon 1
#include <sourcemod>
ConVar g_hTvEnabled;
ConVar g_hAutoRecord;
ConVar g_hMinPlayersStart;
ConVar g_hIgnoreBots;
ConVar g_hTimeStart;
ConVar g_hTimeStop;
ConVar g_hFinishMap;
ConVar g_hDemoPath;
ConVar g_hMaxLength;
bool g_bIsRecording = false;
bool g_bIsManual = false;
int g_iStartedRecording;
// Default: o=rx,g=rx,u=rwx | 755
#define DIRECTORY_PERMISSIONS (FPERM_O_READ|FPERM_O_EXEC | FPERM_G_READ|FPERM_G_EXEC | FPERM_U_READ|FPERM_U_WRITE|FPERM_U_EXEC)
public Plugin myinfo =
{
name = "Auto Recorder",
author = "Stevo.TVR",
description = "Automates SourceTV recording based on player count and time of day.",
version = "1.2.0",
url = "http://www.theville.org"
}
public void OnPluginStart()
{
g_hAutoRecord = CreateConVar("sm_autorecord_enable", "1", "Enable automatic recording", _, true, 0.0, true, 1.0);
g_hMinPlayersStart = CreateConVar("sm_autorecord_minplayers", "4", "Minimum players on server to start recording", _, true, 0.0);
g_hIgnoreBots = CreateConVar("sm_autorecord_ignorebots", "1", "Ignore bots in the player count", _, true, 0.0, true, 1.0);
g_hTimeStart = CreateConVar("sm_autorecord_timestart", "-1", "Hour in the day to start recording (0-23, -1 disables)");
g_hTimeStop = CreateConVar("sm_autorecord_timestop", "-1", "Hour in the day to stop recording (0-23, -1 disables)");
g_hFinishMap = CreateConVar("sm_autorecord_finishmap", "1", "If 1, continue recording until the map ends", _, true, 0.0, true, 1.0);
g_hDemoPath = CreateConVar("sm_autorecord_path", "demos/", "Path to store recorded demos");
g_hMaxLength = CreateConVar("sm_autorecord_maxlength", "0", "Maximum length of demos in seconds, 0 to disable", _, true, 0.0);
AutoExecConfig(true, "autorecorder");
RegAdminCmd("sm_record", Command_Record, ADMFLAG_KICK, "Starts a SourceTV demo");
RegAdminCmd("sm_stoprecord", Command_StopRecord, ADMFLAG_KICK, "Stops the current SourceTV demo");
HookEvent("round_start", OnRoundStart);
g_hTvEnabled = FindConVar("tv_enable");
static char sPath[PLATFORM_MAX_PATH];
GetConVarString(g_hDemoPath, sPath, sizeof(sPath));
if(!DirExists(sPath))
CreateDirectory(sPath, DIRECTORY_PERMISSIONS);
HookConVarChange(g_hMinPlayersStart, OnConVarChanged);
HookConVarChange(g_hIgnoreBots, OnConVarChanged);
HookConVarChange(g_hTimeStart, OnConVarChanged);
HookConVarChange(g_hTimeStop, OnConVarChanged);
HookConVarChange(g_hDemoPath, OnConVarChanged);
CreateTimer(300.0, Timer_CheckStatus, _, TIMER_REPEAT);
StopRecord();
CheckStatus();
}
public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast)
{
int maxLength = GetConVarInt(g_hMaxLength);
if(g_bIsRecording && maxLength > 0 && GetTime() >= g_iStartedRecording + maxLength)
{
StopRecord();
CheckStatus();
}
}
public void OnConVarChanged(ConVar convar, const char[] oldValue, const char[] newValue)
{
if(convar == g_hDemoPath)
{
if(!DirExists(newValue))
CreateDirectory(newValue, DIRECTORY_PERMISSIONS);
}
else
CheckStatus();
}
public void OnMapEnd()
{
if(g_bIsRecording)
{
StopRecord();
g_bIsManual = false;
}
}
public void OnClientPutInServer(int client)
{
CheckStatus();
}
public void OnClientDisconnect_Post(int client)
{
CheckStatus();
}
public Action Timer_CheckStatus(Handle hTimer)
{
CheckStatus();
}
public Action Command_Record(int client, int args)
{
if(g_bIsRecording)
{
ReplyToCommand(client, "[SM] SourceTV is already recording!");
return Plugin_Handled;
}
StartRecord();
g_bIsManual = true;
ReplyToCommand(client, "[SM] SourceTV is now recording...");
return Plugin_Handled;
}
public Action Command_StopRecord(int client, int args)
{
if(!g_bIsRecording)
{
ReplyToCommand(client, "[SM] SourceTV is not recording!");
return Plugin_Handled;
}
StopRecord();
if(g_bIsManual)
{
g_bIsManual = false;
CheckStatus();
}
ReplyToCommand(client, "[SM] Stopped recording.");
return Plugin_Handled;
}
void CheckStatus()
{
if(GetConVarBool(g_hAutoRecord) && !g_bIsManual)
{
int iMinClients = GetConVarInt(g_hMinPlayersStart);
int iTimeStart = GetConVarInt(g_hTimeStart);
int iTimeStop = GetConVarInt(g_hTimeStop);
bool bReverseTimes = (iTimeStart > iTimeStop);
static char sCurrentTime[4];
FormatTime(sCurrentTime, sizeof(sCurrentTime), "%H", GetTime());
int iCurrentTime = StringToInt(sCurrentTime);
if(GetPlayerCount() >= iMinClients+1 && (iTimeStart < 0 || (iCurrentTime >= iTimeStart && (bReverseTimes || iCurrentTime < iTimeStop))))
{
StartRecord();
}
else if(g_bIsRecording && !GetConVarBool(g_hFinishMap) && (iTimeStop < 0 || iCurrentTime >= iTimeStop))
{
StopRecord();
}
}
}
int GetPlayerCount()
{
if(!GetConVarBool(g_hIgnoreBots))
return GetClientCount(false) - 1;
int iNumPlayers = 0;
for(int i = 1; i <= MaxClients; i++)
{
if(IsClientConnected(i) && !IsFakeClient(i))
iNumPlayers++;
}
return iNumPlayers;
}
void StartRecord()
{
if(GetConVarBool(g_hTvEnabled) && !g_bIsRecording)
{
static char sPath[PLATFORM_MAX_PATH];
static char sMap[PLATFORM_MAX_PATH];
static char sTime[16];
GetConVarString(g_hDemoPath, sPath, sizeof(sPath));
FormatTime(sTime, sizeof(sTime), "%Y%m%d-%H%M%S", GetTime());
GetCurrentMap(sMap, sizeof(sMap));
// replace slashes in map path name with dashes, to prevent fail on workshop maps
ReplaceString(sMap, sizeof(sMap), "/", "-", false);
ServerCommand("tv_record \"%s/auto-%s-%s\"", sPath, sTime, sMap);
g_bIsRecording = true;
g_iStartedRecording = GetTime();
LogMessage("Recording to auto-%s-%s.dem", sTime, sMap);
}
}
void StopRecord()
{
if(GetConVarBool(g_hTvEnabled))
{
ServerCommand("tv_stoprecord");
g_bIsRecording = false;
}
}
#pragma semicolon 1
#include <sourcemod>
ConVar g_hTvEnabled;
ConVar g_hAutoRecord;
ConVar g_hMinPlayersStart;
ConVar g_hIgnoreBots;
ConVar g_hTimeStart;
ConVar g_hTimeStop;
ConVar g_hFinishMap;
ConVar g_hDemoPath;
ConVar g_hMaxLength;
bool g_bIsRecording = false;
bool g_bIsManual = false;
int g_iStartedRecording;
// Default: o=rx,g=rx,u=rwx | 755
#define DIRECTORY_PERMISSIONS (FPERM_O_READ|FPERM_O_EXEC | FPERM_G_READ|FPERM_G_EXEC | FPERM_U_READ|FPERM_U_WRITE|FPERM_U_EXEC)
public Plugin myinfo =
{
name = "Auto Recorder",
author = "Stevo.TVR",
description = "Automates SourceTV recording based on player count and time of day.",
version = "1.2.0",
url = "http://www.theville.org"
}
public void OnPluginStart()
{
g_hAutoRecord = CreateConVar("sm_autorecord_enable", "1", "Enable automatic recording", _, true, 0.0, true, 1.0);
g_hMinPlayersStart = CreateConVar("sm_autorecord_minplayers", "4", "Minimum players on server to start recording", _, true, 0.0);
g_hIgnoreBots = CreateConVar("sm_autorecord_ignorebots", "1", "Ignore bots in the player count", _, true, 0.0, true, 1.0);
g_hTimeStart = CreateConVar("sm_autorecord_timestart", "-1", "Hour in the day to start recording (0-23, -1 disables)");
g_hTimeStop = CreateConVar("sm_autorecord_timestop", "-1", "Hour in the day to stop recording (0-23, -1 disables)");
g_hFinishMap = CreateConVar("sm_autorecord_finishmap", "1", "If 1, continue recording until the map ends", _, true, 0.0, true, 1.0);
g_hDemoPath = CreateConVar("sm_autorecord_path", "demos/", "Path to store recorded demos");
g_hMaxLength = CreateConVar("sm_autorecord_maxlength", "0", "Maximum length of demos in seconds, 0 to disable", _, true, 0.0);
AutoExecConfig(true, "autorecorder");
RegAdminCmd("sm_record", Command_Record, ADMFLAG_KICK, "Starts a SourceTV demo");
RegAdminCmd("sm_stoprecord", Command_StopRecord, ADMFLAG_KICK, "Stops the current SourceTV demo");
HookEvent("round_start", OnRoundStart);
g_hTvEnabled = FindConVar("tv_enable");
static char sPath[PLATFORM_MAX_PATH];
GetConVarString(g_hDemoPath, sPath, sizeof(sPath));
if(!DirExists(sPath))
CreateDirectory(sPath, DIRECTORY_PERMISSIONS);
HookConVarChange(g_hMinPlayersStart, OnConVarChanged);
HookConVarChange(g_hIgnoreBots, OnConVarChanged);
HookConVarChange(g_hTimeStart, OnConVarChanged);
HookConVarChange(g_hTimeStop, OnConVarChanged);
HookConVarChange(g_hDemoPath, OnConVarChanged);
CreateTimer(300.0, Timer_CheckStatus, _, TIMER_REPEAT);
StopRecord();
CheckStatus();
}
public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast)
{
int maxLength = GetConVarInt(g_hMaxLength);
if(g_bIsRecording && maxLength > 0 && GetTime() >= g_iStartedRecording + maxLength)
{
StopRecord();
CheckStatus();
}
}
public void OnConVarChanged(ConVar convar, const char[] oldValue, const char[] newValue)
{
if(convar == g_hDemoPath)
{
if(!DirExists(newValue))
CreateDirectory(newValue, DIRECTORY_PERMISSIONS);
}
else
CheckStatus();
}
public void OnMapEnd()
{
if(g_bIsRecording)
{
StopRecord();
g_bIsManual = false;
}
}
public void OnClientPutInServer(int client)
{
CheckStatus();
}
public void OnClientDisconnect_Post(int client)
{
CheckStatus();
}
public Action Timer_CheckStatus(Handle hTimer)
{
CheckStatus();
}
public Action Command_Record(int client, int args)
{
if(g_bIsRecording)
{
ReplyToCommand(client, "[SM] SourceTV is already recording!");
return Plugin_Handled;
}
StartRecord();
g_bIsManual = true;
ReplyToCommand(client, "[SM] SourceTV is now recording...");
return Plugin_Handled;
}
public Action Command_StopRecord(int client, int args)
{
if(!g_bIsRecording)
{
ReplyToCommand(client, "[SM] SourceTV is not recording!");
return Plugin_Handled;
}
StopRecord();
if(g_bIsManual)
{
g_bIsManual = false;
CheckStatus();
}
ReplyToCommand(client, "[SM] Stopped recording.");
return Plugin_Handled;
}
void CheckStatus()
{
if(GetConVarBool(g_hAutoRecord) && !g_bIsManual)
{
int iMinClients = GetConVarInt(g_hMinPlayersStart);
int iTimeStart = GetConVarInt(g_hTimeStart);
int iTimeStop = GetConVarInt(g_hTimeStop);
bool bReverseTimes = (iTimeStart > iTimeStop);
static char sCurrentTime[4];
FormatTime(sCurrentTime, sizeof(sCurrentTime), "%H", GetTime());
int iCurrentTime = StringToInt(sCurrentTime);
if(GetPlayerCount() >= iMinClients+1 && (iTimeStart < 0 || (iCurrentTime >= iTimeStart && (bReverseTimes || iCurrentTime < iTimeStop))))
{
StartRecord();
}
else if(g_bIsRecording && !GetConVarBool(g_hFinishMap) && (iTimeStop < 0 || iCurrentTime >= iTimeStop))
{
StopRecord();
}
}
}
int GetPlayerCount()
{
if(!GetConVarBool(g_hIgnoreBots))
return GetClientCount(false) - 1;
int iNumPlayers = 0;
for(int i = 1; i <= MaxClients; i++)
{
if(IsClientConnected(i) && !IsFakeClient(i))
iNumPlayers++;
}
return iNumPlayers;
}
void StartRecord()
{
if(GetConVarBool(g_hTvEnabled) && !g_bIsRecording)
{
static char sPath[PLATFORM_MAX_PATH];
static char sMap[PLATFORM_MAX_PATH];
static char sTime[16];
GetConVarString(g_hDemoPath, sPath, sizeof(sPath));
FormatTime(sTime, sizeof(sTime), "%Y%m%d-%H%M%S", GetTime());
GetCurrentMap(sMap, sizeof(sMap));
// replace slashes in map path name with dashes, to prevent fail on workshop maps
ReplaceString(sMap, sizeof(sMap), "/", "-", false);
ServerCommand("tv_record \"%s/auto-%s-%s\"", sPath, sTime, sMap);
g_bIsRecording = true;
g_iStartedRecording = GetTime();
LogMessage("Recording to auto-%s-%s.dem", sTime, sMap);
}
}
void StopRecord()
{
if(GetConVarBool(g_hTvEnabled))
{
ServerCommand("tv_stoprecord");
g_bIsRecording = false;
}
}

View File

@ -1,118 +1,118 @@
#pragma semicolon 1
#include <sourcemod>
#define PLUGIN_PREFIX "\x04[ConVar Suppression]\x03 "
#define PLUGIN_VERSION "1.0"
new Handle:g_hGlobalTrie = INVALID_HANDLE;
public Plugin:myinfo =
{
name = "ConVar Suppression", /* https://www.youtube.com/watch?v=ZhjtChtUmBE&hd=1 */
author = "Kyle Sanderson",
description = "Atleast we have candy.",
version = PLUGIN_VERSION,
url = "http://www.SourceMod.net/"
};
public OnPluginStart()
{
g_hGlobalTrie = CreateTrie();
HookEvent("server_cvar", Event_ServerCvar, EventHookMode_Pre);
RegAdminCmd("sm_suppressconvar", OnSupressConVar, ADMFLAG_ROOT, "Supress a ConVar from displaying changes to Clients.");
CreateConVar("sm_convarsuppression_version", PLUGIN_VERSION, "Version string for ConVar Supression.", FCVAR_REPLICATED|FCVAR_DONTRECORD|FCVAR_NOTIFY);
AutoExecConfig(true, "plugin.ConVarSupression");
}
public Action:OnSupressConVar(client, argc)
{
if (client && !IsClientInGame(client)) /* Isn't needed, but makes me feel safe inside. */
{
return Plugin_Handled;
}
decl String:sCommand[256];
if (argc < 2)
{
if (!GetCmdArg(0, sCommand, sizeof(sCommand)))
{
return Plugin_Handled;
}
ReplyToCommand(client, "%s%s <convar> <enabled|disabled>", PLUGIN_PREFIX, sCommand);
return Plugin_Handled;
}
if (!GetCmdArg(2, sCommand, sizeof(sCommand)))
{
return Plugin_Handled;
}
TrimString(sCommand);
new iValue = -1;
if (!IsCharNumeric(sCommand[0]))
{
switch (CharToLower(sCommand[0]))
{
case 'd':
{
iValue = 0;
}
case 'e':
{
iValue = 1;
}
}
}
else
{
iValue = StringToInt(sCommand);
}
if (!GetCmdArg(1, sCommand, sizeof(sCommand)))
{
return Plugin_Handled;
}
switch (iValue)
{
case 0:
{
RemoveFromTrie(g_hGlobalTrie, sCommand);
if (client)
{
ReplyToCommand(client, "%sRemoved ConVar: %s", PLUGIN_PREFIX, sCommand);
}
}
case 1:
{
SetTrieValue(g_hGlobalTrie, sCommand, 1, true);
if (client)
{
ReplyToCommand(client, "%sAdded Hook for ConVar: %s", PLUGIN_PREFIX, sCommand);
}
}
default:
{
ReplyToCommand(client, "%sIllegal Input for Enabled/Disabled with ConVar: %s", PLUGIN_PREFIX, sCommand);
}
}
return Plugin_Handled;
}
public Action:Event_ServerCvar(Handle:event, const String:name[], bool:dontBroadcast)
{
decl String:sConVarName[64];
new iValue;
GetEventString(event, "cvarname", sConVarName, sizeof(sConVarName));
return (GetTrieValue(g_hGlobalTrie, sConVarName, iValue) && iValue) ? Plugin_Handled : Plugin_Continue;
#pragma semicolon 1
#include <sourcemod>
#define PLUGIN_PREFIX "\x04[ConVar Suppression]\x03 "
#define PLUGIN_VERSION "1.0"
new Handle:g_hGlobalTrie = INVALID_HANDLE;
public Plugin:myinfo =
{
name = "ConVar Suppression", /* https://www.youtube.com/watch?v=ZhjtChtUmBE&hd=1 */
author = "Kyle Sanderson",
description = "Atleast we have candy.",
version = PLUGIN_VERSION,
url = "http://www.SourceMod.net/"
};
public OnPluginStart()
{
g_hGlobalTrie = CreateTrie();
HookEvent("server_cvar", Event_ServerCvar, EventHookMode_Pre);
RegAdminCmd("sm_suppressconvar", OnSupressConVar, ADMFLAG_ROOT, "Supress a ConVar from displaying changes to Clients.");
CreateConVar("sm_convarsuppression_version", PLUGIN_VERSION, "Version string for ConVar Supression.", FCVAR_REPLICATED|FCVAR_DONTRECORD|FCVAR_NOTIFY);
AutoExecConfig(true, "plugin.ConVarSupression");
}
public Action:OnSupressConVar(client, argc)
{
if (client && !IsClientInGame(client)) /* Isn't needed, but makes me feel safe inside. */
{
return Plugin_Handled;
}
decl String:sCommand[256];
if (argc < 2)
{
if (!GetCmdArg(0, sCommand, sizeof(sCommand)))
{
return Plugin_Handled;
}
ReplyToCommand(client, "%s%s <convar> <enabled|disabled>", PLUGIN_PREFIX, sCommand);
return Plugin_Handled;
}
if (!GetCmdArg(2, sCommand, sizeof(sCommand)))
{
return Plugin_Handled;
}
TrimString(sCommand);
new iValue = -1;
if (!IsCharNumeric(sCommand[0]))
{
switch (CharToLower(sCommand[0]))
{
case 'd':
{
iValue = 0;
}
case 'e':
{
iValue = 1;
}
}
}
else
{
iValue = StringToInt(sCommand);
}
if (!GetCmdArg(1, sCommand, sizeof(sCommand)))
{
return Plugin_Handled;
}
switch (iValue)
{
case 0:
{
RemoveFromTrie(g_hGlobalTrie, sCommand);
if (client)
{
ReplyToCommand(client, "%sRemoved ConVar: %s", PLUGIN_PREFIX, sCommand);
}
}
case 1:
{
SetTrieValue(g_hGlobalTrie, sCommand, 1, true);
if (client)
{
ReplyToCommand(client, "%sAdded Hook for ConVar: %s", PLUGIN_PREFIX, sCommand);
}
}
default:
{
ReplyToCommand(client, "%sIllegal Input for Enabled/Disabled with ConVar: %s", PLUGIN_PREFIX, sCommand);
}
}
return Plugin_Handled;
}
public Action:Event_ServerCvar(Handle:event, const String:name[], bool:dontBroadcast)
{
decl String:sConVarName[64];
new iValue;
GetEventString(event, "cvarname", sConVarName, sizeof(sConVarName));
return (GetTrieValue(g_hGlobalTrie, sConVarName, iValue) && iValue) ? Plugin_Handled : Plugin_Continue;
}

File diff suppressed because it is too large Load Diff

View File

@ -31,19 +31,19 @@ public void OnPluginStart()
SetFailState("Couldn't load \"FixPointTeleport.games\" game config!");
return;
}
// CBaseCombatWeapon::FallInit()
StartPrepSDKCall(SDKCall_Entity);
if (!PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, "FallInit"))
{
CloseHandle(hGameConf);
SetFailState("PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, \"FallInit\") failed!");
return;
}
hFallInit = EndPrepSDKCall();
// CBaseEntity::Teleport(Vector const*, QAngle const*, Vector const*)
int iOffset;
if ((iOffset = GameConfGetOffset(hGameConf, "Teleport")) == -1)
@ -52,25 +52,25 @@ public void OnPluginStart()
SetFailState("GameConfGetOffset(hGameConf, \"Teleport\") failed!");
return;
}
if ((hTeleport = DHookCreate(iOffset, HookType_Entity, ReturnType_Void, ThisPointer_CBaseEntity, OnEntityTeleport)) == INVALID_HANDLE)
{
CloseHandle(hGameConf);
SetFailState("DHookCreate(iOffset, HookType_Entity, ReturnType_Void, ThisPointer_CBaseEntity, OnEntityTeleport) failed!");
return;
}
DHookAddParam(hTeleport, HookParamType_VectorPtr);
DHookAddParam(hTeleport, HookParamType_ObjectPtr);
DHookAddParam(hTeleport, HookParamType_VectorPtr);
// Late load.
int entity = INVALID_ENT_REFERENCE;
while ((entity = FindEntityByClassname(entity, "weapon_*")) != INVALID_ENT_REFERENCE)
{
OnEntityCreated(entity, "weapon_*");
}
CloseHandle(hGameConf);
}
@ -95,7 +95,7 @@ public MRESReturn OnEntityTeleport(int entity, Handle hParams)
// Dont reinitialize, if we dont have spawnflags or are missing the start constrained spawnflag.
if (!HasEntProp(entity, Prop_Data, "m_spawnflags") || (GetEntProp(entity, Prop_Data, "m_spawnflags") & SF_WEAPON_START_CONSTRAINED) == 0)
return;
SDKCall(hFallInit, entity);
}
}

View File

@ -134,7 +134,7 @@ public Action Command_ForceInput(int client, int args)
AcceptEntityInput(entity, sArguments[1], client, client);
ReplyToCommand(client, "[SM] Input successful.");
char sClassname[64];
char sTargetname[64];
GetEntPropString(entity, Prop_Data, "m_iClassname", sClassname, sizeof(sClassname));
@ -157,7 +157,7 @@ public Action Command_ForceInput(int client, int args)
AcceptEntityInput(entity, sArguments[1], client, client);
ReplyToCommand(client, "[SM] Input successful.");
char sClassname[64];
char sTargetname[64];
GetEntPropString(entity, Prop_Data, "m_iClassname", sClassname, sizeof(sClassname));

View File

@ -239,7 +239,7 @@ public void RequestFrame_ClientSpawnPost(int client)
int ent = GivePlayerItem(client, "weapon_smokegrenade");
EquipPlayerWeapon(client, ent);
//PrintToChatAll("%N spawned in and got a smoke", client);
char sHumanClassName[64];

View File

@ -1,7 +1,7 @@
#include <sourcemod>
#pragma semicolon 1
public Plugin:myinfo =
public Plugin:myinfo =
{
name = "Players count in hostname",
author = "D1maxa",
@ -18,7 +18,7 @@ new Handle:formatted_hostname = INVALID_HANDLE;
public OnPluginStart()
{
hostname = FindConVar("hostname");
sv_visiblemaxplayers = FindConVar("sv_visiblemaxplayers");
sv_visiblemaxplayers = FindConVar("sv_visiblemaxplayers");
formatted_hostname=CreateConVar("sm_formatted_hostname", "My Server %d/%d", "Formatted string for dynamic hostname",FCVAR_PLUGIN);
}
@ -26,12 +26,12 @@ public OnMapStart()
{
g_NumClients=0;
}
public OnConfigsExecuted()
{
SetNumberOfPlayersInHostname();
}
public OnClientConnected(client)
{
if(!IsFakeClient(client))
@ -44,7 +44,7 @@ public OnClientConnected(client)
public OnClientDisconnect(client)
{
if(!IsFakeClient(client))
{
{
g_NumClients--;
SetNumberOfPlayersInHostname();
}

View File

@ -12,7 +12,7 @@ Handle g_hCVar_PushStrength = INVALID_HANDLE;
Handle g_hCVar_PushScale = INVALID_HANDLE;
public Plugin myinfo =
public Plugin myinfo =
{
name = "PushNades",
author = "Neon",
@ -22,37 +22,37 @@ public Plugin myinfo =
}
public void OnPluginStart()
{
{
g_hCVar_PushNadesEnabled = CreateConVar("sm_hegrenade_push_enabled", "0", "Enable PushBack for HE-Grenades", 0, true, 0.0, true, 1.0);
g_hCVar_PushScale = CreateConVar("sm_hegrenade_push_scale", "0", "Make the push scale with the distance to the explosion", 0, true, 0.0, true, 1.0);
g_hCVar_PushRange = CreateConVar("sm_hegrenade_push_range", "500", "Range arround Explosion in which Zombies are affected by the push.");
g_hCVar_PushStrength = CreateConVar("sm_hegrenade_push_strength", "2500", "How strong the HE-Grenade pushes back");
HookEvent("hegrenade_detonate", OnHEDetonate);
HookEvent("hegrenade_detonate", OnHEDetonate);
}
public void OnMapStart()
public void OnMapStart()
{
}
public Action OnHEDetonate(Event hEvent, const char[] sEvent, bool bDontBroadcast)
public Action OnHEDetonate(Event hEvent, const char[] sEvent, bool bDontBroadcast)
{
if (!GetConVarBool(g_hCVar_PushNadesEnabled))
return Plugin_Continue;
float fNadeOrigin[3];
fNadeOrigin[0] = hEvent.GetFloat("x");
fNadeOrigin[0] = hEvent.GetFloat("x");
fNadeOrigin[1] = hEvent.GetFloat("y");
fNadeOrigin[2] = hEvent.GetFloat("z");
int iOwner = GetClientOfUserId(hEvent.GetInt("userid"));
if (!IsValidClient(iOwner, false))
return Plugin_Continue;
return Plugin_Continue;
if (!IsPlayerAlive(iOwner) || !ZR_IsClientHuman(iOwner))
return Plugin_Continue;
for (int client = 1; client <= MaxClients; client++)
{
if (IsValidClient(client, false))
@ -60,43 +60,43 @@ public Action OnHEDetonate(Event hEvent, const char[] sEvent, bool bDontBroadcas
if (IsPlayerAlive(client) && ZR_IsClientZombie(client))
{
float fZombieOrigin[3];
GetClientAbsOrigin(client, fZombieOrigin);
float fDistance = GetVectorDistance(fZombieOrigin, fNadeOrigin, false);
float fMaxRange = GetConVarFloat(g_hCVar_PushRange);
GetClientAbsOrigin(client, fZombieOrigin);
float fDistance = GetVectorDistance(fZombieOrigin, fNadeOrigin, false);
float fMaxRange = GetConVarFloat(g_hCVar_PushRange);
if (fDistance <= fMaxRange)
{
{
float fOwnerOrigin[3];
GetClientAbsOrigin(iOwner, fOwnerOrigin);
float fPushVector[3];
float fPushVector[3];
MakeVectorFromPoints(fOwnerOrigin, fZombieOrigin, fPushVector);
float fCurrentVector[3];
float fCurrentVector[3];
//GetEntPropVector(iOwner, Prop_Data, "m_vecVelocity", fCurrentVector);
float fPushStrength = GetConVarFloat(g_hCVar_PushStrength);
float fDistanceScalingFactor = 1.0;
float fDistanceScalingFactor = 1.0;
if (GetConVarBool(g_hCVar_PushScale))
fDistanceScalingFactor = 1.0 - ((1.0/fMaxRange) * fDistance);
NormalizeVector(fPushVector, fPushVector);
fPushVector[0] *= fPushStrength * fDistanceScalingFactor;
fPushVector[1] *= fPushStrength * fDistanceScalingFactor;
fPushVector[0] *= fPushStrength * fDistanceScalingFactor;
fPushVector[1] *= fPushStrength * fDistanceScalingFactor;
fPushVector[2] *= fPushStrength * fDistanceScalingFactor;
fPushVector[0] += fCurrentVector[0];
fPushVector[1] += fCurrentVector[1];
fPushVector[2] += fCurrentVector[2];
fPushVector[2] += fCurrentVector[2];
TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, fPushVector);
}
}
}
}
return Plugin_Continue;
}

View File

@ -1,165 +1,165 @@
#pragma semicolon 1
#include <sourcemod>
#pragma newdecls required
bool g_bProtoBuf;
bool g_bBlocked[MAXPLAYERS + 1];
int g_iMessageClient = -1;
public Plugin myinfo =
{
name = "RadioMute",
description = "Very simple plugin to block players from using the in-game radio in supported games.",
author = "Obus",
version = "1.0.1",
url = ""
}
public void OnPluginStart()
{
LoadTranslations("common.phrases");
if(GetFeatureStatus(FeatureType_Native, "GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf)
g_bProtoBuf = true;
UserMsg RadioText = GetUserMessageId("RadioText");
if (RadioText == INVALID_MESSAGE_ID)
SetFailState("This game does not support the \"RadioText\" UserMessage.");
UserMsg SendAudio = GetUserMessageId("SendAudio");
if (SendAudio == INVALID_MESSAGE_ID)
SetFailState("This game does not support the \"SendAudio\" UserMessage.");
RegAdminCmd("sm_radiomute", Command_RadioMute, ADMFLAG_BAN, "Block a client from using the in-game radio.");
RegAdminCmd("sm_radiounmute", Command_RadioUnmute, ADMFLAG_BAN, "Unblock a client from using the in-game radio.");
HookUserMessage(RadioText, _hkRadioText, true);
HookUserMessage(SendAudio, _hkSendAudio, true);
}
public void OnClientDisconnect(int client)
{
g_bBlocked[client] = false;
}
public Action Command_RadioMute(int client, int argc)
{
if (argc < 1)
{
ReplyToCommand(client, "[SM] Usage: sm_radiomute <target>");
return Plugin_Handled;
}
char sArgs[64];
char sTargetName[MAX_TARGET_LENGTH];
int iTargets[MAXPLAYERS];
int iTargetCount;
bool bIsML;
GetCmdArg(1, sArgs, sizeof(sArgs));
if ((iTargetCount = ProcessTargetString(sArgs, client, iTargets, MAXPLAYERS, COMMAND_FILTER_CONNECTED, sTargetName, sizeof(sTargetName), bIsML)) <= 0)
{
ReplyToTargetError(client, iTargetCount);
return Plugin_Handled;
}
for (int i = 0; i < iTargetCount; i++)
{
g_bBlocked[iTargets[i]] = true;
}
ShowActivity2(client, "\x01[SM] \x04", "\x01Radio muted \x04%s\x01", sTargetName);
LogAction(client, -1, "\"%L\" radio muted \"%s\"", client, sTargetName);
return Plugin_Handled;
}
public Action Command_RadioUnmute(int client, int argc)
{
if (argc < 1)
{
ReplyToCommand(client, "[SM] Usage: sm_radiounmute <target>");
return Plugin_Handled;
}
char sArgs[64];
char sTargetName[MAX_TARGET_LENGTH];
int iTargets[MAXPLAYERS];
int iTargetCount;
bool bIsML;
GetCmdArg(1, sArgs, sizeof(sArgs));
if ((iTargetCount = ProcessTargetString(sArgs, client, iTargets, MAXPLAYERS, COMMAND_FILTER_CONNECTED, sTargetName, sizeof(sTargetName), bIsML)) <= 0)
{
ReplyToTargetError(client, iTargetCount);
return Plugin_Handled;
}
for (int i = 0; i < iTargetCount; i++)
{
g_bBlocked[iTargets[i]] = false;
}
ShowActivity2(client, "\x01[SM] \x04", "\x01Radio unmuted \x04%s\x01", sTargetName);
LogAction(client, -1, "\"%L\" radio unmuted \"%s\"", client, sTargetName);
return Plugin_Handled;
}
public Action _hkRadioText(UserMsg msg_id, Handle bf, const int[] players, int playersNum, bool reliable, bool init)
{
if (g_bProtoBuf)
{
g_iMessageClient = PbReadInt(bf, "client");
}
else
{
BfReadByte(bf);
g_iMessageClient = BfReadByte(bf);
}
if (g_bBlocked[g_iMessageClient])
{
return Plugin_Handled;
}
return Plugin_Continue;
}
public Action _hkSendAudio(UserMsg msg_id, Handle bf, const int[] players, int playersNum, bool reliable, bool init)
{
if (g_iMessageClient == -1)
return Plugin_Continue;
char sSound[128];
if(g_bProtoBuf)
PbReadString(bf, "radio_sound", sSound, sizeof(sSound));
else
BfReadString(bf, sSound, sizeof(sSound), false);
if (strncmp(sSound[6], "lock", 4, false) == 0)
return Plugin_Continue;
if (g_bBlocked[g_iMessageClient])
{
g_iMessageClient = -1;
return Plugin_Handled;
}
g_iMessageClient = -1;
return Plugin_Continue;
}
#pragma semicolon 1
#include <sourcemod>
#pragma newdecls required
bool g_bProtoBuf;
bool g_bBlocked[MAXPLAYERS + 1];
int g_iMessageClient = -1;
public Plugin myinfo =
{
name = "RadioMute",
description = "Very simple plugin to block players from using the in-game radio in supported games.",
author = "Obus",
version = "1.0.1",
url = ""
}
public void OnPluginStart()
{
LoadTranslations("common.phrases");
if(GetFeatureStatus(FeatureType_Native, "GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf)
g_bProtoBuf = true;
UserMsg RadioText = GetUserMessageId("RadioText");
if (RadioText == INVALID_MESSAGE_ID)
SetFailState("This game does not support the \"RadioText\" UserMessage.");
UserMsg SendAudio = GetUserMessageId("SendAudio");
if (SendAudio == INVALID_MESSAGE_ID)
SetFailState("This game does not support the \"SendAudio\" UserMessage.");
RegAdminCmd("sm_radiomute", Command_RadioMute, ADMFLAG_BAN, "Block a client from using the in-game radio.");
RegAdminCmd("sm_radiounmute", Command_RadioUnmute, ADMFLAG_BAN, "Unblock a client from using the in-game radio.");
HookUserMessage(RadioText, _hkRadioText, true);
HookUserMessage(SendAudio, _hkSendAudio, true);
}
public void OnClientDisconnect(int client)
{
g_bBlocked[client] = false;
}
public Action Command_RadioMute(int client, int argc)
{
if (argc < 1)
{
ReplyToCommand(client, "[SM] Usage: sm_radiomute <target>");
return Plugin_Handled;
}
char sArgs[64];
char sTargetName[MAX_TARGET_LENGTH];
int iTargets[MAXPLAYERS];
int iTargetCount;
bool bIsML;
GetCmdArg(1, sArgs, sizeof(sArgs));
if ((iTargetCount = ProcessTargetString(sArgs, client, iTargets, MAXPLAYERS, COMMAND_FILTER_CONNECTED, sTargetName, sizeof(sTargetName), bIsML)) <= 0)
{
ReplyToTargetError(client, iTargetCount);
return Plugin_Handled;
}
for (int i = 0; i < iTargetCount; i++)
{
g_bBlocked[iTargets[i]] = true;
}
ShowActivity2(client, "\x01[SM] \x04", "\x01Radio muted \x04%s\x01", sTargetName);
LogAction(client, -1, "\"%L\" radio muted \"%s\"", client, sTargetName);
return Plugin_Handled;
}
public Action Command_RadioUnmute(int client, int argc)
{
if (argc < 1)
{
ReplyToCommand(client, "[SM] Usage: sm_radiounmute <target>");
return Plugin_Handled;
}
char sArgs[64];
char sTargetName[MAX_TARGET_LENGTH];
int iTargets[MAXPLAYERS];
int iTargetCount;
bool bIsML;
GetCmdArg(1, sArgs, sizeof(sArgs));
if ((iTargetCount = ProcessTargetString(sArgs, client, iTargets, MAXPLAYERS, COMMAND_FILTER_CONNECTED, sTargetName, sizeof(sTargetName), bIsML)) <= 0)
{
ReplyToTargetError(client, iTargetCount);
return Plugin_Handled;
}
for (int i = 0; i < iTargetCount; i++)
{
g_bBlocked[iTargets[i]] = false;
}
ShowActivity2(client, "\x01[SM] \x04", "\x01Radio unmuted \x04%s\x01", sTargetName);
LogAction(client, -1, "\"%L\" radio unmuted \"%s\"", client, sTargetName);
return Plugin_Handled;
}
public Action _hkRadioText(UserMsg msg_id, Handle bf, const int[] players, int playersNum, bool reliable, bool init)
{
if (g_bProtoBuf)
{
g_iMessageClient = PbReadInt(bf, "client");
}
else
{
BfReadByte(bf);
g_iMessageClient = BfReadByte(bf);
}
if (g_bBlocked[g_iMessageClient])
{
return Plugin_Handled;
}
return Plugin_Continue;
}
public Action _hkSendAudio(UserMsg msg_id, Handle bf, const int[] players, int playersNum, bool reliable, bool init)
{
if (g_iMessageClient == -1)
return Plugin_Continue;
char sSound[128];
if(g_bProtoBuf)
PbReadString(bf, "radio_sound", sSound, sizeof(sSound));
else
BfReadString(bf, sSound, sizeof(sSound), false);
if (strncmp(sSound[6], "lock", 4, false) == 0)
return Plugin_Continue;
if (g_bBlocked[g_iMessageClient])
{
g_iMessageClient = -1;
return Plugin_Handled;
}
g_iMessageClient = -1;
return Plugin_Continue;
}

View File

@ -1,36 +1,36 @@
#if defined _TeamManager_include
#endinput
#endif
#define _TeamManager_include
/**
* Called when warmup ends
*
* @return None
*/
forward void TeamManager_WarmupEnd();
/**
* Returns the status of warmup
*
* @return bool inwarmup
*/
native bool TeamManager_InWarmup();
public SharedPlugin __pl_TeamManager =
{
name = "TeamManager",
file = "TeamManager.smx",
#if defined REQUIRE_PLUGIN
required = 1
#else
required = 0
#endif
};
#if !defined REQUIRE_PLUGIN
public void __pl_TeamManager_SetNTVOptional()
{
MarkNativeAsOptional("TeamManager_InWarmup");
}
#endif
#if defined _TeamManager_include
#endinput
#endif
#define _TeamManager_include
/**
* Called when warmup ends
*
* @return None
*/
forward void TeamManager_WarmupEnd();
/**
* Returns the status of warmup
*
* @return bool inwarmup
*/
native bool TeamManager_InWarmup();
public SharedPlugin __pl_TeamManager =
{
name = "TeamManager",
file = "TeamManager.smx",
#if defined REQUIRE_PLUGIN
required = 1
#else
required = 0
#endif
};
#if !defined REQUIRE_PLUGIN
public void __pl_TeamManager_SetNTVOptional()
{
MarkNativeAsOptional("TeamManager_InWarmup");
}
#endif

View File

@ -49,11 +49,11 @@ public Plugin myinfo =
public APLRes AskPluginLoad2(Handle hMyself, bool bLate, char[] sError, int errorSize)
{
g_bLate = bLate;
CreateNative("EW_GetItemCount", Native_GetItemCount);
CreateNative("EW_GetItemArray", Native_GetItemArray);
CreateNative("EW_SetItemArray", Native_SetItemArray);
RegPluginLibrary("entWatch-core");
return APLRes_Success;
}
@ -68,23 +68,23 @@ public void OnPluginStart()
g_hFwd_OnClientItemPickup = CreateGlobalForward("EW_OnClientItemPickup", ET_Ignore, Param_Array, Param_Cell, Param_Cell);
g_hFwd_OnClientItemActivate = CreateGlobalForward("EW_OnClientItemActivate", ET_Ignore, Param_Array, Param_Cell, Param_Cell);
g_hFwd_OnClientItemDisconnect = CreateGlobalForward("EW_OnClientItemDisconnect", ET_Ignore, Param_Array, Param_Cell, Param_Cell);
g_hFwd_OnClientItemCanPickup = CreateGlobalForward("EW_OnClientItemCanPickup", ET_Hook, Param_Array, Param_Cell, Param_Cell);
g_hFwd_OnClientItemCanActivate = CreateGlobalForward("EW_OnClientItemCanActivate", ET_Hook, Param_Array, Param_Cell, Param_Cell);
g_hArray_Items = new ArrayList(512);
g_hArray_Config = new ArrayList(512);
HookEvent("player_death", OnClientDeath);
HookEvent("round_start", OnRoundStart);
if (g_bLate)
{
for (int client = 1; client <= MaxClients; client++)
{
if (!IsClientInGame(client) || IsFakeClient(client))
continue;
SDKHook(client, SDKHook_WeaponEquipPost, OnWeaponPickup);
SDKHook(client, SDKHook_WeaponDropPost, OnWeaponDrop);
SDKHook(client, SDKHook_WeaponCanUse, OnWeaponTouch);
@ -99,25 +99,25 @@ public void OnMapStart()
{
g_hArray_Items.Clear();
g_hArray_Config.Clear();
char sCurrentMap[128];
GetCurrentMap(sCurrentMap, sizeof(sCurrentMap));
String_ToLower(sCurrentMap, sCurrentMap, sizeof(sCurrentMap));
char sFilePathDefault[PLATFORM_MAX_PATH];
char sFilePathOverride[PLATFORM_MAX_PATH];
BuildPath(Path_SM, sFilePathDefault, sizeof(sFilePathDefault), "configs/entwatch/%s.cfg", sCurrentMap);
BuildPath(Path_SM, sFilePathOverride, sizeof(sFilePathOverride), "configs/entwatch/%s.override.cfg", sCurrentMap);
KeyValues hConfig = new KeyValues("items");
if (FileExists(sFilePathOverride))
{
if (!hConfig.ImportFromFile(sFilePathOverride))
{
LogMessage("Unable to load config \"%s\"!", sFilePathOverride);
delete hConfig;
return;
}
@ -128,13 +128,13 @@ public void OnMapStart()
if (!hConfig.ImportFromFile(sFilePathDefault))
{
LogMessage("Unable to load config \"%s\"!", sFilePathDefault);
delete hConfig;
return;
}
else LogMessage("Loaded config \"%s\"", sFilePathDefault);
}
if (hConfig.GotoFirstSubKey())
{
do
@ -144,7 +144,7 @@ public void OnMapStart()
hConfig.GetString("short", itemArray[item_short], sizeof(itemArray[item_short]));
hConfig.GetString("color", itemArray[item_color], sizeof(itemArray[item_color]));
hConfig.GetString("filter", itemArray[item_filter], sizeof(itemArray[item_filter]));
itemArray[item_weaponid] = hConfig.GetNum("weaponid");
itemArray[item_buttonid] = hConfig.GetNum("buttonid");
itemArray[item_triggerid] = hConfig.GetNum("triggerid");
@ -152,12 +152,12 @@ public void OnMapStart()
itemArray[item_mode] = hConfig.GetNum("mode");
itemArray[item_maxuses] = hConfig.GetNum("maxuses");
itemArray[item_cooldown] = hConfig.GetNum("cooldown");
g_hArray_Config.PushArray(itemArray, sizeof(itemArray));
}
}
while (hConfig.GotoNextKey());
}
delete hConfig;
return;
}
@ -173,7 +173,7 @@ public void OnRoundStart(Event hEvent, const char[] sEvent, bool bDontBroadcast)
{
any itemArray[items];
g_hArray_Items.GetArray(index, itemArray, sizeof(itemArray));
if (itemArray[item_owned] && itemArray[item_owner] >= 0)
g_hArray_Items.Erase(index);
}
@ -202,19 +202,19 @@ public void OnEntitySpawned(int entity)
{
any itemArray[items];
g_hArray_Items.GetArray(index, itemArray, sizeof(itemArray));
if (RegisterItem(itemArray, entity))
{
g_hArray_Items.SetArray(index, itemArray, sizeof(itemArray));
return;
}
}
for (int index; index < g_hArray_Config.Length; index++)
{
any itemArray[items];
g_hArray_Config.GetArray(index, itemArray, sizeof(itemArray));
if (RegisterItem(itemArray, entity))
{
g_hArray_Items.PushArray(itemArray, sizeof(itemArray));
@ -245,7 +245,7 @@ stock bool RegisterItem(any[] itemArray, int entity)
(itemArray[item_weapon] && Entity_GetParent(entity) == itemArray[item_weapon])))
{
SDKHook(entity, SDKHook_Use, OnButtonPress);
itemArray[item_button] = entity;
return true;
}
@ -258,7 +258,7 @@ stock bool RegisterItem(any[] itemArray, int entity)
SDKHook(entity, SDKHook_StartTouch, OnTriggerTouch);
SDKHook(entity, SDKHook_EndTouch, OnTriggerTouch);
SDKHook(entity, SDKHook_Touch, OnTriggerTouch);
itemArray[item_trigger] = entity;
return true;
}
@ -278,25 +278,25 @@ public void OnEntityDestroyed(int entity)
{
any itemArray[items];
g_hArray_Items.GetArray(index, itemArray, sizeof(itemArray));
if (itemArray[item_weapon] && itemArray[item_weapon] == entity)
{
g_hArray_Items.Erase(index);
return;
}
if (itemArray[item_button] && itemArray[item_button] == entity)
{
itemArray[item_button] = INVALID_ENT_REFERENCE;
g_hArray_Items.SetArray(index, itemArray, sizeof(itemArray));
return;
}
if (itemArray[item_trigger] && itemArray[item_trigger] == entity)
{
itemArray[item_trigger] = INVALID_ENT_REFERENCE;
g_hArray_Items.SetArray(index, itemArray, sizeof(itemArray));
return;
}
@ -328,18 +328,18 @@ public void OnClientDisconnect(int client)
{
any itemArray[items];
g_hArray_Items.GetArray(index, itemArray, sizeof(itemArray));
if (itemArray[item_owned] && itemArray[item_owner] == client)
{
itemArray[item_owner] = INVALID_ENT_REFERENCE;
itemArray[item_owned] = false;
Call_StartForward(g_hFwd_OnClientItemDisconnect);
Call_PushArray(itemArray, sizeof(itemArray));
Call_PushCell(client);
Call_PushCell(index);
Call_Finish();
g_hArray_Items.SetArray(index, itemArray, sizeof(itemArray));
}
}
@ -352,25 +352,25 @@ public void OnClientDisconnect(int client)
public void OnClientDeath(Event hEvent, const char[] sEvent, bool bDontBroadcast)
{
int client = GetClientOfUserId(hEvent.GetInt("userid"));
if (Client_IsValid(client) && !IsFakeClient(client) && g_hArray_Items.Length)
{
for (int index; index < g_hArray_Items.Length; index++)
{
any itemArray[items];
g_hArray_Items.GetArray(index, itemArray, sizeof(itemArray));
if (itemArray[item_owned] && itemArray[item_owner] == client)
{
itemArray[item_owner] = INVALID_ENT_REFERENCE;
itemArray[item_owned] = false;
Call_StartForward(g_hFwd_OnClientItemDeath);
Call_PushArray(itemArray, sizeof(itemArray));
Call_PushCell(client);
Call_PushCell(index);
Call_Finish();
g_hArray_Items.SetArray(index, itemArray, sizeof(itemArray));
}
}
@ -388,18 +388,18 @@ public Action OnWeaponPickup(int client, int weapon)
{
any itemArray[items];
g_hArray_Items.GetArray(index, itemArray, sizeof(itemArray));
if (itemArray[item_weapon] && itemArray[item_weapon] == weapon)
{
itemArray[item_owner] = client;
itemArray[item_owned] = true;
Call_StartForward(g_hFwd_OnClientItemPickup);
Call_PushArray(itemArray, sizeof(itemArray));
Call_PushCell(client);
Call_PushCell(index);
Call_Finish();
g_hArray_Items.SetArray(index, itemArray, sizeof(itemArray));
return;
}
@ -418,18 +418,18 @@ public Action OnWeaponDrop(int client, int weapon)
{
any itemArray[items];
g_hArray_Items.GetArray(index, itemArray, sizeof(itemArray));
if (itemArray[item_weapon] && itemArray[item_weapon] == weapon)
{
itemArray[item_owner] = INVALID_ENT_REFERENCE;
itemArray[item_owned] = false;
Call_StartForward(g_hFwd_OnClientItemDrop);
Call_PushArray(itemArray, sizeof(itemArray));
Call_PushCell(client);
Call_PushCell(index);
Call_Finish();
g_hArray_Items.SetArray(index, itemArray, sizeof(itemArray));
return;
}
@ -447,12 +447,12 @@ public Action OnButtonPress(int button, int client)
if (HasEntProp(button, Prop_Data, "m_bLocked") &&
GetEntProp(button, Prop_Data, "m_bLocked"))
return Plugin_Handled;
for (int index; index < g_hArray_Items.Length; index++)
{
any itemArray[items];
g_hArray_Items.GetArray(index, itemArray, sizeof(itemArray));
if (itemArray[item_button] && itemArray[item_button] == button)
{
if (itemArray[item_owned] && itemArray[item_owner] == client)
@ -463,7 +463,7 @@ public Action OnButtonPress(int button, int client)
Call_PushCell(client);
Call_PushCell(index);
Call_Finish(aResult);
if ((aResult == Plugin_Continue) || (aResult == Plugin_Changed))
{
switch(itemArray[item_mode])
@ -498,7 +498,7 @@ public Action OnButtonPress(int button, int client)
if (itemArray[item_nextuse] < RoundToCeil(GetEngineTime()))
{
itemArray[item_uses]++;
if (itemArray[item_uses] >= itemArray[item_maxuses])
{
itemArray[item_nextuse] = RoundToCeil(GetEngineTime()) + itemArray[item_cooldown];
@ -508,17 +508,17 @@ public Action OnButtonPress(int button, int client)
else return Plugin_Handled;
}
}
if (itemArray[item_filter][0])
Entity_SetName(client, itemArray[item_filter]);
Call_StartForward(g_hFwd_OnClientItemActivate);
Call_PushArray(itemArray, sizeof(itemArray));
Call_PushCell(client);
Call_PushCell(index);
Call_Finish();
}
g_hArray_Items.SetArray(index, itemArray, sizeof(itemArray));
return aResult;
}
@ -539,7 +539,7 @@ public Action OnTriggerTouch(int trigger, int client)
{
any itemArray[items];
g_hArray_Items.GetArray(index, itemArray, sizeof(itemArray));
if (itemArray[item_trigger] && itemArray[item_trigger] == trigger)
{
Action aResult;
@ -548,7 +548,7 @@ public Action OnTriggerTouch(int trigger, int client)
Call_PushCell(client);
Call_PushCell(index);
Call_Finish(aResult);
g_hArray_Items.SetArray(index, itemArray, sizeof(itemArray));
return aResult;
}
@ -568,7 +568,7 @@ public Action OnWeaponTouch(int client, int weapon)
{
any itemArray[items];
g_hArray_Items.GetArray(index, itemArray, sizeof(itemArray));
if (itemArray[item_weapon] && itemArray[item_weapon] == weapon)
{
Action aResult;
@ -577,7 +577,7 @@ public Action OnWeaponTouch(int client, int weapon)
Call_PushCell(client);
Call_PushCell(index);
Call_Finish(aResult);
g_hArray_Items.SetArray(index, itemArray, sizeof(itemArray));
return aResult;
}
@ -600,12 +600,12 @@ public int Native_GetItemCount(Handle hPlugin, int numParams)
public int Native_GetItemArray(Handle hPlugin, int numParams)
{
any itemArray[items];
int index = GetNativeCell(1);
int size = GetNativeCell(3);
g_hArray_Items.GetArray(index, itemArray, size);
SetNativeArray(2, itemArray, size);
}
@ -615,11 +615,11 @@ public int Native_GetItemArray(Handle hPlugin, int numParams)
public int Native_SetItemArray(Handle hPlugin, int numParams)
{
any itemArray[items];
int index = GetNativeCell(1);
int size = GetNativeCell(3);
GetNativeArray(2, itemArray, size);
g_hArray_Items.SetArray(index, itemArray, size);
}

View File

@ -33,12 +33,12 @@ public void OnGameFrame()
{
char sHUDFormat[250];
char sHUDBuffer[64];
for (int index; index < EW_GetItemCount(); index++)
{
any itemArray[items];
EW_GetItemArray(index, itemArray, sizeof(itemArray));
if (itemArray[item_display] & DISPLAY_HUD)
{
if (itemArray[item_owned] && itemArray[item_owner] >= 0)
@ -101,7 +101,7 @@ public void OnGameFrame()
Format(sHUDBuffer, sizeof(sHUDBuffer), "%s [%s]: %N", itemArray[item_short], "N/A", itemArray[item_owner]);
}
}
if (strlen(sHUDFormat) + strlen(sHUDBuffer) <= sizeof(sHUDFormat) - 2)
{
Format(sHUDFormat, sizeof(sHUDFormat), "%s\n%s", sHUDFormat, sHUDBuffer);
@ -110,7 +110,7 @@ public void OnGameFrame()
}
}
}
Handle hMessage = StartMessageAll("KeyHintText");
BfWriteByte(hMessage, 1);
BfWriteString(hMessage, sHUDFormat);

View File

@ -44,10 +44,10 @@ public void EW_OnClientItemDrop(any[] itemArray, int client, int index)
{
char sName[32];
GetClientName(client, sName, sizeof(sName));
char sAuth[32];
GetClientAuthId(client, AuthId_Steam2, sAuth, sizeof(sAuth));
CRemoveTags(sName, sizeof(sName));
CPrintToChatAll(MESSAGEFORMAT, "E01B5D", "EDEDED", sName, "E562BA", "B2B2B2", sAuth, "E562BA", "Item Drop", itemArray[item_color], itemArray[item_name]);
}
@ -62,10 +62,10 @@ public void EW_OnClientItemDeath(any[] itemArray, int client, int index)
{
char sName[32];
GetClientName(client, sName, sizeof(sName));
char sAuth[32];
GetClientAuthId(client, AuthId_Steam2, sAuth, sizeof(sAuth));
CRemoveTags(sName, sizeof(sName));
CPrintToChatAll(MESSAGEFORMAT, "E01B5D", "EDEDED", sName, "F1B567", "B2B2B2", sAuth, "F1B567", "Item Death", itemArray[item_color], itemArray[item_name]);
}
@ -80,10 +80,10 @@ public void EW_OnClientItemPickup(any[] itemArray, int client, int index)
{
char sName[32];
GetClientName(client, sName, sizeof(sName));
char sAuth[32];
GetClientAuthId(client, AuthId_Steam2, sAuth, sizeof(sAuth));
CRemoveTags(sName, sizeof(sName));
CPrintToChatAll(MESSAGEFORMAT, "E01B5D", "EDEDED", sName, "C9EF66", "B2B2B2", sAuth, "C9EF66", "Item Pickup", itemArray[item_color], itemArray[item_name]);
}
@ -98,10 +98,10 @@ public void EW_OnClientItemDisconnect(any[] itemArray, int client, int index)
{
char sName[32];
GetClientName(client, sName, sizeof(sName));
char sAuth[32];
GetClientAuthId(client, AuthId_Steam2, sAuth, sizeof(sAuth));
CRemoveTags(sName, sizeof(sName));
CPrintToChatAll(MESSAGEFORMAT, "E01B5D", "EDEDED", sName, "F1B567", "B2B2B2", sAuth, "F1B567", "Item Disconnect", itemArray[item_color], itemArray[item_name]);
}
@ -116,10 +116,10 @@ public void EW_OnClientItemActivate(any[] itemArray, int client, int index)
{
char sName[32];
GetClientName(client, sName, sizeof(sName));
char sAuth[32];
GetClientAuthId(client, AuthId_Steam2, sAuth, sizeof(sAuth));
CRemoveTags(sName, sizeof(sName));
CPrintToChatAll(MESSAGEFORMAT, "E01B5D", "EDEDED", sName, "67ADDF", "B2B2B2", sAuth, "67ADDF", "Item Activate", itemArray[item_color], itemArray[item_name]);
}

View File

@ -48,7 +48,7 @@ public APLRes AskPluginLoad2(Handle hMyself, bool bLate, char[] sError, int erro
CreateNative("EW_ClientRestrict", Native_ClientRestrict);
CreateNative("EW_ClientUnrestrict", Native_ClientUnrestrict);
CreateNative("EW_ClientRestricted", Native_ClientRestricted);
RegPluginLibrary("entWatch-restrictions");
return APLRes_Success;
}
@ -60,14 +60,14 @@ public void OnPluginStart()
{
LoadTranslations("common.phrases");
LoadTranslations("entWatch.restrictions.phrases");
g_hFwd_OnClientRestricted = CreateGlobalForward("EW_OnClientRestricted", ET_Ignore, Param_Cell, Param_Cell, Param_Cell);
g_hFwd_OnClientUnrestricted = CreateGlobalForward("EW_OnClientUnrestricted", ET_Ignore, Param_Cell, Param_Cell);
g_hCookie_RestrictIssued = RegClientCookie("EW_RestrictIssued", "", CookieAccess_Private);
g_hCookie_RestrictLength = RegClientCookie("EW_RestrictLength", "", CookieAccess_Private);
g_hCookie_RestrictExpire = RegClientCookie("EW_RestrictExpire", "", CookieAccess_Private);
RegAdminCmd("sm_eban", Command_ClientRestrict, ADMFLAG_BAN);
RegAdminCmd("sm_eunban", Command_ClientUnrestrict, ADMFLAG_UNBAN);
}
@ -102,18 +102,18 @@ public Action Command_ClientRestrict(int client, int args)
CReplyToCommand(client, "\x07%s[entWatch] \x07%sUsage: sm_eban <#userid/name> [duration]", "E01B5D", "F16767");
return Plugin_Handled;
}
char sTarget[32];
char sLength[32];
GetCmdArg(1, sTarget, sizeof(sTarget));
GetCmdArg(2, sLength, sizeof(sLength));
int target;
if ((target = FindTarget(client, sTarget, true)) == -1)
return Plugin_Handled;
int length = StringToInt(sLength);
if (ClientRestrict(client, target, length))
{
if (length)
@ -127,7 +127,7 @@ public Action Command_ClientRestrict(int client, int args)
LogAction(client, target, "%L restricted %L permanently.", client, target);
}
}
return Plugin_Handled;
}
@ -141,20 +141,20 @@ public Action Command_ClientUnrestrict(int client, int args)
CReplyToCommand(client, "\x07%s[entWatch] \x07%sUsage: sm_eunban <#userid/name>", "E01B5D", "F16767");
return Plugin_Handled;
}
char sTarget[32];
GetCmdArg(1, sTarget, sizeof(sTarget));
int target;
if ((target = FindTarget(client, sTarget, true)) == -1)
return Plugin_Handled;
if (ClientUnrestrict(client, target))
{
CPrintToChatAll("\x07%s[entWatch] \x07%s%N\x07%s unrestricted \x07%s%N\x07%s.", "E01B5D", "EDEDED", client, "F16767", "EDEDED", target, "F16767");
LogAction(client, target, "%L unrestricted %L.", client, target);
}
return Plugin_Handled;
}
@ -181,25 +181,25 @@ stock bool ClientRestrict(int client, int target, int length)
{
if (!Client_IsValid(client) || !Client_IsValid(target) || !AreClientCookiesCached(target) || ClientRestricted(target))
return false;
int issued = GetTime();
int second = length * 60;
int expire = issued + second;
g_iRestrictIssued[target] = issued;
g_iRestrictLength[target] = length;
g_iRestrictExpire[target] = expire;
SetClientCookieInt(target, g_hCookie_RestrictIssued, issued);
SetClientCookieInt(target, g_hCookie_RestrictLength, length);
SetClientCookieInt(target, g_hCookie_RestrictExpire, expire);
Call_StartForward(g_hFwd_OnClientRestricted);
Call_PushCell(client);
Call_PushCell(target);
Call_PushCell(length);
Call_Finish();
return true;
}
@ -210,20 +210,20 @@ stock bool ClientUnrestrict(int client, int target)
{
if (!Client_IsValid(client) || !Client_IsValid(target) || !AreClientCookiesCached(target) || !ClientRestricted(target))
return false;
g_iRestrictIssued[target] = 0;
g_iRestrictLength[target] = 0;
g_iRestrictExpire[target] = 0;
SetClientCookieInt(target, g_hCookie_RestrictIssued, 0);
SetClientCookieInt(target, g_hCookie_RestrictLength, 0);
SetClientCookieInt(target, g_hCookie_RestrictExpire, 0);
Call_StartForward(g_hFwd_OnClientUnrestricted);
Call_PushCell(client);
Call_PushCell(target);
Call_Finish();
return true;
}
@ -234,19 +234,19 @@ stock bool ClientRestricted(int client)
{
if (!Client_IsValid(client))
return false;
//Block them when loading cookies..
if (!AreClientCookiesCached(client))
return true;
//Permanent restriction..
if (g_iRestrictExpire[client] && g_iRestrictLength[client] == 0)
return true;
//Limited restriction..
if (g_iRestrictExpire[client] && g_iRestrictExpire[client] >= GetTime())
return true;
return false;
}
@ -281,7 +281,7 @@ stock void SetClientCookieInt(int client, Handle hCookie, int value)
{
char sValue[32];
IntToString(value, sValue, sizeof(sValue));
SetClientCookie(client, hCookie, sValue);
}
@ -292,6 +292,6 @@ stock int GetClientCookieInt(int client, Handle hCookie)
{
char sValue[32];
GetClientCookie(client, hCookie, sValue, sizeof(sValue));
return StringToInt(sValue);
}

View File

@ -8,7 +8,7 @@ public SharedPlugin __pl_entWatch_core =
{
name = "entWatch-core",
file = "entWatch-core.smx",
#if defined REQUIRE_PLUGIN
required = 1
#else

View File

@ -8,7 +8,7 @@ public SharedPlugin __pl_entWatch_core =
{
name = "entWatch-restrictions",
file = "entWatch-restrictions.smx",
#if defined REQUIRE_PLUGIN
required = 1
#else

View File

@ -23,69 +23,69 @@ enum CCC_ColorType {
/**
* Gets a client's color as a hexadecimal integer.
*
*
* @param client Client index
* @param type Color type to retreive
* @param alpha Pass a boolean variable by reference here and it will be true if the color has alpha specified or false if it doesn't (or is a stock color)
* @return Color as a hexadecimal integer (use %X in formatting to get a hexadecimal string)
*
*
* On error/errors: Invalid client index or client is not in game
*/
native int CCC_GetColor(int client, CCC_ColorType type, bool &alpha = false);
/**
* Sets a client's color as a hexadecimal integer.
*
*
* @param client Client index
* @param type Color type to set
* @param color Integer representation of the color (use StringToInt(input, 16) to convert a hexadecimal string) or one of the color defines
* @param alpha Are you specifying a color with alpha?
* @return True if the color is updated successfully, false otherwise
*
*
* On error/errors: Invalid client index or client is not in game
*/
native int CCC_SetColor(int client, CCC_ColorType type, int color, bool alpha);
/**
* Gets a client's tag
*
*
* @param client Client index
* @param buffer Buffer to store the tag in
* @param maxlen Maximum buffer length
* @noreturn
*
*
* On error/errors: Invalid client index or client is not in game
*/
native int CCC_GetTag(int client, char[] buffer, int maxlen);
/**
* Sets a client's tag
*
*
* @param client Client index
* @param tag String containing the new tag
* @noreturn
*
*
* On error/errors: Invalid client index or client is not in game
*/
native void CCC_SetTag(int client, const char[] tag);
/**
* Resets a client's color to the value in the config file.
*
*
* @param client Client index
* @param type Color type to restore
* @noreturn
*
*
* On error/errors: Invalid client index or client is not in game
*/
native int CCC_ResetColor(int client, CCC_ColorType type);
/**
* Resets a client's tag to the value in the config file.
*
*
* @param client Client index
* @noreturn
*
*
* On error/errors: Invalid client index or client is not in game
*/
native int CCC_ResetTag(int client);
@ -93,7 +93,7 @@ native int CCC_ResetTag(int client);
/**
* Called when a cilent's name is about to be colored
* DO NOT START A NEW USERMESSAGE (i.e. PrintToChat, PrintToChatAll) WITHIN THIS FORWARD
*
*
* @param client Client index
* @return Plugin_Handled to prevent coloring, Plugin_Continue to allow coloring
*/
@ -103,7 +103,7 @@ native int CCC_ResetTag(int client);
/**
* Called when a client's chat is about to be colored
* DO NOT START A NEW USERMESSAGE (i.e. PrintToChat, PrintToChatAll) WITHIN THIS FORWARD
*
*
* @param client Client index
* @return Plugin_Handled to prevent coloring, Plugin_Continue to allow coloring
*/
@ -113,7 +113,7 @@ native int CCC_ResetTag(int client);
/**
* Called when a client's name is about to be tagged
* DO NOT START A NEW USERMESSAGE (i.e. PrintToChat, PrintToChatAll) WITHIN THIS FORWARD
*
*
* @param client Client index
* @return Plugin_Handled to prevent tagging, Plugin_Continue to allow tagging
*/
@ -123,7 +123,7 @@ native int CCC_ResetTag(int client);
/**
* Called when a client's name is about to be tagged
* DO NOT START A NEW USERMESSAGE (i.e. PrintToChat, PrintToChatAll) WITHIN THIS FORWARD
*
*
* @param client Client index
* @param message Chat message that will be printed
* @param type What type of color will be applied. If this is CCC_TagColor, it controls whether the tag will be applied at all, not whether the tag will be colored.
@ -133,7 +133,7 @@ native int CCC_ResetTag(int client);
/**
* Called when a message has been fully colored and will be sent, unless further plugins modify it through Simple Chat Processor
*
*
* @param client Recieving client index
* @param author Author client index
* @param message Message
@ -144,7 +144,7 @@ forward Action CCC_OnChatMessage(int client, int author, const char[] message);
/**
* Called when a client's colors and tag are about to be loaded from the config file
* At this point, the client has NO COLORS
*
*
* @param client Client index
* @return Plugin_Handled or Plugin_Stop to prevent loading, Plugin_Continue or Plugin_Changed to allow
*/
@ -152,7 +152,7 @@ forward Action CCC_OnUserConfigPreLoaded(int client);
/**
* Called when a client's colors and tag have been loaded from the config file
*
*
* @param client Client index
* @noreturn
*/
@ -160,14 +160,14 @@ forward void CCC_OnUserConfigLoaded(int client);
/**
* Called when the configuration file is reloaded with the sm_reloadccc command
*
*
* @noreturn
*/
forward void CCC_OnConfigReloaded();
native int CCC_UpdateIgnoredArray(bool IgnoredArray[(MAXPLAYERS + 1) * (MAXPLAYERS + 1)]);
public SharedPlugin __pl_ccc =
public SharedPlugin __pl_ccc =
{
name = "ccc",
file = "custom-chatcolors.smx",

View File

@ -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",

View File

@ -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
*/

View File

@ -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

View File

@ -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;
}

View File

@ -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
*/

View File

@ -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);

View File

@ -12,7 +12,7 @@
* 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
@ -52,7 +52,7 @@ enum CanNominateResult
/**
* Called whenever warning timer starts
*
*
*/
forward void OnMapVoteWarningStart();
@ -68,7 +68,7 @@ forward void OnMapVoteWarningTick(int time);
/**
* Called whenever vote starts
*
*
* @deprecated Will be removed in MapChooser 1.8. Use OnMapVoteStarted instead.
*/
forward void OnMapVoteStart();
@ -81,7 +81,7 @@ forward void OnMapVoteEnd(const char[] map);
/**
* Is a map on the current game's official list?
* This should be treated as informative only.
*
*
* @param map Name of map to check
* @return true if it's on the list of official maps for this game
*/
@ -89,7 +89,7 @@ native bool IsMapOfficial(const char[] map);
/**
* Is nominate allowed?
*
*
* @return A CanNominateResult corresponding to whether a vote is allowed or not
*/
native CanNominateResult CanNominate();
@ -97,7 +97,7 @@ native CanNominateResult CanNominate();
/**
* Add map to nomination exclude list.
* Known as cooldown.
*
*
* @param map Name of map
* @param cooldown Cooldown, interpretation depends on mode.
* @param mode 0: Normal, use cooldown value from config/default.
@ -130,7 +130,7 @@ native int GetMapGroup(const char[] map, char[] group, int size);
// >=0 = Group _max -> Group full
native int GetMapGroupRestriction(const char[] map, int client = 0);
public SharedPlugin __pl_mapchooser_extended =
public SharedPlugin __pl_mapchooser_extended =
{
name = "mapchooser",
file = "mapchooser_extended.smx",

View File

@ -8,7 +8,7 @@
* 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
@ -28,7 +28,7 @@
*
* Version: $Id$
*/
#include <menus>
#include <sourcemod>
@ -66,7 +66,7 @@ MenuAction_Display A menu is about to be displayed (param1=client). If you choo
MenuAction_Select An item was selected (param1=client, param2=item). For subplugin support.
MenuAction_End A vote has fully ended and the vote object is ready to be cleaned up
param1 is MenuEnd reason, either MenuEnd_VotingCancelled or MenuEnd_VotingDone
MenuAction_VoteEnd A vote sequence has succeeded (param1=chosen item)
MenuAction_VoteEnd A vote sequence has succeeded (param1=chosen item)
This is not called if NativeVotes_SetResultCallback has been used on the vote.
You should call NativeVotes_DisplayPass or NativeVotes_DisplayPassEx after this
MenuAction_VoteStart A vote sequence has started (nothing passed). Use this instead of MenuAction_Start
@ -181,17 +181,17 @@ enum NativeVotesCallFailType
/*
* Is a specific vote type supported by this game?
*
*
* @param voteType Vote type
*/
native bool:NativeVotes_IsVoteTypeSupported(NativeVotesType:voteType);
/**
* Creates a new, empty vote.
*
*
* @param handler Function which will receive vote actions.
* @param voteType Vote type, cannot be changed after set
* @param actions Optionally set which actions to receive. Start,
* @param actions Optionally set which actions to receive. Start,
* Cancel, and End will always be received regardless
* of whether they are set or not. They are also
* the only default actions.
@ -202,9 +202,9 @@ native Handle:NativeVotes_Create(MenuHandler:handler, NativeVotesType:voteType,
/**
* Frees all handles related to a vote.
*
*
* THIS MUST BE CALLED TO AVOID HANDLE LEAKS
*
*
* @param vote Vote handle
* @noreturn
*/
@ -261,13 +261,13 @@ native NativeVotes_RemoveAllItems(Handle:vote);
* @return True on success, false if position is invalid.
* @error Invalid Handlem
*/
native bool:NativeVotes_GetItem(Handle:vote,
position,
String:infoBuf[],
native bool:NativeVotes_GetItem(Handle:vote,
position,
String:infoBuf[],
infoBufLen,
String:dispBuf[]="",
dispBufLen=0);
/**
* Returns the number of items in a vote.
*
@ -325,9 +325,9 @@ native NativeVotes_GetTitle(Handle:vote, String:buffer[], maxlength);
/**
* Sets the target userid for vote
* This should be used instead of SetArgument for votes that target players
*
*
* Also sets target SteamID
*
*
* @param vote Vote Handle.
* @param userid Client index of target player
* @param setDetails If true, also sets vote details to client's name
@ -367,7 +367,7 @@ native bool:NativeVotes_IsVoteInProgress();
/**
* Returns a style's maximum items
*
*
* @return Maximum items
*/
native NativeVotes_GetMaxItems();
@ -376,7 +376,7 @@ native NativeVotes_GetMaxItems();
* Sets a vote's option flags.
*
* If a certain bit is not supported, it will be stripped before being set.
*
*
* NOTE: This is currently unused, but reserved for future use.
*
* @param menu Builtin Vote Handle.
@ -407,11 +407,11 @@ native NativeVotes_Cancel();
/**
* Callback for when a vote has ended and results are available.
*
*
* Due to SourceMod Forward limitations in plugins, multi-dimension arrays can't be passed
* to forwards. This means we have to split the client_info and item_info arrays into
* their components.
*
*
* @param vote The vote being voted on.
* @param num_votes Number of votes tallied in total.
* @param num_clients Number of clients who could vote.
@ -433,13 +433,13 @@ typedef NativeVotes_VoteHandler = function int (Handle vote,
/**
* Function to convert client/vote arrays into their two-dimensional versions,
* which can then be passed to a standard vote handler.
*
*
* client_info and item_info are the resulting arrays.
*
*
* Note: When declaring client_info and item_info, you'll probably want to declare them like this:
* new client_info[num_clients][2];
* new item_info[num_items][2];
*
*
* @param num_clients Number of clients who could vote.
* @param client_indexes Array of client indexes. Parallel with client_votes.
* @param client_votes Array of client votes. Parallel with client_indexes.
@ -457,7 +457,7 @@ stock NativeVotes_FixResults(num_clients,
num_items,
const item_indexes[],
const item_votes[],
client_info[][],
client_info[][],
item_info[][])
{
for (new i = 0; i < num_clients; ++i)
@ -465,7 +465,7 @@ stock NativeVotes_FixResults(num_clients,
client_info[i][VOTEINFO_CLIENT_INDEX] = client_indexes[i];
client_info[i][VOTEINFO_CLIENT_ITEM] = client_votes[i];
}
for (new i = 0; i < num_items; ++i)
{
item_info[i][VOTEINFO_ITEM_INDEX] = item_indexes[i];
@ -494,8 +494,8 @@ native NativeVotes_SetResultCallback(Handle:vote, NativeVotes_VoteHandler:callba
native NativeVotes_CheckVoteDelay();
/**
* Returns whether a client is in the pool of clients allowed
* to participate in the current vote. This is determined by
* 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 NativeVotes_Display().
*
* @param client Client index.
@ -509,16 +509,16 @@ native bool:NativeVotes_IsClientInVotePool(client);
*
* @param client Client index.
* @param revotes True to allow revotes, false otherwise.
* @return True on success, false if the client is in the vote pool
* @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,
* @error No vote in progress, client is not in the voting pool,
* or client index is invalid.
*/
native bool:NativeVotes_RedrawClientVote(client, bool:revotes=true);
/**
* Retrieve the vote type
*
*
* @param vote NativeVotes Handle.
* @return The built in vote type
* @error Invalid Handle
@ -527,9 +527,9 @@ native NativeVotesType:NativeVotes_GetType(Handle:vote);
/**
* Set the team this vote is for, or NATIVEVOTES_ALL_TEAMS for all teams.
*
*
* Defaults to NATIVEVOTES_ALL_TEAMS if not explicitly set.
*
*
* @param vote NativeVotes Handle.
* @param team Team number this vote is for
* @noreturn
@ -539,7 +539,7 @@ native NativeVotes_SetTeam(Handle:vote, team);
/**
* Retrieve the team this vote is for
*
*
* @param vote NativeVotes Handle.
* @return Team index or NATIVEVOTES_ALL_TEAMS for all teams.
* @error Invalid Handle
@ -549,9 +549,9 @@ native NativeVotes_GetTeam(Handle:vote);
/**
* Set the client index of the player who initiated the vote.
* Use NATIVEVOTES_SERVER_INDEX if initiated by the server itself.
*
*
* Defaults to NATIVEVOTES_SERVER_INDEX if not explicitly set.
*
*
* @param vote NativeVotes Handle.
* @param client Client who initiated the vote or NATIVEVOTES_SERVER_INDEX
* @noreturn
@ -560,9 +560,9 @@ native NativeVotes_GetTeam(Handle:vote);
native NativeVotes_SetInitiator(Handle:vote, client);
/**
* Retrieve the client index of the player who initiated the vote or NATIVEVOTES_SERVER_INDEX if
* Retrieve the client index of the player who initiated the vote or NATIVEVOTES_SERVER_INDEX if
* initiated by the server itself.
*
*
* @param Vote handle
* @return Client index or NATIVEVOTES_SERVER_INDEX
* @error Invalid Handle
@ -570,8 +570,8 @@ native NativeVotes_SetInitiator(Handle:vote, client);
native NativeVotes_GetInitiator(Handle:vote);
/**
* Broadcasts a vote to a list of clients. The most selected item will be
* returned through MenuAction_VoteEnd. On a tie, a random item will be returned
* Broadcasts a vote to a list of clients. The most selected item will be
* returned through MenuAction_VoteEnd. On a tie, a random item will be returned
* from a list of the tied items.
*
* Note that MenuAction_VoteStart, MenuAction_VoteCancel, MenuAction_VoteEnd, and MenuAction_End are all
@ -599,7 +599,7 @@ stock bool:NativeVotes_DisplayToAll(Handle:vote, time)
{
new total = 0;
decl players[MaxClients];
for (new i=1; i<=MaxClients; i++)
{
if (!IsClientInGame(i) || IsFakeClient(i))
@ -608,7 +608,7 @@ stock bool:NativeVotes_DisplayToAll(Handle:vote, time)
}
players[total++] = i;
}
return NativeVotes_Display(vote, players, total, time);
}
@ -628,7 +628,7 @@ stock bool:NativeVotes_DisplayToTeam(Handle:vote, team, time)
new total;
decl players[MaxClients];
for (new i=1; i<=MaxClients; i++)
{
if (!IsClientInGame(i) || IsFakeClient(i) || (GetClientTeam(i) != team))
@ -637,7 +637,7 @@ stock bool:NativeVotes_DisplayToTeam(Handle:vote, team, time)
}
players[total++] = i;
}
return NativeVotes_Display(vote, players, total, time);
}
@ -654,7 +654,7 @@ stock bool:NativeVotes_DisplayToAllNonSpectators(Handle:vote, time)
{
new total;
decl players[MaxClients];
for (new i=1; i<=MaxClients; i++)
{
if (!IsClientInGame(i) || IsFakeClient(i) || (GetClientTeam(i) < 2))
@ -663,7 +663,7 @@ stock bool:NativeVotes_DisplayToAllNonSpectators(Handle:vote, time)
}
players[total++] = i;
}
return NativeVotes_Display(vote, players, total, time);
}
@ -673,7 +673,7 @@ stock bool:NativeVotes_DisplayToAllNonSpectators(Handle:vote, time)
* You MUST call one of the NativeVotesDisplayPass* or NativeVotes_DisplayFail functions
* to hide the vote screen for users who didn't vote, and to clear out their selection
* for the next vote.
*
*
* @param vote Vote handle
* @param details Normally the item that won the vote or format string. Also used for custom vote winners
* @param ... Variable number of format parameters.
@ -687,7 +687,7 @@ native NativeVotes_DisplayPass(Handle:vote, const String:details[]="");
* You MUST call one of the NativeVotesDisplayPass* or NativeVotes_DisplayFail functions
* to hide the vote screen for users who didn't vote, and to clear out their selection
* for the next vote.
*
*
* @param vote Vote handle
* @param client client to display to
* @param format A format string.
@ -702,7 +702,7 @@ native NativeVotes_DisplayPassCustomToOne(Handle:vote, client, const String:form
* You MUST call one of the NativeVotesDisplayPass* or NativeVotes_DisplayFail functions
* to hide the vote screen for users who didn't vote, and to clear out their selection
* for the next vote.
*
*
* @param vote Vote handle
* @param format A format string.
* @param any Variable number of format parameters
@ -711,7 +711,7 @@ native NativeVotes_DisplayPassCustomToOne(Handle:vote, client, const String:form
stock NativeVotes_DisplayPassCustom(Handle:vote, const String:format[], any:...)
{
decl String:buffer[192];
for (new i = 1; i <= MaxClients; ++i)
{
if (IsClientInGame(i))
@ -731,7 +731,7 @@ stock NativeVotes_DisplayPassCustom(Handle:vote, const String:format[], any:...)
* You MUST call one of NativeVotes_DisplayPass, NativeVotes_DisplayPassEx,
* or NativeVotes_DisplayFail to hide the vote screen for users who didn't vote
* and to clear out their selection for the next vote.
*
*
* #param vote Vote handle
* @param passType The pass screen to display
* @param details Normally the item that won the vote. Also used for custom vote winners
@ -745,17 +745,17 @@ native NativeVotes_DisplayPassEx(Handle:vote, NativeVotesPassType:passType, cons
* You MUST call one of NativeVotes_DisplayPass, NativeVotes_DisplayPassEx,
* or NativeVotes_DisplayFail to hide the vote screen for users who didn't vote,
* and to clear out their selection for the next vote.
*
*
* @param reason Vote failure reason from NativeVotesFailType enum
* @noreturn
*/
native NativeVotes_DisplayFail(Handle:vote, NativeVotesFailType:reason=NativeVotesFail_Generic);
/**
* Quick stock to determine whether voting is allowed. This doesn't let you
* fine-tune a reason for not voting, so it's not recommended for lazily
* Quick stock to determine whether voting is allowed. This doesn't let you
* fine-tune a reason for not voting, so it's not recommended for lazily
* telling clients that voting isn't allowed.
*
*
* @return True if voting is allowed, false if voting is in progress
* or the cooldown is active.
*/
@ -765,15 +765,15 @@ stock bool:NativeVotes_IsNewVoteAllowed()
{
return false;
}
return true;
}
/**
* Used when callvote is called with no arguments.
*
*
* This is used to configure the VoteSetup usermessage on TF2 and CS:GO
*
*
* @param client Client, in case the votes are restricted by client
* @param voteTypes Populate this array with the vote types this server supports
* Custom and multiple choice votes are not supported from
@ -787,9 +787,9 @@ stock bool:NativeVotes_IsNewVoteAllowed()
/**
* Forward for "callvote" handling
*
*
* You should respond to this by starting a vote or by calling NativeVotes_DisplayCallVoteFail
*
*
* @param client Client
* @param voteType Type of vote being called. This will NEVER be a multiple-choice or custom vote.
* @param voteArgument Vote argument or blank if the vote type has no argument.
@ -803,7 +803,7 @@ stock bool:NativeVotes_IsNewVoteAllowed()
/**
* Register a plugin as a vote manager.
* This is used to abstract away the details of the callvote command.
*
*
* @param callHandler Handler for callvote commands.
* @param setupHandler Handler to override the which vote types your server supports. Only useful on TF2 and CS:GO.
* @noreturn
@ -814,7 +814,7 @@ stock bool:NativeVotes_IsNewVoteAllowed()
* Send a call vote fail screen to a user
* Used to respond to a callvote with invalid arguments or for other reasons
* (such as trying to target an admin for a kick/ban vote)
*
*
* @param client The client to display the fail screen to
* @param reason A vote call fail reason
* @param time For NativeVotesCallFail_Recent, the number of seconds until the vote
@ -825,7 +825,7 @@ native NativeVotes_DisplayCallVoteFail(client, NativeVotesCallFailType:reason, t
/**
* Redraws the vote title from inside a MenuAction_Display callback
* Not supported on L4D
*
*
* @param text Vote title to draw
* @error If called from outside MenuAction_Display
* @return Plugin_Changed if the change is allowed, Plugin_Continue if it isn't.
@ -835,7 +835,7 @@ native Action:NativeVotes_RedrawVoteTitle(const String:text[]);
/**
* Redraws the vote text from inside a MenuAction_DisplayItem callback.
* Only supported on multiple-choice votes
*
*
* @param text Vote text to draw.
* @error If called from outside MenuAction_DisplayItem
* @return Plugin_Changed if the change is allowed, Plugin_Continue if it isn't.
@ -859,7 +859,7 @@ stock NativeVotes_GetInfo(param2, &winningVotes, &totalVotes)
/**
* Do not edit below this line!
*/
public SharedPlugin:__pl_nativevotes =
public SharedPlugin:__pl_nativevotes =
{
name = "nativevotes",
file = "nativevotes.smx",

View File

@ -2327,7 +2327,7 @@ void CheckMapRestrictions(bool time = false, bool players = false)
CPrintToChat(client, "[MCE] %t", "Nomination Removed Time Error", map);
}
}
if (players)
{
int PlayerRestriction = InternalGetMapPlayerRestriction(map);

View File

@ -1342,7 +1342,7 @@ public Query_UnBlockSelect(Handle:owner, Handle:hndl, const String:error[], any:
#endif
TempUnBlock(data); // Datapack closed inside.
switch (type)
{
case TYPE_UNMUTE:
@ -1358,7 +1358,7 @@ public Query_UnBlockSelect(Handle:owner, Handle:hndl, const String:error[], any:
LogAction(admin, target, "\"%L\" temporary unsilenced \"%L\" (reason \"%s\")", admin, target, reason);
}
}
return;
}
else
@ -2385,7 +2385,7 @@ stock ProcessUnBlock(client, targetId = 0, type, String:sReason[] = "", const St
TempUnBlock(dataPack);
}
switch (type)
{
case TYPE_UNMUTE:

View File

@ -86,7 +86,7 @@ native bool:ZRT_IsRoundActive();
***********************************
-----------------------------------*/
public SharedPlugin:__pl_zr_tools =
public SharedPlugin:__pl_zr_tools =
{
name = "zr_tools",
file = "zr_tools.smx",

View File

@ -9,7 +9,7 @@ new Handle:kv;
new Handle:hPlayerClasses, String:sClassPath[PLATFORM_MAX_PATH] = "configs/zr/playerclasses.txt";
new bool:g_RoundEnd = false;
public Plugin:myinfo =
public Plugin:myinfo =
{
name = "[ZR] Tools",
author = "FrozDark",
@ -26,18 +26,18 @@ public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max)
CreateNative("ZRT_GetClientAttributeValueFloat", Native_GetClientAttributeValueFloat);
CreateNative("ZRT_PlayerHasAttribute", Native_PlayerHasAttribute);
CreateNative("ZRT_IsRoundActive", Native_IsRoundActive);
RegPluginLibrary("zr_tools");
return APLRes_Success;
}
public OnPluginStart()
{
CreateConVar("zr_tools_version", PLUGIN_VERSION, "Zombie:Reloaded tools plugin version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_CHEAT|FCVAR_DONTRECORD);
RegAdminCmd("zr_tools_reload", Command_Reload, ADMFLAG_ROOT);
HookEvent("round_start", Event_RoundStart);
HookEvent("round_end", Event_RoundEnd);
}
@ -69,10 +69,10 @@ public OnConfigsExecuted()
CloseHandle(kv);
}
kv = CreateKeyValues("classes");
decl String:buffer[PLATFORM_MAX_PATH];
BuildPath(Path_SM, buffer, sizeof(buffer), "%s", sClassPath);
if (!FileToKeyValues(kv, buffer))
{
SetFailState("Class data file \"%s\" not found", buffer);
@ -104,13 +104,13 @@ public Native_PlayerHasAttribute(Handle:plugin, numParams)
{
new client = GetNativeCell(1);
ValidateClient(client);
decl String:attrib[32];
GetNativeString(2, attrib, sizeof(attrib));
decl String:className[64], String:buffer[64];
ZR_GetClassDisplayName(client, className, sizeof(className), ZR_CLASS_CACHE_PLAYER);
new bool:result = false;
if (KvGotoFirstSubKey(kv))
{
@ -120,14 +120,14 @@ public Native_PlayerHasAttribute(Handle:plugin, numParams)
if (StrEqual(buffer, className, false))
{
KvGetString(kv, attrib, buffer, sizeof(buffer), "0");
result = bool:(StrContains("yes|1|true", buffer, false) != -1);
break;
}
} while (KvGotoNextKey(kv));
}
KvRewind(kv);
return result;
}
@ -135,14 +135,14 @@ public Native_GetClientAttributeString(Handle:plugin, numParams)
{
new client = GetNativeCell(1);
ValidateClient(client);
decl String:attrib[32];
GetNativeString(2, attrib, sizeof(attrib));
decl String:className[64], String:buffer[PLATFORM_MAX_PATH];
buffer[0] = '\0';
ZR_GetClassDisplayName(client, className, sizeof(className), ZR_CLASS_CACHE_PLAYER);
new bytes;
if (KvGotoFirstSubKey(kv))
{
@ -152,14 +152,14 @@ public Native_GetClientAttributeString(Handle:plugin, numParams)
if (StrEqual(buffer, className, false))
{
KvGetString(kv, attrib, buffer, sizeof(buffer), "");
SetNativeString(3, buffer, GetNativeCell(4), true, bytes);
break;
}
} while (KvGotoNextKey(kv));
}
KvRewind(kv);
if (!buffer[0])
{
GetNativeString(5, buffer, sizeof(buffer));
@ -172,15 +172,15 @@ public Native_GetClientAttributeValue(Handle:plugin, numParams)
{
new client = GetNativeCell(1);
ValidateClient(client);
decl String:attrib[32];
GetNativeString(2, attrib, sizeof(attrib));
decl String:className[64], String:buffer[PLATFORM_MAX_PATH];
ZR_GetClassDisplayName(client, className, sizeof(className), ZR_CLASS_CACHE_PLAYER);
new result = -1;
if (KvGotoFirstSubKey(kv))
{
do
@ -194,7 +194,7 @@ public Native_GetClientAttributeValue(Handle:plugin, numParams)
} while (KvGotoNextKey(kv));
}
KvRewind(kv);
return result;
}
@ -202,15 +202,15 @@ public Native_GetClientAttributeValueFloat(Handle:plugin, numParams)
{
new client = GetNativeCell(1);
ValidateClient(client);
decl String:attrib[32];
GetNativeString(2, attrib, sizeof(attrib));
decl String:className[64], String:buffer[PLATFORM_MAX_PATH];
ZR_GetClassDisplayName(client, className, sizeof(className), ZR_CLASS_CACHE_PLAYER);
new Float:result = -1.0;
if (KvGotoFirstSubKey(kv))
{
do
@ -224,7 +224,7 @@ public Native_GetClientAttributeValueFloat(Handle:plugin, numParams)
} while (KvGotoNextKey(kv));
}
KvRewind(kv);
return _:result;
}
@ -232,10 +232,10 @@ public Native_GetClientClassSectionName(Handle:plugin, numParams)
{
new client = GetNativeCell(1);
ValidateClient(client);
decl String:className[64], String:buffer[64];
ZR_GetClassDisplayName(client, className, sizeof(className), ZR_CLASS_CACHE_PLAYER);
new bytes;
if (KvGotoFirstSubKey(kv))
{
@ -245,14 +245,14 @@ public Native_GetClientClassSectionName(Handle:plugin, numParams)
if (StrEqual(buffer, className, false))
{
KvGetSectionName(kv, buffer, sizeof(buffer));
SetNativeString(2, buffer, GetNativeCell(3), true, bytes);
break;
}
} while (KvGotoNextKey(kv));
}
KvRewind(kv);
return bytes;
}