//************************************* //* NWN-MySQL 4.0 (c) 2004 FastFrench * //************************************* // This file is licensed under the terms of the // GNU GENERAL PUBLIC LICENSE (GPL) Version 2 // ************************ // ** ff_on_cl_leave.nss ** // ************************ // ** use this script on your OnActivate module event // ** or add the instruction: // ** ExecuteScript("ff_on_cl_leave", OBJECT_SELF); // ** at the beginning of your main function in your existing script #include "ff_include" void main() { if (!FF_USE_EXTERNAL_DATABASE) return; object oPC = GetExitingObject(); string sId = GetLocalString(oPC, "PWId"); if (StringToInt(sId)<=0) return; ff_FlushData(oPC); string sNewRecord; if (GetIsDM(oPC)) sNewRecord = "DM_OUT"; else if (GetCurrentHitPoints(oPC)<=0) sNewRecord = "DEAD_OUT"; else sNewRecord = "PC_OUT"; pwWriteLogCon(oPC, sNewRecord); SQLExecDirect("UPDATE idplayer SET Actif=0 WHERE Id=" + sId); }