map,x,y,z script Tribe Officer 100,{ set .@tribe_1$, "[Dark Army]"; set .@tribe_2$, "[Light Army]"; set .@n$, "[Tribe Officer]"; if ( tribe ) { mes .@n$; mes "You have no business here..."; mes "Back off!"; close; } for ( set .@i, 0; getd(".@tribe_"+(.@i+1)+"$") != ""; set .@i, .@i + 1 ) set .@menu$, .@menu$ + getd(".@tribe_"+(.@i+1)+"$") + ":"; do { set .@j, 0; set .@k, 0; mes .@n$; mes "Which tribe do you want to join?"; set .@j, select (.@menu$) - 1; explode(.@tribe$,.@menu$,":"); next; mes .@n$; mes "Are you sure you want to join the " + .@tribe$[.@j] + "?"; set .@k, select ( "Yes:No" ); next; } while (.@k != 1); set .@tmp_length, 23 - getstrlen(.@tribe$[.@j]); if ( getstrlen(strcharinfo(0)) > .@tmp_length ) { mes .@n$; mes "You're required to change your name before joining the " + .@tribe$[.@j] + " and your name length shouldn't be longer than " + .@tmp_length + "."; select ( "Okay..." ); next; do { mes .@n$; mes "Please provide me your new name"; do { input .@tmp_name$; } while (getstrlen(.@tmp_name$) > .@tmp_length); next; mes .@n$; mes "So.. " + .@tmp_name$ + " will be your new name?"; set .@k, select ( "Yes:No" ); next; mes .@n$; setarray .@char$, "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "{", "}", "[", "]"; for ( set .@i, 0; .@i < getarraysize(.@char$); set .@i, .@i + 1 ) { if ( compare(.@tmp_name$,.@char$[.@i]) ) { set .@msg$[getarraysize(.@msg$)], "No restricted characters allowed."; } } if ( getstrlen(.@tmp_name$) <= 4 ) { set .@msg$[getarraysize(.@msg$)], "- Must have more than 4 characters."; } query_sql("SELECT `char_id` FROM `char` WHERE `name` REGEXP ('\[.*\]"+escape_sql(.@tmp_name$)+"') OR `name`='"+escape_sql(.@tmp_name$)+"",.@cid); if ( .@cid[1] != 0 ) { set .@msg$[getarraysize(.@msg$)], "- This name has been used."; } for ( set .@i, 0; .@i < getarraysize(.@msg$); set .@i, .@i + 1 ) mes .@msg$[.@i]; next; } while (.@k != 1 || getarraysize(.@msg$) > 0); } else { set .@tmp_name$, strcharinfo(0); } mes .@n$; mes "You will be forced to logout, in order for your new name to take effect."; close2; set tribe, .@j + 1; query_sql "UPDATE `char` SET `name`='" + escape_sql(.@tribe$[.@j]+.@tmp_name$) + "' WHERE `char_id`="+escape_sql(getcharid(0))+""; atcommand "@kick " + strcharinfo(0); end; }