本文整理汇总了C++中PlayerSAO::setWieldIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerSAO::setWieldIndex方法的具体用法?C++ PlayerSAO::setWieldIndex怎么用?C++ PlayerSAO::setWieldIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerSAO
的用法示例。
在下文中一共展示了PlayerSAO::setWieldIndex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessData
//.........这里部分代码省略.........
SendChatMessage(peer_id, "Invalid new password hash supplied. Password NOT changed.");
return;
}
infostream<<"Server: Client requests a password change from "
<<"'"<<oldpwd<<"' to '"<<newpwd<<"'"<<std::endl;
std::string playername = player->getName();
std::string checkpwd;
m_script->getAuth(playername, &checkpwd, NULL);
if(oldpwd != checkpwd)
{
infostream<<"Server: invalid old password"<<std::endl;
// Wrong old password supplied!!
SendChatMessage(peer_id, "Invalid old password supplied. Password NOT changed.");
return;
}
bool success = m_script->setPassword(playername, newpwd);
if(success){
actionstream<<player->getName()<<" changes password"<<std::endl;
SendChatMessage(peer_id, "Password change successful.");
} else {
actionstream<<player->getName()<<" tries to change password but "
<<"it fails"<<std::endl;
SendChatMessage(peer_id, "Password change failed or inavailable.");
}
}
else if(command == TOSERVER_PLAYERITEM)
{
u16 item = packet[TOSERVER_PLAYERITEM_VALUE].as<u16>();
playersao->setWieldIndex(item);
}
else if(command == TOSERVER_RESPAWN)
{
if(!player->isDead())
return;
RespawnPlayer(peer_id);
actionstream << player->getName() << " respawns at "
<< PP(player->getPosition()/BS) << std::endl;
// ActiveObject is added to environment in AsyncRunStep after
// the previous addition has been successfully removed
}
else if(command == TOSERVER_INTERACT)
{
u8 action;
u16 item_i;
PointedThing pointed;
packet[TOSERVER_INTERACT_ACTION].convert(&action);
packet[TOSERVER_INTERACT_ITEM].convert(&item_i);
packet[TOSERVER_INTERACT_POINTED_THING].convert(&pointed);
if(player->hp == 0)
{
verbosestream<<"TOSERVER_INTERACT: "<<player->getName()
<<" tried to interact, but is dead!"<<std::endl;
return;
}
v3f player_pos = playersao->getLastGoodPosition();