- updated basecommands and basefuncommands to use ProcessTargetString() and ShowActivity2()
- moved a bunch of translation phrases around - ShowActivity2() no longer prints to console - fixed a memory corruption bug in the translation parser --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401630
This commit is contained in:
parent
04b2845b0d
commit
53156446d4
@ -473,6 +473,7 @@ SMCParseResult CPhraseFile::ReadSMC_KeyValue(const char *key, const char *value,
|
|||||||
pPhrase = (phrase_t *)m_pMemory->GetAddress(m_CurPhrase);
|
pPhrase = (phrase_t *)m_pMemory->GetAddress(m_CurPhrase);
|
||||||
pTrans = (trans_t *)m_pMemory->GetAddress(pPhrase->trans_tbl);
|
pTrans = (trans_t *)m_pMemory->GetAddress(pPhrase->trans_tbl);
|
||||||
fmt_list = (int *)m_pMemory->GetAddress(pPhrase->fmt_list);
|
fmt_list = (int *)m_pMemory->GetAddress(pPhrase->fmt_list);
|
||||||
|
out_buf = (char *)m_pMemory->GetAddress(out_idx);
|
||||||
pTrans = &pTrans[lang];
|
pTrans = &pTrans[lang];
|
||||||
|
|
||||||
/* Now it's safe to save the index */
|
/* Now it's safe to save the index */
|
||||||
|
@ -884,8 +884,7 @@ static cell_t GetClientOfUserId(IPluginContext *pContext, const cell_t *params)
|
|||||||
static cell_t _ShowActivity(IPluginContext *pContext,
|
static cell_t _ShowActivity(IPluginContext *pContext,
|
||||||
const cell_t *params,
|
const cell_t *params,
|
||||||
const char *tag,
|
const char *tag,
|
||||||
cell_t fmt_param,
|
cell_t fmt_param)
|
||||||
unsigned int mode)
|
|
||||||
{
|
{
|
||||||
char message[255];
|
char message[255];
|
||||||
char buffer[255];
|
char buffer[255];
|
||||||
@ -926,10 +925,6 @@ static cell_t _ShowActivity(IPluginContext *pContext,
|
|||||||
engine->ClientPrintf(pPlayer->GetEdict(), message);
|
engine->ClientPrintf(pPlayer->GetEdict(), message);
|
||||||
display_in_chat = true;
|
display_in_chat = true;
|
||||||
}
|
}
|
||||||
else if (mode == 2)
|
|
||||||
{
|
|
||||||
display_in_chat = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1013,9 +1008,146 @@ static cell_t _ShowActivity(IPluginContext *pContext,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static cell_t _ShowActivity2(IPluginContext *pContext,
|
||||||
|
const cell_t *params,
|
||||||
|
const char *tag,
|
||||||
|
cell_t fmt_param)
|
||||||
|
{
|
||||||
|
char message[255];
|
||||||
|
char buffer[255];
|
||||||
|
int value = sm_show_activity.GetInt();
|
||||||
|
unsigned int replyto = g_ChatTriggers.GetReplyTo();
|
||||||
|
int client = params[1];
|
||||||
|
|
||||||
|
const char *name = "Console";
|
||||||
|
const char *sign = "ADMIN";
|
||||||
|
if (client != 0)
|
||||||
|
{
|
||||||
|
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
|
||||||
|
if (!pPlayer || !pPlayer->IsConnected())
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("Client index %d is invalid", client);
|
||||||
|
}
|
||||||
|
name = pPlayer->GetName();
|
||||||
|
AdminId id = pPlayer->GetAdminId();
|
||||||
|
if (id == INVALID_ADMIN_ID
|
||||||
|
|| !g_Admins.GetAdminFlag(id, Admin_Generic, Access_Effective))
|
||||||
|
{
|
||||||
|
sign = "PLAYER";
|
||||||
|
}
|
||||||
|
|
||||||
|
g_SourceMod.SetGlobalTarget(client);
|
||||||
|
g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, fmt_param);
|
||||||
|
|
||||||
|
if (pContext->GetContext()->n_err != SP_ERROR_NONE)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 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.
|
||||||
|
*/
|
||||||
|
if (replyto == SM_REPLY_CONSOLE)
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
UTIL_Format(message, sizeof(message), "%s%s\n", tag, buffer);
|
||||||
|
engine->ClientPrintf(pPlayer->GetEdict(), message);
|
||||||
|
#endif
|
||||||
|
UTIL_Format(message, sizeof(message), "%s%s", tag, buffer);
|
||||||
|
g_HL2.TextMsg(client, HUD_PRINTTALK, message);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UTIL_Format(message, sizeof(message), "%s%s", tag, buffer);
|
||||||
|
g_HL2.TextMsg(client, HUD_PRINTTALK, message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_SourceMod.SetGlobalTarget(LANG_SERVER);
|
||||||
|
g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, fmt_param);
|
||||||
|
|
||||||
|
if (pContext->GetContext()->n_err != SP_ERROR_NONE)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
UTIL_Format(message, sizeof(message), "%s%s\n", tag, buffer);
|
||||||
|
META_CONPRINT(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!value)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int maxClients = g_Players.GetMaxClients();
|
||||||
|
for (int i=1; i<=maxClients; i++)
|
||||||
|
{
|
||||||
|
CPlayer *pPlayer = g_Players.GetPlayerByIndex(i);
|
||||||
|
if (!pPlayer->IsInGame()
|
||||||
|
|| pPlayer->IsFakeClient()
|
||||||
|
|| i == client)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
AdminId id = pPlayer->GetAdminId();
|
||||||
|
g_SourceMod.SetGlobalTarget(i);
|
||||||
|
if (id == INVALID_ADMIN_ID
|
||||||
|
|| !g_Admins.GetAdminFlag(id, Admin_Generic, Access_Effective))
|
||||||
|
{
|
||||||
|
/* Treat this as a normal user */
|
||||||
|
if ((value & 1) || (value & 2))
|
||||||
|
{
|
||||||
|
const char *newsign = sign;
|
||||||
|
if ((value & 2))
|
||||||
|
{
|
||||||
|
newsign = name;
|
||||||
|
}
|
||||||
|
g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, fmt_param);
|
||||||
|
|
||||||
|
if (pContext->GetContext()->n_err != SP_ERROR_NONE)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
UTIL_Format(message, sizeof(message), "%s%s: %s", tag, newsign, buffer);
|
||||||
|
g_HL2.TextMsg(i, HUD_PRINTTALK, message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Treat this as an admin user */
|
||||||
|
bool is_root = g_Admins.GetAdminFlag(id, Admin_Root, Access_Effective);
|
||||||
|
if ((value & 4)
|
||||||
|
|| (value & 8)
|
||||||
|
|| ((value & 16) && is_root))
|
||||||
|
{
|
||||||
|
const char *newsign = sign;
|
||||||
|
if ((value & 8) || ((value & 16) && is_root))
|
||||||
|
{
|
||||||
|
newsign = name;
|
||||||
|
}
|
||||||
|
g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, fmt_param);
|
||||||
|
|
||||||
|
if (pContext->GetContext()->n_err != SP_ERROR_NONE)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
UTIL_Format(message, sizeof(message), "%s%s: %s", tag, newsign, buffer);
|
||||||
|
g_HL2.TextMsg(i, HUD_PRINTTALK, message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static cell_t ShowActivity(IPluginContext *pContext, const cell_t *params)
|
static cell_t ShowActivity(IPluginContext *pContext, const cell_t *params)
|
||||||
{
|
{
|
||||||
return _ShowActivity(pContext, params, "[SM] ", 2, 1);
|
return _ShowActivity(pContext, params, "[SM] ", 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell_t ShowActivityEx(IPluginContext *pContext, const cell_t *params)
|
static cell_t ShowActivityEx(IPluginContext *pContext, const cell_t *params)
|
||||||
@ -1023,7 +1155,7 @@ static cell_t ShowActivityEx(IPluginContext *pContext, const cell_t *params)
|
|||||||
char *str;
|
char *str;
|
||||||
pContext->LocalToString(params[2], &str);
|
pContext->LocalToString(params[2], &str);
|
||||||
|
|
||||||
return _ShowActivity(pContext, params, str, 3, 1);
|
return _ShowActivity(pContext, params, str, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell_t ShowActivity2(IPluginContext *pContext, const cell_t *params)
|
static cell_t ShowActivity2(IPluginContext *pContext, const cell_t *params)
|
||||||
@ -1031,7 +1163,7 @@ static cell_t ShowActivity2(IPluginContext *pContext, const cell_t *params)
|
|||||||
char *str;
|
char *str;
|
||||||
pContext->LocalToString(params[2], &str);
|
pContext->LocalToString(params[2], &str);
|
||||||
|
|
||||||
return _ShowActivity(pContext, params, str, 3, 2);
|
return _ShowActivity2(pContext, params, str, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell_t KickClient(IPluginContext *pContext, const cell_t *params)
|
static cell_t KickClient(IPluginContext *pContext, const cell_t *params)
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
* this program. If not, see <http://www.gnu.org/licenses/>.
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* As a special exception, AlliedModders LLC gives you permission to link the
|
* As a special exception, AlliedModders LLC gives you permission to link the
|
||||||
* code of this program (as well as its derivative works) to "Half-Life 2," the
|
* code of this program (as well as its derivative 1works) to "Half-Life 2," the
|
||||||
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
|
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
|
||||||
* by the Valve Corporation. You must obey the GNU General Public License in
|
* by the Valve Corporation. You must obey the GNU General Public License in
|
||||||
* all respects for all other code used. Additionally, AlliedModders LLC grants
|
* all respects for all other code used. Additionally, AlliedModders LLC grants
|
||||||
|
@ -77,7 +77,7 @@ public MenuHandler_Kick(Handle:menu, MenuAction:action, param1, param2)
|
|||||||
{
|
{
|
||||||
decl String:name[MAX_NAME_LENGTH];
|
decl String:name[MAX_NAME_LENGTH];
|
||||||
GetClientName(target, name, sizeof(name));
|
GetClientName(target, name, sizeof(name));
|
||||||
ShowActivity2(param1, "[SM] ", "%t", "Kicked target", "_S", name);
|
ShowActivity2(param1, "[SM] ", "%t", "Kicked target", "_s", name);
|
||||||
PerformKick(param1, target, "");
|
PerformKick(param1, target, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +129,7 @@ public Action:Command_Kick(client, args)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowActivity2(client, "[SM] ", "%t", "Kicked target", "_S", target_name);
|
ShowActivity2(client, "[SM] ", "%t", "Kicked target", "_s", target_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
new kick_self = 0;
|
new kick_self = 0;
|
||||||
|
@ -58,6 +58,7 @@ new g_SlapDamage[MAXPLAYERS+1];
|
|||||||
public OnPluginStart()
|
public OnPluginStart()
|
||||||
{
|
{
|
||||||
LoadTranslations("common.phrases");
|
LoadTranslations("common.phrases");
|
||||||
|
LoadTranslations("basefuncommands.phrases");
|
||||||
|
|
||||||
RegAdminCmd("sm_burn", Command_Burn, ADMFLAG_SLAY, "sm_burn <#userid|name> [time]");
|
RegAdminCmd("sm_burn", Command_Burn, ADMFLAG_SLAY, "sm_burn <#userid|name> [time]");
|
||||||
RegAdminCmd("sm_slap", Command_Slap, ADMFLAG_SLAY, "sm_slap <#userid|name> [damage]");
|
RegAdminCmd("sm_slap", Command_Slap, ADMFLAG_SLAY, "sm_slap <#userid|name> [damage]");
|
||||||
@ -127,12 +128,6 @@ public Action:Command_Play(client, args)
|
|||||||
decl String:Arg[65];
|
decl String:Arg[65];
|
||||||
new len = BreakString(Arguments, Arg, sizeof(Arg));
|
new len = BreakString(Arguments, Arg, sizeof(Arg));
|
||||||
|
|
||||||
new target = FindTarget(client, Arg);
|
|
||||||
if (target == -1)
|
|
||||||
{
|
|
||||||
return Plugin_Handled;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Make sure it does not go out of bound by doing "sm_play user "*/
|
/* Make sure it does not go out of bound by doing "sm_play user "*/
|
||||||
if (len == -1)
|
if (len == -1)
|
||||||
{
|
{
|
||||||
@ -152,12 +147,37 @@ public Action:Command_Play(client, args)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GetClientName(target, Arg, sizeof(Arg));
|
decl String:target_name[MAX_TARGET_LENGTH];
|
||||||
ShowActivity(client, "%t", "Played Sound", Arg);
|
decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
|
||||||
LogAction(client, target, "\"%L\" played sound on \"%L\" (file \"%s\")", client, target, Arguments[len]);
|
|
||||||
|
|
||||||
ClientCommand(target, "playgamesound \"%s\"", Arguments[len]);
|
if ((target_count = ProcessTargetString(
|
||||||
|
Arg,
|
||||||
|
client,
|
||||||
|
target_list,
|
||||||
|
MAXPLAYERS,
|
||||||
|
COMMAND_FILTER_NO_BOTS,
|
||||||
|
target_name,
|
||||||
|
sizeof(target_name),
|
||||||
|
tn_is_ml)) <= 0)
|
||||||
|
{
|
||||||
|
ReplyToTargetError(client, target_count);
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (new i = 0; i < target_count; i++)
|
||||||
|
{
|
||||||
|
ClientCommand(target_list[i], "playgamesound \"%s\"", Arguments[len]);
|
||||||
|
LogAction(client, target_list[i], "\"%L\" played sound on \"%L\" (file \"%s\")", client, target_list[i], Arguments[len]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tn_is_ml)
|
||||||
|
{
|
||||||
|
ShowActivity2(client, "[SM] ", "%t", "Played sound to target", target_name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ShowActivity2(client, "[SM] ", "%t", "Played sound to target", "_s", target_name);
|
||||||
|
}
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,16 +1,5 @@
|
|||||||
PerformBurn(client, target, Float:seconds)
|
PerformBurn(client, target, Float:seconds)
|
||||||
{
|
{
|
||||||
new String:name[32];
|
|
||||||
|
|
||||||
GetClientName(target, name, sizeof(name));
|
|
||||||
|
|
||||||
if (!IsPlayerAlive(target))
|
|
||||||
{
|
|
||||||
ReplyToCommand(client, "[SM] %t", "Cannot be performed on dead", name);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ShowActivity(client, "%t", "Ignited player", name);
|
|
||||||
LogAction(client, target, "\"%L\" ignited \"%L\" (seconds \"%f\")", client, target, seconds);
|
LogAction(client, target, "\"%L\" ignited \"%L\" (seconds \"%f\")", client, target, seconds);
|
||||||
IgniteEntity(target, seconds);
|
IgniteEntity(target, seconds);
|
||||||
}
|
}
|
||||||
@ -77,7 +66,10 @@ public MenuHandler_Burn(Handle:menu, MenuAction:action, param1, param2)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
new String:name[32];
|
||||||
|
GetClientName(target, name, sizeof(name));
|
||||||
PerformBurn(param1, target, 20.0);
|
PerformBurn(param1, target, 20.0);
|
||||||
|
ShowActivity2(param1, "[SM] ", "%t", "Set target on fire", "_s", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Re-draw the menu if they're still valid */
|
/* Re-draw the menu if they're still valid */
|
||||||
@ -99,12 +91,6 @@ public Action:Command_Burn(client, args)
|
|||||||
decl String:arg[65];
|
decl String:arg[65];
|
||||||
GetCmdArg(1, arg, sizeof(arg));
|
GetCmdArg(1, arg, sizeof(arg));
|
||||||
|
|
||||||
new target = FindTarget(client, arg);
|
|
||||||
if (target == -1)
|
|
||||||
{
|
|
||||||
return Plugin_Handled;
|
|
||||||
}
|
|
||||||
|
|
||||||
new Float:seconds = 20.0;
|
new Float:seconds = 20.0;
|
||||||
|
|
||||||
if (args > 1)
|
if (args > 1)
|
||||||
@ -118,7 +104,36 @@ public Action:Command_Burn(client, args)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PerformBurn(client, target, seconds);
|
decl String:target_name[MAX_TARGET_LENGTH];
|
||||||
|
decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
|
||||||
|
|
||||||
|
if ((target_count = ProcessTargetString(
|
||||||
|
arg,
|
||||||
|
client,
|
||||||
|
target_list,
|
||||||
|
MAXPLAYERS,
|
||||||
|
COMMAND_FILTER_NO_BOTS,
|
||||||
|
target_name,
|
||||||
|
sizeof(target_name),
|
||||||
|
tn_is_ml)) <= 0)
|
||||||
|
{
|
||||||
|
ReplyToTargetError(client, target_count);
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (new i = 0; i < target_count; i++)
|
||||||
|
{
|
||||||
|
PerformBurn(client, target_list[i], seconds);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tn_is_ml)
|
||||||
|
{
|
||||||
|
ShowActivity2(client, "[SM] ", "%t", "Set target on fire", target_name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ShowActivity2(client, "[SM] ", "%t", "Set target on fire", "_s", target_name);
|
||||||
|
}
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
@ -1,16 +1,5 @@
|
|||||||
PerformSlap(client, target, damage)
|
PerformSlap(client, target, damage)
|
||||||
{
|
{
|
||||||
new String:name[32];
|
|
||||||
|
|
||||||
GetClientName(target, name, sizeof(name));
|
|
||||||
|
|
||||||
if (!IsPlayerAlive(target))
|
|
||||||
{
|
|
||||||
ReplyToCommand(client, "[SM] %t", "Cannot be performed on dead", name);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ShowActivity(client, "%t", "Slapped player", name);
|
|
||||||
LogAction(client, target, "\"%L\" slapped \"%L\" (damage \"%d\")", client, target, damage);
|
LogAction(client, target, "\"%L\" slapped \"%L\" (damage \"%d\")", client, target, damage);
|
||||||
SlapPlayer(target, damage, true);
|
SlapPlayer(target, damage, true);
|
||||||
}
|
}
|
||||||
@ -119,16 +108,19 @@ public MenuHandler_Slap(Handle:menu, MenuAction:action, param1, param2)
|
|||||||
{
|
{
|
||||||
PrintToChat(param1, "[SM] %t", "Unable to target");
|
PrintToChat(param1, "[SM] %t", "Unable to target");
|
||||||
}
|
}
|
||||||
|
else if (!IsPlayerAlive(target))
|
||||||
|
{
|
||||||
|
ReplyToCommand(param1, "[SM] %t", "Player has since died");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
decl String:name[32];
|
||||||
|
GetClientName(target, name, sizeof(name));
|
||||||
PerformSlap(param1, target, g_SlapDamage[param1]);
|
PerformSlap(param1, target, g_SlapDamage[param1]);
|
||||||
|
ShowActivity2(param1, "[SM] ", "%t", "Slapped target", "_s", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Re-draw the menu if they're still valid */
|
DisplaySlapTargetMenu(param1);
|
||||||
if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
|
|
||||||
{
|
|
||||||
DisplaySlapTargetMenu(param1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,12 +135,6 @@ public Action:Command_Slap(client, args)
|
|||||||
decl String:arg[65];
|
decl String:arg[65];
|
||||||
GetCmdArg(1, arg, sizeof(arg));
|
GetCmdArg(1, arg, sizeof(arg));
|
||||||
|
|
||||||
new target = FindTarget(client, arg);
|
|
||||||
if (target == -1)
|
|
||||||
{
|
|
||||||
return Plugin_Handled;
|
|
||||||
}
|
|
||||||
|
|
||||||
new damage = 0;
|
new damage = 0;
|
||||||
if (args > 1)
|
if (args > 1)
|
||||||
{
|
{
|
||||||
@ -161,7 +147,36 @@ public Action:Command_Slap(client, args)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PerformSlap(client, target, damage);
|
decl String:target_name[MAX_TARGET_LENGTH];
|
||||||
|
decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
|
||||||
|
|
||||||
|
if ((target_count = ProcessTargetString(
|
||||||
|
arg,
|
||||||
|
client,
|
||||||
|
target_list,
|
||||||
|
MAXPLAYERS,
|
||||||
|
COMMAND_FILTER_NO_BOTS,
|
||||||
|
target_name,
|
||||||
|
sizeof(target_name),
|
||||||
|
tn_is_ml)) <= 0)
|
||||||
|
{
|
||||||
|
ReplyToTargetError(client, target_count);
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (new i = 0; i < target_count; i++)
|
||||||
|
{
|
||||||
|
PerformSlap(client, target_list[i], damage);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tn_is_ml)
|
||||||
|
{
|
||||||
|
ShowActivity2(client, "[SM] ", "%t", "Slapped target", target_name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ShowActivity2(client, "[SM] ", "%t", "Slapped target", "_s", target_name);
|
||||||
|
}
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
@ -1,17 +1,6 @@
|
|||||||
|
|
||||||
PerformSlay(client, target)
|
PerformSlay(client, target)
|
||||||
{
|
{
|
||||||
decl String:name[32];
|
|
||||||
|
|
||||||
GetClientName(target, name, sizeof(name));
|
|
||||||
|
|
||||||
if (!IsPlayerAlive(target))
|
|
||||||
{
|
|
||||||
ReplyToCommand(client, "[SM] %t", "Cannot be performed on dead", name);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ShowActivity(client, "%t", "Slayed player", name);
|
|
||||||
LogAction(client, target, "\"%L\" slayed \"%L\"", client, target);
|
LogAction(client, target, "\"%L\" slayed \"%L\"", client, target);
|
||||||
ForcePlayerSuicide(target);
|
ForcePlayerSuicide(target);
|
||||||
}
|
}
|
||||||
@ -76,16 +65,19 @@ public MenuHandler_Slay(Handle:menu, MenuAction:action, param1, param2)
|
|||||||
{
|
{
|
||||||
PrintToChat(param1, "[SM] %t", "Unable to target");
|
PrintToChat(param1, "[SM] %t", "Unable to target");
|
||||||
}
|
}
|
||||||
|
else if (!IsPlayerAlive(target))
|
||||||
|
{
|
||||||
|
ReplyToCommand(param1, "[SM] %t", "Player has since died");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
decl String:name[32];
|
||||||
|
GetClientName(target, name, sizeof(name));
|
||||||
PerformSlay(param1, target);
|
PerformSlay(param1, target);
|
||||||
|
ShowActivity2(param1, "[SM] ", "%t", "Slayed target", "_s", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Re-draw the menu if they're still valid */
|
DisplaySlayMenu(param1);
|
||||||
if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
|
|
||||||
{
|
|
||||||
DisplaySlayMenu(param1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,13 +92,36 @@ public Action:Command_Slay(client, args)
|
|||||||
decl String:arg[65];
|
decl String:arg[65];
|
||||||
GetCmdArg(1, arg, sizeof(arg));
|
GetCmdArg(1, arg, sizeof(arg));
|
||||||
|
|
||||||
new target = FindTarget(client, arg);
|
decl String:target_name[MAX_TARGET_LENGTH];
|
||||||
if (target == -1)
|
decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
|
||||||
|
|
||||||
|
if ((target_count = ProcessTargetString(
|
||||||
|
arg,
|
||||||
|
client,
|
||||||
|
target_list,
|
||||||
|
MAXPLAYERS,
|
||||||
|
COMMAND_FILTER_NO_BOTS,
|
||||||
|
target_name,
|
||||||
|
sizeof(target_name),
|
||||||
|
tn_is_ml)) <= 0)
|
||||||
{
|
{
|
||||||
|
ReplyToTargetError(client, target_count);
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
PerformSlay(client, target);
|
for (new i = 0; i < target_count; i++)
|
||||||
|
{
|
||||||
|
PerformSlay(client, target_list[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tn_is_ml)
|
||||||
|
{
|
||||||
|
ShowActivity2(client, "[SM] ", "%t", "Slayed target", target_name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ShowActivity2(client, "[SM] ", "%t", "Slayed target", "_s", target_name);
|
||||||
|
}
|
||||||
|
|
||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
@ -96,6 +96,7 @@ public OnPluginStart()
|
|||||||
LoadTranslations("common.phrases");
|
LoadTranslations("common.phrases");
|
||||||
LoadTranslations("basevotes.phrases");
|
LoadTranslations("basevotes.phrases");
|
||||||
LoadTranslations("basefunvotes.phrases");
|
LoadTranslations("basefunvotes.phrases");
|
||||||
|
LoadTranslations("basefuncommands.phrases");
|
||||||
|
|
||||||
RegAdminCmd("sm_votegravity", Command_VoteGravity, ADMFLAG_VOTE, "sm_votegravity <amount> [amount2] ... [amount5]");
|
RegAdminCmd("sm_votegravity", Command_VoteGravity, ADMFLAG_VOTE, "sm_votegravity <amount> [amount2] ... [amount5]");
|
||||||
RegAdminCmd("sm_voteburn", Command_VoteBurn, ADMFLAG_VOTE|ADMFLAG_SLAY, "sm_voteburn <player>");
|
RegAdminCmd("sm_voteburn", Command_VoteBurn, ADMFLAG_VOTE|ADMFLAG_SLAY, "sm_voteburn <player>");
|
||||||
|
@ -246,8 +246,7 @@ native bool:IsChatTrigger();
|
|||||||
* the message based on the current ReplySource.
|
* the message based on the current ReplySource.
|
||||||
*
|
*
|
||||||
* @param client Client index doing the action, or 0 for server.
|
* @param client Client index doing the action, or 0 for server.
|
||||||
* @param tag Tag to display before the message string. For example,
|
* @param tag Tag to prepend to the message.
|
||||||
* "[SM] " would show "[SM] <message>".
|
|
||||||
* @param format Formatting rules.
|
* @param format Formatting rules.
|
||||||
* @param ... Variable number of format parameters.
|
* @param ... Variable number of format parameters.
|
||||||
* @noreturn
|
* @noreturn
|
||||||
|
46
translations/basefuncommands.phrases.txt
Normal file
46
translations/basefuncommands.phrases.txt
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
"Phrases"
|
||||||
|
{
|
||||||
|
"Played sound to target"
|
||||||
|
{
|
||||||
|
"#format" "{1:t}"
|
||||||
|
"en" "Played sound to {1}"
|
||||||
|
}
|
||||||
|
|
||||||
|
"Burn player"
|
||||||
|
{
|
||||||
|
"en" "Burn player"
|
||||||
|
}
|
||||||
|
|
||||||
|
"Slap player"
|
||||||
|
{
|
||||||
|
"en" "Slap player"
|
||||||
|
}
|
||||||
|
|
||||||
|
"Slap damage"
|
||||||
|
{
|
||||||
|
"en" "Slap damage"
|
||||||
|
}
|
||||||
|
|
||||||
|
"Slay player"
|
||||||
|
{
|
||||||
|
"en" "Slay player"
|
||||||
|
}
|
||||||
|
|
||||||
|
"Slapped target"
|
||||||
|
{
|
||||||
|
"#format" "{1:t}"
|
||||||
|
"en" "Slapped {1}."
|
||||||
|
}
|
||||||
|
|
||||||
|
"Slayed target"
|
||||||
|
{
|
||||||
|
"#format" "{1:t}"
|
||||||
|
"en" "Slayed {1}."
|
||||||
|
}
|
||||||
|
|
||||||
|
"Set target on fire"
|
||||||
|
{
|
||||||
|
"#format" "{1:t}"
|
||||||
|
"en" "Set {1} on fire."
|
||||||
|
}
|
||||||
|
}
|
@ -100,4 +100,9 @@
|
|||||||
"en" "Slay vote"
|
"en" "Slay vote"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"Ignited player"
|
||||||
|
{
|
||||||
|
"#format" "{1:s}"
|
||||||
|
"en" "Set player '{1}' on fire"
|
||||||
|
}
|
||||||
}
|
}
|
@ -89,35 +89,6 @@
|
|||||||
"en" "Unable to perform this command on a bot."
|
"en" "Unable to perform this command on a bot."
|
||||||
}
|
}
|
||||||
|
|
||||||
"Ignited player"
|
|
||||||
{
|
|
||||||
"#format" "{1:s}"
|
|
||||||
"en" "Set player '{1}' on fire"
|
|
||||||
}
|
|
||||||
|
|
||||||
"Slapped player"
|
|
||||||
{
|
|
||||||
"#format" "{1:s}"
|
|
||||||
"en" "Slapped player '{1}'"
|
|
||||||
}
|
|
||||||
|
|
||||||
"Slay player"
|
|
||||||
{
|
|
||||||
"en" "Slay player"
|
|
||||||
}
|
|
||||||
|
|
||||||
"Slayed player"
|
|
||||||
{
|
|
||||||
"#format" "{1:s}"
|
|
||||||
"en" "Slayed player '{1}'"
|
|
||||||
}
|
|
||||||
|
|
||||||
"Played Sound"
|
|
||||||
{
|
|
||||||
"#format" "{1:s}"
|
|
||||||
"en" "Played sound on player '{1}'"
|
|
||||||
}
|
|
||||||
|
|
||||||
"Unable to find cvar"
|
"Unable to find cvar"
|
||||||
{
|
{
|
||||||
"#format" "{1:s}"
|
"#format" "{1:s}"
|
||||||
@ -206,7 +177,6 @@
|
|||||||
|
|
||||||
"Player has since died"
|
"Player has since died"
|
||||||
{
|
{
|
||||||
"#format" "{1:s}"
|
|
||||||
"en" "Action cannot be performed, the player has since died."
|
"en" "Action cannot be performed, the player has since died."
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -308,21 +278,6 @@
|
|||||||
"en" "Ban reason"
|
"en" "Ban reason"
|
||||||
}
|
}
|
||||||
|
|
||||||
"Burn player"
|
|
||||||
{
|
|
||||||
"en" "Burn player"
|
|
||||||
}
|
|
||||||
|
|
||||||
"Slap player"
|
|
||||||
{
|
|
||||||
"en" "Slap player"
|
|
||||||
}
|
|
||||||
|
|
||||||
"Slap damage"
|
|
||||||
{
|
|
||||||
"en" "Slap damage"
|
|
||||||
}
|
|
||||||
|
|
||||||
"Command is in-game only"
|
"Command is in-game only"
|
||||||
{
|
{
|
||||||
"en" "This command can only be used in-game."
|
"en" "This command can only be used in-game."
|
||||||
@ -342,4 +297,25 @@
|
|||||||
{
|
{
|
||||||
"en" "The given player is not fully in-game yet."
|
"en" "The given player is not fully in-game yet."
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* :UNUSED: */
|
||||||
|
"Played Sound"
|
||||||
|
{
|
||||||
|
"#format" "{1:s}"
|
||||||
|
"en" "Played sound on player '{1}'"
|
||||||
|
}
|
||||||
|
|
||||||
|
/* :UNUSED: */
|
||||||
|
"Slapped player"
|
||||||
|
{
|
||||||
|
"#format" "{1:s}"
|
||||||
|
"en" "Slapped player '{1}'"
|
||||||
|
}
|
||||||
|
|
||||||
|
/* :UNUSED: */
|
||||||
|
"Slayed player"
|
||||||
|
{
|
||||||
|
"#format" "{1:s}"
|
||||||
|
"en" "Slayed player '{1}'"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* This is a special "pass-thru" translation */
|
/* This is a special "pass-thru" translation */
|
||||||
"_S"
|
"_s"
|
||||||
{
|
{
|
||||||
"#format" "{1:s}"
|
"#format" "{1:s}"
|
||||||
"en" "{1}"
|
"en" "{1}"
|
||||||
|
@ -116,6 +116,6 @@
|
|||||||
"Kicked target"
|
"Kicked target"
|
||||||
{
|
{
|
||||||
"#format" "{1:t}"
|
"#format" "{1:t}"
|
||||||
"en" "Kicked {1}"
|
"en" "Kicked {1}."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user