Jump to content
  • 0
Fresh prince

@question

Question

12 answers to this question

Recommended Posts


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

[email protected] = rand( (.x_center-.x_radius), (.x_center+.x_radius) );

[email protected] = rand( (.y_center-.y_radius), (.y_center+.y_radius) );

[email protected]++;

if ( [email protected] == 1000 ) {

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

end;

}

}

while( getareausers( "prontera",[email protected],[email protected],[email protected],[email protected] ) || !checkcell( "prontera",[email protected],[email protected],cell_chkpass ) );

warp "prontera",[email protected],[email protected];

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

sit;

end;

}

  • Upvote 1
Link to comment
Share on other sites

  • 1
-	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
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
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

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

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

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

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

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

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.