Jump to content

Orc Lord

Members
  • Posts

    56
  • Joined

  • Last visited

Posts posted by Orc Lord

  1. The problem is players uses space in the beginning of name which is hard to recall or ban them, is there a way to disable the spacebar at the start of the name?

    // http://www.eathena.ws/board/index.php?showtopic=216929

    poring_c01,100,100,0 script NameChange 910,{
    // CONFIG - copy these settings from ../conf/char_athena.conf
    set .@char_name_option, 1;
    set .@char_name_letters$, "abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";


    mes "Input the name you want to change to:";
    input .@name$;

    // check name length
    if (getstrlen(.@name$)<4) {
    mes "Names must be at least^FF0000 4^000000 characters long.";
    close;
    } else if (getstrlen(.@name$)>24) {
    mes "Names can be up to^FF0000 24^000000 characters long.";
    close;
    }
    // check allowed characters
    if (.@char_name_option == 1) {
    // only letters/symbols in 'char_name_letters' are allowed
    for (set .@i,0; .@i<getstrlen(.@name$); set .@i,.@i+1) {
    if (!compare(.@char_name_letters$, charat(.@name$,.@i))) {
    mes "Invalid character: " + charat(.@name$,.@i);
    close;
    }
    }
    } else if (.@char_name_option == 2) {
    // letters/symbols in 'char_name_letters' option are forbidden
    for (set .@i,0; .@i<getstrlen(.@name$); set .@i,.@i+1) {
    if (compare(.@char_name_letters$, charat(.@name$,.@i))) {
    mes "Invalid character: " + charat(.@name$,.@i);
    close;
    }
    }
    }

    // confirm
    mes "Change your name from";
    mes strcharinfo(0)+" -->^0000FF "+.@name$+"^000000 ?";
    mes "^FF0000After you confirm, you will be logged out. Please wait 10 seconds before logging back in!";
    if(select("Yes, change my name:No, thanks")==2) close;

    if (getcharid(1)) {
    mes "Please leave your party before requesting a name change.";
    close;
    } else if (getcharid(2)) {
    mes "Please leave your guild before requesting a name change.";
    close;
    }
    // check if name exists
    query_sql "SELECT COUNT(char_id) FROM `char` WHERE `name`='"+escape_sql(.@name$)+"'", .@name_exists;
    if (.@name_exists) {
    mes "Sorry, that name is already taken ";
    close;
    }

    // Zeny/Item cost goes here
    // if(countitem(13962) < 5) {
    // mes "[Namechange Service]";
    // mes "It appears that you're lacking some Donation Credit Boxes.";
    // close;
    // }
    // delitem 13962,5;

    set .@char_id, getcharid(0); // save their Char ID
    atcommand "@kick "+strcharinfo(0);
    // sleep 500; // (usually not necessary) give the server time to save their char to SQL
    query_sql "UPDATE `char` SET `name`='"+escape_sql(.@name$)+"' WHERE char_id="+.@char_id;
    end;
    }
    [/codeBOX]

×
×
  • Create New...