Hello !
Yesterday I was testing a command that was requested by the user 'Fresh prince', called @question, and I'm using the script similar to Capuche's one.
But, when I tested it with my "normal" account (level 0, a normal player), it doesn't create the Chat Room, just teleports me and sits me.
This are the scripts (an exact copy of the script owned (or given by) by Capuche , since I don't find mines D:!)
- script atcmd_example -1,{
OnInit:
bindatcmd "question",strnpcinfo(3)+"::OnAtcommand";
end;
OnAtcommand:
warp "prontera",150,150;
createchatroom( getcharid(3), "Question", "",5 );
sit;
end;
}
And its .src modification at 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 script_def.inc
BUILDIN_DEF(createchatroom,"vss??"),
As I said before, it works with any GM account (level 99 tested at least), but when used in level 0 accounts, it does not create the pub when teleported.
Where is the possible error or what is the problem here?
Thanks C: