Jump to content
  • 0

OnPCLogoutEvent count


Surefirer

Question


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.02
  • Content Count:  113
  • Reputation:   1
  • Joined:  12/15/18
  • Last Seen:  

Hello,

I was trying to make a script about if a player for some reason logout or disconnect, when the player logout back in, the character will return to where he disconnected. But only allow once. If logout second time, the character will return to save point.

I am able to do it without count logout time, I was tried many methods, but did not work. I hope someone can teach me how to do it.

I script as following:

-    script    reset_map    -1,{
OnInit:
    setarray .maplist$[0],"prt_fild08";
    end;
    
OnPCLogoutEvent:
    getmapxy (.@map$, .@x, .@y, BL_PC);
  
    if (inarray(.maplist$[0],.@map$) == -1)
        end;
    
    warp "prt_fild08",0,0;
    end;
}

(I was tired to count the logout times, and use OnPCLogoutEvent to warp character to save point if the character logout the map second with no luck.)

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  159
  • Reputation:   58
  • Joined:  07/11/14
  • Last Seen:  

I didn't understand what you want to do, you cannot warp a player in logout, if can explain more clearly what you want, I can try to do. ?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  303
  • Reputation:   117
  • Joined:  12/10/16
  • Last Seen:  

Like this?

-	script	reset_map	-1,{

OnInit:

	setarray .maplist$[0],"prt_fild08";
	end;

OnPCLogoutEvent:

	if(inarray(.maplist$,strcharinfo(3)) != -1) {
		getmapxy map$,x,y,BC_PC;
		logout_count++;
	}
	end;

OnPCLoginEvent:

	if(logout_count == 1) {
		warp map$,x,y;
		logout_count = 0;
		map$ = "";
		x = y = 0;
	} else if(inarray(.maplist$,strcharinfo(3)) != -1) {
		warp "SavePoint",0,0;
	}
	end;

}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.02
  • Content Count:  113
  • Reputation:   1
  • Joined:  12/15/18
  • Last Seen:  

1 hour ago, n0tttt said:

Like this?


-	script	reset_map	-1,{

OnInit:

	setarray .maplist$[0],"prt_fild08";
	end;

OnPCLogoutEvent:

	if(inarray(.maplist$,strcharinfo(3)) != -1) {
		getmapxy map$,x,y,BC_PC;
		logout_count++;
	}
	end;

OnPCLoginEvent:

	if(logout_count == 1) {
		warp map$,x,y;
		logout_count = 0;
		map$ = "";
		x = y = 0;
	} else if(inarray(.maplist$,strcharinfo(3)) != -1) {
		warp "SavePoint",0,0;
	}
	end;

}

 

Thank you for the help. I think you get my idea. But your script shows error. Please see attached picture.

QQ图片20200227145626.png

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.02
  • Content Count:  113
  • Reputation:   1
  • Joined:  12/15/18
  • Last Seen:  

3 hours ago, Hyroshima said:

I didn't understand what you want to do, you cannot warp a player in logout, if can explain more clearly what you want, I can try to do. ?

Hello, I have a custom instance, when the player disconnect or logout the game, when they log in again, I want the character back to the instance map, so they can continue enjoy the game, however it only allow re-enter the instance map once. hope you understand, if not I will try explain more detail.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  159
  • Reputation:   58
  • Joined:  07/11/14
  • Last Seen:  

20 minutes ago, Surefirer said:

Hello, I have a custom instance, when the player disconnect or logout the game, when they log in again, I want the character back to the instance map, so they can continue enjoy the game, however it only allow re-enter the instance map once. hope you understand, if not I will try explain more detail.

in this case warp will not work since it is an instance, it would have to be instance_enter, or am i mistaken?
I will make a model and send it here...

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.02
  • Content Count:  113
  • Reputation:   1
  • Joined:  12/15/18
  • Last Seen:  

On 2/28/2020 at 7:26 AM, Hyroshima said:

in this case warp will not work since it is an instance, it would have to be instance_enter, or am i mistaken?
I will make a model and send it here...

you are right, I just tested, and realized it should be instance_enter just like you mentioned. thanks for ur help.

I have one more request, when the character re-enter the instance map, the character will be dead to avoid player abuse this function. Thanks.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  303
  • Reputation:   117
  • Joined:  12/10/16
  • Last Seen:  

Try changing BL_PC to UNITTYPE_PC. It seems like you have an outdated rAthena.

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