Help[FSoD] Command Help

Posts 15 of 5 · Page 1 of 1
[FSoD] Command Help
Hi, so I had recently made a pet renamer command, but instead of renaming the pet that you have, it renames all of your pets. How would I change this to make it only that one pet?

 
Command

internal class petNameCommand : Command
{
public petNameCommand() : base("petName", 3) { }
protected override bool Process(Player player, RealmTime time, string[] args)
{
if (args.Length > 1)
{
player.SendHelp("Usage: /petname <newname>");
return false;
}
player.Manager.Database.DoActionAsync(db =>
{
var cmd = db.CreateQuery();
cmd.CommandText = "UPDATE pets SET skinName=@skinName WHERE accId=@accId";
cmd.Parameters.AddWithValue("@skinName", args[0]);
cmd.Parameters.AddWithValue("@accId", player.AccountId);
if (cmd.ExecuteNonQuery() == 0)
{
player.SendError("Your pet name could not be changed!");
}
else
{
player.SendInfo("Your pet name was successfully changed to " + args[0] + "! Please disconnect or relog for the process to complete.");
}
});
return true;
}
}
I think realms resolutions has a pet renamer cmd
You cant unless you have the pet id and the accid to go withit
Quote Originally Posted by KillerViking View Post
I think realms resolutions has a pet renamer cmd
i cant find it in the source

Quote Originally Posted by Desire View Post
You cant unless you have the pet id and the accid to go withit
how would i add the petId thign to the command
I changed this part
 
Code

cmd.CommandText = "UPDATE pets SET skinName=@skinName WHERE accId=@accId";


into

 
Code

cmd.CommandText = "UPDATE pets SET skinName=@skinName WHERE accId=@accId" AND petId=@petId;


but i need to add something for
 
Code

cmd.Parameters.AddWithValue("@petId", player.);


would it be player.petId?
Posts 15 of 5 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?