Replace hardcoded "/ff" check in basetriggers (bug 5863, r=drifter).
This commit is contained in:
parent
ba55ef0b2e
commit
9bf78a96cc
@ -78,6 +78,7 @@ public OnPluginStart()
|
|||||||
RegConsoleCmd("timeleft", Command_Timeleft);
|
RegConsoleCmd("timeleft", Command_Timeleft);
|
||||||
RegConsoleCmd("nextmap", Command_Nextmap);
|
RegConsoleCmd("nextmap", Command_Nextmap);
|
||||||
RegConsoleCmd("motd", Command_Motd);
|
RegConsoleCmd("motd", Command_Motd);
|
||||||
|
RegConsoleCmd("ff", Command_FriendlyFire);
|
||||||
|
|
||||||
HookConVarChange(g_Cvar_TimeleftInterval, ConVarChange_TimeleftInterval);
|
HookConVarChange(g_Cvar_TimeleftInterval, ConVarChange_TimeleftInterval);
|
||||||
|
|
||||||
@ -232,6 +233,22 @@ public Action:Command_Motd(client, args)
|
|||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Action:Command_FriendlyFire(client, args)
|
||||||
|
{
|
||||||
|
if (client == 0)
|
||||||
|
{
|
||||||
|
ReplyToCommand(client, "[SM] %t", "Command is in-game only");
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!IsClientInGame(client))
|
||||||
|
return Plugin_Handled;
|
||||||
|
|
||||||
|
ShowFriendlyFire(client);
|
||||||
|
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
public OnClientSayCommand_Post(client, const String:command[], const String:sArgs[])
|
public OnClientSayCommand_Post(client, const String:command[], const String:sArgs[])
|
||||||
{
|
{
|
||||||
decl String:text[192];
|
decl String:text[192];
|
||||||
@ -268,29 +285,9 @@ public OnClientSayCommand_Post(client, const String:command[], const String:sArg
|
|||||||
PrintToChat(client,"[SM] %t", "Thetime", ctime);
|
PrintToChat(client,"[SM] %t", "Thetime", ctime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strcmp(text[startidx], "ff", false) == 0 || strcmp(text[startidx], "/ff", false) == 0)
|
else if (strcmp(text[startidx], "ff", false) == 0)
|
||||||
{
|
{
|
||||||
if (g_Cvar_FriendlyFire != INVALID_HANDLE)
|
ShowFriendlyFire(client);
|
||||||
{
|
|
||||||
decl String:phrase[24];
|
|
||||||
if (GetConVarBool(g_Cvar_FriendlyFire))
|
|
||||||
{
|
|
||||||
strcopy(phrase, sizeof(phrase), "Friendly Fire On");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
strcopy(phrase, sizeof(phrase), "Friendly Fire Off");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(GetConVarInt(g_Cvar_TriggerShow))
|
|
||||||
{
|
|
||||||
PrintToChatAll("[SM] %t", phrase);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PrintToChat(client,"[SM] %t", phrase);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (strcmp(text[startidx], "currentmap", false) == 0)
|
else if (strcmp(text[startidx], "currentmap", false) == 0)
|
||||||
{
|
{
|
||||||
@ -519,3 +516,28 @@ ShowTimeLeft(client, who)
|
|||||||
PrintToServer("[SM] %s", finalOutput);
|
PrintToServer("[SM] %s", finalOutput);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ShowFriendlyFire(client)
|
||||||
|
{
|
||||||
|
if (g_Cvar_FriendlyFire != INVALID_HANDLE)
|
||||||
|
{
|
||||||
|
decl String:phrase[24];
|
||||||
|
if (GetConVarBool(g_Cvar_FriendlyFire))
|
||||||
|
{
|
||||||
|
strcopy(phrase, sizeof(phrase), "Friendly Fire On");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strcopy(phrase, sizeof(phrase), "Friendly Fire Off");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(GetConVarInt(g_Cvar_TriggerShow))
|
||||||
|
{
|
||||||
|
PrintToChatAll("[SM] %t", phrase);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PrintToChat(client,"[SM] %t", phrase);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user