File: ServerGameLogic.cpp
int ServerGameLogic::ProcessChatCommand(obj_ServerPlayer* plr, const char* cmd)
{
r3dOutToLog("cmd: %s admin:%d\n", cmd, plr->profile_.ProfileData.isDevAccount);
if(strncmp(cmd, "/tp", 3) == 0 && plr->profile_.ProfileData.isDevAccount)
return Cmd_Teleport(plr, cmd);
- - - Updated - - -Code:int ServerGameLogic::Cmd_Teleport(obj_ServerPlayer* plr, const char* cmd) { char buf[128]; float x, z; if(3 != sscanf(cmd, "%s %f %f", buf, &x, &z)) return 2; // cast ray down and find where we should place mine. should be in front of character, facing away from him PxRaycastHit hit; PxSceneQueryFilterData filter(PxFilterData(COLLIDABLE_STATIC_MASK, 0, 0, 0), PxSceneQueryFilterFlag::eSTATIC); if(!g_pPhysicsWorld->raycastSingle(PxVec3(x, 1000.0f, z), PxVec3(0, -1, 0), 2000.0f, PxSceneQueryFlag::eIMPACT, hit, filter)) { r3dOutToLog("unable to teleport - no collision\n"); return 2; } r3dPoint3D pos = AdjustPositionToFloor(r3dPoint3D(x, 0, z)); //Sleep(10000); //test delay PKT_S2C_MoveTeleport_s n; n.teleport_pos = pos; p2pBroadcastToActive(plr, &n, sizeof(n)); plr->SetLatePacketsBarrier("teleport"); plr->TeleportPlayer(pos); r3dOutToLog("%s teleported to %f, %f, %f\n", plr->userName, pos.x, pos.y, pos.z); return 0; }
bumppppp






