|
Developers Forum Developers, Client and Server announcements. |
![]() |
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
Palace Plugin - Cant examine or consume USERMOVE message
OK,
I donwloaded the Server_SDK.ZIP for Palace and complied and ran the example plugin perfectly. I want to make a plugin that can selectively prevent a user from moving around in a room, sort of like the `PIN command, but freezing them at their current location and not changing their avatar. As a test I tried to examine the MSG_USERMOVE message and consume it with my plugin. Thinking this would prevent ALL users from moving. This crashes my Palace server. If I comment out the examination code, the server runs but people can still move as if I have not consumed the message... Anybody can help would be appreciated... Code for message handler pasted in below: ClientMsg *handleMessage(ServerState *state, AnyType pluginDat, ClientMsg *msg) { char buf[256]; char *text; int textLength; /* talk messages */ if (msg->eventType == MSG_TALK || msg->eventType == MSG_XTALK) { ClientMsg_xTalk *xmsg = (ClientMsg_xTalk *) &msg->msg; if (msg->eventType == MSG_TALK) { /* Normal talk messages just have plain text... */ ClientMsg_talk *tmsg = (ClientMsg_talk *) &msg->msg; text = tmsg->text; } else { /* ...but xtalk messages need to be "decrypted". */ if (msg->length < sizeof(uint16)) { /* Abort if badly formed xstring */ return msg; } textLength = *(uint16 *)(xmsg->text) - 3; if (textLength > 255) { /* Avoid nasty buffer overrun opportunity */ return msg; } DecryptCString((StringPtr) xmsg->text + 2, buf, textLength, FALSE); text = buf; } /* Handle commands, if present */ if (checkCommands((PluginID) pluginDat, text, state->currentUser)) { /* Consume commands */ return NULL; } return msg; } char smBuff[32]; sprintf(smBuff, "Message: %08x", msg->eventType); UserPrivateMessage(state->currentUser, smBuff); if (msg->eventType == MSG_USERMOVE) { Point *pt = (Point *) msg->msg; char medBuff[64]; sprintf(medBuff, "New Pos: v=%d, h=%d", (int) pt->v, (int) pt->h); UserPrivateMessage(state->currentUser, medBuff); /* Consume commands */ return NULL; } return msg; } Thanks, Macore |
#2
|
||||
|
||||
Not sure anyone on the forum would know how to answer this, perhaps try posting your question on the Palace Server group? We got some of the original Palace programmers on there.
http://tech.groups.yahoo.com/group/palace-server/ |
#3
|
|||
|
|||
Thank you maarten,
Macore |
#4
|
||||
|
||||
No prob and yes its a free service (the yahoo group) helping people on Palace should always be free i think. :)
|
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
wordfilter plugin | dustinn | User Questions | 2 | 12-15-2006 04:59 AM |
start-plugin will not work, but start-palace will | RobertSearcy | User Questions | 1 | 04-12-2005 10:11 AM |
Weird message entering palace? | complexity | User Questions | 1 | 02-03-2005 08:56 PM |
Wordfilter plugin | Riverspirit | User Questions | 4 | 01-19-2005 03:15 PM |
Any clue what happened to the Plugin SDK? | Mitch | User Questions | 1 | 10-12-2004 10:34 AM |