• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Feature Send a message to player when a nearly monster it appears

Jetro

jangeldev
Joined
Aug 1, 2011
Messages
452
Reaction score
68
Location
Venezuela
Hi all, with this code the players who are near of respawn zone of a monster will get a message when the monster respawn.

image:
bPfZDcM.png


go monster.cpp
find:
[cpp] if(creature == this)
{[/cpp]

add after:
[cpp] if(!isSummon())
{

SpectatorVec list;
g_game.getSpectators(list, getPosition(), false, false, Map::maxViewportX, Map::maxViewportX,
Map::maxViewportY, Map::maxViewportY);

std::stringstream ss;
ss << getName() << " has respawned.";

Player* player = NULL;
for(SpectatorVec::const_iterator it = list.begin(); it != list.end(); ++it)
{
if((player = (*it)->getPlayer()))
player->sendTextMessage(MSG_EVENT_ADVANCE, ss.str());
}
}[/cpp]

that's all
I hope you like this small feature
Regards
 
Last edited:
"There is a rat plague at Thais"
"Rat has respawned."
"Rat has respawned."
"Rat has respawned."
"Rat has respawned."
"Rat has respawned."
"Rat has respawned."
"Rat has respawned."
"Rat has respawned."
"Rat has respawned."
"Rat has respawned."
"Rat has respawned."
"Rat has respawned."
"Rat has respawned."
"Rat has respawned."
"Rat has respawned."
"Rat has respawned."
"Rat has respawned."
 
"There is a rat plague at Thais"
"Rat has respawned."
"Rat has respawned."
"Rat has respawned."
"Rat has respawned."
"Rat has respawned."
"Rat has respawned."
"Rat has respawned."
"Rat has respawned."
"Rat has respawned."
"Rat has respawned."
"Rat has respawned."
"Rat has respawned."
"Rat has respawned."
"Rat has respawned."
"Rat has respawned."
"Rat has respawned."
"Rat has respawned."

lag?
 
That will not cause any lagg, but the players will get spammed.
 
I have a question about this, how the monsters spawns with one player so near them?
 
Back
Top