Author Topic: preventing identical name  (Read 385 times)

Legacy_Cursed Eclipse

  • Full Member
  • ***
  • Posts: 132
  • Karma: +0/-0
preventing identical name
« on: December 14, 2011, 08:57:37 am »


               Hi, a month ago I received an old module (2007).
I hosted it and works very well except for the fact that players can create multiple pc with the same name.
This gives rise to a problem that I would like to avoid.

This module use nwnx and mySQL.

I'm not a scripter,and I do not know how to do it,and do not know anyone who can do it for me.
Anyone could help me? 
               
               

               


                     Modifié par Cursed Eclipse, 14 décembre 2011 - 09:08 .
                     
                  


            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
preventing identical name
« Reply #1 on: December 14, 2011, 10:15:47 am »


               A new character will always have 0xp, check for 0xp in OnEnter, Set 1 XP and then do things for new player. Whether or not is his name unique can be found via saving the names of all characters into database. Well depends what exact problem you are dealing with there are plenty of options. So describe the issue a bit detailed and so I can suggest something.
               
               

               
            

Legacy_Cursed Eclipse

  • Full Member
  • ***
  • Posts: 132
  • Karma: +0/-0
preventing identical name
« Reply #2 on: December 14, 2011, 07:14:40 pm »


               

ShaDoOoW wrote...

A new character will always have 0xp, check for 0xp in OnEnter, Set 1 XP and then do things for new player.


I do this already.

