• 0
joelolopez

any ideas to avoid loging out in a match

Question

whenever my wizard opponent is running out of potions, he will freeze me with stormgust and run away and waiting for the 10 secs to logout. any solution for this? i need a script that wont allow to logout while his on the pvp.

Share this post


Link to post
Share on other sites

10 answers to this question

Recommended Posts

  • 1

@All

all solution isnt working ... nowarp mapflag isnt used to prevent logout....

OnPCLogoutEvent only get triggered when the players logout already ...

 

there is no actual way to prevent logout issue....player still can logout with the ultimate "ALT + F4" ...just that the characters might still remain inside the games for awhile before it disappear from your sight.

Share this post


Link to post
Share on other sites
  • 0
Posted (edited)
On 4/26/2013 at 12:03 PM, Emistry said:

@All

all solution isnt working ... nowarp mapflag isnt used to prevent logout....

OnPCLogoutEvent only get triggered when the players logout already ...

 

there is no actual way to prevent logout issue....player still can logout with the ultimate "ALT + F4" ...just that the characters might still remain inside the games for awhile before it disappear from your sight.

Nowadays there's any way to prevent the Ultimate Alt+F4? Because people are abusing it from my server. ;/

Like, change the time the char will remain connected in game after Client Close...

Edited by Tanlor

Share this post


Link to post
Share on other sites
  • 0
Posted (edited)
Quote

AnnieRuru: the trick is, if the player is something like battle_config.prevent_logout, then use the autotrade code
Emistry: there are no way u could force ppl cant do the alt-f4 thing lol
AnnieRuru: if they alt+f4, then run autotrade
AnnieRuru: or @afk code
Emistry: these should be control by SOP rules
Emistry: like auto declare lose if quit from the map using alt-f4 or not through the designated exit.
Emistry: etc
Emistry: ban/jail/mute if left
AnnieRuru: lol this mod is not meant for pvp event .... this is just pure pk
AnnieRuru: like I pk you on the field map, you fight back, I losing, I quickly alt+f4
AnnieRuru: if event, already prevented by onpclogoutevent
Emistry: if they ever accept some custom idea .... it might work ....
Emistry: like.... to summon a soul upon logout.... the remaining player who kill the soul earn the points lol
Emistry: auto remove the soul after 1 min....
Emistry: etc
AnnieRuru: HAHAHAHA
Emistry: or  a clone instead.
AnnieRuru: nope, doesn't work, when login there is 5 second invulnerable, can use wing of butterfly to escape
Emistry: dun care about login
Emistry: only the logout
AnnieRuru: a clone means, I losing, I alt+f4, a clone continue harass
Emistry: upon logout from PK map ... auto summon a clone .....  clone will delete within 10~15 sec....whoever kill it before it deleted, earn the point.
AnnieRuru: haha go post it then XD funny idea
AnnieRuru: anyway I have at least tried, well now do some other stuff then

behind the scene .... in case anyone share the same views and would like to join for discussion lol  @AnnieRuru

Edited by Emistry
  • Love 1

Share this post


Link to post
Share on other sites
  • 0
Posted (edited)

 

1 - Add new map_flag: MF_NORAGEQUIT
2 - Add new value to map_session_data: lastpk
3 - Add new configuration in battle/conf.misc with PK_TIMER (time to set sd->lastpk to 0)
4 - In battle.c when player receive damage from other player in a map with this mapflag set sd->lastpk with source damage char_id.
5 - When player who logout with (sd->lastpk) > 0 && map_id2sd(sd->lastpk) is not null (still online), set for this player who last hitted the player who logout the tsd->killedrid = sd->status.char_id this sd (lets call tsd) and execute npc_event( NPCE_KILLLEVENT, tsd).
6 - Now when player A hit player B, until a ms of time, if player B Log out, the player A garants the execution of label OnPcKillEvent.
7 - Don't forget to put Add_timer in battle.c from same line of 3 step to clean the sd->lastpk of a player (gap between damage. If a player does not hit other in time of a x ms there is no reason to give the kill to the other when logout)
 

let me improve the explication, with pseudo code. I don't remember the funcions name cause I'm on office


-- battle.c
pc_damage()... // Whatever where log player damage

if(sd && tsd)
{
       sd->lasthitter= tsd->status.char_id;
       add_timer( gettick() + 5000, function_timerToCleanLastHitter, sd->bl.id); // After 5 seconds the function will set sd->lasthitter to 0
}

-- pc.c or map.c (dont remember from where OnPcLogOut is called, but the funcion of logout)

