This should work with non-OB mods (TF2/DOD:S); I'll add them in later on.
PHP Code:
#pragma semicolon 1
#include <sourcemod>
// Global Definitions
#define PLUGIN_VERSION "1.0.0"
new Handle:cvarTag;
new Handle:cvarLoc;
// Functions
public Plugin:myinfo =
{
name = "TagMe",
author = "bl4nk",
description = "Adds a tag to the beginning of a player's name when they say '!tagme'",
version = PLUGIN_VERSION,
url = "http://forums.alliedmods.net"
};
public OnPluginStart()
{
CreateConVar("sm_tagme_version", PLUGIN_VERSION, "TagMe Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
cvarTag = CreateConVar("sm_tagme_tag", "[TAG] ", "The tag that will be added to the player's name", FCVAR_PLUGIN);
cvarLoc = CreateConVar("sm_tagme_loc", "1", "Where in the name to place the tag (1 = Beginning, 2 = End)", FCVAR_PLUGIN, true, 1.0, true, 2.0);
RegConsoleCmd("say", Command_Say);
RegConsoleCmd("say_team", Command_Say);
}
public Action:Command_Say(client, args)
{
decl String:text[192];
GetCmdArgString(text, sizeof(text));
new startidx = 0;
if (text[0] == '"')
{
startidx = 1;
new len = strlen(text);
if (text[len-1] == '"')
{
text[len-1] = '\0';
}
}
if (strcmp(text[startidx], "!tagme") == 0)
{
decl String:name[32], String:tag[16], String:buffer[48];
GetClientName(client, name, sizeof(name));
GetConVarString(cvarTag, tag, sizeof(tag));
switch (GetConVarInt(cvarLoc))
{
case 1:
{
Format(buffer, sizeof(buffer), "%s%s", tag, name);
}
case 2:
{
Format(buffer, sizeof(buffer), "%s%s", name, tag);
}
}
ClientCommand(client, "name %s", buffer);
PrintToChat(client, "[SM] You have been tagged!");
return Plugin_Handled;
}
return Plugin_Continue;
}