UW2_PRC8/_module/nss/onclientexit.nss
Jaysyn904 5197ad9a4d Initial upload
Initial upload
2023-09-25 20:24:01 -04:00

106 lines
2.3 KiB
Plaintext

//Script Name: onclientexit
//////////////////////////////////////////
//Created By: Genisys (Guile)
//Created On: 5/20/08 (Updated 8/10/08)
/////////////////////////////////////////
/*
This script goes in your OnClientExit
Module Properties Event for this event
*/
////////////////////////////////////////
//Required Include for SimTools
#include "hgll_func_inc"
//PROTOTYPE DECLARED
void SendMessageToAllPC(string sMessage);
//This is used to send messages to all
//PCs on the module
/////////////////////////////////////////
//Main Script
void main()
{
ExecuteScript("prc_onleave", OBJECT_SELF);
object oPC = GetExitingObject();
if(GetIsDM(oPC))
{return; }
//Prevent Accidental Death Logging for any reason!
//If they are truly dead, then set them as dead for when they return!
if(GetIsDead(oPC))
{
//Make sure we record this kind of action...
WriteTimestampedLogEntry(GetName(oPC) + " LOGGED OUT TO CHEAT DEATH " +
GetPCPublicCDKey(oPC, FALSE) + " " + GetPCPlayerName(oPC));
SendMessageToAllDMs(GetName(oPC) + " HAS LOGGED OUT TO CHEAT DEATH");
}
//Higher Ground's Legendary leveler
object PC = GetExitingObject();
object M = GetModule();
string Script = GetLocalString(PC, "LetoScript");
if( Script != "" )
{
SetLocalString(PC, "LetoScript", "");
LetoScript(Script);
}
/////////////////////////////////////////////////////////////
if(!GetIsPC(oPC)) return;
location lSaved = GetLocation(oPC);
string sLeave;
sLeave = GetName(oPC);
sLeave += " / ";
sLeave += GetPCPlayerName(oPC);
sLeave += " / ";
sLeave += GetPCIPAddress(oPC);
sLeave += " / ";
sLeave += GetPCPublicCDKey(oPC);
sLeave += " /";
sLeave += "<c B+> Has left as a player.";
//Write a log entry of the info
WriteTimestampedLogEntry(sLeave);
//Send the info to all DMs online
SendMessageToAllDMs(sLeave);
//Tell ALL the Players who just left
SendMessageToAllPC(GetName(oPC) + " <c §û>Has left as a player.");
/* ***DISABLED FOR ERROR REASONS***
//Let's make sure we can save thier location
if(GetArea(GetAreaFromLocation(lSaved))!=OBJECT_INVALID)
{
SetCampaignLocation(GetName(GetModule()), "SAVED_LOC", lSaved, oPC);
}
*/
//Main Script End
}
//PROTOTYPE DEFINED
void SendMessageToAllPC(string sMessage)
{
object oPC = GetFirstPC();
while(GetIsObjectValid(oPC))
{
FloatingTextStringOnCreature(sMessage, oPC);
oPC = GetNextPC();
}
}