Undisguise when player die

Easycore

New member
Messages
184
Points
0
Hi Hercules,

Is there any way to disable disguise when character is die?

Regards ~

 
Last edited by a moderator:
hmm ...

#include "common/hercules.h"#include <stdio.h>#include <string.h>#include <stdlib.h>#include "map/pc.h"#include "common/HPMDataCheck.h"HPExport struct hplugin_info pinfo = { "deadnodisguise", // Plugin name SERVER_TYPE_MAP,// Which server types this plugin works with? "0.1", // Plugin version HPM_VERSION, // HPM Version (don't change, macro is automatically updated)};int pc_disguise_pre( struct map_session_data *sd, int class_ ) { // disable player from disguise if ( pc_isdead(sd) ) hookStop(); return 0;}int pc_dead_pre( struct map_session_data *sd, struct block_list *src ) { // undisguise when player die if ( sd->disguise != -1 ) pc->disguise(sd, -1); return 0;}HPExport void plugin_init (void) { addHookPre( "pc->disguise", pc_disguise_pre ); addHookPre( "pc->dead", pc_dead_pre );}sry that I no longer writing source, only plugins
EDIT: sry there are 2 checks

 
Last edited by a moderator:
hmm ...

#include "common/hercules.h"#include <stdio.h>#include <string.h>#include <stdlib.h>#include "map/pc.h"#include "common/HPMDataCheck.h"HPExport struct hplugin_info pinfo = { "deadnodisguise", // Plugin name SERVER_TYPE_MAP,// Which server types this plugin works with? "0.1", // Plugin version HPM_VERSION, // HPM Version (don't change, macro is automatically updated)};int pc_disguise_pre( struct map_session_data *sd, int class_ ) { // disable player from disguise if ( pc_isdead(sd) ) hookStop(); return 0;}int pc_dead_pre( struct map_session_data *sd, struct block_list *src ) { // undisguise when player die if ( sd->disguise != -1 ) pc->disguise(sd, -1); return 0;}HPExport void plugin_init (void) { addHookPre( "pc->disguise", pc_disguise_pre ); addHookPre( "pc->dead", pc_dead_pre );}sry that I no longer writing source, only plugins
EDIT: sry there are 2 checks
Thank you for help me. I'll try this at night ~

@@AnnieRuru Your plugin doesn't work me. The map-server is crash.

But don't worry, I'll use OnPCDieEvent for this.

 
OnPCDieEvent can only undisguise player when died, but still allow GMs to @disguise when died

that's why I did a plugin

just test again, it actually works

maybe your hercules still use the old plugin format that still needs GET_SYMBOL stuff

 
OnPCDieEvent can only undisguise player when died, but still allow GMs to @disguise when died

that's why I did a plugin

just test again, it actually works

maybe your hercules still use the old plugin format that still needs GET_SYMBOL stuff
How can check this?

 
hmm ...

#include "common/hercules.h"#include <stdio.h>#include <string.h>#include <stdlib.h>#include "map/pc.h"#include "common/HPMDataCheck.h"HPExport struct hplugin_info pinfo = { "deadnodisguise", // Plugin name SERVER_TYPE_MAP,// Which server types this plugin works with? "0.1", // Plugin version HPM_VERSION, // HPM Version (don't change, macro is automatically updated)};int pc_disguise_pre( struct map_session_data *sd, int class_ ) { // disable player from disguise if ( pc_isdead(sd) ) hookStop(); return 0;}int pc_dead_pre( struct map_session_data *sd, struct block_list *src ) { // undisguise when player die if ( sd->disguise != -1 ) pc->disguise(sd, -1); return 0;}HPExport void plugin_init (void) { addHookPre( "pc->disguise", pc_disguise_pre ); addHookPre( "pc->dead", pc_dead_pre );}sry that I no longer writing source, only pluginsEDIT: sry there are 2 checks
On pc_dead, add a null check.

Probably thats why its a crash, if Easycore was using old version, he probably wouldnt be able to compile plugin, sincw hercules.h was added with the removal of GET_SYMBOL

 
if (sd == NULL)

return 0;

OR

nullpo_retr(0,sd);

 
now that make some sense

Code:
#include "common/hercules.h"#include <stdio.h>#include <string.h>#include <stdlib.h>#include "map/pc.h"#include "common/nullpo.h"#include "common/HPMDataCheck.h"HPExport struct hplugin_info pinfo = {	"deadnodisguise", // Plugin name	SERVER_TYPE_MAP,// Which server types this plugin works with?	"0.2",			// Plugin version	HPM_VERSION,	// HPM Version (don't change, macro is automatically updated)};int pc_disguise_pre( struct map_session_data *sd, int class_ ) { // disable player from disguise	nullpo_retr( 0, sd ); 	if ( pc_isdead(sd) )		hookStop();	return 0;}int pc_dead_pre( struct map_session_data *sd, struct block_list *src ) { // undisguise when player die	nullpo_retr( 0, sd ); 	if ( sd->disguise != -1 )		pc->disguise(sd, -1);	return 0;}HPExport void plugin_init (void) {	addHookPre( "pc->disguise", pc_disguise_pre );	addHookPre( "pc->dead", pc_dead_pre );}
 
Last edited by a moderator:
Oh sorry, I already had solved this.

Indeed, the problem was old version.

@@AnnieRuru

A part of the plugin I sent you (@pk) ,I took it out based on this topic

 
Back
Top