本文整理汇总了C++中LookupPlayerSearchCommand函数的典型用法代码示例。如果您正苦于以下问题:C++ LookupPlayerSearchCommand函数的具体用法?C++ LookupPlayerSearchCommand怎么用?C++ LookupPlayerSearchCommand使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LookupPlayerSearchCommand函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getSelectedPlayer
bool ChatHandler::HandleLookupPlayerIpCommand(const char* args)
{
std::string ip;
int32 limit;
char* limit_str;
Player *chr = getSelectedPlayer();
if (!*args)
{
// NULL only if used from console
if (!chr || chr == GetSession()->GetPlayer())
return false;
ip = chr->GetSession()->GetRemoteAddress();
limit = -1;
}
else
{
ip = strtok ((char*)args, " ");
limit_str = strtok (NULL, " ");
limit = limit_str ? atoi (limit_str) : -1;
}
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BY_IP);
stmt->setString(0, ip);
PreparedQueryResult result = LoginDatabase.Query(stmt);
return LookupPlayerSearchCommand(result, limit);
}
示例2: getSelectedPlayer
bool ChatHandler::HandleLookupPlayerIpCommand(const char* args)
{
std::string ip;
int32 limit;
char* limit_str;
Player *chr = getSelectedPlayer();
if (!*args)
{
// NULL only if used from console
if (!chr || chr == GetSession()->GetPlayer())
return false;
ip = chr->GetSession()->GetRemoteAddress();
limit = -1;
}
else
{
ip = strtok ((char*)args, " ");
limit_str = strtok (NULL, " ");
limit = limit_str ? atoi (limit_str) : -1;
}
LoginDatabase.EscapeString(ip);
QueryResult result = LoginDatabase.PQuery("SELECT id, username FROM account WHERE last_ip = '%s'", ip.c_str());
return LookupPlayerSearchCommand(result, limit);
}
示例3: strtok
bool ChatHandler::HandleLookupPlayerEmailCommand(const char* args)
{
if (!*args)
return false;
std::string email = strtok ((char*)args, " ");
char* limit_str = strtok (NULL, " ");
int32 limit = limit_str ? atoi (limit_str) : -1;
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_LIST_BY_EMAIL);
stmt->setString(0, email);
PreparedQueryResult result = LoginDatabase.Query(stmt);
return LookupPlayerSearchCommand(result, limit);
}
示例4: strtok
bool ChatHandler::HandleLookupPlayerEmailCommand(const char* args)
{
if (!*args)
return false;
std::string email = strtok ((char*)args, " ");
char* limit_str = strtok (NULL, " ");
int32 limit = limit_str ? atoi (limit_str) : -1;
LoginDatabase.EscapeString (email);
QueryResult result = LoginDatabase.PQuery ("SELECT id, username FROM account WHERE email = '%s'", email.c_str ());
return LookupPlayerSearchCommand (result, limit);
}