if(GetXP(oPC) == 0 )//new
{
//do stuff


i think is this line of code...but i reapeat i'm not a scripter,are just an old player who is very familiar with the bug of this game, that would not be exploitable.

ShaDoOoW wrote...
Whether or not is his name unique can be found via saving the names of all characters into database. Well depends what exact problem you are dealing with there are plenty of options. So describe the issue a bit detailed and so I can suggest something.


For my experience like a player is a big problem instead.
If someone create a char whit same name,body,voice,portraits ecc ecc at the next login
can apply 2 times the bonus of subrace. And that is my problem.

Anyway...let me repeat my request,just to make sure that I explained well (i'm not english speaker man)

I would like to have an on enter script that checks for same-named characters in the server vault or database (I use mysql,and I have absolutely no understanding of database scripting) and if it finds one, set char like not valid.

ot
p.s
  ahh ShadoOow,forgot to make you my congratulations for the work that you are released on the vault in recent years.
Using already many of your fixes in my module (exploit of throwing weapon for example) and are very useful. thx.'^_^'
               
               

               


                     Modifié par Cursed Eclipse, 14 décembre 2011 - 07:27 .
                     
                  


            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
preventing identical name
« Reply #3 on: December 14, 2011, 08:48:42 pm »


               

Cursed Eclipse wrote...
can apply 2 times the bonus of subrace. And that is my problem.

Then subrace script must be placed in the section for new characters only. I mean, right you can via database disallow creating a second character with the same name, but the issue still remains and players might find a way how to deal with your script that checks is the name is unique so I think its best to fix the subrace if possible.

Can you post your full OnEnter script?
               
               

               
            

Legacy_Cursed Eclipse

  • Full Member
  • ***
  • Posts: 132
  • Karma: +0/-0
preventing identical name
« Reply #4 on: December 14, 2011, 11:46:17 pm »


               

ShaDoOoW wrote...

Cursed Eclipse wrote...
can apply 2 times the bonus of subrace. And that is my problem.

Then subrace script must be placed in the section for new characters only. I mean, right you can via database disallow creating a second character with the same name,[cut] best to fix the subrace if possible.

Can you post your full OnEnter script?


forgot to say,i use DAR II 
for subrace.


EDIT
ShadoOow,a player told me that the subrace do not work very well,In fact, the bonuses are not always applied ,i supposed is because the leto plugin is no longer supported...(??)
I'm sorry for the mistake, but the tests I had done had gone well.
I do not know what happened, I'm still investigating.
Now I try to put Shayan as subrace system, and then let you know if the problem persists.










Script :  ON _PLAYER  ENTER



//////////////////////////////////////INCLUDE///////////////////////////////////
#include "lt_sub_func"
#include "zep_inc_craft"
#include "tero_inc_honour"
#include "aps_include"
#include "se_inc_pc_check"
#include "_sh_inc_core"

//==============================================//
//FUNCTION

//////////////////////////////////////////////////////////////////////////////////////////////////////////
//Preventing players from logging in to other player's accounts
// all credits go to: Funky  Swerve

int VerifyPlayernameAgainstCDKey(object oPlayer)
{
int nBoot = FALSE;
string sUnencoded = GetPCPlayerName(oPlayer);
string sPlayer = SQLEncodeSpecialChars(sUnencoded);
string sKey = GetPCPublicCDKey(oPlayer);
string sStoredKey, sAddingKey;
string sSQL = "SELECT val, tag FROM pwdata WHERE name='PlayernameKey_" + sPlayer + "'";

SQLExecDirect(sSQL);

/* there's at least one key stored already */
if (SQLFetch() == SQL_SUCCESS)
{
sStoredKey = SQLGetData(1);
sAddingKey = SQLGetData(2);
/* they indicated that they wanted to add a key this login */
if (sAddingKey == "Adding")
{
/* their current key is not in the key string, add it unless at 7 keys already */
if (FindSubString(sStoredKey, sKey) == -1)
{
int nKeyLength = GetStringLength(sStoredKey);

/* allow 7 keys max key-key-key-key-key-key-key 6 spacers + 7x8 keys = 62 */
if (nKeyLength > 61)
{
nBoot = TRUE;

/* must mark as no longer adding */
sSQL = "UPDATE pwdata SET tag='Set' WHERE name='PlayernameKey_" + sPlayer + "'";
SQLExecDirect(sSQL);

/* add the key to the string */
}
else
{
sSQL =
"UPDATE pwdata SET tag='Set',val='" + sStoredKey + "-" + sKey + "' WHERE name='PlayernameKey_" + sPlayer +
"'";
SQLExecDirect(sSQL);
DelayCommand(25.0, FloatingTextStringOnCreature("New CD Key Successfully Added!", oPlayer, FALSE));
}

/* let them know they already had this key in their string */
}
else
{
DelayCommand(25.0,
FloatingTextStringOnCreature("CD Key Addition Failed! This key already listed for this account!", oPlayer,
FALSE));

/* must mark as no longer adding */
sSQL = "UPDATE pwdata SET tag='Set' WHERE name='PlayernameKey_" + sPlayer + "'";
SQLExecDirect(sSQL);
}

/* they are not adding, and the cd key doesnt match those listed - boot and log */
} else if (FindSubString(sStoredKey, sKey) == -1) {
string sReport = "INCORRECT CD KEY DETECTED! ID: " + sUnencoded + "; Name: " +
GetName(oPlayer) + "; CD Key: " + sKey + "; IP: " + GetPCIPAddress(oPlayer) ;

WriteTimestampedLogEntry(sReport);
SendMessageToAllDMs(sReport);

nBoot = TRUE;
}

/* new account, add the key */
}
else
{
sSQL = "INSERT INTO pwdata (val,name) VALUES" + "('" + sKey + "','PlayernameKey_" + sPlayer + "')";
SQLExecDirect(sSQL);
}
return nBoot;
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////
//Auto reload

const int    ENABLE_AUTO_RELOAD = TRUE;
const float  RELOAD_TIME_DELAY = 15.0;
const string PORTAL_ADDRESS = "localhost";//192.168.100.1   <-???????
const string PORTAL_PASSWORD = "";
const string PORTAL_WAYPOINT = "";
void ReloadPC(object oPC);
void ReloadPC(object oPC)
{
    //ExportSingleCharacter(oPC);
    DelayCommand(RELOAD_TIME_DELAY,ActivatePortal(oPC, PORTAL_ADDRESS, PORTAL_PASSWORD, PORTAL_WAYPOINT, TRUE));
}
//////////////////////////////////////////////////////////////////////////////////////////////
//Journal

void OPEN_JOURNAL(object oPC);
void OPEN_JOURNAL(object oPC)
     {
    AddJournalQuestEntry("GAMEPLAY",        2, oPC, FALSE, FALSE, TRUE);
    AddJournalQuestEntry("FEAT",            2, oPC, FALSE, FALSE, TRUE);
    AddJournalQuestEntry("WEAPONS",         2, oPC, FALSE, FALSE, TRUE);
    AddJournalQuestEntry("SPELLS 1",        1, oPC, FALSE, FALSE, FALSE);
    AddJournalQuestEntry("SPELLS 2",        1, oPC, FALSE, FALSE, FALSE);
    AddJournalQuestEntry("SPELLS 3",        1, oPC, FALSE, FALSE, FALSE);
    AddJournalQuestEntry("SPELLS 4",        1, oPC, FALSE, FALSE, FALSE);
    AddJournalQuestEntry("SPELLS 5",        1, oPC, FALSE, FALSE, FALSE);
    AddJournalQuestEntry("SPELLS 6",        1, oPC, FALSE, FALSE, FALSE);
    AddJournalQuestEntry("SPELLS 7",        1, oPC, FALSE, FALSE, FALSE);
    AddJournalQuestEntry("SPELLS 8",        1, oPC, FALSE, FALSE, FALSE);
    AddJournalQuestEntry("SPELLS 9",        1, oPC, FALSE, FALSE, FALSE);
    AddJournalQuestEntry("ARCANE ARCHER",   1, oPC, FALSE, FALSE, FALSE);
    AddJournalQuestEntry("ASSASSIN",        1, oPC, FALSE, FALSE, FALSE);
    AddJournalQuestEntry("BARBARIAN",       1, oPC, FALSE, FALSE, FALSE);
    AddJournalQuestEntry("BG",              1, oPC, FALSE, FALSE, FALSE);
    AddJournalQuestEntry("CLER",            1, oPC, FALSE, FALSE, FALSE);
    AddJournalQuestEntry("HARPER SCOUT",    1, oPC, FALSE, FALSE, FALSE);
    AddJournalQuestEntry("MONK",            1, oPC, FALSE, FALSE, FALSE);
    AddJournalQuestEntry("PDK",             1, oPC, FALSE, FALSE, FALSE);
    AddJournalQuestEntry("PALLY",           1, oPC, FALSE, FALSE, FALSE);
    AddJournalQuestEntry("PM",              1, oPC, FALSE, FALSE, FALSE);
    AddJournalQuestEntry("RANGER",          1, oPC, FALSE, FALSE, FALSE);
    AddJournalQuestEntry("SD",              1, oPC, FALSE, FALSE, FALSE);
    AddJournalQuestEntry("SUMMONER",        1, oPC, FALSE, FALSE, FALSE);
    AddJournalQuestEntry("CREDITS",        1, oPC, FALSE, FALSE, FALSE);
    }
////////////////////////////////////////////////////////////////////////////////////////////////////////
//Weapons

int GetIsWeapon(object oItem)
{
    int nType = GetBaseItemType(oItem);
    if (nType == BASE_ITEM_BASTARDSWORD || nType == BASE_ITEM_BATTLEAXE || nType == BASE_ITEM_CLUB ||
        nType == BASE_ITEM_DAGGER || nType == BASE_ITEM_DIREMACE || nType == BASE_ITEM_DOUBLEAXE ||
        nType == BASE_ITEM_DWARVENWARAXE || nType == BASE_ITEM_GLOVES || nType == BASE_ITEM_GREATAXE ||
        nType == BASE_ITEM_GREATSWORD || nType == BASE_ITEM_GRENADE || nType == BASE_ITEM_HALBERD ||
        nType == BASE_ITEM_HANDAXE || nType == BASE_ITEM_HEAVYFLAIL || nType == BASE_ITEM_KAMA ||
        nType == BASE_ITEM_KATANA || nType == BASE_ITEM_KUKRI || nType == BASE_ITEM_LIGHTFLAIL ||
        nType == BASE_ITEM_LIGHTHAMMER || nType == BASE_ITEM_LIGHTMACE || nType == BASE_ITEM_LONGSWORD ||
        nType == BASE_ITEM_MORNINGSTAR || nType == BASE_ITEM_QUARTERSTAFF || nType == BASE_ITEM_RAPIER ||
        nType == BASE_ITEM_SCIMITAR || nType == BASE_ITEM_SCYTHE || nType == BASE_ITEM_SHORTSPEAR ||
        nType == BASE_ITEM_SHORTSWORD || nType == BASE_ITEM_SICKLE || nType == BASE_ITEM_SLING ||
        nType == BASE_ITEM_TRIDENT || nType == BASE_ITEM_TWOBLADEDSWORD || nType == BASE_ITEM_WARHAMMER ||
        nType == BASE_ITEM_WHIP)
    {
        return TRUE;
    }
    return FALSE;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////
//costant

object oStore = GetObjectByTag("CHARACTER_STORE");
//////////////////////////////////////////////////////////////////////////////////////////////////////
//PROTOTYPE
void death_on_enter(object oPC);
void death_on_leave(object oPC);
/////////////////////////////////////////////////////////////////////////////////////////////////////////
//Death function

void death_on_enter(object oPC)
{
    string sName = GetName(oPC);
    string sXp = IntToString(GetXP(oPC));
    string sVerify = sName + sXp;
    //int i, j;
    //int nBefore, nNow, nDifference;
    //string sSpell;
    int nDamage = GetPersistentInt(oStore,sVerify);
    effect eDamage = EffectDamage(nDamage);
   /* if(GetIsPC(oPC)) //<-  1.69 - restore spells on login
    {
        for(i=0; i<805; i++)
        {
            sSpell = sVerify + IntToString(i);
            nBefore = GetPersistentInt(oStore,sSpell);
            nNow = GetHasSpell(i,oPC);
            nDifference = nNow - nBefore;
            if(nNow != 0 && nDifference != 0)
            {
                for(j=0; j<nDifference; j++)
                {
                    DecrementRemainingSpellUses(oPC,i);
                }
            }
        }
    }   */  //cut end
    if(nDamage!=0)
    {
        ApplyEffectToObject(DURATION_TYPE_INSTANT,eDamage, oPC);
    }
}


void death_on_leave(object oPC)
{
    string sName = GetName(oPC);
    if(!GetIsPC(oPC))return;
    string sXp = IntToString(GetXP(oPC));
    string sVerify = sName + sXp;

//string sSpell; <- 1.69 - restore spells on login
    //int i, n;
    /*for(i=0; i<805; i++)
    {
        n = GetHasSpell(i,oPC);
        if(n!=0)
        {
            sSpell = sVerify + IntToString(i);
            SetPersistentInt(oStore,sSpell,n);
        }
    }*///CUT  END

    int nDamage = GetMaxHitPoints(oPC)-GetCurrentHitPoints(oPC);
    if(nDamage!=0)
    {
        SetPersistentInt(oStore,sVerify,nDamage);
    }
}
////////////////////////////////////////////////////////////////////////////////
void GiveXP(object oPC, int nXP)
{
    nXP=GetXP(oPC)+nXP;
    SetXP(oPC, nXP);
}
/////////////////////////////////////////////////////////////////////////////////
//DM  function - just a simple check

void check_DM(object oDM)
{
    string sNacc = GetPCPlayerName(oDM);
    return;
    if (sNacc!="Cursed Eclipse" &&
        sNacc!="invincibbile")
    {
        BootPC(oDM);
        return;
    }
}
////////////////////////////////////////////////////////////////////////////////

//===========================================//
//FUNCTION:  END
//===========================================//

////////////////////////////////////////////////////////////////////////////////



//MAIN



////////////////////////////////////////////////////////////////////////////////
void main()
{
    object oPC = GetEnteringObject();
    if (GetIsDM(oPC))
    {
        check_DM(oPC);
        return;
    }

    if (!GetIsPC(oPC)) return;

    string sGods = GetDeity(oPC);
    if(sGods == "test")return;

   /////////////////////////////////////////////////////////////////////////////
   string Script = GetLocalString(oPC, "LetoScript");
    if( Script != "" )
    {
        SetLocalString(oPC, "LetoScript", "");
    }
   /////////////////////////////////////////////////////////////////////////////
    int iCount, iValid;
    string sAccount = GetPCPlayerName(oPC);
    int iRacial = GetRacialType(oPC);
    string sNome = GetName(oPC);
    string sKey=GetPCPublicCDKey(oPC);
///////////////////////////////////////
death_on_enter(oPC);

///////////////////////////NEW TOON//////////////////////////
if(GetXP(oPC) == 0 )//<-new
{
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
SE_PlayerValidityCheck(oPC); //validity check. all credits go to sir_Elric
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////////////////////
//169_nohak_NWNXdb_Persistent__Exploit_Free_Starter_Module
//all credits go to: ShadoOoW

 effect eExploit = GetFirstEffect(oPC);
  while(GetIsEffectValid(eExploit))
  {
  RemoveEffect(oPC,eExploit);
  eExploit = GetNextEffect(oPC);
  }
 object oContainer,oExploit;
 int nSlot;
  for(;nSlot < NUM_INVENTORY_SLOTS;nSlot++)
  {
  oExploit = GetItemInSlot(nSlot,oPC);
   if(oExploit != OBJECT_INVALID)
   {
   DestroyObject(oExploit);
   }
  }
 oExploit = GetFirstItemInInventory(oPC);
  while(oExploit != OBJECT_INVALID)
  {
   if(GetHasInventory(oExploit))
   {
   oContainer = GetFirstItemInInventory(oExploit);
    while(oContainer != OBJECT_INVALID)
    {
    DestroyObject(oContainer);
    oContainer = GetNextItemInInventory(oExploit);
    }
   }
   DestroyObject(oExploit);
  oExploit = GetNextItemInInventory(oPC);
  }
//////////////////////////////////
//repeat string

   ExecuteScript("_on_enter_msg",oPC);

////////////////////////////////////////////////////////////////////////

   int iLength = GetStringLength(sNome);
   string sLetter;
   string sLettere;

     if (iLength > 32)
     {
     SetLocalInt(oPC, "NAME_INVALID", 1);
     }
     if( iLength < 3)
     {
     SetLocalInt(oPC, "NAME_INVALID", 2);
     }
     for (iCount = 0; iCount < iLength; iCount ++)
       {
          sLettere = GetSubString(GetStringLeft(sNome, iLength), iCount, 1);

           if (sLettere == " ") iValid ++;
            else iValid = 0;

            if (iValid > 1)
              {
              SetLocalInt(oPC, "NAME_INVALID", 3);
              }
              if (iCount < 2 && sLetter == " ")
              {
              SetLocalInt(oPC, "NAME_INVALID", 4);
               }
               if (!GetIsAlphaNumericValid(sLettere)==FALSE)
                {
                SetLocalInt(oPC, "NAME_INVALID", 5);
                }
                if(iRacial > 178 && iRacial < 159 )   //<-??????????????????????
                {
                SetLocalInt(oPC, "NAME_INVALID", 6);
                }
                }


                if (GetLocalInt(oPC, "NAME_INVALID") == 0)
                {
                SendMessageToPC(oPC, "character proved to be suitable.
Thanks for your cooperation.
You will be excluded from the server to complete the process of creation");

//TAG  BASED  ITEM  for new char

                CreateItemOnObject("boot_of_ac", oPC);
                CreateItemOnObject("NW_IT_MPOTION020", oPC , 4);//potions
                CreateItemOnObject("souvenir_leano", oPC);
                CreateItemOnObject("helm_of_ac", oPC);
                CreateItemOnObject("bracer_of_sprint", oPC);
//////////////////////////////////////////////////////////////////////////////
//Check appearence

               SetCreatureWingType(CREATURE_WING_TYPE_NONE, oPC);
                SetCreatureTailType(CREATURE_TAIL_TYPE_NONE, oPC);
                // make invisible heads visible, otherwise leave
                if(GetCreatureBodyPart(CREATURE_PART_HEAD, oPC) == 0)
                SetCreatureBodyPart(CREATURE_PART_HEAD, 1, oPC);
////////////////////////////////////////////////////////////////////////////////
               
                AssignCommand(oPC,ClearAllActions(TRUE));
/////////////////////////////////////////////////////////////////////
//APPLY  SUBRACE
OnSubraceEnter(oPC);
/////////////////////////////////////////////////////////////////////
                effect ePetrify = EffectCutsceneParalyze();
                effect eLight = (EffectVisualEffect(VFX_DUR_LIGHT_WHITE_20));
                effect eDur = EffectVisualEffect(VFX_DUR_CESSATE_NEGATIVE);
                effect eLink = EffectLinkEffects(eDur, ePetrify);
                effect eIce= EffectVisualEffect(VFX_DUR_ICESKIN);
                eLink =  EffectLinkEffects(eLink,eIce);
                effect eFro = EffectVisualEffect(VFX_IMP_FROST_S);
                eLink = EffectLinkEffects(eLight, eLink);
                float fDur = 14.9;
                ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eLink, oPC, fDur);
                ApplyEffectToObject(DURATION_TYPE_INSTANT,eFro,oPC,fDur);
                //ReloadPC(oPC);<----- DOESN'T  WORK.
                DelayCommand(15.0, BootPC(oPC));
                }
                else
                {
                SendMessageToPC(oPC, "<có  >Name <cÃŒwþ>" + sNome + "<có  > invalid. illegal name");
                ClearAllActions(TRUE);
                effect ePoly = EffectCutsceneParalyze();
                effect eVis3 = EffectVisualEffect(119);//820
                effect eDisappear = EffectLinkEffects(eVis3, ePoly);
                ApplyEffectToObject(DURATION_TYPE_TEMPORARY,eDisappear,oPC,14.7);
                DelayCommand(6.0 ,SendMessageToPC(oPC, "<có  >TRY USING (A-Z) (0-9)"));
                DelayCommand(13.0 ,SendMessageToPC(oPC, "<có  >You will be kicked from the server "));
                DelayCommand(15.0, BootPC(oPC));
                return;
                }
                ////////////////////////////////////////////////////////////////
                ////////////////CHAR IS OK
                SetXP(oPC, 1);
                DeleteLocalInt(oPC, "NAME_INVALID");
                ////////////////////////////////////////////////////////////////
//_____________________________________________________________________________/

                }
                else
                {
//_____________________________________________________________________________/

    effect eEffect=GetFirstEffect(oPC);
    while (GetIsEffectValid(eEffect))
    {
    if( (GetEffectType(eEffect)==EFFECT_TYPE_POLYMORPH) || (GetEffectType(eEffect)== EFFECT_TYPE_DARKNESS))
    {
        RemoveEffect(oPC, eEffect);
    }
    eEffect = GetNextEffect(oPC);
    }
    ///////////////////////////////UNEQUIP WEAPONS ON ENTER
    object oItem = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC);
    object oItem2 = GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC);
    if(GetIsWeapon(oItem)==TRUE)
    {
    AssignCommand(oPC, ActionUnequipItem(oItem));
    AssignCommand(oPC, ActionUnequipItem(oItem2));
    IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_ON_HIT_PROPERTIES, -1);
    IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_ONHITCASTSPELL, -1);
    IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_SPELL_RESISTANCE, -1);
    IPRemoveMatchingItemProperties(oItem, ITEM_PROPERTY_HOLY_AVENGER, -1);
    IPRemoveMatchingItemProperties(oItem2, ITEM_PROPERTY_ON_HIT_PROPERTIES, -1);
    IPRemoveMatchingItemProperties(oItem2, ITEM_PROPERTY_ONHITCASTSPELL, -1);
    IPRemoveMatchingItemProperties(oItem2, ITEM_PROPERTY_SPELL_RESISTANCE, -1);
    IPRemoveMatchingItemProperties(oItem2, ITEM_PROPERTY_HOLY_AVENGER, -1);
    }
    ////////////////////////////////////////////////////////////////////////////
    //PLAYER TOOL 1,2 & 3 - removed. 12-10-11
    ////////////////////////////////////////////////////////////////////////////
    DelayCommand(1.0,hero(oPC));
    DelayCommand(2.0,onore(oPC));
    DelayCommand(3.0,Guild_on_enter(oPC));
    DelayCommand(4.5, ZEP_PurifyAllItems(oPC));
    //DelayCommand(6.0, Replace(oPC));<- is really necessary anymore? cut 10-10-2011
//////////////////////////////////////////
   if (VerifyPlayernameAgainstCDKey(oPC))
    {
    if (GetIsObjectValid(oPC))
    BootPC(oPC);
    return;
    }
///////////////////////////////////////////////////////////////////////////////////
    SetLocalInt(GetObjectByTag("numeropg"),"numeropg",GetLocalInt(GetObjectByTag("numeropg"),"numeropg")+1);
   // }
    ////////////////////////////////////////////////////////////////////////////
    DelayCommand(5.1, OPEN_JOURNAL(oPC));
    ////////////////////////////////////////////////////////////////////////////
    DeleteLocalInt(oPC,"MHTimer");
    DeleteLocalInt(oPC,"HTimer");
    DeleteLocalInt(oPC,"GTimer");
    DeleteLocalInt(oPC,"timestopup");
    DeleteLocalInt(oPC,"GSTimer");
}
}


