//Script Name: everclientexit ////////////////////////////////////////// //Created By: Genisys (Guile) //Created On: 7/05/08 (Updated_8/10/08) ///////////////////////////////////////// /* This is my premier CEP2 - NWNX2 / Leto OnClientExit Event Script. */ ///////////////////////////////////////////////////////////////// /* This script does multiple things, it checks to see if... If the PC is immortal or level 40 (apply special effects) If the character they have has been banned. (not a total bann) If they logged out while dead, if so make them dead instantly!!! ;) If the player is playing a legal character or not...read below.. And if the Player themself have been banned from the module or not.. */ ////////////////////////////////////////////////////////////////////// //Redundant Variables Declared effect eEffect; int nInt; object oItem; object aTarget; location bTarget; //////////////////////////////////////// //Required Includes //#include "hgll_func_inc" #include "fky_chat_inc" ///////////////////////////////////////// //PROTOTYPE DECLARED void SendMessageToAllPC(string sMessage); ///////////////////////////////////////// //Main Script void main() { //Declare Major Variables.. object oPC; oPC = GetEnteringObject(); object oTarget; oTarget = oPC; object oPlayer = oPC; object oPP = oPC; object oInfo = GetItemPossessedBy(oPP, "pcidname"); string sID = GetStringRight(GetName(oInfo), 14); //This means the entering Character has been banned. int nBann = GetCampaignInt(GetName(GetModule()), "CBANN", oPP); object oTag; location lTag; //This part is about verifying the Player's name.. //A player must have at least a 2 character name or they are going to //return with an error! If they have spaces in their name it will return //with an error as well, including alt code! string sPCNM = GetName(oPP); string sPCNMR = GetStringRight(sPCNM, 2); string sNC1; string sNC2; string sRNC1; string sRNC2; int nBad; //Find the second character of the players name.. sNC1 = GetSubString(sPCNM, 0, 1); //Find the second character of the players name.. sNC2 = GetSubString(sPCNM, 0, 2); //Find the last letter in the player's name. sRNC1 = GetSubString(sPCNMR, 0, 1); //Find the next to the last letter in the player's name. sRNC2 = GetSubString(sPCNMR, 0, 2); //////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////// //Sim Tools & Legendary Level Functions.. ////////////////////////////////////////////////////// object M = GetModule(); string Script = GetLocalString(oPC, "LetoScript"); if( Script != "" ) { SetLocalString(oPC, "LetoScript", ""); LetoScript(Script); } Speech_OnClientExit(GetExitingObject()); //////////////////////////////////////////////////////////////////// //Your Code Goes here.. /////////////////////////IMPORTANT////////////////////////////////// //You must make all the "" below into " " to check for legal names //I turned it off because a lot of my characters have bad names! //Simply put the cursor between "" and hit the space bar for "" to " " if(sNC1 =="") { nBad =1; } else if(sNC2 =="") { nBad =1; } else if(sRNC1 =="") { nBad =1; } else if(sRNC2 =="") { nBad =1; } else { nBad = 0; } //See below to activate this system.. //////////////////////////////////////////////////////////////////////// //If it's a DM entering the module... if(GetIsDM(oPC)) { //If the DM has never logged on before.. if(GetItemPossessedBy(oPC, "dmtoolz")==OBJECT_INVALID) { //Change "dmtoolz" to the tag name of any items you want given to DMs //the first time they enter only...(copy / paste for more items) //simply type // at the start of a line to deactivate it.. CreateItemOnObject("dmtoolz", oPC, 1); CreateItemOnObject("dmtoolz", oPC, 1); CreateItemOnObject("dmtoolz", oPC, 1); CreateItemOnObject("dmtoolz", oPC, 1); //CreateItemOnObject("dmtoolz", oPC, 1); //This message is here for a reason! DelayCommand(10.0, FloatingTextStringOnCreature( "You have been given DM Items and your DM Character was saved," + " please login with the updated version of your DM Character and" + " delete the original, thank you.", oPC, FALSE)); //You may want to create a journal tagnamed "dmrules" and define //what your DMs are not allowed to do here.. //simply delete the // on the line below to activate the jounral entry //AddJournalQuestEntry("dmrules", 1, oPC, FALSE, FALSE); } } //This is for the rest of the script, if it's not a PC stop here! if(!GetIsPC(oPC))return; ///////////////////////////////////////////////////////////////////////////// //These function add journal entries by the tag names below //If you wish to create more, just copy / paste and change //The tagname which is in "here", and the entry # remains 1 only! AddJournalQuestEntry("rules", 1, oPC, FALSE, FALSE); AddJournalQuestEntry("pcinfo", 1, oPC, FALSE, FALSE); AddJournalQuestEntry("spells", 1, oPC, FALSE, FALSE); AddJournalQuestEntry("x2spells", 1, oPC, FALSE, FALSE); AddJournalQuestEntry("feats", 1, oPC, FALSE, FALSE); AddJournalQuestEntry("shifter", 1, oPC, FALSE, FALSE); //////////////////IMPORTANT////////////////IMPORTANT//////////////////////// //This function scans the Entering PC to see if they have a legal character. //Delete the // Below to activate the anti-cheat script //DelayCommand(9.0, ExecuteScript("cheatercheck2", oPC)); ///////////////////////////////////////////////////////////////////////////// //If level 40 lets do some cool stuff to them :) (optional of course) //If you do not wish to use this options you will need to delete the // below // /* <<(don't touch this part) if(GetHitDice(oPC) == 40) { //Lets make the concealed 40% eEffect = EffectConcealment(40); eEffect = SupernaturalEffect(eEffect); ApplyEffectToObject(DURATION_TYPE_PERMANENT, eEffect, oPC); //Lets make the look like a ghost.. :) ApplyEffectToObject(DURATION_TYPE_PERMANENT, SupernaturalEffect(EffectVisualEffect(VFX_DUR_GLOW_WHITE)), oPC); } // don't touch this line */ ////////////////////////////////////////////////////////////////////////////// //This is the immortal option, you must utilize the "makeimmortal" script //to make players immortal (please read that script.) if(GetItemPossessedBy(oPC, "immotoken") != OBJECT_INVALID) { //Run this script on the player (See script to configure settings) ExecuteScript("powerimmortal", oPC); } ////////////////////////////////////////////////////////////////////////////// //If a player has been found with an illegal character they will have this item. //It will prevent them from logging onto your server with that character. //Note this will only work if you have activated the Anti-Cheat option above! if (GetItemPossessedBy(oPC, "banned")!= OBJECT_INVALID) { AssignCommand(oPC, ClearAllActions()); SetCutsceneMode(oPC, TRUE); SetCameraMode(oPC, CAMERA_MODE_CHASE_CAMERA); DelayCommand(4.0, FloatingTextStringOnCreature("You have an illegal character which is not allowed on this server.", oPC)); DelayCommand(5.0, SetCutsceneMode(oPC, FALSE)); DelayCommand(6.0, BootPC(oPC)); } //////////////////////////////////////////////////////////////////////////// //Since the player was dead when they logged, kill them! if (GetItemPossessedBy(oPC, "death")!= OBJECT_INVALID) { effect eEffect; eEffect = EffectDeath(); eEffect = SupernaturalEffect(eEffect); ApplyEffectToObject(DURATION_TYPE_INSTANT, eEffect, oPC); SendMessageToPC(oPC, "You died because you were dead when you logged out."); } ////////////////////////////////////////////////////////////////////////////// //This function is currently disabled (Not in use, may be used later on) /* //Let's make sure All players have a valid PC Name ID Item.. if(oInfo==OBJECT_INVALID) { //Open the "eq_pcidname" script to learn more CreateItemOnObject("pcidname", oPP, 1); } // */ //////////////////////////////////////////////////////////////////////// //Let's see if the entering CHARACTER has been banned from the module.. //Not the save as a player being banned altogether.. if(nBann ==1) { //Boot the PC fast! DelayCommand(3.9, BootPC(oPP)); return; } //Let's see if the player has been banned altogether! //Note the TRUE after oPP = Single Player / FALSE = Multiplayer Mode if(GetCampaignInt(GetName(GetModule()), "BANN", oPP)==TRUE) { //If so boot them fast! DelayCommand(3.5, BootPC(oPP)); //In Case They Can't be Booted..(Allow them to enter the module first..) //Then lock thier game down! (Note; You cannot have a script in OnCutscenAbort!) DelayCommand(9.0, SetCutsceneMode(oPP, TRUE, FALSE)); //They can't see nothing! DelayCommand(9.1, FadeToBlack(oPP, FADE_SPEED_FAST)); //Turn the PC into a punk chicken :) DelayCommand(9.2, ApplyEffectToObject (DURATION_TYPE_PERMANENT, EffectPolymorph(113, TRUE), oPP)); DelayCommand(9.3, ExportSingleCharacter(oPP)); //Make it permanent! return; } ////////////////////////////////////////////////////////////////////////////// //Let's prevent badly named characters from logging onto the server.. //Delete the /* below this line to activate the name checking system. /* //Let's verify the Entering PC has a legal name! //NOTE This function works in conjunction with another script //in which an NPC at the start verifies if the PC is playing a legal name. //If the first 2 or last 2 letters of their name are bad.. if(nBad==1) { //Delay the following to allow the PC to enter the module.. DelayCommand(10.0, FloatingTextStringOnCreature("You character name is not allowed!", oPP)); //Tell the database the player character is banned DelayCommand(11.0, SetCampaignInt(GetName(GetModule()), "BANN", 1, oPP)); //Boot the PC DelayCommand(14.0, BootPC(oPP)); return; } else { //do nothing.. } // (do not touch this line!) */ /////////////////////////////////////////////////////////////// //If the player has been inside of a party room, but logged out, then //teleport them to the start and take the token! if (GetItemPossessedBy(oPC, "partyroom")!= OBJECT_INVALID) { oItem = GetFirstItemInInventory(oPC); while (GetIsObjectValid(oItem)) { if (GetTag(oItem)=="partyroom") DestroyObject(oItem); oItem = GetNextItemInInventory(oPC); } aTarget = GetWaypointByTag("home"); bTarget = GetLocation(aTarget); if (GetAreaFromLocation(bTarget)==OBJECT_INVALID) return; //Allow them to fully enter the module.. DelayCommand(8.0, AssignCommand(oPC, ClearAllActions())); DelayCommand(8.1, AssignCommand(oPC, ActionJumpToLocation(bTarget))); } //Finally! Send this message to the PC.. //(Please change to match your module name) //(I would appreciate credit to my work in your start message thanks.) //Welcome them PC to the server with a colorful message DelayCommand(5.0, SendMessageToPC(oPP, //Enter your module name below "Welcome to (ENTER MODULE NAME)" + //Make sure you use one space! " a 1.68 Persistent Module " + "Created by Genisys " + //Enter your name below "Designed By: (YOUR NAME HERE)")); //Main Script End } //PROTOTYPE DEFINED void SendMessageToAllPC(string sMessage) { object PC = GetFirstPC(); while(GetIsObjectValid(PC)) { FloatingTextStringOnCreature(sMessage, PC); PC = GetNextPC(); } }