Jump to content
  • 0

@maintown commands (@warp phtownall 199,184 )


awesomazingxed

Question


  • Group:  Members
  • Topic Count:  51
  • Topics Per Day:  0.01
  • Content Count:  95
  • Reputation:   0
  • Joined:  10/24/14
  • Last Seen:  

Hello Everyone. Can someone make me a custom commands that has a function to warp in a specific location. 

@maintown = ( @warp phtownall 199,184 )

@mall = ( @warp turbo_room 100, 100 )

@event = ( @warp quiz_02 100,100 )

@donate = ( @warp turbo_room 200,200 )

 

 

I know there's @go commands. But is it possible to make a commands like that? 

 

Thank you in advance. Ciao.  /no1

Link to comment
Share on other sites

7 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.05
  • Content Count:  1546
  • Reputation:   192
  • Joined:  07/23/14
  • Last Seen:  

Try this you can do the same thing for others just change the " maintown

-	script	maintown	-1,{
OnInit:
	bindatcmd "maintown",strnpcinfo(3)+"::OnAtcommand";
	end;
OnAtcommand:
	atcommand "@warp phtownall 199 184";
	end;
}
  • Like 1
Link to comment
Share on other sites

  • 1

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.05
  • Content Count:  1546
  • Reputation:   192
  • Joined:  07/23/14
  • Last Seen:  

4 minutes ago, maken06 said:

Is it possible to add restrictions so that it is only used for a level 45 gm? @Radian

Change this part

bindatcmd "maintown",strnpcinfo(3)+"::OnAtcommand";

Into this

bindatcmd "maintown",strnpcinfo(3)+"::OnAtcommand",45,99;

So a level 45 and 99 GM can only access this command.

  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  234
  • Reputation:   113
  • Joined:  02/24/15
  • Last Seen:  

On 21/1/2015 at 3:50 PM, Radian said:

Try this you can do the same thing for others just change the " maintown


-	script	maintown	-1,{
OnInit:
	bindatcmd "maintown",strnpcinfo(3)+"::OnAtcommand";
	end;
OnAtcommand:
	atcommand "@warp phtownall 199 184";
	end;
}

Is it possible to add restrictions so that it is only used for a level 45 gm? @Radian

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  16
  • Reputation:   0
  • Joined:  02/16/16
  • Last Seen:  

how to add cast time or at least 5 seconds time before warping?

 

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  69
  • Reputation:   3
  • Joined:  09/04/14
  • Last Seen:  

Hello guy,

 

i have try it and it works fine. You have to do 4 steps.

 

First of all: [step 1]

Add your custom Map in the src/common/mapindex.h file. After:

#define MAP_ECLAGE_IN "ecl_in01"

add this:

#define MAP_MAINTOWN "phtownall"

Now. Step 2.

Open your src/map/atcommands.c file. Search for:

/*==========================================
 * @tonpc
 *------------------------------------------*/
ACMD_FUNC(tonpc)
{
	char npcname[NAME_LENGTH+1];
	struct npc_data *nd;

	nullpo_retr(-1, sd);

	memset(npcname, 0, sizeof(npcname));

	if (!message || !*message || sscanf(message, "%23[^\n]", npcname) < 1) {
		clif_displaymessage(fd, msg_txt(sd,1129)); // Please enter a NPC name (usage: @tonpc <NPC_name>).
		return -1;
	}

	if ((nd = npc_name2id(npcname)) != NULL) {
		if (pc_setpos(sd, map_id2index(nd->bl.m), nd->bl.x, nd->bl.y, CLR_TELEPORT) == 0)
			clif_displaymessage(fd, msg_txt(sd,0)); // Warped.
		else
			return -1;
	} else {
		clif_displaymessage(fd, msg_txt(sd,111)); // This NPC doesn't exist.
		return -1;
	}

	return 0;
}

And after it add this:

/*==========================================
 * @maintown
 *------------------------------------------*/
ACMD_FUNC(maintown)
{
if (pc_setpos(sd, mapindex_name2id(MAP_MAINTOWN), 119, 184, CLR_TELEPORT) == 0){
	clif_displaymessage(fd, msg_txt(sd,0)); // Warped.
} else {
	return -1;
}
return 0;
}

After you finish that go to Step 3. Search for

ACMD_DEF(tonpc),

And after it add this one:

ACMD_DEF(maintown),

Last but not least: Step 4.

Recompile your server and test it. It works fine for me ;) You can use it for all 4 commands. I hope you like it and I hope you have a lot of fun with it. http://pastebin.com/D144ZaQ9

 

Best regards,

Garkor

Edited by Garkor
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  86
  • Topics Per Day:  0.02
  • Content Count:  591
  • Reputation:   146
  • Joined:  06/19/12
  • Last Seen:  

use bindatcmd

-	script	warp#11	-1,{
	
	
OnInit:
bindatcmd "maintown ", strnpcinfo(3) +"::OnMaintown";
bindatcmd "mall", strnpcinfo(3) +"::OnMall";
bindatcmd "event", strnpcinfo(3) +"::OnEvent";
bindatcmd "donate", strnpcinfo(3) +"::OnDonate";
end;
		
	
	
OnMaintown:	
warp "phtownall",199,184;
end;


OnMall:	
warp "turbo_room",100,100;
end;


OnEvent:	
warp "quiz_02",100,100;
end;


OnDonate:	
warp "turbo_room",200,200;
end;
}	
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  177
  • Reputation:   21
  • Joined:  01/31/12
  • Last Seen:  

use bindatcmd

-	script	warp#11	-1,{
	
	
OnInit:
bindatcmd "maintown ", strnpcinfo(3) +"::OnMaintown";
bindatcmd "mall", strnpcinfo(3) +"::OnMall";
bindatcmd "event", strnpcinfo(3) +"::OnEvent";
bindatcmd "donate", strnpcinfo(3) +"::OnDonate";
end;
		
	
	
OnMaintown:	
warp "phtownall",199,184;
end;


OnMall:	
warp "turbo_room",100,100;
end;


OnEvent:	
warp "quiz_02",100,100;
end;


OnDonate:	
warp "turbo_room",200,200;
end;
}	

Each atcommand is only allowed one binding. If you rebind, it will override the original binding.

and

 

-	script	maintown	-1,{
OnInit:
	bindatcmd "maintown",strnpcinfo(3)+"::OnAtcommand";
	end;
OnAtcommand:
	atcommand "@warp phtownall 199 184";
	end;
}
Why use atcommand "@war... when you can use the warp script command?

i.e.

warp "phtownhall",199,184;
So.. Maybe something like this (untested):

 

-	script	atcmdwarp#Maintown	-1,{

	OnInit:
		bindatcmd strnpcinfo(3)+"::On"+strnpcinfo(3);
		end;
	
	OnMaintown:
		warp "phtownall",199,184;
		end;
	
	OnMall:
		warp "turbo_room",100,100;
		end;
	
	OnEvent:
		warp "quiz_02",100,100;
		end;
	
	OnDonate:
		warp "turbo_room",200,200;
		end;
}
-	duplicate(Maintown)	atcmdwarp#Mall	-1
-	duplicate(Maintown)	atcmdwarp#Event	-1
-	duplicate(Maintown)	atcmdwarp#Donate	-1
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...