mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 01:11:29 +00:00
command_ban converted to QueryDatabase
This commit is contained in:
parent
e2382137e6
commit
1d08b1687f
@ -6111,15 +6111,11 @@ void command_stun(Client *c, const Seperator *sep)
|
|||||||
|
|
||||||
void command_ban(Client *c, const Seperator *sep)
|
void command_ban(Client *c, const Seperator *sep)
|
||||||
{
|
{
|
||||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
if(sep->arg[1][0] == 0 || sep->arg[2][0] == 0) {
|
||||||
char *query = 0;
|
|
||||||
|
|
||||||
if(sep->arg[1][0] == 0 || sep->arg[2][0] == 0)
|
|
||||||
{
|
|
||||||
c->Message(0, "Usage: #ban <charname> <message>");
|
c->Message(0, "Usage: #ban <charname> <message>");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
auto account_id = database.GetAccountIDByChar(sep->arg[1]);
|
auto account_id = database.GetAccountIDByChar(sep->arg[1]);
|
||||||
|
|
||||||
std::string message;
|
std::string message;
|
||||||
@ -6142,39 +6138,35 @@ void command_ban(Client *c, const Seperator *sep)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(account_id > 0)
|
if(account_id == 0) {
|
||||||
{
|
c->Message(13, "Character does not exist.");
|
||||||
database.RunQuery(query, MakeAnyLenString(&query, "UPDATE account set status = -2, ban_reason = '%s' where id = %i", EscapeString(message).c_str(), account_id), errbuf, 0);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string query = StringFormat("UPDATE account SET status = -2, ban_reason = '%s' "
|
||||||
|
"WHERE id = %i", EscapeString(message).c_str(), account_id);
|
||||||
|
auto results = database.QueryDatabase(query);
|
||||||
|
|
||||||
c->Message(13, "Account number %i with the character %s has been banned with message: \"%s\"", account_id, sep->arg[1], message.c_str());
|
c->Message(13, "Account number %i with the character %s has been banned with message: \"%s\"", account_id, sep->arg[1], message.c_str());
|
||||||
|
|
||||||
ServerPacket pack(ServerOP_FlagUpdate, 6);
|
ServerPacket flagUpdatePack(ServerOP_FlagUpdate, 6);
|
||||||
*((uint32*)&pack.pBuffer[0]) = account_id;
|
*((uint32*)&flagUpdatePack.pBuffer[0]) = account_id;
|
||||||
*((int16*)&pack.pBuffer[4]) = -2;
|
*((int16*)&flagUpdatePack.pBuffer[4]) = -2;
|
||||||
worldserver.SendPacket(&pack);
|
worldserver.SendPacket(&flagUpdatePack);
|
||||||
|
|
||||||
Client *client = nullptr;
|
Client *client = nullptr;
|
||||||
client = entity_list.GetClientByName(sep->arg[1]);
|
client = entity_list.GetClientByName(sep->arg[1]);
|
||||||
if(client)
|
if(client) {
|
||||||
{
|
|
||||||
client->WorldKick();
|
client->WorldKick();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
ServerPacket kickPlayerPack(ServerOP_KickPlayer, sizeof(ServerKickPlayer_Struct));
|
||||||
ServerPacket pack(ServerOP_KickPlayer, sizeof(ServerKickPlayer_Struct));
|
ServerKickPlayer_Struct* skp = (ServerKickPlayer_Struct*)kickPlayerPack.pBuffer;
|
||||||
ServerKickPlayer_Struct* skp = (ServerKickPlayer_Struct*)pack.pBuffer;
|
|
||||||
strcpy(skp->adminname, c->GetName());
|
strcpy(skp->adminname, c->GetName());
|
||||||
strcpy(skp->name, sep->arg[1]);
|
strcpy(skp->name, sep->arg[1]);
|
||||||
skp->adminrank = c->Admin();
|
skp->adminrank = c->Admin();
|
||||||
worldserver.SendPacket(&pack);
|
worldserver.SendPacket(&kickPlayerPack);
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
c->Message(13, "Character does not exist.");
|
|
||||||
}
|
|
||||||
|
|
||||||
safe_delete_array(query);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void command_suspend(Client *c, const Seperator *sep)
|
void command_suspend(Client *c, const Seperator *sep)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user