ShaDoOoW wrote...
but the issue still remains and players might find a way how to deal with your script that checks is the name is unique


This means that there is another way to bypass the check of subrace?
               
               

               


                     Modifié par Cursed Eclipse, 15 décembre 2011 - 12:48 .
                     
                  


            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
preventing identical name
« Reply #5 on: December 15, 2011, 10:03:36 am »


               

Cursed Eclipse wrote...
EDIT
ShadoOow,a player told me that
the subrace do not work very well,In fact, the bonuses are not always
applied ,i supposed is because the leto plugin is no longer
supported...(??)
I'm sorry for the mistake, but the tests I had done had gone well.
I do not know what happened, I'm still investigating.
Now I try to put Shayan as subrace system, and then let you know if the problem persists.

This is due the way how letoscript work. It can fail sometimes but the subrace scripts should be robust enough to take care of this issue and make sure the ability bonuses will be readded next logout.

Letoscript is no longer supported by developer however it still works and many scripts on vault still uses it.

To the script, it seems to be correct. Maybe there is a bug how a player BIC file is generated, if your current subrace system generates it from name that might be the issue. However its just a guess.

So back to your original request:

#include "aps_include"

void main()
{
object oPC = GetEnteringObject();
string varname = GetPCPlayerName(oPC)+"_NAMES";
string sNames = GetPersistentString(GetModule(),varname);
string sName = GetName(oPC)+"|";
 if(FindSubString(sNames,sName) > -1)
 {
 //This name is used already!!
 BootPC(oPC);
 }
 else
 {
 SetPersistentString(GetModule(),varname,sNames+sName);
 }
}

