#include "aps_include" #include "nwnx_funcs_l" #include "inc_system_const" void main() { object oDM = GetEnteringObject(); // Debug mode enabled - disable authentication if(GetLocalInt(GetModule(), DEBUG_MODE)) return; // Only fires for DMs if(!GetIsDM(oDM)) return; string sCDKey = GetPCPublicCDKey(oDM, TRUE); string sAccount = GetPCPlayerName(oDM); string sSQL = "SELECT CDKey1, CDKey2, CDKey3 FROM dm_validation WHERE Account='" + sAccount + "'"; SQLExecDirect(sSQL); if(SQLFetch() == SQL_SUCCESS) { string sKey1 = SQLGetData(1); string sKey2 = SQLGetData(2); string sKey3 = SQLGetData(3); // The key matches one of the accepted ones. Simply exit the script if(sCDKey == sKey1 || sCDKey == sKey2 || sCDKey == sKey3) { return; } } // By this point we know that the key is invalid due to not being accepted or the account isn't even listed. // We just need to boot the DM out of the server and display the error message. // Always do a check if the object is valid - it's possible to crash the server if the PC/DM isn't there if(GetIsObjectValid(oDM)) { BootPCWithMessage(oDM, 16782504); } }