Jump to content
  • 0

One transaction at a time


Reborn

Question


  • Group:  Members
  • Topic Count:  104
  • Topics Per Day:  0.03
  • Content Count:  290
  • Reputation:   3
  • Joined:  09/29/13
  • Last Seen:  

is there a way that there will only be one player is allowed to transact or talk to the NPC? If there is already transacting a conversation to the npc other player wont be able to talk to the NPC unless the current player is done with the transaction or if the player cancel the transaction to the NPC then by then the other player will be able to transact to the NPC but one at a time only. If this is possible can anyone share the code?

I have already tried the getattachedrid and playerattached but this 2 doesnt work. other player still able to transact to the NPC even though there is already doing a transaction to the NPC.

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   382
  • Joined:  02/03/12
  • Last Seen:  

Yeah just set a npc variable for it.
 

prontera,100,200,3	script	Picky	78,{
	if(!.one_at_a_time) {
		.one_at_a_time = 1;
		mes "Hello";
		next;
		.one_at_a_time = 0;
	} else {
		mes "Do you mind I'm talking to someone here!";
	}
	close;
}

Edit --

I thought about it a little more and this method might not always work for example if a player gets disconnected while talking with the npc and never resets the variable. So instead maybe it would be better to use an npctimer there might still be some conditions where the player leaves the npc and is still attached but I think overall it's a better approach.

prontera,100,200,3	script	Picky	78,{
	if(!.one_at_a_time) {
		attachnpctimer;
		initnpctimer;
		mes "Hello";
		next;
	} else {
		mes "Do you mind I'm talking to someone here!";
	}
	close;

Ontimer0:
	.one_at_a_time = 1;
OnTimer5000:
	if(getattachedrid()) {
		attachnpctimer;
		initnpctimer;
	}
OnTimerQuit:
	.one_at_a_time = 0;
	stopnpctimer;
	detachnpctimer;
}

@Reborn

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