This should make sure player wont use same names, however untested might also have some issue (in this case other scripters out there will hopefully correct me).
               
               

               
            

Legacy_Squatting Monk

  • Hero Member
  • *****
  • Posts: 776
  • Karma: +0/-0
preventing identical name
« Reply #6 on: December 15, 2011, 03:03:19 pm »


               A better solution (though it would involve rejigging the scripts and the database) would be to not use the player's name as the unique identifier. In my module, I set the PC's tag to a unique string to identify him in the database. I can then use that string to represent the PC on any number of MySQL tables.
               
               

               
            

Legacy_Cursed Eclipse

  • Full Member
  • ***
  • Posts: 132
  • Karma: +0/-0
preventing identical name
« Reply #7 on: December 15, 2011, 05:20:50 pm »


               

ShaDoOoW wrote...

Cursed Eclipse wrote...
EDIT
ShadoOow,a player told me that
the subrace do not work very well,In fact, the bonuses are not always
applied ,i supposed is because the leto plugin is no longer
supported...(??)
I'm sorry for the mistake, but the tests I had done had gone well.
I do not know what happened, I'm still investigating.
Now I try to put Shayan as subrace system, and then let you know if the problem persists.

This is due the way how letoscript work. It can fail sometimes but the subrace scripts should be robust enough to take care of this issue and make sure the ability bonuses will be readded next logout.

