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: [b]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: [b]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 .