viewing paste Tribe Officer | Text

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
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;
 
}
Viewed 964 times, submitted by Guest.