62 lines
2.0 KiB
Plaintext
62 lines
2.0 KiB
Plaintext
#include "delchar_include"
|
|
|
|
string RemoveCharFromString(string sName, string sChar)
|
|
{
|
|
//Lower case
|
|
string sLeft, sRight;
|
|
int nChar = FindSubString(sName, sChar);
|
|
int nLength= GetStringLength(sName);
|
|
while(nChar >= 0){
|
|
|
|
//Remove character from word
|
|
sRight = GetStringRight(sName, nLength-nChar-1);
|
|
sLeft = GetStringLeft (sName, nChar);
|
|
|
|
//Make new name minus the space
|
|
sName = sLeft + sRight;
|
|
nLength= GetStringLength(sName);
|
|
nChar = FindSubString(sName, sChar);
|
|
}
|
|
//return sName;
|
|
return sName;
|
|
}
|
|
|
|
string RemoveInvalidChar(string sName)
|
|
{
|
|
string sInvalidChar = GetLocalString(GetModule(),"sInvalidChar");
|
|
string sChar = GetSubString(sInvalidChar, 1, 1);
|
|
int n = 0;
|
|
while(sChar != "")
|
|
{
|
|
n = n + 1;
|
|
sName = RemoveCharFromString(sName, sChar);
|
|
sChar = GetSubString(sInvalidChar, n, 1);
|
|
}
|
|
return sName;
|
|
}
|
|
|
|
void main()
|
|
{
|
|
object oPC = GetPCSpeaker();
|
|
string sPJ = GetName(oPC);
|
|
string sUpperCase = RemoveInvalidChar(sUpperCase);
|
|
string sCharName = GetStringLeft(GetStringLowerCase(sUpperCase),16);
|
|
string sPlayerName = GetPCPlayerName(oPC);
|
|
//backup
|
|
SetLocalString(oPC, "NWNX!SYSTEM!BACKUP", sPlayerName+"/"+sCharName+".bic");
|
|
//delete
|
|
//DelayCommand(5.0, SetLocalString(oPC, "NWNX!SYSTEM!DELETE", "C:/NeverwinterNights/NWN/servervault/"+sPlayerName+"/"+sCharName+".bic"));
|
|
ExportSingleCharacter(oPC);
|
|
DelayCommand(5.0, deletechar(sPlayerName, sCharName));
|
|
|
|
DelayCommand(5.0, SendMessageToPC(oPC, "Character with name "+sCharName+" deleted"));
|
|
WriteTimestampedLogEntry("Personaje " +sPJ+ " del jugador " + sPlayerName + " borrado. Fichero: " + sCharName +".bic");
|
|
//boot after setting delete
|
|
DelayCommand(6.0, FloatingTextStringOnCreature("5 seconds", oPC, FALSE));
|
|
DelayCommand(7.0, FloatingTextStringOnCreature("4 seconds", oPC, FALSE));
|
|
DelayCommand(8.0, FloatingTextStringOnCreature("3 seconds", oPC, FALSE));
|
|
DelayCommand(9.0, FloatingTextStringOnCreature("2 seconds", oPC, FALSE));
|
|
DelayCommand(10.0, FloatingTextStringOnCreature("1 seconds", oPC, FALSE));
|
|
DelayCommand(11.0, FloatingTextStringOnCreature("Bootage!", oPC, FALSE));
|
|
DelayCommand(12.0,BootPC (oPC));}
|