// Prevents reconnecting with a new character when playing in elimination // mode. ////////////////////////////////////////////////////////////////////////////// #include "color_header" ///////////////////////////// // PROTOTYPES ///////////////////////////// // FILE: death_lock_h FUNCTION: fnDeathShouldLock() // Returns true if this PC should be locked to a specific key. int fnDeathShouldLock(object oPC); //FILE: death_lock_h FUNCTION: fnDeathIsLocked() // Tests the CDKEY and PLAYERNAME to see if they are locked. If they // are it returns TRUE. int fnDeathIsLocked(object oPC); // FILE: death_lock_h FUNCTION: fnDeathGetLock() // This returns the character name that this CDKEY and Player Name are // locked to. string fnDeathGetLock(object oPC); // FILE: death_lock_h FUNCTION: fnDeathSetLock() // This will set the current character name as the character locked to this // CDKEY and PLAYER NAME void fnDeathSetLock(object oPC); // FILE: death_lock_h FUNCTION: fnDeathLockBootPC() // This will boot the PC due to death lock violation if their character name // does not match the one currently stored with the CDKEY and PLAYERNAME in // the LOCK. void fnDeathLockBootPC(object oPC); //////////////////////////// // FUNCTION //////////////////////////// int fnDeathShouldLock(object oPC) { // PURPOSE: Check to see if this player should be locked int bRet=FALSE; int nDeaths=GetLocalInt(oPC,"nDeaths"); int nMaxLives=GetLocalInt(GetModule(),"nElimLives"); int nHalf=nMaxLives/50; int nGT=GetLocalInt(GetModule(),"nGameType"); if (nDeaths>=nHalf&&nGT==0) bRet=TRUE; return bRet; } // fnDeathShouldLock() int fnDeathIsLocked(object oPC) { // PURPOSE: Should return TRUE if this CDKEY and PLAYERNAME are locked int bRet=FALSE; string sCDKEY=GetPCPublicCDKey(oPC); string sPName=GetPCPlayerName(oPC); string sCap=GetLocalString(GetModule(),"sDeathLocked"+sCDKEY+sPName); if (GetStringLength(sCap)>0) bRet=TRUE; return bRet; } // fnDeathIsLocked() string fnDeathGetLock(object oPC) { // PURPOSE: return the Death Lock for the PC string sName=GetName(oPC); string sCDKEY=GetPCPublicCDKey(oPC); string sPName=GetPCPlayerName(oPC); string sCap=GetLocalString(GetModule(),"sDeathLocked"+sCDKEY+sPName); if (GetStringLength(sCap)>0) sName=sCap; return sName; } // fnDeathGetLock() void fnDeathSetLock(object oPC) { // PURPOSE: To set the Death Lock string sName=GetName(oPC); string sCDKEY=GetPCPublicCDKey(oPC); string sPName=GetPCPlayerName(oPC); SetLocalString(GetModule(),"sDeathLocked"+sCDKEY+sPName,sName); } // fnDeathSetLock() void fnDeathLockBootPC(object oPC) { // PURPOSE: Will compare the lock and if the player is LOCKED // and the character name does not match the current lock it // will boot the PC string sName=GetName(oPC); string sS; if (fnDeathIsLocked(oPC)) { // this CDKEY and PLAYER NAME are locked if (fnDeathGetLock(oPC)!=sName) { // lock violation sS="WARNING!!!"; sS=ColorRGBString(sS,0,4,0); SendMessageToPC(oPC,sS); SendMessageToPC(oPC,sS); SendMessageToPC(oPC,sS); SendMessageToPC(oPC,"This CDKEY and PLAYER name are already locked in this game!!"); sS="They are locked to the player named '"; sName=ColorRGBString(sS,0,0,4); sS=sS+sName+"' who has already used half or more of their lives in this elimination game."; SendMessageToPC(oPC,sS); DelayCommand(20.0,BootPC(oPC)); } // lock violation } // this CDKEY and PLAYER NAME are locked } // fnDeathLockBootPC() //void main(){}