Jump to content
  • 0

@question


Fresh prince

Question


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  295
  • Reputation:   6
  • Joined:  10/14/12
  • Last Seen:  

Requesting a command that when executed, you will be warped at a certain location (Prontera 200,200) with a chatroom named "question".

Link to comment
Share on other sites

12 answers to this question

Recommended Posts


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  


- script atcmd_example -1,{

OnInit:

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

.x_radius = 10;

.y_radius = 10;

.x_center = 150;// radius... center... no need explanation it's obvious

.y_center = 150;

end;

OnAtcommand:

do {

.@x = rand( (.x_center-.x_radius), (.x_center+.x_radius) );

.@y = rand( (.y_center-.y_radius), (.y_center+.y_radius) );

.@loop++;

if ( .@loop == 1000 ) {

message strcharinfo(0), "Too much people. You must wait. Command failed.";

end;

}

}

while( getareausers( "prontera",.@x,.@y,.@x,.@y ) || !checkcell( "prontera",.@x,.@y,cell_chkpass ) );

warp "prontera",.@x,.@y;

createchatroom( getcharid(3), "Question", "",5 );

sit;

end;

}

  • Upvote 1
Link to comment
Share on other sites

  • 1

  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

-	script	atcmd_example	-1,{
OnInit:
	bindatcmd "question",strnpcinfo(3)+"::OnAtcommand";
	end;
OnAtcommand:
	warp "prontera",150,150;
	createchatroom( getcharid(3), "Question", "",5 );
	sit;
	end;
}

 

 

Add in src/custom/script.inc

// createchatroom( <char|account|name>, <title>, <password>, {<limit>, <type>} );
// password : only enabled for type 0
// limit[ 1,20 ], 1 by default
// type : 1 -> public, 0 -> private

BUILDIN_FUNC(createchatroom)
{
	int len = strlen( script_getstr(st,3) );
	int limit = 1;
	char title[ CHATROOM_TITLE_SIZE ];
	char password[ CHATROOM_PASS_SIZE ];
	bool type = 1;// chat public by default
	TBL_PC *sd = NULL;

	if ( script_isstring(st,2) )
		sd = map_nick2sd( script_getstr(st,2) );
	else {
		int id = script_getnum(st,2);
		sd = map_charid2sd(id) ? map_charid2sd(id) : map_id2sd(id);
	}
	if ( sd == NULL ) {
		ShowWarning( "createchatroom : none player attached.\n" );
		return 0;
	}
	if ( (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOROOM) || (battle_config.basic_skill_check && pc_checkskill(sd,NV_BASIC) < 4 ) || npc_isnear(&sd->bl) ) return 0;
	if ( len > CHATROOM_TITLE_SIZE || strlen( script_getstr(st,4) ) > CHATROOM_PASS_SIZE ) return 0;
	if ( sd->chatID != 0 ) return 0;

	safestrncpy( title, script_getstr(st,3), min( len+1,CHATROOM_TITLE_SIZE ) );
	safestrncpy( password, script_getstr(st,4), CHATROOM_PASS_SIZE );

	if ( script_hasdata(st,5) ) {
		int tmp = script_getnum(st,5);
		if ( tmp > limit && tmp <= 20 ) limit = tmp;
		else if ( tmp > 20 ) limit = 20;
	}
	if ( script_hasdata(st,6) && script_getnum(st,6) == 0 ) type = 0;

	chat_createpcchat( sd, title, password, limit, type );
	chat_changechatstatus( sd, title, password, limit, type );
	return 0;
}

 

and in src/custom/script_def.inc

BUILDIN_DEF(createchatroom,"vss??"),

then recompile

  • Upvote 2
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  59
  • Reputation:   2
  • Joined:  08/01/12
  • Last Seen:  

On 11/9/2013 at 3:34 AM, Capuche said:

-	script	atcmd_example	-1,{
OnInit:
	bindatcmd "question",strnpcinfo(3)+"::OnAtcommand";
	end;
OnAtcommand:
	warp "prontera",150,150;
	createchatroom( getcharid(3), "Question", "",5 );
	sit;
	end;
}

 

 

Add in src/custom/script.inc


// createchatroom( <char|account|name>, <title>, <password>, {<limit>, <type>} );
// password : only enabled for type 0
// limit[ 1,20 ], 1 by default
// type : 1 -> public, 0 -> private

BUILDIN_FUNC(createchatroom)
{
	int len = strlen( script_getstr(st,3) );
	int limit = 1;
	char title[ CHATROOM_TITLE_SIZE ];
	char password[ CHATROOM_PASS_SIZE ];
	bool type = 1;// chat public by default
	TBL_PC *sd = NULL;

	if ( script_isstring(st,2) )
		sd = map_nick2sd( script_getstr(st,2) );
	else {
		int id = script_getnum(st,2);
		sd = map_charid2sd(id) ? map_charid2sd(id) : map_id2sd(id);
	}
	if ( sd == NULL ) {
		ShowWarning( "createchatroom : none player attached.\n" );
		return 0;
	}
	if ( (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOROOM) || (battle_config.basic_skill_check && pc_checkskill(sd,NV_BASIC) < 4 ) || npc_isnear(&sd->bl) ) return 0;
	if ( len > CHATROOM_TITLE_SIZE || strlen( script_getstr(st,4) ) > CHATROOM_PASS_SIZE ) return 0;
	if ( sd->chatID != 0 ) return 0;

	safestrncpy( title, script_getstr(st,3), min( len+1,CHATROOM_TITLE_SIZE ) );
	safestrncpy( password, script_getstr(st,4), CHATROOM_PASS_SIZE );

	if ( script_hasdata(st,5) ) {
		int tmp = script_getnum(st,5);
		if ( tmp > limit && tmp <= 20 ) limit = tmp;
		else if ( tmp > 20 ) limit = 20;
	}
	if ( script_hasdata(st,6) && script_getnum(st,6) == 0 ) type = 0;

	chat_createpcchat( sd, title, password, limit, type );
	chat_changechatstatus( sd, title, password, limit, type );
	return 0;
}

 

