Open Rapophage opened 5 months ago
Modified the code slightly.
I managed to get nwnx to compile and I've been running some tests. The function works fine, though only when a player already has a folder in the server vault. If a new player logs in and selects a character that's in the server vault's root folder, a player folder isn't created the changed character won't save. A player folder needs to be created first, though I currently have no idea how to do that.
You can try adding:
CExoString sDirectory;
CNetLayerPlayerInfo *pPlayerInfo = Globals::AppManager()->m_pServerExoApp->GetNetLayer()->GetPlayerInfo(pPlayer->m_nPlayerID);
CExoString sSubdirectory = pPlayerInfo->m_lstKeys[0].sPublic;
if (Globals::AppManager()->m_pServerExoApp->GetServerInfo()->m_PersistantWorldOptions.bServerVaultByPlayerName)
sSubdirectory = pPlayer->GetPlayerName();
if (sSubdirectory.IsEmpty())
sDirectory.Format( "SERVERVAULT:%s", "lost+found");
else
sDirectory.Format( "SERVERVAULT:%s", sSubdirectory.CStr());
Globals::ExoResMan()->CreateDirectory(sDirectory);
before the SaveServerCharacter() call.
You can try adding:
CExoString sDirectory; CNetLayerPlayerInfo *pPlayerInfo = Globals::AppManager()->m_pServerExoApp->GetNetLayer()->GetPlayerInfo(pPlayer->m_nPlayerID); CExoString sSubdirectory = pPlayerInfo->m_lstKeys[0].sPublic; if (Globals::AppManager()->m_pServerExoApp->GetServerInfo()->m_PersistantWorldOptions.bServerVaultByPlayerName) sSubdirectory = pPlayer->GetPlayerName(); if (sSubdirectory.IsEmpty()) sDirectory.Format( "SERVERVAULT:%s", "lost+found"); else sDirectory.Format( "SERVERVAULT:%s", sSubdirectory.CStr()); Globals::ExoResMan()->CreateDirectory(sDirectory);
before the SaveServerCharacter() call.
Yep, that worked!
Tried doing this myself, but I can't get nwnx to compile and I figured this would be something that fits right in with the player plugin.
NSS
CPP