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;
}
while (.@k != 1);
}
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;
}