Aller au contenu

Photo

Alert All DMs Online..


  • Veuillez vous connecter pour répondre
4 réponses à ce sujet

#1
The Dragonator

The Dragonator
  • Members
  • 4 messages
Heya'. I'm trying to go about making my OnPlayerChat script to send a message (sString) to the DM if they have a campaign int of "enablemessages", sName set to true. I would like to do this to all DMs online. How would I go about doing that? Thanks. :)

Current Code:

void main()
{
object oPC = GetPCChatSpeaker();
object oFamiliar = GetAssociate(ASSOCIATE_TYPE_FAMILIAR, oPC);

string sChat  = GetPCChatMessage();
SetLocalString(oPC, "message", sChat);

int nLength = GetStringLength(sChat);

string sSpoke = GetLocalString(oPC, "message");
string sSend;
string sTalk  = GetStringRight(sSpoke, nLength - 2);

string sRed   = "<cþ  >";
string sClear = "</c>";
string sBlack = "<c   >";

string sEmotes   = "-EmoteList";
string sDate     = "-Date";
string sSave     = "-Save";
string sFamiliar = "-Familiar";

if (GetIsDM(oPC))
{
  sSend =sRed + sEmotes + sDate + sSave + sFamiliar;
}

else
{
 sSend =sRed + sEmotes + sDate + sSave + sFamiliar;
}
if (GetStringLowerCase(sChat) == "-help")
{
 SetPCChatMessage("");
 SendMessageToPC(oPC, sSend);
}

if (GetStringLowerCase(sChat) == "-")
{
 SetPCChatMessage("");
 SendMessageToPC(oPC, sSend);
}

if (GetStringLowerCase(sChat) == "-save")
{
 SetPCChatMessage("");
 ExportSingleCharacter(oPC);
 SendMessageToPC(oPC, sRed + "Your character has been saved.");
}
}

Modifié par The Dragonator, 24 août 2013 - 03:07 .


#2
BelowTheBelt

BelowTheBelt
  • Members
  • 394 messages
Once you know what message to send, loop through all PCs in the module and if the PC is a DM or DM Possessed, send them the string. You could even set something up such that DMs have their CD keys recorded in your code and check by that. The advantage of that way is that even if the DM was logged-on as a player, he/she would still get the message.

A simple loop could look like:

object oDM = GetFirstPC();
while (oDM != OBJECT_INVALID)
{
if (GetIsDM(oDM) || GetIsDMPossessed(oDM))
{
SendMessageToPC(oDM, sString);
}
oDM = GetNextPC();
}

In the more complete version, rather than checking to see if the PC is a DM, you would check the player's CD key. If it matched with one in a central DM list, then send the message.

Modifié par BelowTheBelt, 24 août 2013 - 03:12 .


#3
Squatting Monk

Squatting Monk
  • Members
  • 446 messages
Why not use SendMessageToAllDMs?

#4
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages

Squatting Monk wrote...

Why not use SendMessageToAllDMs?



The Dragonator wrote...

Heya'. I'm trying to go about making my OnPlayerChat script to send a message (sString) to the DM if they have a campaign int of "enablemessages", sName set to true. I would like to do this to all DMs online. How would I go about doing that? Thanks. :)



#5
Squatting Monk

Squatting Monk
  • Members
  • 446 messages
Ah. For some reason, I was reading that as the players having the int set on them. That makes more sense.