Newbie Spellweaver
- Joined
- Jul 18, 2014
- Messages
- 85
- Reaction score
- 39
So yeah... @Johno lately released this but sadly... phoenix do this already Because phoenix is so awesome and cool we want use way how phoenix do it so cmdlogs table. I made simple command for everyone to track name changes. :shownames
Add to RoleManager.cs where other commands exit this:
this.dictionary_4.Add("shownames", 97);
Then to ChatCommandManager.cs somewhere end of case this:
Now everyone can do :shownames <name> and they will see latest 100 name change
Add to RoleManager.cs where other commands exit this:
this.dictionary_4.Add("shownames", 97);
Then to ChatCommandManager.cs somewhere end of case this:
Code:
case 97:
{
if (Params.Length >= 2)
{
using (DatabaseClient dbClient = Phoenix.GetDatabase().GetClient())
{
dbClient.AddParamWithValue("userid", Phoenix.GetGame().GetClientManager().method_27(Params[1]));
DataTable dataTable = dbClient.ReadDataTable("SELECT extra_data, timestamp FROM cmdlogs WHERE user_id = @[I][B][URL="https://forum.ragezone.com/members/1335.html"]user[/URL][/B][/I]id AND command='flagme' LIMIT 100;");
string motdMessage = "User " + Params[1] + " last 100 name changes: \n";
foreach(DataRow dataRow in dataTable.Rows)
{
string extraData = dataRow["extra_data"].ToString();
string newName = extraData.Substring(extraData.IndexOf(':') + 1).Split(' ')[1];
string oldName = extraData.Substring(extraData.IndexOf(':') + 1).Split(' ')[3];
DateTime whenChangedName = Phoenix.smethod_21(double.Parse((string)dataRow["timestamp"].ToString()));
motdMessage += whenChangedName.ToString() + " - Old name: " + oldName + " - New name: " + newName + "\n";
}
Session.SendNotif(motdMessage, 2);
}
return true;
}
else
{
return false;
}
}
Now everyone can do :shownames <name> and they will see latest 100 name change
Last edited: