Jump to content
  • 0

Warp party check


Question

Posted

Hi guys, I tried to make an npc which can teleport a player as long as he is in a party. If player doesnt, they cant use the warper.
However, I always got an error which told me that I failed to put a curly in my script.

 

prontera,145,199,4	script	Struggler	10059,{
	if (getcharid(1) == 0){
		mes "^ff0000To enter, you must create or join a party of 1 or more members.^000000";
		close;
	}
	else {
		mes .@npc$;
		mes "Would you like to enter the dungeon?";
		close2;
		warp "chalo2",70,114;
		end;
	}
}

I hope anyone can tell me where my mistake is. Thank you.

6 answers to this question

Recommended Posts

  • 1
Posted

Your script will already check if the invoking player is in party or not 

if (getcharid(1) == 0){
   mes "^ff0000To enter, you must create or join a party of 1 or more members.^000000";
   close;
}
*getcharid(<type>{,"<character name>"})

This function will return a unique ID number of the invoking character, or, if a
character name is specified, of that player.

Type is the kind of associated ID number required:

 0 - Character ID
 1 - Party ID
 2 - Guild ID
 3 - Account ID
 4 - Battle Ground ID
 5 - Clan ID

 

  • 0
Posted

Thanks for your help Haruka ?

May I ask one more question?

How to add partycheck in this script, since I always got an error (missing curlys) when I added one . For example

prontera,141,181,4	script	PvP Warper	10210,{

	.@npc$ = "["+strnpcinfo(0)+"]";
	if (getcharid(1) == 0){
	mes "^ff0000To enter, you must create or join a party of 1 or more members.^000000";
	close;
	}
	mes .@npc$;
	mes "Would you like to enter the PvP Room?";
	next;
	switch(select("Enter Room [Current Users ~ "+getmapusers("pvp_n_1-1")+" ~]:Leave")) {	// Change pvp_y_2-2 into your PvP Map
	
		case 1:
			warp "pvp_n_1-1",0,0;	// Change pvp_y_2-2 into your PvP Map
			end;
			
		case 2:
			close;
	}
	end;
}

 

 

  • 0
Posted

@Patskie , Thank you, but I still got an error which told me that I missed a curlys in my script. I tried to add and modifiy it but when I do so, the server only read the script till the line 6.

  • 0
Posted (edited)

Once again. i loaded the script code. nothing is wrong..

Is this a line from a script or is this the full script from a single file?..
I recommend that for every npc script. you create a new file because it's much organize and easier to locate the errors, it will also help as you will only load the single npc..

EDIT : Please include a screenshot of the error, this can help.

Edited by Haruka Mayumi
  • Upvote 1
  • 0
Posted

@Haruka Mayumi Wow, you are correct, it works. But I am confused because everytime I reload the script using @reloadnpc command the server said that I made an error or missing curlys, but if I try re-started the server, it worked normally. Anyway, thanks for both of you @Haruka Mayumi and @Patskie . 

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...