and in src/custom/script_def.inc


BUILDIN_DEF(createchatroom,"vss??"),

then recompile

got error when recompile using Rathena lates Rev.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  21
  • Topics Per Day:  0.01
  • Content Count:  46
  • Reputation:   1
  • Joined:  03/16/20
  • Last Seen:  

On 11/9/2013 at 6:34 AM, Capuche said:

-	script	atcmd_example	-1,{
OnInit:
	bindatcmd "question",strnpcinfo(3)+"::OnAtcommand";
	end;
OnAtcommand:
	warp "prontera",150,150;
	createchatroom( getcharid(3), "Question", "",5 );
	sit;
	end;
}

 

 

Add in src/custom/script.inc


// createchatroom( <char|account|name>, <title>, <password>, {<limit>, <type>} );
// password : only enabled for type 0
// limit[ 1,20 ], 1 by default
// type : 1 -> public, 0 -> private

BUILDIN_FUNC(createchatroom)
{
	int len = strlen( script_getstr(st,3) );
	int limit = 1;
	char title[ CHATROOM_TITLE_SIZE ];
	char password[ CHATROOM_PASS_SIZE ];
	bool type = 1;// chat public by default
	TBL_PC *sd = NULL;

	if ( script_isstring(st,2) )
		sd = map_nick2sd( script_getstr(st,2) );
	else {
		int id = script_getnum(st,2);
		sd = map_charid2sd(id) ? map_charid2sd(id) : map_id2sd(id);
	}
	if ( sd == NULL ) {
		ShowWarning( "createchatroom : none player attached.\n" );
		return 0;
	}
	if ( (sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOROOM) || (battle_config.basic_skill_check && pc_checkskill(sd,NV_BASIC) < 4 ) || npc_isnear(&sd->bl) ) return 0;
	if ( len > CHATROOM_TITLE_SIZE || strlen( script_getstr(st,4) ) > CHATROOM_PASS_SIZE ) return 0;
	if ( sd->chatID != 0 ) return 0;

	safestrncpy( title, script_getstr(st,3), min( len+1,CHATROOM_TITLE_SIZE ) );
	safestrncpy( password, script_getstr(st,4), CHATROOM_PASS_SIZE );

	if ( script_hasdata(st,5) ) {
		int tmp = script_getnum(st,5);
		if ( tmp > limit && tmp <= 20 ) limit = tmp;
		else if ( tmp > 20 ) limit = 20;
	}
	if ( script_hasdata(st,6) && script_getnum(st,6) == 0 ) type = 0;

	chat_createpcchat( sd, title, password, limit, type );
	chat_changechatstatus( sd, title, password, limit, type );
	return 0;
}

 

and in src/custom/script_def.inc


BUILDIN_DEF(createchatroom,"vss??"),

then recompile

does this work in latest git?

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  


- script atcmd_example -1,{

OnInit:

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

end;

OnAtcommand:

warp "prontera",150,150;

end;

}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  116
  • Reputation:   4
  • Joined:  01/11/12
  • Last Seen:  

Requesting a command that when executed, you will be warped at a certain location (Prontera 200,200) with a chatroom named "question".

 

Chat room on the char? I dun know if there is a way to make a chat room on a char, only on NPC.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  295
  • Reputation:   6
  • Joined:  10/14/12
  • Last Seen:  

It is like when i for example use a command @question, i will be warped into prontera 150,150 with an automatic pub named "question" so a GM can assist me/us players by seeing ang getting into those pubs one at a time.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  116
  • Reputation:   4
  • Joined:  01/11/12
  • Last Seen:  

Yep. I dont know if that is possible thru script. src edit might bee needed for that.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  295
  • Reputation:   6
  • Joined:  10/14/12
  • Last Seen:  

Anyone that can give me a hand here?

Thanks capuche for trying though

Capuche's script work but only warps you to a certain spot.

What i need is warps you and creates a pub automaticlly saying help, 1/5 so 5 people can get inside the pub.

Thanks!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  295
  • Reputation:   6
  • Joined:  10/14/12
  • Last Seen:  

Thanks Mr. Capuche,

 

Forgive me for being so ignorant, I could not find scr/custom. Did not know how to add as well, if ever those needs to be added. However, I found a topic similar to what i wanted. I'm wondering if you could add a delay on this kindly.

 

 

 

pc->setpos(sd, mapindex_name2id( prontera ), 150, 150, CLR_TELEPORT);      //needed to be executed 1st

 

// 2~ 3 seconds delay


chat_createpcchat(sd, "waiting for someone", "", 2, 2);    //executed last

 

 

 

Thanks very much!

Edited by Fresh prince
Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

src/custom

Are you using rAthena ?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  69
  • Topics Per Day:  0.02
  • Content Count:  295
  • Reputation:   6
  • Joined:  10/14/12
  • Last Seen:  

Yes, looks like it was recently added.

Src/custom folder with .inc files. Im going to add thses later.

Btw, is it possible to narrow down its warping coordinates say in a square cell of 15x15?

If they use the command, they will only get warped inside the 15x15 square?

Thanks Mr.capuche

Should be random warp inside aswell to avoid getting in the same cell

Thanks again!

 

thanks so much Mr.Capuche!!

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