version 1.5 | | version 1.6 |
---|
| | |
/* | | /* |
* static char *rcsid_c_chat_c = | | * static char *rcsid_c_chat_c = |
* "$Id: c_chat.c,v 1.5 2001/10/07 06:48:53 garbled Exp $"; | | * "$Id: c_chat.c,v 1.6 2001/10/14 07:57:14 gros Exp $"; |
*/ | | */ |
/* | | /* |
CrossFire, A Multiplayer game for X-windows | | CrossFire, A Multiplayer game for X-windows |
| | |
int command_shout (object *op, char *params) | | int command_shout (object *op, char *params) |
{ | | { |
char buf[MAX_BUF]; | | char buf[MAX_BUF]; |
| | #ifdef PLUGINS |
| | int evtid; |
| | CFParm CFP; |
| | #endif |
if (params == NULL) { | | if (params == NULL) { |
new_draw_info(NDI_UNIQUE, 0,op,"Shout what?"); | | new_draw_info(NDI_UNIQUE, 0,op,"Shout what?"); |
return 1; | | return 1; |
| | |
strncat(buf, params, MAX_BUF-30); | | strncat(buf, params, MAX_BUF-30); |
buf[MAX_BUF - 30] = '\0'; | | buf[MAX_BUF - 30] = '\0'; |
new_draw_info(NDI_UNIQUE | NDI_ALL | NDI_RED, 1, NULL, buf); | | new_draw_info(NDI_UNIQUE | NDI_ALL | NDI_RED, 1, NULL, buf); |
| | #ifdef PLUGINS |
| | /* GROS : Here we handle the SHOUT global event */ |
| | evtid = EVENT_SHOUT; |
| | CFP.Value[0] = (void *)(&evtid); |
| | CFP.Value[1] = (void *)(op); |
| | CFP.Value[2] = (void *)(params); |
| | GlobalEvent(&CFP); |
| | #endif |
return 1; | | return 1; |
} | | } |
| | |
int command_tell (object *op, char *params) | | int command_tell (object *op, char *params) |
{ | | { |
char buf[MAX_BUF],*name = NULL ,*msg = NULL; | | char buf[MAX_BUF],*name = NULL ,*msg = NULL; |
| | char buf2[MAX_BUF]; |
player *pl; | | player *pl; |
if ( params != NULL){ | | if ( params != NULL){ |
name = params; | | name = params; |
| | |
return 1; | | return 1; |
} | | } |
| | |
| | |
sprintf(buf,"%s tells you:",op->name); | | sprintf(buf,"%s tells you:",op->name); |
strncat(buf, msg, MAX_BUF-strlen(buf)-1); | | strncat(buf, msg, MAX_BUF-strlen(buf)-1); |
buf[MAX_BUF-1]=0; | | buf[MAX_BUF-1]=0; |
| | |
for(pl=first_player;pl!=NULL;pl=pl->next) | | for(pl=first_player;pl!=NULL;pl=pl->next) |
if(strncasecmp(pl->ob->name,name,MAX_NAME)==0) | | if(strncasecmp(pl->ob->name,name,MAX_NAME)==0) |
{ | | { |
new_draw_info(NDI_UNIQUE | NDI_WHITE, 0, pl->ob, buf); | | new_draw_info(NDI_UNIQUE | NDI_ORANGE, 0, pl->ob, buf); |
| | sprintf(buf2, "You tell to %s: %s",name,msg); |
| | new_draw_info(NDI_UNIQUE | NDI_ORANGE, 0, op, buf2); |
return 1; | | return 1; |
} | | } |
new_draw_info(NDI_UNIQUE, 0,op,"No such player."); | | new_draw_info(NDI_UNIQUE, 0,op,"No such player."); |
return 1; | | return 1; |
} | | } |
| | |
| | |
/* | | /* |
* This function covers basic emotions a player can have. An emotion can be | | * This function covers basic emotions a player can have. An emotion can be |
* one of three things currently. Directed at oneself, directed at someone, | | * one of three things currently. Directed at oneself, directed at someone, |