- 0
 
	
		 Sign in to follow this  
	
	
	
		
		
			Followers
			0
		
	
HPM Hooking return random value from the defined function
				
				
					Asked by 
AnnieRuru
				
				
				
			
- 
Recently Browsing 0 members
No registered users viewing this page.
 

need both patch and plugin to explain
patch
src/map/pc.c | 2 ++ 1 file changed, 2 insertions(+)diff --git a/src/map/pc.c b/src/map/pc.cindex 2372d31..412c12b 100644--- a/src/map/pc.c+++ b/src/map/pc.c@@ -975,12 +975,14 @@ bool pc_authok(struct map_session_data *sd, int login_id2, time_t expiration_tim sd->login_id2 = login_id2; +ShowDebug ( "2. %s try to login. Value %d Group %d.", sd->status.name, group_id, sd->group_id ); if (pc->set_group(sd, group_id) != 0) { ShowWarning("pc_authok: %s (AID:%d) logged in with unknown group id (%d)! kicking...n", st->name, sd->status.account_id, group_id); clif->authfail_fd(sd->fd, 0); return false; }+ShowDebug ( "3. %s try to login. Value %d Group %d.", sd->status.name, group_id, sd->group_id ); memcpy(&sd->status, st, sizeof(*st));#include <stdio.h>#include <string.h>#include <stdlib.h>#include "../map/pc.h"#include "../common/HPMi.h"#include "../common/HPMDataCheck.h" /* should always be the last file included! (if you don't make it last, it'll intentionally break compile time) */HPExport struct hplugin_info pinfo = { "maintenance", // Plugin name SERVER_TYPE_MAP,// Which server types this plugin works with? "1.0", // Plugin version HPM_VERSION, // HPM Version (don't change, macro is automatically updated)};bool pc_authok_pre( struct map_session_data *sd, int login_id2, time_t expiration_time, int group_id, struct mmo_charstatus *st, bool changing_mapservers ) { ShowDebug ( "1. %s try to login. Value %d Group %d.", sd->status.name, group_id, sd->group_id ); if ( group_id < 99 ) { clif->authfail_fd( sd->fd, 1 ); return false; } return true;}bool pc_authok_post( int retVal, struct map_session_data *sd, int login_id2, time_t expiration_time, int group_id, struct mmo_charstatus *st, bool changing_mapservers ) { ShowDebug ( "4. %s try to login. Value %d Group %d.", sd->status.name, group_id, sd->group_id ); if ( sd->group_id < 99 ) { clif->authfail_fd( sd->fd, 1 ); return false; } return true;}HPExport void plugin_init (void) { clif = GET_SYMBOL("clif"); addHookPre( "pc->authok", pc_authok_pre ); addHookPost( "pc->authok", pc_authok_post );}..
.
ok I need the group_id value, when I debug it with a normal char
[Debug]: 1. try to login. Value 90443865 Group 0.
[Debug]: 2. try to login. Value 0 Group 0.
[Debug]: 3. try to login. Value 0 Group 0.
[Debug]: 4. KinoRuru try to login. Value 90443865 Group 0.
then only got a kick
debug with a GM99 char
[Debug]: 1. try to login. Value 90443865 Group 0.
[Debug]: 2. try to login. Value 99 Group 0.
[Debug]: 3. try to login. Value 99 Group 99.
[Debug]: 4. AnnieRuru try to login. Value 90443865 Group 99.
and successfully login
the problem here is ... why is that when using patch,
the pc_authok function inside pc.c works fine, group_id returns the value correctly
but when using plugin,
no matter is pre-hook or post-hook, group_id value gives random-like value ?
my feeling tells me, there is some bug inside srcpluginsHPMHooking folder..
Share this post
Link to post
Share on other sites