Well... I've just made an ulgy part of code, based on two different plugins.
I did not founded any sub-categories to help me to code this.
I think a skilled coder will "understand" my code and my intentions.
Code:
#include <sourcemod>
#include <sdktools>
#define AUTOLOAD_EXTENSIONS
#define REQUIRE_EXTENSIONS
#define PLUGIN_VERSION "0.0.1"
public Plugin:myinfo = {
name = "[TF2] MW2Renamer",
author = "SqTH",
description = "Automatically remove colors characters of MW2 players. Based on [TF2] Free2BeRenamed by DarthNinja, and Colored Names by Thraka (Original by Afronanny)",
version = PLUGIN_VERSION
};
//Execute itself on client connect ?
public OnClientPostAdminCheck(client)
{
//exclude bots ?
if (IsFakeClient(client))
{
return;
}
//create strings
decl String:NewName[MAX_NAME_LENGTH];
decl String:Name[MAX_NAME_LENGTH];
//take name's player ?
GetEventString(event, "newname", Name, sizeof(Name));
//replaces characters ?
ReplaceString(name, sizeof(name), "^0", "");
ReplaceString(name, sizeof(name), "^1", "");
ReplaceString(name, sizeof(name), "^2", "");
ReplaceString(name, sizeof(name), "^3", "");
ReplaceString(name, sizeof(name), "^4", "");
ReplaceString(name, sizeof(name), "^5", "");
ReplaceString(name, sizeof(name), "^6", "");
ReplaceString(name, sizeof(name), "^7", "");
ReplaceString(name, sizeof(name), "^8", "");
ReplaceString(name, sizeof(name), "^9", "");
//update name ? Dont think is needed with "replace string, but got to have something to send new name ?"
SetClientInfo(client, "name", NewName);
//?? :s
return;
}
Can someone help me to make this compile ?