Jump to content
  • 0

onpclogoutevent


caspa

Question


  • Group:  Members
  • Topic Count:  194
  • Topics Per Day:  0.04
  • Content Count:  499
  • Reputation:   3
  • Joined:  03/11/12
  • Last Seen:  

OnPCLogoutEvent:
if(getmapusers("1@pump") == 0) hideoffnpc "MvP Summoner"; announce "MvP room is now availabe.",bc_all;
}else if(strcharinfo(3) != "1@pump"){
warp "prontera",150,150;
end;

is there anything wrong with this?

coz i want it to :

1. it kills the monster in the map if the last person in the map log out

2. it announce mvp room is now available if the last person in the map log out

3. it hideoffnpc if the last person in the map log out

4. it warps the person to prontera if they log out and log in again.

Link to comment
Share on other sites

2 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  379
  • Reputation:   304
  • Joined:  11/10/11
  • Last Seen:  

You should test it before ask :)

Missing a "{", missing a "}", bad else location, the announce is send every time a player log out, warp players every time the log out to prontera.

Should be something like this:

OnPCLogOutEvent:

   if ( strcharinfo(3) == "1@pump" )
   {
       if ( getmapusers("1@pump") == 0 ) // 0 or 1 ? Does the script is execute before decrement the map counter ?
       {
           hideoffnpc "MvP Summoner";
           announce "MvP room is now availabe.", bc_all;
           killmonsterall "1@pump";
       }
       warp "prontera", 150, 150;
       end;
   }

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  439
  • Reputation:   29
  • Joined:  12/08/11
  • Last Seen:  

OnPCLogOutEvent:
if ( strcharinfo(3) == "1@pump" ) {
	if ( getmapusers("1@pump") == 0 ) {
			announce "MvP room is now availabe.", bc_all;
			killmonsterall "1@pump";
			disablenpc "MvP Summoner";
	}
}

// = Mapflag
1@pump	mapflag	nosave	SavePoint

I don't know if this will work. I can't find event that triggers when a user leaves a map example warping out of the map. You may want to add a check script for the map every x minutes to get mapusers, in case they leave the map without logging out.

Another alternative is to provide an npc to exit the map.

Edited by Magnetix
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...