pcmap_logout()
{
    //before OnPcLogoutevent and other stuff
    if(sd->lasthitter > 0 && get_mapflag(sd->bl.m, MF_NORAGEQUIT) // Player logout and received hit from a player in last 5 seconds
    {
          struct map_session_data* tsd = map_ids2sd( sd->lasthitter );
          if(tsd != null)
          {
             tsd->killedrid = sd->status.char_id;
             npce_event( map_id2sd( tsd->lasthitter, NPCE_KILLPC);
          }
    }
}
sorry about english and code. Writing without consulting google translate or source code

Edited by Zell
  • Love 1

Share this post


Link to post
Share on other sites
  • 0

ok try 1 more time

after some intense browsing src/map/clif.cpp file, this function is the one that's responsible for handling client quit

/*==========================================
 * // line 1839
 *------------------------------------------*/
void clif_quitsave(int fd,struct map_session_data *sd) {
	if (!battle_config.prevent_logout ||
		sd->canlog_tick == 0 ||
		DIFF_TICK(gettick(), sd->canlog_tick) > battle_config.prevent_logout)
		map_quit(sd);
	else if (sd->fd) {
		//Disassociate session from player (session is deleted after this function was called)
		//And set a timer to make him quit later.
		session[sd->fd]->session_data = NULL;
		sd->fd = 0;
		add_timer(gettick() + 10000, clif_delayquit, sd->bl.id, 0);
	}
}

I have tested in-game that when Player A hitting Player B, and Player B instantly Alt+F4, there is indeed a 10 seconds duration staying in the game

add_timer(gettick() + 10000, clif_delayquit, sd->bl.id, 0);
so just change 10000, means 10000 mili-seconds into 30000 to let the player stay in-game for 30 seconds
of course the prevent_logout also set to 30000 just to be safe

  • Love 1

Share this post


Link to post
Share on other sites
  • 0
43 minutes ago, AnnieRuru said:

ok try 1 more time

after some intense browsing src/map/clif.cpp file, this function is the one that's responsible for handling client quit

/*==========================================
 * // line 1839
 *------------------------------------------*/
void clif_quitsave(int fd,struct map_session_data *sd) {
	if (!battle_config.prevent_logout ||
		sd->canlog_tick == 0 ||
		DIFF_TICK(gettick(), sd->canlog_tick) > battle_config.prevent_logout)
		map_quit(sd);
	else if (sd->fd) {
		//Disassociate session from player (session is deleted after this function was called)
		//And set a timer to make him quit later.
		session[sd->fd]->session_data = NULL;
		sd->fd = 0;
		add_timer(gettick() + 10000, clif_delayquit, sd->bl.id, 0);
	}
}

I have tested in-game that when Player A hitting Player B, and Player B instantly Alt+F4, there is indeed a 10 seconds duration staying in the game

add_timer(gettick() + 10000, clif_delayquit, sd->bl.id, 0);
so just change 10000, means 10000 mili-seconds into 30000 to let the player stay in-game for 30 seconds
of course the prevent_logout also set to 30000 just to be safe

If you set the prevent logout to 30 seconds will this not affect too when player use a skill or hit a monster? . If the player wants to go to character screen after those action will wait 30 seconds 

  • Like 1

Share this post


Link to post
Share on other sites
  • 0
1 hour ago, Zell said:

If you set the prevent logout to 30 seconds will this not affect too when player use a skill or hit a monster? . If the player wants to go to character screen after those action will wait 30 seconds 

yes, battle_config.prevent_logout when set to 30 seconds, if they are hitting monster also need to wait 30 seconds to return to character screen

hmm .... this battle_config.prevent_logout cover too broad ...

Share this post


Link to post
Share on other sites

whenever my wizard opponent is running out of potions, he will freeze me with stormgust and run away and waiting for the 10 secs to logout. any solution for this? i need a script that wont allow to logout while his on the pvp.

Set a nowarp mapflag on your pvp room.

Share this post


Link to post
Share on other sites

@Pastkie

nowarp mapflag won't solve the problem since it's about log out after some time.

 

 

 

With just script npc :

-	script	jono	-1,{
OnPCLogoutEvent:
	if( getmapflag( strcharinfo(3),mf_pvp ) && getgmlevel() < 5 )
		atcommand "@mute 1 "+ strcharinfo(0);
	end;
}

Mute the player for 1 min if he log out in pvp map  /gg

 

(don't forget to add a npc to leave the pvp).

Share this post


Link to post
Share on other sites

@Pastkie

nowarp mapflag won't solve the problem since it's about log out after some time.

 

 

 

With just script npc :

-	script	jono	-1,{
OnPCLogoutEvent:
	if( getmapflag( strcharinfo(3),mf_pvp ) && getgmlevel() < 5 )
		atcommand "@mute 1 "+ strcharinfo(0);
	end;
}

Mute the player for 1 min if he log out in pvp map  /gg

 

(don't forget to add a npc to leave the pvp).

Haha lol i misunderstood the topic. /sob

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now