Letoscript is no longer supported by developer however it still works and many scripts on vault still uses it.

To the script, it seems to be correct. Maybe there is a bug how a player BIC file is generated, if your current subrace system generates it from name that might be the issue. However its just a guess.

So back to your original request:

#include "aps_include"

void main()
{
object oPC = GetEnteringObject();
string varname = GetPCPlayerName(oPC)+"_NAMES";
string sNames = GetPersistentString(GetModule(),varname);
string sName = GetName(oPC)+"|";
 if(FindSubString(sNames,sName) > -1)
 {
 //This name is used already!!
 BootPC(oPC);
 }
 else
 {
 SetPersistentString(GetModule(),varname,sNames+sName);
 }
}

This should make sure player wont use same names, however untested might also have some issue (in this case other scripters out there will hopefully correct me).

It work very well.
This code is what I asked for, thanks a lot.

Squatting Monk wrote...

A better solution (though it would
involve rejigging the scripts and the database) would be to not use the
player's name as the unique identifier. In my module, I set the PC's
tag to a unique string to identify him in the database. I can then use
that string to represent the PC on any number of MySQL tables.


I might also add the cdkey at the name,in order to create a unique id.
Is another good idea. thx
               
               

               
            

Legacy_Cursed Eclipse

  • Full Member
  • ***
  • Posts: 132
  • Karma: +0/-0
preventing identical name
« Reply #8 on: December 15, 2011, 05:21:44 pm »


               Edit
double post.
               
               

               


                     Modifié par Cursed Eclipse, 15 décembre 2011 - 05:22 .