Jump to content
  • 0

any ideas to avoid loging out in a match


joelolopez

Question


  • Group:  Members
  • Topic Count:  154
  • Topics Per Day:  0.03
  • Content Count:  493
  • Reputation:   46
  • Joined:  01/24/12
  • Last Seen:  

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.

Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 1

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2345
  • Joined:  10/28/11
  • Last Seen:  

@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.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  50
  • Reputation:   14
  • Joined:  07/23/18
  • Last Seen:  

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
Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2345
  • Joined:  10/28/11
  • Last Seen:  

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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  53
  • Topics Per Day:  0.01
  • Content Count:  411
  • Reputation:   260
  • Joined:  04/25/12
  • Last Seen:  

 

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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  53
  • Topics Per Day:  0.01
  • Content Count:  411
  • Reputation:   260
  • Joined:  04/25/12
  • Last Seen:  

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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

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 ...

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

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.

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

@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).

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

@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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...