I just pasted the code from my namechanger plugin into it, so:
PHP Code:
/**
* namechanger.sp by bl4nk
* Allows an admin with the 'f' flag to change a player's name.
*
* Thanks to:
* Extreme_One for requesting the plugin.
* ferret for his easy-to-copy "client checker" code.
* theY4Kman for a fix with the single quote bug.
*
* Changelog at http://forums.alliedmods.net/showthread.php?t=58825
*/
#pragma semicolon 1
#include <sourcemod>
#define PLUGIN_VERSION "1.2"
public Plugin:myinfo =
{
name = "Name Changer",
author = "bl4nk",
description = "Change the name of a player",
version = PLUGIN_VERSION,
url = "http://forums.alliedmods.net"
};
public OnPluginStart()
{
LoadTranslations("common.phrases");
LoadTranslations("namechanger.phrases");
CreateConVar("sm_namechanger_version", PLUGIN_VERSION, "Name Changer Version", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
RegAdminCmd("sm_name", Command_Name, ADMFLAG_SLAY, "sm_name <user> <name>");
}
public Action:Command_Name(client, args)
{
if (args < 2)
{
ReplyToCommand(client, "[SM] Usage: sm_name <user> <name>");
return Plugin_Handled;
}
new String:target[64];
GetCmdArg(1, target, sizeof(target));
new String:name[64];
GetCmdArg(2, name, sizeof(name));
ReplaceString(name, sizeof(name), " ' ", "'");
new clients[2];
new numClients = SearchForClients(target, clients, 2);
if (numClients == 0)
{
ReplyToCommand(client, "[SM] %t", "No matching client");
return Plugin_Handled;
}
else if (numClients > 1)
{
ReplyToCommand(client, "[SM] %t", "More than one client matches");
return Plugin_Handled;
}
else if (!CanUserTarget(client, clients[0]))
{
ReplyToCommand(client, "[SM] %t", "Unable to target");
return Plugin_Handled;
}
else if (IsFakeClient(clients[0]))
{
ReplyToCommand(client, "[SM] %t", "Cannot target bot");
return Plugin_Handled;
}
new player = clients[0];
PrintToChat(player, "[SM] %t", "Name Changed");
ClientCommand(player, "name \"%s\"", name);
return Plugin_Handled;
}