• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

[Release] Map only notices

Status
Not open for further replies.
Junior Spellweaver
Joined
Apr 5, 2008
Messages
152
Reaction score
65
Hello everyone,
I thought i would release my map only GM commands. (So i don't feel like I'm leaching as much)


In Players.cpp add: (i hope you know where)
Code:
        // Code made by ZeusMS
        else if(strcmp(command, "mnotice") == 0){ // Blue notice Map Only
            for(unsigned int j=0; j<Maps::info[player->getMap()].Players.size(); j++)
                PlayersPacket::showNoticeOneChar(next_token, 0, Maps::info[player->getMap()].Players[j]);
        }
        else if(strcmp(command, "mnotice1") == 0){ // Box Notice Map Only
            for(unsigned int j=0; j<Maps::info[player->getMap()].Players.size(); j++)
                PlayersPacket::showNoticeOneChar(next_token, 1, Maps::info[player->getMap()].Players[j]);
        }
        else if(strcmp(command, "mnotice2") == 0){ // Red Notice Map Only
            for(unsigned int j=0; j<Maps::info[player->getMap()].Players.size(); j++)
                PlayersPacket::showNoticeOneChar(next_token, 5, Maps::info[player->getMap()].Players[j]);
        }
        // End code made by ZeusMS

And for this part i couldn't find the creator (if you are him just say so and i will credit you)

Add in PlayersPacket.h:
Code:
static void showNoticeOneChar(char* msg, char type, Player* player);

Below:
Code:
static void showInfo(Player* player, Player* getinfo);

At the bottom of PlayersPacket.cpp add:
Code:
void PlayersPacket::showNoticeOneChar(char* msg, char type, Player* player){
    Packet packet = Packet();
    packet.addHeader(0x2d);
    packet.addByte(type);
    packet.addShort(strlen(msg));
    packet.addString(msg, strlen(msg));
    packet.packetSend(player);
}

And i think that covers it :)
 
Newbie Spellweaver
Joined
Apr 16, 2008
Messages
14
Reaction score
0
Thank you~
I was trying to figure out how to make it map-only, haha.
 
Newbie Spellweaver
Joined
Apr 22, 2008
Messages
54
Reaction score
0
you need a loop in 'showNoticeOneChar', otherwise i think it will just send the message to one player only

Edit: my bad.. its in the 'else if' statements
 
Last edited:
Junior Spellweaver
Joined
Apr 5, 2008
Messages
152
Reaction score
65
Actually, no.

If you look at the for loops it sends it multiple times to each character on the map.

It works perfect for me.

EDIT: You beat me to it with your editing :p
 
Status
Not open for further replies.
Back
Top