Jump to content
  • 0
Surefirer

OnPCLogoutEvent count

Question

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 ([email protected]$, [email protected], [email protected], BL_PC);
  
    if (inarray(.maplist$[0],[email protected]$) == -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

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

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

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.