Jump to content
  • 0

Recruiter NPC not deleting the registry part...


caspa

Question


  • Group:  Members
  • Topic Count:  194
  • Topics Per Day:  0.04
  • Content Count:  499
  • Reputation:   3
  • Joined:  03/11/12
  • Last Seen:  

hello again.. i have found a bug on a script called recuiter npc... by mr. kenedos...

 

	//===== eAthena Script ============================================
//= Recruiter
//===== By: =======================================================
//= Kenedos (FlowFallFlakes)
//===== Current Version: ==========================================
//= 2.0
//===== Compatible With: ==========================================
//= eAthena 14214+ Trunk TXT/SQL
//===== Description: ==============================================
//= Lists party, or guild registries, allowing people to
//= Join party/guilds with certain ease.
//===== Topic =====================================================
//= http://www.eathena.ws/board/index.php?showtopic=242306
//===== Additional Comments: ======================================
//= Added guild-part, reorganized party-part.
//= Please report any further bugs you find.
//= Special thanks to AnnieRuru, Zippy, Z3R0, alexxdls and every other eA
//= scripter for their hard work helping us newbies, and for making guides
//= that contribute to everyone.
//=================================================================
	prontera,158,188,5    script    Recruiter#h1-0    758,{
	
//             ------------------------------------------------------
//            |               ____    __  __  _                       |
//            |              / __/__ / /_/ /_(_)__  ___  ____         |
//            |             _\ \/ -_) __/ __/ / _ \/ _ `(_-<          |
//            |            /___/\__/\__/\__/_/_//_/\_, /___/          |
//            |                                   /___/               |
//            |                                                       |
//             ------------------------------------------------------
	// --------------------------------------------------------------------------------
// ------------------------------- Party Side -------------------------------------
// --------------------------------------------------------------------------------
	//Max character base level for the party part of the script.
//Default : 99
set .@maxservlvl, 99;
	//Input the maximum ammount of parties in the list (If you set this too high, it may overload your server!)
//Default : 30
set .@maxptnum, 30;
	//Input the delay (in seconds) between announcements for both leader and members. (the "Charname wants to join your party" message.)
//Default : 30
set @announcecd, 30;
	//Input 1 for true and 0 for false.
//This will allow players to change their settings, to show or hide any of the 3 parameters bellow.
//Default: 1
set .@allowchange,1;
	//Ignore this part -------
if (0) {
// -----------------------
	//This will display party member's level in the "List Members" option
//Default : 1
set .list0, 1;
	//This will display the party member's job in the "List Members" option
//Default : 1
set .list1, 1;
	//This will display the party member's location in the "List Members" option
//Default : 0
set .list2, 0;
	
}// -------------------------------------------------------------------------------
// ------------------------------- Guild Side -------------------------------------
// --------------------------------------------------------------------------------
	//Max number of guild registries (If you set this too high, it may overload your server!)
//Default : 30
set .maxgnum, 30;
	//Max number of guild objectives
//Default : 3
//Maximum : 6
set .@objnum, 6;
	//Max level of guild members
//Default : 99
set .@maxglvl, 99;
	//If your server has third classes, set to 1, otherwise, set to 0.
//Default : 0
set .@gthird, 1;
	//Max number of jobs chosen generally
//Default : 3
//Maximum : 6
set .@jobnum1, 6;
	//Max number of jobs chosen specifically
//Default : 6
//Maximum : 18
set .@jobnum2, 18;
	//Max numer of items in item requirement list
//Default : 3
set .@gmaxitem, 10;
	//Cooldown of Leader and Member announcements
//Default : 30
set .gannocd, 30;
	//Answer time for Guild Leader warps.
//Default : 10
set .gwdelay, 10;
	//Wait time for Map Search and List Members (Sleep time)
//The higher, the longer it will take to calculate those functions.
//but also will lag less your server.
//WARNING : Setting this too low will CRASH your server.
//Minimum : 10
//Default : 15
set .sleeptime, 15;
	//Initial Bitmask Option (Must be a potency of 2)
//Default : 7859
//Maximum : 16383
set .@bitmask, 7859;
	//Max Bitmask Options (Do not mess with this unless you know what you are doing!)
//Default : 8192
set .maxbit, 8192;
	//Max Bitmask Number (Do not mess with this unless you know what you are doing!)
//Default : 14
set .maxbitn, 14;
	// --------------------------------------------------------------------------------
// ----------------------------- End of Settings ----------------------------------
// --------------------------------------------------------------------------------
    
    if (.reload == 1 ) {
        mes "["+strnpcinfo(1)+"]";
        mes "Please wait, this npc is still being ^0000FFLoaded^000000. This may happen after server restarts or npc reloads.";
        close;
    }
    
    mes "["+strnpcinfo(1)+"]";
    mes "Welcome! I'm here to offer you the ^009900Party^000000 and ^FF0000Guild^000000 Recruiting services. Wich kind of service are you interested in?";
    next;
    
    L_start:
    
    switch (select ("Party Function:Guild Function")) {
        case 1:
        
        //Check for a player inside a party, but not party leader.
        if (getcharid(1) != 0) {
            if ( getpartyleader(getcharid(1),2) != getcharid(0) ){
                mes "[Party Warper]";
                mes "Sorry but you are already inside a party.";
                close;
            }
        }
        
        if (getcharid(1) == 0) {
        mes "["+strnpcinfo(1)+"]";
        mes "Looking for a party? Let me check the list of avaible parties for you...";
        next;
        }
	        for (set .@dyn,0; .@dyn<.@maxptnum; set .@dyn,.@dyn+1){
            if (getd("puprdy"+.@dyn) == 1){
                if (getcharid(1) == 0)
                    setd "puprdy"+.@dyn,0;
                else if ((getpartyleader(getcharid(1))) != (getd(".partyinfo"+.@dyn+"$[4]")))
                    setd "puprdy"+.@dyn,0;
                else if (getcharid(1,strcharinfo(0)) != getd(".partyinfo"+.@dyn+"[0]")) {
                    //there is a deletearray here to retain from a player creating a party, leaving the party and before anyone talks to the npc he remakes another party and re-recruit. this deletearray here is to prevent this bug.
                    setd "puprdy"+.@dyn,0;
                    deletearray getd(".partyinfo"+.@dyn+"$");
                    deletearray getd(".partyinfo"+.@dyn);
                }
            }
        }
	        set .@leaderid, getpartyleader(getcharid(1),2);
	        if(.@leaderid == getcharid(0)){
                for (set .@k,0;.@k<.@maxptnum;set .@k,.@k+1){
                    if (getd("puprdy"+.@k) == 1){
                        mes "["+strnpcinfo(1)+"]";
                        mes "You already registered a party.";
                        close;
                    }
                }
            mes "["+strnpcinfo(1)+"]";
            mes "Would you like to register your party for recruiting new members?";
            if (select ("Yes:No") == 2)
                close;
            set @plevel$,"Any";
            set @plocation$,"Any";
            set @pjob$,"Any";
            set @pobj$,"Any";
            set @pname$,strcharinfo(1);
            set @pequip1,32767;
            set @pequip2,32767;
            set @pequip3,32767;
            while (1) {
                if (.@breakeq)
                    set .@breakeq,0;
                next;
                mes "["+strnpcinfo(1)+"]";
                mes "Please fill the information for ^0000FF"+strcharinfo(1)+"^000000 party";
                switch (select ("Objective (^FF0000"+@pobj$+"^000000):Level (^FF0000"+@plevel$+"^000000):Location (^FF0000"+@plocation$+"^000000):Jobs (^FF0000"+@pjob$+"^000000):Equips:^00AA00Complete^000000") ) {
                    case 1:
                    next;
                    mes "["+strnpcinfo(1)+"]";
                    mes "Please select the objective of your party";
                    switch ( select ("Any:Leveling:Item Hunting:MVPing:PVPing:Role-Playing:Cancel") ) {
                        case 1:
                        set @pobj$,"Any";
                        break;
                        case 2:
                        set @pobj$,"Leveling";
                        break;
                        case 3:
                        set @pobj$,"Item Hunting";
                        break;
                        case 4:
                        set @pobj$,"MVPing";
                        break;
                        case 5:
                        set @pobj$,"PVPing";
                        break;
                        case 6:
                        set @pobj$,"Role-Playing";
                        break;
                        case 7:
                        break;
                    }
                    break;
                    
                    case 2:
                    next;
                    //ATTENTION : the maximum level is 99 by default! change this in the beggining of the script!
                    mes "["+strnpcinfo(1)+"]";
                    mes "Please input the minimum level requirement";
                    input @pminlvl;
                    if ((@pminlvl > .@maxservlvl ) || ( @pminlvl < 1 )) {
                        next;
                        mes "["+strnpcinfo(1)+"]";
                        mes "Sorry but the minimum level requirement is invalid.";
                        break;
                    }
                    next;
                    mes "["+strnpcinfo(1)+"]";
                    mes "Please input the maximum level requirement";
                    input @pmaxlvl;
                        if ((@pmaxlvl > .@maxservlvl ) || ( @pmaxlvl < 1 ) || (@pminlvl >= @pmaxlvl)) {
                        next;
                        mes "["+strnpcinfo(1)+"]";
                        mes "Sorry but the maximum level requirement is invalid.";
                        break;
                    }
                    set @plevel$,""+@pminlvl+"~"+@pmaxlvl+"";
                    break;
                    
                    case 3:
                    next;
                    mes "["+strnpcinfo(1)+"]";
                    mes "Please enter the party location";
                    menu "Any",-,"Fields",field,"Dungeons",dungeon,"Instanced Dungeons",indun,"Cancel",premenu;
                    set @plocation$,"Any";
                    break;
	                    indun:
                    menu "Endless Tower",in1,"Orc Memorial Dungeon",in2,"Sealed Shrine",in3,"Quest Dungeons",inquest,"Cancel",premenu;
	                    field:
                    menu     "Amatsu Fields",wamafild,
                    "Ayothaya Fields",wayofild,
                    "Bifrost Fields",wbiffild,
                    "Brasilis Fields",wbrfild,
                    "Comodo Fields",wcmdfild,
                    "Descates Fields",wdescatesfild,
                    "Einbroch Fields",weinfild,
                    "Geffen Fields",wgeffild,
                    "Gonryun Fields",wgonfild,
                    "Hugel Fields",whufild,
                    "Lighthalzen Fields",wlhzfild,
                    "Louyang Field",wloufild,
                    "Lutie Field",wxmasfild,
                    "Manuk Fields",wmanukfild,
                    "Mjolnir Fields",wmjolnir,
                    "Moscovia Fields",wmosc,
                    "Niflheim Fields",wniffild,
                    "Odin Temple",wodint,
                    "Payon Forests",wpayfor,
                    "Prontera Fields",wprtfild,
                    "Rachel Fields",warunfild,
                    "Sograt Deserts",wmocfild,
                    "Umbala Fields",wumfild,
                    "Veins Fields",wveinsfild,
                    "Yuno Fields",wyunofild,
                    "Cancel",premenu;
                    
                    dungeon:
                    menu     "Abbey, Cursed Monastery",wabbey,
                    "Abyss Lakes",wabyss,
                    "Amatsu Dungeon",ama,
                    "Anthell",ant,
                    "Ayothaya Dungeons",wayodun,
                    "Beach Dungeon",beach,
                    "Byalan Dungeon",byalan,
                    "Brasilis Dungeon",toilet,
                    "Clock Tower",clock,
                    "Coal Mines",coal,
                    "Culverts",culvert,
                    "Einbroch Dungeons",weindun,
                    "Gefenia",gefenia,
                    "Geffen Dungeon",geffen,
                    "Glast Heim",glast,
                    "Gonryun Dungeon",gon,
                    "Hidden Dungeon",hidden,
                    "Ice Dungeon",iced,
                    "Juperos Dungeons",wjuper,
                    "Kiel Dungeons",wkieldun,
                    "Lighthalzen",wlhzdun,
                    "Louyang Dungeons",wloudun,
                    "Magma Dungeon",magma,
                    "Moscovia Dungeon",wmosk,
                    "Niddhogr Dungeon",niddhogr,
                    "Orc Dungeon",orc,
                    "Payon Dungeon",payon,
                    "Pyramids",pyramids,
                    "Rachel Sanctuary",rachels,
                    "Scaraba Hole",scaraba,
                    "Sphinx",sphinx,
                    "Sunken Ship",sunken,
                    "Thanatos Tower",wthat,
                    "Thor Volcano",wthor,
                    "Toy Factory",toy,
                    "Turtle Dungeon",turtle,
                    "Umbala Dungeons",wumdun,
                    "Dimensonal Gorge",dimen,
                    "Cancel",premenu;
                    
                    premenu:
                    break;
                    
                    wamafild:
                    set @plocation$,"Amatsu Field";
                    
                    break;
                    wayofild:
                    set @plocation$,"Ayothaya Field";
                    
                    break;
                    wbiffild:
                    //attention! this field is new, it may bug ur server
                    set @plocation$,"Bifrost Field";
                    
                    break;
                    wbrfild:
                    set @plocation$,"Brasilis Field";
                    
                    break;
                    wcmdfild:
                    set @plocation$,"Comodo Field";
                    
                    break;
                    wdescatesfild:
                    set @plocation$,"Descates Field";
                    
                    break;
                    weinfild:
                    set @plocation$,"Einbroch Field";
                    
                    break;
                    wgeffild:
                    set @plocation$,"Geffen Field";
                    
                    break;
                    wgonfild:
                    set @plocation$,"Gonryun Field";
                    
                    break;
                    whufild:
                    set @plocation$,"Hugel Fields";
                    
                    break;
                    wlhzfild:
                    set @plocation$,"Lighthalzen Fields";
                    
                    break;
                    wloufild:
                    set @plocation$,"Louyang Fields";
                    
                    break;
                    wxmasfild:
                    set @plocation$,"Lutie Fields";
                    
                    break;
                    wmanukfild:
                    set @plocation$,"Manuk Fields";
                    
                    break;
                    wmjolnir:
                    set @plocation$,"Mjolnir Fields";
                    
                    break;
                    wmosc:
                    set @plocation$,"Moscovia Fields";
                    
                    break;
                    wniffild:
                    set @plocation$,"Nifflheim Fields";
                    
                    break;
                    wodint:
                    set @plocation$,"Odin Temple";
                    
                    break;
                    wpayfor:
                    set @plocation$,"Payon Forests";
                    
                    break;
                    wprtfild:
                    set @plocation$,"Prontera Fields";
                    
                    break;
                    warunfild:
                    set @plocation$,"Rachel Fields";
                    
                    break;
                    wmocfild:
                    set @plocation$,"Sograt Deserts";
                    
                    break;
                    wumfild:
                    set @plocation$,"Umbala Fields";
                    
                    break;
                    wveinsfild:
                    set @plocation$,"Veins Fields";
                    
                    break;
                    wyunofild:
                    set @plocation$,"Yuno Fields";
                    
                    break;
                    
                //Dungeons -------------------------------------
	                    wabbey:
                    set @plocation$,"Cursed Abbey";
                    
                    break;
                    wabyss:
                    set @plocation$,"Abyss Lakes";
                    
                    break;
                    ama:
                    set @plocation$,"Amatsu Dungeon";
                    
                    break;
                    ant:
                    set @plocation$,"Anthell";
                    
                    break;
                    wayodun:
                    set @plocation$,"Ayothaya Dungeon";
                    
                    break;
                    beach:
                    set @plocation$,"Beach Dungeon";
                    
                    break;
                    byalan:
                    set @plocation$,"Byalan Dungeon";
                    
                    break;
                    toilet:
                    set @plocation$,"Brasilis Dungeon";
                    
                    break;
                    clock:
                    set @plocation$,"Clock Tower";
                    
                    break;
                    coal:
                    set @plocation$,"Coal Mines";
                    
                    break;
                    culvert:
                    set @plocation$,"Culvert";
                    
                    break;
                    weindun:
                    set @plocation$,"Einbroch Dungeon";
                    
                    break;
                    gefenia:
                    set @plocation$,"Gefenia";
                    
                    break;
                    geffen:
                    set @plocation$,"Geffen Dungeon";
                    
                    break;
                    glast:
                    set @plocation$,"Glast Heim";
                    
                    break;
                    gon:
                    set @plocation$,"Gonryun Dungeon";
                    
                    break;
                    hidden:
                    set @plocation$,"Hidden Temple";
                    
                    break;
                    iced:
                    set @plocation$,"Ice Dungeon";
                    
                    break;
                    wjuper:
                    set @plocation$,"Juperos";
                    
                    break;
                    wkieldun:
                    set @plocation$,"Kiel Dungeon";
                    
                    break;
                    wlhzdun:
                    set @plocation$,"Lighthalzen Dungeon";
                    
                    break;
                    wloudun:
                    set @plocation$,"Louyang Dungeon";
                    
                    //oh my god i cant take it anymore
                    break;
                    magma:
                    set @plocation$,"Magma Dungeon";
                    
                    break;
                    wmosk:
                    set @plocation$,"Moscovia Dungeon";
                    
                    break;
                    niddhogr:
                    set @plocation$,"Niddhogr Dungeon";
                    
                    break;
                    orc:
                    set @plocation$,"Orc Dungeon";
                    
                    break;
                    payon:
                    set @plocation$,"Payon Dungeon";
                    
                    break;
                    pyramids:
                    set @plocation$,"Pyramids";
                    
                    break;
                    rachels:
                    set @plocation$,"Rachel Sanctuary";
                    
                    break;
                    scaraba:
                    set @plocation$,"Scaraba Hole";
                    
                    break;
                    sphinx:
                    set @plocation$,"Sphinx";
                    
                    break;
                    sunken:
                    set @plocation$,"Sunken Ship";
                    
                    break;
                    wthat:
                    set @plocation$,"Thanatos Tower";
                    
                    break;
                    wthor:
                    set @plocation$,"Thors Volcano";
                    
                    break;
                    toy:
                    set @plocation$,"Toy Factory";
                    
                    break;
                    turtle:
                    set @plocation$,"Turtle Dungeon";
                    
                    break;
                    wumdun:
                    set @plocation$,"Umbala Dungeon";
                    
                    break;
                    dimen:
                    set @plocation$,"Dimensional Gorge";
                    
                    break;
                    
                    
                //Instances -----------------------------------
	                    in1:
                    set @plocation$,"Endless Tower";
                    
                    break;
                    in2:
                    set @plocation$,"Orc Memorial Dungeon";
                    
                    break;
                    in3:
                    set @plocation$,"Sealed Shrine";
                    
                    break;
                    
                    inquest:
                    set @plocation$,"Quest Dungeons";
                    
                    break;
                        
                    case 4:
                    next;
                    mes "["+strnpcinfo(1)+"]";
                    mes "The current jobs are (^FF0000"+@pjob$+"^000000)";
                    mes "Please select the jobs you want";
                    menu "Any",anyj,"Damage Dealers",dd,"Tankers",tanker,"Mobbers",mobber,"Spellcasters",spell,"Healers",healer,"Supports",support,"Cancel",-;
                    break;
                    
                    anyj:
                    set @pjob$,"Any";
                    break;
                    
                    dd:
                    set @pjob$,"Damage Dealers";
                    break;
                    
                    tanker:
                    set @pjob$,"Tankers";
                    break;
                    
                    mobber:
                    set @pjob$,"Mobbers";
                    break;
                    
                    spell:
                    set @pjob$,"Spellcasters";
                    break;
                    
                    healer:
                    set @pjob$,"Healers";
                    break;
                    
                    support:
                    set @pjob$,"Supports";
                    break;
                    
                    case 5:
                    while (1) {
                        if (.@breakeq)
                            break;
                        next;
                        mes "["+strnpcinfo(1)+"]";
                        mes "Current required equipment list is:";
                        mes "Item 1: ^FF0000"+getitemname(@pequip1)+"^000000";
                        mes "Item 2: ^0000FF"+getitemname(@pequip2)+"^000000";
                        mes "Item 3: ^009900"+getitemname(@pequip3)+"^000000";
                        switch ( select ("Add Item:Remove Item:Back") ) {
                            
                            case 1:
                            next;
                            mes "["+strnpcinfo(1)+"]";
                            mes "Input the item ID";
                            input @pequip,0,32767;
                            if (getitemname(@pequip)=="null"){
                                mes "["+strnpcinfo(1)+"]";
                                mes "Invalid Item!";
                                break;
                            }
                            if (getitemname(@pequip1)=="null") set @pequip1,@pequip;
                            else if (getitemname(@pequip2)=="null") set @pequip2,@pequip;
                            else if (getitemname(@pequip3)=="null") set @pequip3,@pequip;
                            else {
                                mes "["+strnpcinfo(1)+"]";
                                mes "All Item Slots are full!";
                                next;
                            }
                            break;
                            
                            case 2:
                            next;
                            mes "["+strnpcinfo(1)+"]";
                            mes "Wich item would you like to remove?";
                            switch ( select("^FF0000"+getitemname(@pequip1)+"^000000:^0000FF"+getitemname(@pequip2)+"^000000:^009900"+getitemname(@pequip3)+"^000000:Cancel") ) {
                                case 1:
                                set @pequip1,32767;
                                break;
                                case 2:
                                set @pequip2,32767;
                                break;
                                case 3:
                                set @pequip3,32767;
                                break;
                                case 4:
                                break;
                            }
                            break;
                                
                            case 3:
                            set .@breakeq,1;
                            break;
                        }
                    }
                    break;
	                    case 6:
                    next;
                    //thanks to alexxdls for the dynamic variables idea!
                    for (set .@i,0; .@i <.@maxptnum ; set .@i, .@i + 1 ) {
                        if (getarraysize(getd(".partyinfo"+.@i+"$")) == 0) {
                            set @pleadername$,strcharinfo(0);
                            set @partyid,getcharid(1,strcharinfo(0));
                            setd ".partyinfo"+.@i+"$[0]",@pname$;
                            setd ".partyinfo"+.@i+"$[1]",@plevel$;
                            setd ".partyinfo"+.@i+"$[2]",@plocation$;
                            setd ".partyinfo"+.@i+"$[3]",@pjob$;
                            setd ".partyinfo"+.@i+"$[4]",@pleadername$;
                            setd ".partyinfo"+.@i+"$[5]",@pobj$;
                            setd ".partyinfo"+.@i+"[0]",@partyid;
                            setd ".partyinfo"+.@i+"[1]",@pequip1;
                            setd ".partyinfo"+.@i+"[2]",@pequip2;
                            setd ".partyinfo"+.@i+"[3]",@pequip3;
                            setd "puprdy"+.@i,1;
                            mes "["+strnpcinfo(1)+"]";
                            mes "Your party has been added succesfully!";
                                if (@pobj$ == "Any" ) announce @pname$ +" party level "+@plevel$+" for "+@plocation$+" location is recruiting "+@pjob$+" jobs!",bc_all,0x8080FF;
                            else announce @pobj$+" : "+@pname$+" party level "+@plevel$+" for "+@plocation$+" location is recruiting "+@pjob$+" jobs!",bc_all,0x8080FF;
                            break;
                        }
                        
                        if (.@i >= .@maxptnum) {
                            mes "["+strnpcinfo(1)+"]";
                            mes "Im sorry but all the slots for parties are filled up, please come back later";
                            break;
                        }
                    }
                    close;
                }
            }
        }
	        if (.@leaderid != getcharid(0)){
            L_return:
            
            
            //uses the function for this specific kind of restriction.
            set .@pupnow,99;
            for (set .@dyn,0; .@dyn<.@maxptnum; set .@dyn, .@dyn+1) {
                if (getarraysize(getd(".partyinfo"+.@dyn+"$")) != 0) {
                    set .@restrict, callfunc ( "checkonline#pt1",.@pupnow,getd(".partyinfo"+.@dyn+"$[4]"),getd(".partyinfo"+.@dyn+"[0]") );
                    if (.@restrict != 0) {
                        deletearray getd(".partyinfo"+.@dyn+"$");
                        deletearray getd(".partyinfo"+.@dyn);
                    }
                }
            }
            
            //Reorganizes arrays
            set .@w, 0;
            while (.@w < .@maxptnum) {
                if ( getarraysize(getd(".partyinfo"+.@w+"$")) != 0  ) {
                    set .@i,.@w - 1;
                    while ( .@i >= 0 ) {
                        if (getarraysize(getd(".partyinfo"+.@i+"$")) == 0) {
                            setd ".partyinfo"+.@i+"$[0]", getd(".partyinfo"+.@w+"$[0]");
                            setd ".partyinfo"+.@i+"$[1]", getd(".partyinfo"+.@w+"$[1]");
                            setd ".partyinfo"+.@i+"$[2]", getd(".partyinfo"+.@w+"$[2]");
                            setd ".partyinfo"+.@i+"$[3]", getd(".partyinfo"+.@w+"$[3]");
                            setd ".partyinfo"+.@i+"$[4]", getd(".partyinfo"+.@w+"$[4]");
                            setd ".partyinfo"+.@i+"$[5]", getd(".partyinfo"+.@w+"$[5]");
                            setd ".partyinfo"+.@i+"[0]", getd(".partyinfo"+.@w+"[0]");
                            setd ".partyinfo"+.@i+"[1]", getd(".partyinfo"+.@w+"[1]");
                            setd ".partyinfo"+.@i+"[2]", getd(".partyinfo"+.@w+"[2]");
                            setd ".partyinfo"+.@i+"[3]", getd(".partyinfo"+.@w+"[3]");
                            deletearray getd(".partyinfo"+.@w+"$");
                            deletearray getd(".partyinfo"+.@w);
                        }
                    set .@i, .@i - 1;
                    }
                }
                set .@w,.@w+1;
            }
            
            
            
            
            
            //First dynamic menu try
            //Thanks to Z3R0 and AnnieRuru for their guides and assitance.
            set .menu$,"";
            set .@cn,0;
            for (set .@den,0; .@den<.@maxptnum; set .@den,.@den+1) {
                if ((getarraysize(getd(".partyinfo"+.@den+"$"))) != 0) {
                    if (getcharid(0,getd(".partyinfo"+.@den+"$[4]")) == 0 ) {
                        set .@menu$, .@menu$ + ":" + "Party- ^0000FF" + getd(".partyinfo"+.@den+"$") + " (^FF0000Off^000000)";
                        set .@cn,.@cn+1;
                    }
                    else{
                        set .@menu$, .@menu$ + ":" + "Party- ^0000FF" + getd(".partyinfo"+.@den+"$") + " (^009900On^000000)";
                        set .@cn,.@cn+1;
                    }
                }
	            }
            set .@cn,.@cn+2;
            set .@menu$, .@menu$  +":Cancel";
            if (.@menu$ == ":Cancel" ) {
                mes "["+strnpcinfo(1)+"]";
                mes "Im sorry but there are no parties avaible at the moment.";
                close;
            }
            mes "["+strnpcinfo(1)+"]";
            mes "Please select your party! Then I can provide you the information and functions related to your choice";
            set .@menu, select(.@menu$);
            
            next;
            if (.@menu == .@cn) {
                mes "["+strnpcinfo(1)+"]";
                mes "Thanks for your time, may I help you with something else?";
                set .@menu$,"";
                next;
                goto L_start;
            }
            set .@pupnow, .@menu - 2;
            L_sameparty:
            
            if (.@redop == 1) {
                mes "["+strnpcinfo(1)+"]";
                mes "That was the avaible list of party members. Would you like to do any other function related to this party?";
                set .@redop,0;
                next;
            }
            
            set .@restrict, callfunc ( "checkonline#pt1",.@pupnow,getd(".partyinfo"+.@pupnow+"$[4]"),getd(".partyinfo"+.@pupnow+"[0]") );
            if (.@restrict != 0)
                goto L_ultimatecheck;
            for (set .@i,1;.@i<4;set .@i,.@i+1){
                if (getd(".partyinfo"+.@pupnow+"["+.@i+"]") < 32767){
                    if (countitem (getd(".partyinfo"+.@pupnow+"["+.@i+"]")) < 1) {
                        set .@poornoob,1;
                    }
                }
            }
            if (.@poornoob == 1){
                mes "["+strnpcinfo(1)+"]";
                mes "Im sorry but you are missing the following items :";
                    for (set .@i,1;.@i<4;set .@i,.@i+1){
                        if (getd(".partyinfo"+.@pupnow+"["+.@i+"]") != 32767){
                            mes "^0000FF"+getitemname(getelementofarray(getd(".partyinfo"+.@pupnow),.@i))+"^000000";
                        }
                    }
                close;
            }
            getmapxy (.@leadermap$,.@varx,.@vary,0,getelementofarray(getd(".partyinfo"+.@pupnow+"$"),4));
            mes "["+strnpcinfo(1)+"]";
            mes "Party Leader : ^FF9900"+getelementofarray(getd(".partyinfo"+.@pupnow+"$"),4)+"^000000";
            mes "Leader Location : ^FF0099"+.@leadermap$+" ^0099FF"+.@varx+" "+.@vary+"^000000";
            mes "Objective : ^339966"+getelementofarray(getd(".partyinfo"+.@pupnow+"$"),5)+"^000000";
            mes "Level : ^0000FF"+getelementofarray(getd(".partyinfo"+.@pupnow+"$"),1)+"^000000";
            mes "Location : ^FF0000"+getelementofarray(getd(".partyinfo"+.@pupnow+"$"),2)+"^000000";
            mes "Jobs : ^FF9900"+getelementofarray(getd(".partyinfo"+.@pupnow+"$"),3)+"^000000";
            getpartymember(getcharid(1,getelementofarray(getd(".partyinfo"+.@pupnow+"$"),4))); //Added in here to make sure it wont lose data (like it would make any difference >_>)
            mes "Party Members : ^FF9900"+$@partymembercount+"^000000";
            set .@tempname$,strcharinfo(0);
            menu "Announce to Leader",ano1,"Warp to Leader",wa1,"List Members",list1,"Cancel",-;
            next;
            set .@menu$,"";
            goto L_return;
	            ano1:
            //this re-check is made to not bug the script if the party leader logs out, changes party, or leaves party while the character speaking to the npc
            //is within the function selection menu.
            set .@restrict, callfunc ( "checkonline#pt1",.@pupnow,getd(".partyinfo"+.@pupnow+"$[4]"),getd(".partyinfo"+.@pupnow+"[0]") );
            if (.@restrict != 0) {
                next;
                goto L_ultimatecheck;
            }
                if (gettimetick(2) < p_announce) {
                    next;
                    mes "["+strnpcinfo(1)+"]";
                    set @remainingt,p_announce-gettimetick(2);
                    mes "Sorry but you must wait ^FF0000"+@remainingt+"^000000 more seconds to use this function again.";
                    set .@menu$, "";
                    next;
                    goto L_return;
                }
            next;
            mes "["+strnpcinfo(1)+"]";
            mes "You have been announced to the party leader.";
            close2;
            set p_announce,gettimetick(2)+@announcecd;
            attachrid(getcharid(3,getd(".partyinfo"+.@pupnow+"$[4]")));
            announce ""+.@tempname$+" wants to join your party",bc_self,0x8080FF,0,0,0;
            end;
                
            wa1:
            //this re-check is made to not bug the script if the party leader logs out, changes party, or leaves party while the character speaking to the npc
            //is within the function selection menu.
            set .@restrict, callfunc ( "checkonline#pt1",.@pupnow,getd(".partyinfo"+.@pupnow+"$[4]"),getd(".partyinfo"+.@pupnow+"[0]") );
            if (.@restrict != 0)    {
                next;
                goto L_ultimatecheck;
            }
            warp .@leadermap$,.@varx,.@vary;
            end;
	            list1:
            //this re-check is made to not bug the script if the party leader logs out, changes party, or leaves party while the character speaking to the npc
            //is within the function selection menu.
            set .@restrict, callfunc ( "checkonline#pt1",.@pupnow,getd(".partyinfo"+.@pupnow+"$[4]"),getd(".partyinfo"+.@pupnow+"[0]") );
            if (.@restrict != 0) {
                next;
                goto L_ultimatecheck;
            }
            getpartymember(getcharid(1,getelementofarray(getd(".partyinfo"+.@pupnow+"$"),4)));
            set @partymembercount,$@partymembercount;
            copyarray @partymembername$[0],$@partymembername$[0],@partymembercount;
            set @count,0;
            if (.@allowchange == 1) {
                next;
                mes "["+strnpcinfo(1)+"]";
                set .@repeatoff,0;
            }
            L_DisplayMember:
            set .@menu2$,"";
            if (.@allowchange == 1)
            {
                if (.@repeatoff != 1)
                    mes "Please select your settings for the party listing. The more settings you enable, the bigger the list will be.";
                set .@repeatoff,1;
                set .@menu2$, .@menu2$ +"List Members";
                for (set .@i,0; .@i<3 ; set .@i,.@i+1) {
                    if (.@i == 0)
                        set .@show$,"Lvl";
                    if (.@i == 1)
                        set .@show$,"Job";
                    if (.@i == 2)
                        set .@show$,"Location";
                    if (getd(".list"+.@i) == 1)
                        set .@menu2$, .@menu2$ + ":" + "Show "+.@show$+" (^009900On^000000)";
                    else
                        set .@menu2$, .@menu2$ + ":" + "Show "+.@show$+" (^FF0000Off^000000)";
                }
                set .@menu2$,.@menu2$ + ":Cancel";
                set .@menu2, select (.@menu2$);
                set .@menu2,.@menu2 - 2;
            }
            if ( (.@menu2 == -1) || (.@allowchange != 1) ) {
                next;
                mes "["+strnpcinfo(1)+"]";
                while (@count != @partymembercount) {
                    set .@invokerrid,getcharid(3);
                    if (getcharid(0,@partymembername$[@count]) != 0) {
                        attachrid(getcharid(3,@partymembername$[@count]));
                        if (.list0 == 1)
                            set .@templevel,BaseLevel;
                        if (.list1 == 1)
                            set .@tjob$,jobname(Class);
                        if (.list2 == 1)
                            getmapxy .@tmap$,.@tx,.@ty,0;
                        attachrid(.@invokerrid);
                        mes (@count + 1) + " - ^3388FF" + @partymembername$[@count] + "^000000";
                        if (.list0 == 1)
                            mes "Lv: ^DD1100"+.@templevel+"^000000";
                        if (.list1 == 1)
                            mes "Job: ^CC9922"+.@tjob$+"^000000";
                        if (.list2 == 1)
                            mes "Location :^FF0099"+.@tmap$+"^000000 ^33DD66"+.@tx+"^000000, ^33DD66"+.@ty+"^000000";
                    }
                    else {
                        mes (@count + 1) + " - ^3388FF" + @partymembername$[@count] + " ^000000(^FF0000Offline^000000)";
                    }
                    mes " ";
                    set @count,@count+1;
                }
                L_DisplayMemberEnd:
                next;
                set .@menu$, "";
                set .@redop,1;
                goto L_sameparty;
            }
            if (.@allowchange == 1) {
                for (set .@targ,0; .@targ < 3; set .@targ, .@targ+1) {
                    if (.@menu2 == .@targ) {
                        if (getd(".list"+.@targ) == 0)
                            setd ".list"+.@targ,1;
                        else
                            setd ".list"+.@targ,0;
                        goto L_DisplayMember;
                    }
                }
            }
            
            if (.@allowchange == 1) {
                if (.@menu2 == 3) {
                    next;
                    set .@menu$, "";
                    goto L_sameparty;
                }
            }
        }
        
// --------------------------------------------------------------------------------------------------------
//                          _____     _ __   __  ___                   _ __                 __               |
//                         / ___/_ __(_) /__/ / / _ \___ __________ __(_) /___ _  ___ ___  / /_              |
//                        / (_ / // / / / _  / / , _/ -_) __/ __/ // / / __/  ' \/ -_) _ \/ __/              |
//                        \___/\_,_/_/_/\_,_/ /_/|_|\__/\__/_/  \_,_/_/\__/_/_/_/\__/_//_/\__/               |
//                                                                                                         |
// --------------------------------------------------------------------------------------------------------
	        case 2:
        while (1) {
            if (getguildname(getcharid(2)) != "null") {
                if ( getguildmaster (getcharid(2)) == strcharinfo(0) ) {
                    mes "["+strnpcinfo(1)+"]";
                    if (sex)
                        mes "Sir ^0000FF"+strcharinfo(0)+"^000000, how may I be of service?";
                    else
                        mes "Lady ^0000FF"+strcharinfo(0)+"^000000, how may I be of service?";
                    next;
                    switch ( select ("Create Recruitment:Modify Recruitment:Delete Recruitment:Cancel") ) {
                    
        //----------------------------------------------------------------------------------------------------------------------------------
        //Create Registry Part -------------------------------------------------------------------------------------------------------------
        // ---------------------------------------------------------------------------------------------------------------------------------
                        case 1:
                        //Check if you already registered.
                        for (set .@i,0; .@i < .maxgnum; set .@i, .@i + 1) {
                            if (getarraysize (getd(".guildinfo"+.@i)) != 0) {
                                if ( ( getd(".guildinfo"+.@i+"[1]") == getcharid(2) ) && (getguildmaster(getd(".guildinfo"+.@i+"[1]")) == strcharinfo(0)) ) {
                                    mes "["+strnpcinfo(1)+"]";
                                    mes "Im sorry but your guild is already registered.";
                                    close;
                                }
                            }
                        }
                        
                        while (1) {
                            if ( getguildmaster (getcharid(2)) == strcharinfo(0) ) {
                                set .@guildname$, strcharinfo(2);
                                mes "["+strnpcinfo(1)+"]";
                                mes "Please fill in the application for ^FF0000"+.@guildname$+"^000000 guild...";
                                next;
                                switch (select ("Objectives ( ^FF0000"+.@gobj$+"^000000):Description:Level ( ^FF0000"+.@glvl$+"^000000):Jobs:Equips:Display Options:^009900Complete^000000") ) {
                                
                                    case 1:
                                    mes "["+strnpcinfo(1)+"]";
                                    mes "You can write the objective, or the main focus of your guild.";
                                    if (.@gobj$ == "") {    
                                        mes "The current objective is ^FF0000Empty^000000";
                                    }
                                    else {
                                        mes "Current objective:";
                                        mes "^FF0000"+.@gobj$+"^000000";
                                    }
                                    if (select ("Modify:Delete:Cancel") == 3) {
                                        next;
                                        break;
                                    }
                                    if (@menu == 2) {
                                        next;
                                        mes "["+strnpcinfo(1)+"]";
                                        mes "The objective has been successfully deleted.";
                                        set .@gobj$,"";
                                        next;
                                        break;
                                    }
                                    set .@gobj$, callfunc ("calcmenu#g1",6,.@objnum,"objectives","Level","MvP","WoE","Social","Event","Quest");
                                    break;
                                    
                                    case 2:
                                    mes "["+strnpcinfo(1)+"]";
                                    mes "You can input the description, comments, or additional info related to your guild.";
                                    if (.@gdesc$ == "") {
                                        mes "The current description is ^FF0000Empty^000000";
                                    }
                                    else {
                                        mes "Current Description:";
                                        mes "^FF0000"+.@gdesc$+"^000000";
                                    }
                                    if (select ("Modify:Delete:Cancel") == 3) {
                                        next;
                                        break;
                                    }
                                    if (@menu == 2) {
                                        next;
                                        mes "["+strnpcinfo(1)+"]";
                                        mes "The description has been successfully deleted.";
                                        set .@gdesc$,"";
                                        next;
                                        break;
                                    }
                                    
                                    set .@gdesc$,"";
                                    for (set .@i,1; .@i < 4; set .@i, .@i + 1 )
                                    set getd(".@gdesc"+.@i+"$"),"";
                                    for (set .@i,1; .@i < 5 ; set .@i, .@i + 1 ) {
                                        next;
                                        mes "["+strnpcinfo(1)+"]";
                                        if ( (.@i > 1) && (.@i < 4) )
                                            mes "Would you like to write more information about your guild?";
                                        else if (.@i == 1)
                                            mes "Please write down the description of your guild.";
                                        else if (.@i >= 4) {
                                            mes "Thank you for writting the whole description for your guild.";
                                            mes "Final Description:";
                                            mes "^FF0000"+.@gdesc$+"^000000";
                                            break;
                                        }
                                        if ( (.@i > 1) && (.@i < 4) ) {
                                            mes "Current Description:";
                                            mes "^FF0000"+.@gdesc$+"^000000";
                                            if ( select ("Yes:No") == 2)
                                                break;
                                        }
                                        input getd(".@gdesc"+.@i+"$");
                                        set .@gdesc$,.@gdesc1$ + " " + .@gdesc2$ + " " + .@gdesc3$;
                                    }
                                    next;
                                    break;
                                    
                                    case 3:
                                    mes "["+strnpcinfo(1)+"]";
                                    mes "You can add the level range required to enter your guild.";
                                    if (.@glvl$ == "")
                                        mes "The current level is ^FF0000Empty^000000";
                                    else
                                        mes "Current level:";
                                        mes "^FF0000"+.@glvl$+"^000000";
                                    next;
                                    if (select ("Modify:Delete:Cancel") == 3) break;
                                    if (@menu == 2) {
                                        next;
                                        mes "["+strnpcinfo(1)+"]";
                                        mes "The level has been successfully deleted.";
                                        set .@glvl$,"";
                                        next;
                                        break;
                                    }
                                    mes "["+strnpcinfo(1)+"]";
                                    mes "Please input the minimum level requirement.";
                                    input .@gminlvl;
                                    if ((.@gminlvl > .@maxglvl ) || ( .@gminlvl < 1 )) {
                                        next;
                                        mes "["+strnpcinfo(1)+"]";
                                        mes "Sorry but the minimum level requirement is invalid.";
                                        next;
                                        break;
                                    }
                                    next;
                                    mes "["+strnpcinfo(1)+"]";
                                    mes "Please input the maximum level requirement.";
                                    input .@gmaxlvl;
                                        if ((.@gmaxlvl > .@maxglvl ) || ( .@gmaxlvl < 1 ) || (.@gminlvl > .@gmaxlvl)) {
                                        next;
                                        mes "["+strnpcinfo(1)+"]";
                                        mes "Sorry but the maximum level requirement is invalid.";
                                        next;
                                        break;
                                    }
                                    set .@glvl$,""+.@gminlvl+"~"+.@gmaxlvl+" ";
                                    next;
                                    break;
                                    
                                    case 4:
                                    mes "["+strnpcinfo(1)+"]";
                                    mes "You can add the jobs you're looking foward joining your guild.";
                                    if (.@gjob$ != "") {
                                        mes "Current jobs:";
                                        mes "^FF0000"+.@gjob$+"^000000";
                                    }
                                    else
                                    mes "The current job list is ^FF0000Empty^000000.";
                                    next;
                                    switch (select ("Modify:Delete:Cancel") ) {
                                    
                                        case 1:
                                        mes "["+strnpcinfo(1)+"]";
                                        mes "Would you like to choose specifically or generally?";
                                        next;
                                        if (select ("Generally:Specifically") == 1) {
                                            set .@gjob$, callfunc ("calcmenu#g1",6,.@jobnum1,"jobs","Damage-Dealers","Tankers","Mobbers","Spellcasters","Healers","Supports");
                                        }
                                        else {
                                        if ( .@gthird )
                                            set .@gjob$, callfunc ("calcmenu#g1",18,.@jobnum2,"jobs","Rune-Knights","Royal-Guards","Warlocks","Sorcerers","Rangers","Minstrels",
                                            "Wanderers","Arch-Bishops","Suras","Mechanics","Genetics","Guillotine-Cross","Shadow-Chasers","Ninja","Gunslinger","Soul-Linker",
                                            "Star-Gladiator","Super-Novice");
                                        else 
                                            set .@gjob$, callfunc ("calcmenu#g1",18,.@jobnum2,"jobs","Lord-Knights","Paladins","High-Wizards","Professors","Snipers","Clowns",
                                            "Gypsies","High-Priests","Champions","Whitesmiths","Creators","Assassin-Cross","Stalkers","Ninja","Gunslinger","Soul-Linker",
                                            "Star-Gladiator","Super-Novice");
                                        }
                                        break;
                                        
                                        case 2:
                                        next;
                                        mes "["+strnpcinfo(1)+"]";
                                        mes "The job list has been succesfully deleted.";
                                        set .@gjob$,"";
                                        next;
                                        break;
                                        
                                        case 3:
                                        break;
                                        
                                    }
                                    break;
                                    
                                    
                                    
                                    case 5:
                                    mes "["+strnpcinfo(1)+"]";
                                    mes "You can write the required cards, equipment or items for your guild.";
                                    mes "Current equipments:";
                                    for (set .@i,1;    .@i <= .@gmaxitem; set .@i,.@i + 1) {
                                        if (getitemname(getd(".@gequip"+.@i))=="null") {
                                            mes .@i+"- ^FF0000Empty^000000";
                                        }
                                        else {
                                            mes .@i+"- ^0000FF"+getitemname(getd(".@gequip"+.@i))+"^000000";
                                        }
                                    }
                                    if (select ("Modify:Delete:Cancel") == 3) {
                                        next;
                                        break;
                                    }
                                    if (@menu == 2) {
                                        next;
                                        mes "["+strnpcinfo(1)+"]";
                                        mes "The equip list has been successfully deleted.";
                                        for (set .@i,1;    .@i <= .@gmaxitem; set .@i,.@i + 1) {
                                            setd ".@gequip"+.@i,0;
                                        }
                                        set .@max,0;
                                        next;
                                        break;
                                    }
                                    
                                    while (1) {
                                        if (.@breakeq) {
                                            set .@breakeq,0;
                                            break;
                                        }
                                        next;
                                        mes "["+strnpcinfo(1)+"]";
                                        mes "You can write the required cards, equipment or items for your guild.";
                                        mes "Current equipments:";
                                        for (set .@i,1;    .@i <= .@gmaxitem; set .@i,.@i + 1) {
                                            if (getitemname(getd(".@gequip"+.@i))=="null") {
                                                mes .@i+"- ^FF0000Empty^000000";
                                            }
                                            else {
                                            mes .@i+"- ^0000FF"+getitemname(getd(".@gequip"+.@i))+"^000000";
                                            }
                                        }
                                        
                                        switch ( select ("Add Item:Remove Item:Back") ) {
                                            
                                            case 1:
                                            if (.@max == .@gmaxitem) {
                                                next;
                                                mes "["+strnpcinfo(1)+"]";
                                                mes "All Item Slots are full!";
                                                break;
                                            }
                                            next;
                                            mes "["+strnpcinfo(1)+"]";
                                            mes "Input the item ID";
                                            input .@gequip,0,32767;
                                            if (getitemname(.@gequip)=="null"){
                                                next;
                                                mes "["+strnpcinfo(1)+"]";
                                                mes "Invalid Item!";
                                                break;
                                            }
                                            for (set .@i,1;    .@i <= .@gmaxitem; set .@i,.@i + 1) {
                                                if (getitemname(getd(".@gequip"+.@i))=="null") {
                                                    setd ".@gequip"+.@i,.@gequip;
                                                    set .@max,.@max + 1;
                                                    for (set .@j, 1; .@j <= .@gmaxitem; set .@j,.@j + 1) {
                                                        if ( ( getitemname(getd(".@gequip"+.@i)) == getitemname(getd(".@gequip"+.@j)) ) && (.@i != .@j) && (getitemname(getd(".@gequip"+.@j)) != "null") ) {
                                                            next;
                                                            mes "["+strnpcinfo(1)+"]";
                                                            mes "This item is already in the list...";
                                                            setd ".@gequip"+.@i,0;
                                                            set .@max,.@max - 1;
                                                            break;
                                                        }
                                                    }
                                                    break;
                                                }
                                            }
                                            break;
                                            
                                            case 2:
                                            next;
                                            mes "["+strnpcinfo(1)+"]";
                                            mes "Let me check the avaible item list...";
                                            set .@menu4$,"";
                                            for (set .@i,1; .@i <= .@gmaxitem; set .@i,.@i + 1) {
                                                if ( getitemname(getd(".@gequip"+.@i)) != "null" ) {
                                                    set .@menu4$, .@menu4$ + ":" + .@i + "- ^0000FF"+getitemname(getd(".@gequip"+.@i))+"^000000";
                                                    set .@cncheck,.@cncheck + 1;
                                                }
                                            }
                                            set .@menu4$,.@menu4$ + ":Cancel";
                                            set .@cncheck,.@cncheck + 1;
                                            if (.@menu4$ == ":Cancel") {
                                                next;
                                                mes "["+strnpcinfo(1)+"]";
                                                mes "There are no items avaible to delete.";
                                                break;
                                            }
                                            else {
                                                next;
                                                mes "["+strnpcinfo(1)+"]";
                                                mes "Please select the item you wish to delete.";
                                            }
                                            set .@menu4,select(.@menu4$);
                                            set .@menu4,.@menu4 - 1;
                                            for (set .@i,1; .@i <= .@gmaxitem ; set .@i, .@i + 1) {
                                                if (.@menu4 == .@cncheck)
                                                    break;
                                                if (.@menu4 == .@i) {
                                                    set .@max,.@max - 1;
                                                    setd ".@gequip"+.@i,0;
                                                    break;
                                                }
                                            }
                                            for (set .@i,1;    .@i <= .@gmaxitem; set .@i, .@i + 1) {
                                                if ( !getd(".@gequip"+.@i) ) {
                                                    for (set .@j, 1; .@j <= .@gmaxitem; set .@j, .@j + 1) {
                                                        if ( (getd(".@gequip"+.@j) ) && (.@i < .@j) ) {
                                                            setd ".@gequip"+.@i,getd(".@gequip"+.@j);
                                                            setd ".@gequip"+.@j,0;
                                                            break;
                                                        }
                                                    }
                                                }
                                            }
                                            break;
                                                
                                            case 3:
                                            next;
                                            set .@breakeq,1;
                                            break;
                                        }
                                    }
                                    break;
                                    
                                    case 6:
                                    set .@megabreak,0;
                                    set .@repeatoff,0;
                                    while (1) {
                                        if (.@megabreak) {
                                            next;
                                            break;
                                        }
                                        if (!.@repeatoff) {
                                            mes "["+strnpcinfo(1)+"]";
                                            mes "You can turn on/off the options regarding your guild here.";
                                        }
                                        set .@repeatoff,1;
                                        set .@n,0;
                                        set .@i,0;
                                        while ( .@i < .maxbit ) {
                                            set .@i, pow(2,.@n);
                                            if (.@bitmask & .@i)
                                                setd ".@bitopt"+.@n,1;
                                            else
                                                setd ".@bitopt"+.@n,0;
                                            set .@n,.@n + 1;
                                        }
                                        set .@menu5$,"";
                                        for (set .@i,0; .@i < .maxbitn; set .@i,.@i + 1) {
                                            
                                            set .@display$, callfunc ("displaylist#g1",.@i);
                                            
                                            if (getd(".@bitopt"+.@i)) {
                                                if ( .@display$ == "Allow Member Listing" )
                                                    set .@menu5$, .@menu5$ + ":^FF0000" + .@display$ + "^000000 (^009900On^000000)";
                                                else if ( .@display$ == "Allow Warp to Guild Leader" )
                                                    set .@menu5$, .@menu5$ + ":^FF0000" + .@display$ + "^000000 (^009900On^000000)";
                                                else
                                                    set .@menu5$, .@menu5$ + ":" + .@display$ + " (^009900On^000000)";
                                            }
                                            else {
                                                if ( .@display$ == "Always Accept Warps" )
                                                    set .@menu5$, .@menu5$ + ":^0000FF" + .@display$ + "^000000 (^FF0000Off^000000)";
                                                else if ( .@display$ == "Allow Announce to Member" )
                                                    set .@menu5$, .@menu5$ + ":^0000FF" + .@display$ + "^000000 (^FF0000Off^000000)";
                                                else if ( .@display$ == "Display Online Member Level" )
                                                    set .@menu5$, .@menu5$ + ":^0000FF" + .@display$ + "^000000 (^FF0000Off^000000)";
                                                else if ( .@display$ == "Display Online Member Job" )
                                                    set .@menu5$, .@menu5$ + ":^0000FF" + .@display$ + "^000000 (^FF0000Off^000000)";
                                                else if ( .@display$ == "Display Online Member Location" )
                                                    set .@menu5$, .@menu5$ + ":^0000FF" + .@display$ + "^000000 (^FF0000Off^000000)";
                                                else
                                                    set .@menu5$, .@menu5$ + ":" + .@display$ + " (^FF0000Off^000000)";
                                            }
                                        }
                                        set .@menu5$, .@menu5$ + ":^009900Back^000000";
                                        set .@menu5, select (.@menu5$);
                                        set .@menu5, .@menu5 - 2;
                                        for (set .@i,0; .@i < .maxbitn ; set .@i, .@i + 1 ) {
                                            if (.@menu5 == .maxbitn) {
                                                set .@megabreak,1;
                                                break;
                                            }
                                            if (.@menu5 == .@i) {
                                                if (.@i == 0) {
                                                    if (.@bitopt0) {
                                                        next;
                                                        mes "["+strnpcinfo(1)+"]";
                                                        mes "^FF0000Warning:^000000 ^990099Disabling^000000 this option will also disable:";
                                                        mes "^0000FF-Allow Announce to Member^000000";
                                                        mes "^0000FF-Display Leader in Member List^000000";
                                                        mes "^0000FF-Display Online Member Level^000000";
                                                        mes "^0000FF-Display Online Member Job^000000";
                                                        mes "^0000FF-Display Online Member Location^000000";
                                                        next;
                                                        if (select ("Continue:Return") == 2) {
                                                            set .@repeatoff,0;
                                                            break;
                                                        }
                                                        set .@bitopt7,0;
                                                        set .@bitopt0,0;
                                                        set .@bitopt4,0;
                                                        set .@bitopt5,0;
                                                        set .@bitopt6,0;
                                                        set .@bitopt1,0;
                                                        set .@repeatoff,0;
                                                        break;
                                                    }
                                                    else {
                                                        set .@bitopt0,1;
                                                        break;
                                                    }
                                                }
                                                if ( (.@i == 1) || (.@i == 4) || (.@i == 5) || (.@i == 6) ) {
                                                    if ( (!.@bitopt1) || (!.@bitopt4) || (!.@bitopt5) || (!.@bitopt6) ) {
                                                        next;
                                                        mes "["+strnpcinfo(1)+"]";
                                                        mes "^FF0000Warning:^000000 ^009900Enabling^000000 this option will also enable:";
                                                        mes "^0000FF-Allow Member Listing^000000";
                                                        next;
                                                        if (select ("Continue:Return") == 2) {
                                                            set .@repeatoff,0;
                                                            break;
                                                        }
                                                        if (.@i == 1)
                                                            set .@bitopt1,1;
                                                        if (.@i == 4)
                                                            set .@bitopt4,1;
                                                        if (.@i == 5)
                                                            set .@bitopt5,1;
                                                        if (.@i == 6)
                                                            set .@bitopt6,1;
                                                        set .@bitopt0,1;
                                                        set .@repeatoff,0;
                                                        break;
                                                    }
                                                    else {
                                                        if (.@i == 1)
                                                            set .@bitopt1,0;
                                                        if (.@i == 4)
                                                            set .@bitopt4,0;
                                                        if (.@i == 5)
                                                            set .@bitopt5,0;
                                                        if (.@i == 6)
                                                            set .@bitopt6,0;
                                                    }
                                                }
                                                if (.@i == 13) {
                                                    if (!.@bitopt13) {
                                                        next;
                                                        mes "["+strnpcinfo(1)+"]";
                                                        mes "^FF0000Warning:^000000 ^009900Enabling^000000 this option will also enable:";
                                                        mes "^0000FF-Allow Warp to Guild Leader^000000";
                                                        next;
                                                        if (select ("Continue:Return") == 2) {
                                                            set .@repeatoff,0;
                                                            break;
                                                        }
                                                        set .@bitopt13,1;
                                                        set .@bitopt12,1;
                                                        set .@repeatoff,0;
                                                        break;
                                                    }
                                                    else
                                                        set .@bitopt13,1;
                                                }
                                                if (.@i == 12) {
                                                    if (.@bitopt12) {
                                                        next;
                                                        mes "["+strnpcinfo(1)+"]";
                                                        mes "^FF0000Warning:^000000 ^990099Disabling^000000 this option will also disable:";
                                                        mes "^0000FF-Always Accept Warps^000000";
                                                        next;
                                                        if (select ("Continue:Return") == 2) {
                                                            set .@repeatoff,0;
                                                            break;
                                                        }
                                                        set .@bitopt13,0;
                                                        set .@bitopt12,0;
                                                        set .@repeatoff,0;
                                                        break;
                                                    }
                                                    else
                                                        set .@bitopt12,1;
                                                }
                                                else {
                                                    if (getd(".@bitopt"+.@i) )
                                                        setd ".@bitopt"+.@i,0;
                                                    else
                                                        setd ".@bitopt"+.@i,1;
                                                    break;
                                                }
                                            }
                                        }
                                        set .@bitmask,0;
                                        for (set .@i,0; .@i < .maxbitn; set .@i , .@i + 1) {
                                            if (getd(".@bitopt"+.@i))
                                                set .@bitmask,.@bitmask | pow (2,.@i);
                                        }
                                    }
                                    break;
                                    
                                    case 7:
                                    for (set .@i,0; .@i <.maxgnum ; set .@i, .@i + 1 ) {
                                        if (getarraysize(getd(".guildinfo"+.@i+"$")) == 0) {
                                        
                                        //String Array
                                            //Leader Name
                                            setd ".guildinfo"+.@i+"$[0]", strcharinfo(0);
                                            //Objective Inputted
                                            setd ".guildinfo"+.@i+"$[1]", .@gobj$;
                                            //Level Inputted
                                            setd ".guildinfo"+.@i+"$[2]", .@glvl$;
                                            //Description Inputted
                                            setd ".guildinfo"+.@i+"$[3]", .@gdesc$;
                                            //Job Inputted
                                            setd ".guildinfo"+.@i+"$[4]", .@gjob$;
                                            
                                        //Numeric Array
                                            //Bitmask
                                            setd ".guildinfo"+.@i+"[0]", .@bitmask;
                                            //Guild ID
                                            setd ".guildinfo"+.@i+"[1]", getcharid(2,strcharinfo(0));
                                            //Equips
                                            set .@n, 1;
                                            for (set .@j,1; .@j <= .@gmaxitem; set .@j, .@j + 1) {
                                                set .@n, .@n + 1;
                                                if (getd(".@gequip"+.@j) == 0)
                                                    setd ".@gequip"+.@j,32767;
                                                setd ".guildinfo"+.@i+"["+.@n+"]", getd(".@gequip"+.@j);
                                            }
                                            mes "["+strnpcinfo(1)+"]";
                                            mes "Your guild has been added succesfully!";
                                            break;
                                        }
                                    }
                                    if (.@i >= .maxgnum) {
                                        mes "["+strnpcinfo(1)+"]";
                                        mes "Im sorry but all the slots for parties are filled up, please come back later";
                                        close;
                                    }
                                    close;
                                break;
                                }
                            }
                            else {
                                mes "["+strnpcinfo(1)+"]";
                                mes "^FF0000Error^000000 you are no longer the guild leader. This function has been terminated.";
                                close;
                            }
                        }
                        break;
	        //----------------------------------------------------------------------------------------------------------------------------------
        //Modify Registry Part -------------------------------------------------------------------------------------------------------------
        // ---------------------------------------------------------------------------------------------------------------------------------
        
                        case 2:
                        while (1) {
                            if ( getguildmaster (getcharid(2)) == strcharinfo(0) ) {
                                for (set .@i,0; .@i < .maxgnum ; set .@i, .@i + 1) {
                                    if ( (getd (".guildinfo"+.@i+"$[0]") == strcharinfo(0)) && (getarraysize(getd(".guildinfo"+.@i)) != 0) && (getd (".guildinfo"+.@i+"[1]") == getcharid(2)) ) {
                                    
                                    //Set the semi-permanent array back into temporary values.
                                        //String Part
                                            //Checks if char is in same guild as the old guild.
                                            if ( getd (".guildinfo"+.@i+"$[0]") != strcharinfo(0) ) {
                                                mes "["+strnpcinfo(1)+"]";
                                                mes "An unexpected ^FF0000error^000000 has ocurred, I'm sorry but you are no longer the leader of this guild.";
                                                close;
                                            }
                                            //Objective Retaken
                                            set .@gobj$, getd (".guildinfo"+.@i+"$[1]");
                                            //Level Retaken
                                            set .@glvl$, getd (".guildinfo"+.@i+"$[2]");
                                            //Description Retaken
                                            set .@gdesc$, getd (".guildinfo"+.@i+"$[3]");
                                            //Job Retaken
                                            set .@gjob$, getd (".guildinfo"+.@i+"$[4]");
                                            
                                        //Numeric Part
                                            //Bitmask Retaken
                                            set .@bitmask, getd (".guildinfo"+.@i+"[0]");
                                            //Equips Retaken
                                            set .@n, 1;
                                            for (set .@j,1; .@j <= .@gmaxitem; set .@j, .@j + 1) {
                                                set .@n, .@n + 1;
                                                if (getd (".guildinfo"+.@i+"["+.@n+"]") == 32767)
                                                    setd ".@gequip"+.@j,0;
                                                setd ".@gequip"+.@j, getd (".guildinfo"+.@i+"["+.@n+"]");
                                            }
                                    //End of temporary variable setting.
                                        
                                        while (1) {
                                            mes "["+strnpcinfo(1)+"]";
                                            mes "Please select your modifications...";
                                            next;
                                            switch (select ("Objectives ( ^FF0000"+.@gobj$+"^000000):Description:Level ( ^FF0000"+.@glvl$+"^000000):Jobs:Equips:Display Options:^009900Complete^000000") ) {
                                            
                                                case 1:
                                                mes "["+strnpcinfo(1)+"]";
                                                mes "You can write the objective, or the main focus of your guild.";
                                                if (.@gobj$ == "") {    
                                                    mes "The current objective is ^FF0000Empty^000000";
                                                }
                                                else {
                                                    mes "Current objective:";
                                                    mes "^FF0000"+.@gobj$+"^000000";
                                                }
                                                if (select ("Modify:Delete:Cancel") == 3) {
                                                    next;
                                                    break;
                                                }
                                                if (@menu == 2) {
                                                    next;
                                                    mes "["+strnpcinfo(1)+"]";
                                                    mes "The objective has been successfully deleted.";
                                                    set .@gobj$,"";
                                                    next;
                                                    break;
                                                }
                                                set .@gobj$, callfunc ("calcmenu#g1",6,.@objnum,"objectives","Level","MvP","WoE","Social","Event","Quest");
                                                break;
                                                
                                                case 2:
                                                mes "["+strnpcinfo(1)+"]";
                                                mes "You can input the description, comments, or additional info related to your guild.";
                                                if (.@gdesc$ == "") {
                                                    mes "The current description is ^FF0000Empty^000000";
                                                }
                                                else {
                                                    mes "Current Description:";
                                                    mes "^FF0000"+.@gdesc$+"^000000";
                                                }
                                                if (select ("Modify:Delete:Cancel") == 3) {
                                                    next;
                                                    break;
                                                }
                                                if (@menu == 2) {
                                                    next;
                                                    mes "["+strnpcinfo(1)+"]";
                                                    mes "The description has been successfully deleted.";
                                                    set .@gdesc$,"";
                                                    next;
                                                    break;
                                                }
                                                
                                                set .@gdesc$,"";
                                                for (set .@i,1; .@i < 4; set .@i, .@i + 1 )
                                                set getd(".@gdesc"+.@i+"$"),"";
                                                for (set .@i,1; .@i < 5 ; set .@i, .@i + 1 ) {
                                                    next;
                                                    mes "["+strnpcinfo(1)+"]";
                                                    if ( (.@i > 1) && (.@i < 4) )
                                                        mes "Would you like to write more information about your guild?";
                                                    else if (.@i == 1)
                                                        mes "Please write down the description of your guild.";
                                                    else if (.@i >= 4) {
                                                        mes "Thank you for writting the whole description for your guild.";
                                                        mes "Final Description:";
                                                        mes "^FF0000"+.@gdesc$+"^000000";
                                                        break;
                                                    }
                                                    if ( (.@i > 1) && (.@i < 4) ) {
                                                        mes "Current Description:";
                                                        mes "^FF0000"+.@gdesc$+"^000000";
                                                        if ( select ("Yes:No") == 2)
                                                            break;
                                                    }
                                                    input getd(".@gdesc"+.@i+"$");
                                                    set .@gdesc$,.@gdesc1$ + " " + .@gdesc2$ + " " + .@gdesc3$;
                                                }
                                                next;
                                                break;
                                                
                                                case 3:
                                                mes "["+strnpcinfo(1)+"]";
                                                mes "You can add the level range required to enter your guild.";
                                                if (.@glvl$ == "")
                                                    mes "The current level is ^FF0000Empty^000000";
                                                else
                                                    mes "Current level:";
                                                    mes "^FF0000"+.@glvl$+"^000000";
                                                next;
                                                if (select ("Modify:Delete:Cancel") == 3) break;
                                                if (@menu == 2) {
                                                    next;
                                                    mes "["+strnpcinfo(1)+"]";
                                                    mes "The level has been successfully deleted.";
                                                    set .@glvl$,"";
                                                    next;
                                                    break;
                                                }
                                                mes "["+strnpcinfo(1)+"]";
                                                mes "Please input the minimum level requirement.";
                                                input .@gminlvl;
                                                if ((.@gminlvl > .@maxglvl ) || ( .@gminlvl < 1 )) {
                                                    next;
                                                    mes "["+strnpcinfo(1)+"]";
                                                    mes "Sorry but the minimum level requirement is invalid.";
                                                    next;
                                                    break;
                                                }
                                                next;
                                                mes "["+strnpcinfo(1)+"]";
                                                mes "Please input the maximum level requirement.";
                                                input .@gmaxlvl;
                                                    if ((.@gmaxlvl > .@maxglvl ) || ( .@gmaxlvl < 1 ) || (.@gminlvl > .@gmaxlvl)) {
                                                    next;
                                                    mes "["+strnpcinfo(1)+"]";
                                                    mes "Sorry but the maximum level requirement is invalid.";
                                                    next;
                                                    break;
                                                }
                                                set .@glvl$,""+.@gminlvl+"~"+.@gmaxlvl+" ";
                                                next;
                                                break;
                                                
                                                case 4:
                                                mes "["+strnpcinfo(1)+"]";
                                                mes "You can add the jobs you're looking foward joining your guild.";
                                                if (.@gjob$ != "") {
                                                    mes "Current jobs:";
                                                    mes "^FF0000"+.@gjob$+"^000000";
                                                }
                                                else
                                                mes "The current job list is ^FF0000Empty^000000.";
                                                next;
                                                switch (select ("Modify:Delete:Cancel") ) {
                                                
                                                    case 1:
                                                    mes "["+strnpcinfo(1)+"]";
                                                    mes "Would you like to choose specifically or generally?";
                                                    next;
                                                    if (select ("Generally:Specifically") == 1) {
                                                        set .@gjob$, callfunc ("calcmenu#g1",6,.@jobnum1,"jobs","Damage-Dealers","Tankers","Mobbers","Spellcasters","Healers","Supports");
                                                    }
                                                    else {
                                                    if ( .@gthird )
                                                        set .@gjob$, callfunc ("calcmenu#g1",18,.@jobnum2,"jobs","Rune-Knights","Royal-Guards","Warlocks","Sorcerers","Rangers","Minstrels",
                                                        "Wanderers","Arch-Bishops","Suras","Mechanics","Genetics","Guillotine-Cross","Shadow-Chasers","Ninja","Gunslinger","Soul-Linker",
                                                        "Star-Gladiator","Super-Novice");
                                                    else 
                                                        set .@gjob$, callfunc ("calcmenu#g1",18,.@jobnum2,"jobs","Lord-Knights","Paladins","High-Wizards","Professors","Snipers","Clowns",
                                                        "Gypsies","High-Priests","Champions","Whitesmiths","Creators","Assassin-Cross","Stalkers","Ninja","Gunslinger","Soul-Linker",
                                                        "Star-Gladiator","Super-Novice");
                                                    }
                                                    break;
                                                    
                                                    case 2:
                                                    next;
                                                    mes "["+strnpcinfo(1)+"]";
                                                    mes "The job list has been succesfully deleted.";
                                                    set .@gjob$,"";
                                                    next;
                                                    break;
                                                    
                                                    case 3:
                                                    break;
                                                    
                                                }
                                                break;
                                                
                                                
                                                
                                                case 5:
                                                mes "["+strnpcinfo(1)+"]";
                                                mes "You can write the required cards, equipment or items for your guild.";
                                                mes "Current equipments:";
                                                for (set .@i,1;    .@i <= .@gmaxitem; set .@i,.@i + 1) {
                                                    if (getitemname(getd(".@gequip"+.@i))=="null") {
                                                        mes .@i+"- ^FF0000Empty^000000";
                                                    }
                                                    else {
                                                        mes .@i+"- ^0000FF"+getitemname(getd(".@gequip"+.@i))+"^000000";
                                                    }
                                                }
                                                if (select ("Modify:Delete:Cancel") == 3) {
                                                    next;
                                                    break;
                                                }
                                                if (@menu == 2) {
                                                    next;
                                                    mes "["+strnpcinfo(1)+"]";
                                                    mes "The equip list has been successfully deleted.";
                                                    for (set .@i,1;    .@i <= .@gmaxitem; set .@i,.@i + 1) {
                                                        setd ".@gequip"+.@i,0;
                                                    }
                                                    set .@max,0;
                                                    next;
                                                    break;
                                                }
                                                
                                                while (1) {
                                                    if (.@breakeq) {
                                                        set .@breakeq,0;
                                                        break;
                                                    }
                                                    next;
                                                    mes "["+strnpcinfo(1)+"]";
                                                    mes "You can write the required cards, equipment or items for your guild.";
                                                    mes "Current equipments:";
                                                    for (set .@i,1;    .@i <= .@gmaxitem; set .@i,.@i + 1) {
                                                        if (getitemname(getd(".@gequip"+.@i))=="null") {
                                                            mes .@i+"- ^FF0000Empty^000000";
                                                        }
                                                        else {
                                                        mes .@i+"- ^0000FF"+getitemname(getd(".@gequip"+.@i))+"^000000";
                                                        }
                                                    }
                                                    
                                                    switch ( select ("Add Item:Remove Item:Back") ) {
                                                        
                                                        case 1:
                                                        if (.@max == .@gmaxitem) {
                                                            next;
                                                            mes "["+strnpcinfo(1)+"]";
                                                            mes "All Item Slots are full!";
                                                            break;
                                                        }
                                                        next;
                                                        mes "["+strnpcinfo(1)+"]";
                                                        mes "Input the item ID";
                                                        input .@gequip,0,32767;
                                                        if (getitemname(.@gequip)=="null"){
                                                            next;
                                                            mes "["+strnpcinfo(1)+"]";
                                                            mes "Invalid Item!";
                                                            break;
                                                        }
                                                        for (set .@i,1;    .@i <= .@gmaxitem; set .@i,.@i + 1) {
                                                            if (getitemname(getd(".@gequip"+.@i))=="null") {
                                                                setd ".@gequip"+.@i,.@gequip;
                                                                set .@max,.@max + 1;
                                                                for (set .@j, 1; .@j <= .@gmaxitem; set .@j,.@j + 1) {
                                                                    if ( ( getitemname(getd(".@gequip"+.@i)) == getitemname(getd(".@gequip"+.@j)) ) && (.@i != .@j) && (getitemname(getd(".@gequip"+.@j)) != "null") ) {
                                                                        next;
                                                                        mes "["+strnpcinfo(1)+"]";
                                                                        mes "This item is already in the list...";
                                                                        setd ".@gequip"+.@i,0;
                                                                        set .@max,.@max - 1;
                                                                        break;
                                                                    }
                                                                }
                                                                break;
                                                            }
                                                        }
                                                        break;
                                                        
                                                        case 2:
                                                        next;
                                                        mes "["+strnpcinfo(1)+"]";
                                                        mes "Let me check the avaible item list...";
                                                        set .@menu4$,"";
                                                        for (set .@i,1; .@i <= .@gmaxitem; set .@i,.@i + 1) {
                                                            if ( getitemname(getd(".@gequip"+.@i)) != "null" ) {
                                                                set .@menu4$, .@menu4$ + ":" + .@i + "- ^0000FF"+getitemname(getd(".@gequip"+.@i))+"^000000";
                                                                set .@cncheck,.@cncheck + 1;
                                                            }
                                                        }
                                                        set .@menu4$,.@menu4$ + ":Cancel";
                                                        set .@cncheck,.@cncheck + 1;
                                                        if (.@menu4$ == ":Cancel") {
                                                            next;
                                                            mes "["+strnpcinfo(1)+"]";
                                                            mes "There are no items avaible to delete.";
                                                            break;
                                                        }
                                                        else {
                                                            next;
                                                            mes "["+strnpcinfo(1)+"]";
                                                            mes "Please select the item you wish to delete.";
                                                        }
                                                        set .@menu4,select(.@menu4$);
                                                        set .@menu4,.@menu4 - 1;
                                                        for (set .@i,1; .@i <= .@gmaxitem ; set .@i, .@i + 1) {
                                                            if (.@menu4 == .@cncheck)
                                                                break;
                                                            if (.@menu4 == .@i) {
                                                                set .@max,.@max - 1;
                                                                setd ".@gequip"+.@i,0;
                                                                break;
                                                            }
                                                        }
                                                        for (set .@i,1;    .@i <= .@gmaxitem; set .@i, .@i + 1) {
                                                            if ( !getd(".@gequip"+.@i) ) {
                                                                for (set .@j, 1; .@j <= .@gmaxitem; set .@j, .@j + 1) {
                                                                    if ( (getd(".@gequip"+.@j) ) && (.@i < .@j) ) {
                                                                        setd ".@gequip"+.@i,getd(".@gequip"+.@j);
                                                                        setd ".@gequip"+.@j,0;
                                                                        break;
                                                                    }
                                                                }
                                                            }
                                                        }
                                                        break;
                                                            
                                                        case 3:
                                                        next;
                                                        set .@breakeq,1;
                                                        break;
                                                    }
                                                }
                                                break;
                                                
                                                case 6:
                                                set .@megabreak,0;
                                                set .@repeatoff,0;
                                                while (1) {
                                                    if (.@megabreak) {
                                                        next;
                                                        break;
                                                    }
                                                    if (!.@repeatoff) {
                                                        mes "["+strnpcinfo(1)+"]";
                                                        mes "You can turn on/off the options regarding your guild here.";
                                                    }
                                                    set .@repeatoff,1;
                                                    set .@n,0;
                                                    set .@i,0;
                                                    while ( .@i < .maxbit ) {
                                                        set .@i, pow(2,.@n);
                                                        if (.@bitmask & .@i)
                                                            setd ".@bitopt"+.@n,1;
                                                        else
                                                            setd ".@bitopt"+.@n,0;
                                                        set .@n,.@n + 1;
                                                    }
                                                    set .@menu5$,"";
                                                    for (set .@i,0; .@i < .maxbitn; set .@i,.@i + 1) {
                                                        
                                                        set .@display$, callfunc ("displaylist#g1",.@i);
                                                        
                                                        if (getd(".@bitopt"+.@i)) {
                                                            if ( .@display$ == "Allow Member Listing" )
                                                                set .@menu5$, .@menu5$ + ":^FF0000" + .@display$ + "^000000 (^009900On^000000)";
                                                            else if ( .@display$ == "Allow Warp to Guild Leader" )
                                                                set .@menu5$, .@menu5$ + ":^FF0000" + .@display$ + "^000000 (^009900On^000000)";
                                                            else
                                                                set .@menu5$, .@menu5$ + ":" + .@display$ + " (^009900On^000000)";
                                                        }
                                                        else {
                                                            if ( .@display$ == "Always Accept Warps" )
                                                                set .@menu5$, .@menu5$ + ":^0000FF" + .@display$ + "^000000 (^FF0000Off^000000)";
                                                            else if ( .@display$ == "Allow Announce to Member" )
                                                                set .@menu5$, .@menu5$ + ":^0000FF" + .@display$ + "^000000 (^FF0000Off^000000)";
                                                            else if ( .@display$ == "Display Online Member Level" )
                                                                set .@menu5$, .@menu5$ + ":^0000FF" + .@display$ + "^000000 (^FF0000Off^000000)";
                                                            else if ( .@display$ == "Display Online Member Job" )
                                                                set .@menu5$, .@menu5$ + ":^0000FF" + .@display$ + "^000000 (^FF0000Off^000000)";
                                                            else if ( .@display$ == "Display Online Member Location" )
                                                                set .@menu5$, .@menu5$ + ":^0000FF" + .@display$ + "^000000 (^FF0000Off^000000)";
                                                            else
                                                                set .@menu5$, .@menu5$ + ":" + .@display$ + " (^FF0000Off^000000)";
                                                        }
                                                    }
                                                    set .@menu5$, .@menu5$ + ":^009900Back^000000";
                                                    set .@menu5, select (.@menu5$);
                                                    set .@menu5, .@menu5 - 2;
                                                    for (set .@i,0; .@i < .maxbitn ; set .@i, .@i + 1 ) {
                                                        if (.@menu5 == .maxbitn) {
                                                            set .@megabreak,1;
                                                            break;
                                                        }
                                                        if (.@menu5 == .@i) {
                                                            if (.@i == 0) {
                                                                if (.@bitopt0) {
                                                                    next;
                                                                    mes "["+strnpcinfo(1)+"]";
                                                                    mes "^FF0000Warning:^000000 ^990099Disabling^000000 this option will also disable:";
                                                                    mes "^0000FF-Allow Announce to Member^000000";
                                                                    mes "^0000FF-Display Leader in Member List^000000";
                                                                    mes "^0000FF-Display Online Member Level^000000";
                                                                    mes "^0000FF-Display Online Member Job^000000";
                                                                    mes "^0000FF-Display Online Member Location^000000";
                                                                    next;
                                                                    if (select ("Continue:Return") == 2) {
                                                                        set .@repeatoff,0;
                                                                        break;
                                                                    }
                                                                    set .@bitopt7,0;
                                                                    set .@bitopt0,0;
                                                                    set .@bitopt4,0;
                                                                    set .@bitopt5,0;
                                                                    set .@bitopt6,0;
                                                                    set .@bitopt1,0;
                                                                    set .@repeatoff,0;
                                                                    break;
                                                                }
                                                                else {
                                                                    set .@bitopt0,1;
                                                                    break;
                                                                }
                                                            }
                                                            if ( (.@i == 1) || (.@i == 4) || (.@i == 5) || (.@i == 6) ) {
                                                                if ( (!.@bitopt1) || (!.@bitopt4) || (!.@bitopt5) || (!.@bitopt6) ) {
                                                                    next;
                                                                    mes "["+strnpcinfo(1)+"]";
                                                                    mes "^FF0000Warning:^000000 ^009900Enabling^000000 this option will also enable:";
                                                                    mes "^0000FF-Allow Member Listing^000000";
                                                                    next;
                                                                    if (select ("Continue:Return") == 2) {
                                                                        set .@repeatoff,0;
                                                                        break;
                                                                    }
                                                                    if (.@i == 1)
                                                                        set .@bitopt1,1;
                                                                    if (.@i == 4)
                                                                        set .@bitopt4,1;
                                                                    if (.@i == 5)
                                                                        set .@bitopt5,1;
                                                                    if (.@i == 6)
                                                                        set .@bitopt6,1;
                                                                    set .@bitopt0,1;
                                                                    set .@repeatoff,0;
                                                                    break;
                                                                }
                                                                else {
                                                                    if (.@i == 1)
                                                                        set .@bitopt1,0;
                                                                    if (.@i == 4)
                                                                        set .@bitopt4,0;
                                                                    if (.@i == 5)
                                                                        set .@bitopt5,0;
                                                                    if (.@i == 6)
                                                                        set .@bitopt6,0;
                                                                }
                                                            }
                                                            if (.@i == 13) {
                                                                if (!.@bitopt13) {
                                                                    next;
                                                                    mes "["+strnpcinfo(1)+"]";
                                                                    mes "^FF0000Warning:^000000 ^009900Enabling^000000 this option will also enable:";
                                                                    mes "^0000FF-Allow Warp to Guild Leader^000000";
                                                                    next;
                                                                    if (select ("Continue:Return") == 2) {
                                                                        set .@repeatoff,0;
                                                                        break;
                                                                    }
                                                                    set .@bitopt13,1;
                                                                    set .@bitopt12,1;
                                                                    set .@repeatoff,0;
                                                                    break;
                                                                }
                                                                else
                                                                    set .@bitopt13,1;
                                                            }
                                                            if (.@i == 12) {
                                                                if (.@bitopt12) {
                                                                    next;
                                                                    mes "["+strnpcinfo(1)+"]";
                                                                    mes "^FF0000Warning:^000000 ^990099Disabling^000000 this option will also disable:";
                                                                    mes "^0000FF-Always Accept Warps^000000";
                                                                    next;
                                                                    if (select ("Continue:Return") == 2) {
                                                                        set .@repeatoff,0;
                                                                        break;
                                                                    }
                                                                    set .@bitopt13,0;
                                                                    set .@bitopt12,0;
                                                                    set .@repeatoff,0;
                                                                    break;
                                                                }
                                                                else
                                                                    set .@bitopt12,1;
                                                            }
                                                            else {
                                                                if (getd(".@bitopt"+.@i) )
                                                                    setd ".@bitopt"+.@i,0;
                                                                else
                                                                    setd ".@bitopt"+.@i,1;
                                                                break;
                                                            }
                                                        }
                                                    }
                                                    set .@bitmask,0;
                                                    for (set .@i,0; .@i < .maxbitn; set .@i , .@i + 1) {
                                                        if (getd(".@bitopt"+.@i))
                                                            set .@bitmask,.@bitmask | pow (2,.@i);
                                                    }
                                                }
                                                break;
                                                
                                                case 7:
                                                for (set .@i,0; .@i <.maxgnum ; set .@i, .@i + 1 ) {
                                                
                                                    if ( (getd (".guildinfo"+.@i+"$[0]") == strcharinfo(0) ) && (getarraysize(getd(".guildinfo"+.@i)) != 0)  && (getd (".guildinfo"+.@i+"[1]") == getcharid(2)) ) {
                                                    
                                                    //Deletes Old Registry
                                                        deletearray getd(".guildinfo$"+.@i);
                                                        deletearray getd(".guildinfo"+.@i);
                                                    
                                                    //String Array
                                                        //Leader Name
                                                        setd ".guildinfo"+.@i+"$[0]", strcharinfo(0);
                                                        //Objective Inputted
                                                        setd ".guildinfo"+.@i+"$[1]", .@gobj$;
                                                        //Level Inputted
                                                        setd ".guildinfo"+.@i+"$[2]", .@glvl$;
                                                        //Description Inputted
                                                        setd ".guildinfo"+.@i+"$[3]", .@gdesc$;
                                                        //Job Inputted
                                                        setd ".guildinfo"+.@i+"$[4]", .@gjob$;
                                                        
                                                    //Numeric Array
                                                        //Bitmask
                                                        setd ".guildinfo"+.@i+"[0]", .@bitmask;
                                                        //Guild ID
                                                        setd ".guildinfo"+.@i+"[1]", getcharid(2,strcharinfo(0));
                                                        //Equips
                                                        set .@n, 1;
                                                        for (set .@j,1; .@j <= .@gmaxitem; set .@j, .@j + 1) {
                                                            set .@n, .@n + 1;
                                                            if (getd(".@gequip"+.@j) == 0)
                                                                setd ".@gequip"+.@j,32767;
                                                            setd ".guildinfo"+.@i+"["+.@n+"]", getd(".@gequip"+.@j);
                                                        }
                                                        
                                                        mes "["+strnpcinfo(1)+"]";
                                                        mes "Your guild has been added succesfully!";
                                                        break;
                                                    }
                                                }
                                                if (.@i >= .maxgnum) {
                                                    mes "["+strnpcinfo(1)+"]";
                                                    mes "Im sorry but all the slots for parties are filled up, please come back later";
                                                    close;
                                                }
                                                close;
                                            break;
                                            }
                                        }
                                        break;
                                    }
                                    else {
                                        mes "["+strnpcinfo(1)+"]";
                                        mes "Sorry but I do not have any registry of your guild recruitment. Please try creating a new guild registry.";
                                        close;
                                    }
                                }
                            }
                            else {
                                mes "["+strnpcinfo(1)+"]";
                                mes "^FF0000Error^000000 you are no longer the guild leader. This function has been terminated.";
                                close;
                            }
                        }
                        break;
        
        //----------------------------------------------------------------------------------------------------------------------------------
        //Delete Registry Part -------------------------------------------------------------------------------------------------------------
        // ---------------------------------------------------------------------------------------------------------------------------------
                        case 3:
                        if ( getguildmaster (getcharid(2)) == strcharinfo(0) ) {
                            for (set .@i,0; .@i < .maxgnum ; set .@i, .@i + 1 ) {
                                if ( (getd (".guildinfo"+.@i+"$[0]") == strcharinfo(0)) && (getarraysize(getd(".guildinfo"+.@i)) != 0)  && (getd (".guildinfo"+.@i+"[1]") == getcharid(2)) ) {
                                    mes "["+strnpcinfo(1)+"]";
                                    mes "The registry for ^009900"+getd (".guildinfo"+.@i+"$[0]")+"^000000 guild has been found. Are you sure you want to delete this registry?";
                                    next;
                                    if (select("Yes:No") == 2) break;
                                    deletearray getd(".guildinfo"+.@i+"$");
                                    deletearray getd(".guildinfo"+.@i);
                                    mes "["+strnpcinfo(1)+"]";
                                    mes "The registry has been successfully deleted.";
                                    close;
                                }
                                else {
                                mes "["+strnpcinfo(1)+"]";
                                    mes "I'm sorry but you do not have a guild registry with us.";
                                    close;
                                }
                            }
                            break;
                        }
                        else {
                            mes "["+strnpcinfo(1)+"]";
                            mes "^FF0000Error^000000 you are no longer the guild leader. This function has been terminated.";
                            close;
                        }
                        break;
        
        //Cancel Part
                        case 4:
                        mes "["+strnpcinfo(1)+"]";
                        mes "Thank you for your time.";
                        close;
                    }
                }
                else {
                
                //Guild Member but not leader part
                
                    mes "["+strnpcinfo(1)+"]";
                    mes "Im sorry but you are already inside a guild.";
                    close;
                }
                
            }
            else {
            
            //Unguildied part
            
                while (1) {
                
                    //Checks if Registered Player is Still Leader of Registered Guild
                    for (set .@i,0; .@i < .maxgnum; set .@i, .@i + 1) {
                        if (getarraysize(getd(".guildinfo"+.@i)) != 0) {
                            set .@restrict, callfunc ( "checkrest#g1",getd(".guildinfo"+.@i+"$[0]"),getd(".guildinfo"+.@i+"[1]") );
                            if (.@restrict) {
                                deletearray getd(".guildinfo"+.@i+"$");
                                deletearray getd(".guildinfo"+.@i);
                            }
                        }
                    }
                    
                    //Reorganizes arrays
                    set .@w, 0;
                    while (.@w < .maxgnum) {
                        if ( getarraysize(getd(".guildinfo"+.@w)) != 0  ) {
                            set .@i,.@w - 1;
                            while ( .@i >= 0 ) {
                                if (getarraysize(getd(".guildinfo"+.@i)) == 0) {
                                
                            //Sets a new place for the array
                                //String Array
                                    //Leader Name
                                    setd ".guildinfo"+.@i+"$[0]", getd(".guildinfo"+.@w+"$[0]");
                                    //Objective Inputted
                                    setd ".guildinfo"+.@i+"$[1]", getd(".guildinfo"+.@w+"$[1]");
                                    //Level Inputted
                                    setd ".guildinfo"+.@i+"$[2]", getd(".guildinfo"+.@w+"$[2]");
                                    //Description Inputted
                                    setd ".guildinfo"+.@i+"$[3]", getd(".guildinfo"+.@w+"$[3]");
                                    //Job Inputted
                                    setd ".guildinfo"+.@i+"$[4]", getd(".guildinfo"+.@w+"$[4]");
                                    
                                //Numeric Array
                                    //Bitmask
                                    setd ".guildinfo"+.@i+"[0]", getd (".guildinfo"+.@w+"[0]");
                                    //Guild ID
                                    setd ".guildinfo"+.@i+"[1]", getd (".guildinfo"+.@w+"[1]");
                                    //Equips
                                    for (set .@n,2; .@n <= .@gmaxitem + 1; set .@n, .@n + 1) {
                                        setd ".guildinfo"+.@i+"["+.@n+"]", getd (".guildinfo"+.@w+"["+.@n+"]");
                                    }
                                    
                            //Deletes Old Array
                                    deletearray getd(".guildinfo"+.@w+"$");
                                    deletearray getd(".guildinfo"+.@w);
                                }
                            set .@i, .@i - 1;
                            }
                        }
                        set .@w, .@w + 1;
                    }
                    
                    
                    //Dynamic Menu
                    set .@cn,0;
                    set .@menu$,"";
                    for (set .@i,0; .@i < .maxgnum; set .@i, .@i + 1) {
                        if ((getarraysize(getd(".guildinfo"+.@i))) != 0) {
                            if (getcharid(0,getd(".guildinfo"+.@i+"$[0]")) == 0 ) {
                                set .@menu$, .@menu$ + ":" + "Guild- ^009900" + getguildname( getd(".guildinfo"+.@i+"[1]") ) + "^000000 (Leader- ^FF0000Off^000000)";
                                set .@cn,.@cn+1;
                            }
                            else{
                                set .@menu$, .@menu$ + ":" + "Guild- ^009900" + getguildname( getd(".guildinfo"+.@i+"[1]") ) + "^000000 (Leader- ^009900On^000000)";
                                set .@cn,.@cn+1;
                            }
                        }
	                    }
                    set .@menu$, .@menu$  +":Cancel";
                    if (.@menu$ == ":Cancel" ) {
                        mes "["+strnpcinfo(1)+"]";
                        mes "Im sorry but there are no guilds avaible at the moment.";
                        close;
                    }
                    mes "["+strnpcinfo(1)+"]";
                    mes "Please select a guild registry, then I can provide you the avaible info regarding that guild.";
                    next;
                    set .@menu, select(.@menu$);
                    set .@menu, .@menu - 2;
                    for (set .@i, 0; .@i < .maxgnum; set .@i, .@i + 1) {
                        if (.@menu == .@cn) {
                            mes "["+strnpcinfo(1)+"]";
                            mes "Thank you for your time.";
                            close;
                        }
                        if (.@menu == .@i) {
                            if ( callfunc ( "checkrest#g1",getd(".guildinfo"+.@i+"$[0]"),getd(".guildinfo"+.@i+"[1]") ) ) {
                                deletearray getd(".guildinfo"+.@i+"$");
                                deletearray getd(".guildinfo"+.@i);
                            }
                            if (getarraysize(getd(".guildinfo"+.@i)) != 0 ) {
                            
                            //Sets bitmask to guild's bitmask.
                            set .@bitmask, getd(".guildinfo"+.@i+"[0]");
                                
                            //Guild Information
                                mes "["+strnpcinfo(1)+"]";
                                
                                //Guild Name
                                mes "^000000Guild- ^99CC33" + getguildname(getd(".guildinfo"+.@i+"[1]"));
                                //Leader Avaible Information
                                if (  ( getd (".guildinfo"+.@i+"[0]") & pow (2,9) )  ||  ( getd (".guildinfo"+.@i+"[0]") & pow (2,10) )  ||  ( getd (".guildinfo"+.@i+"[0]") & pow (2,11) ) || ( .@bitmask & pow(2,7) )  ) {
                                    mes "----- Leader Information -----";
                                    //Leader Name
                                    if ( .@bitmask & pow(2,7) )
                                        mes "^000000Name- ^6633CC" + getd(".guildinfo"+.@i+"$[0]");
                                    set .@leaderinfo$, callfunc("leaderinfo#g1", getd(".guildinfo"+.@i+"$[0]"), getd (".guildinfo"+.@i+"[0]"));
                                    mes .@leaderinfo$;
                                    mes "------------------------------";
                                }
                                //Objective
                                if ( getd (".guildinfo"+.@i+"$[1]") != "" ) {
                                    mes "^000000Objective- ^33CC00" + getd(".guildinfo"+.@i+"$[1]");
                                }
                                //Level
                                if (  getd (".guildinfo"+.@i+"$[2]") != "" ) {
                                    mes "^000000Levels- ^99CC33" + getd(".guildinfo"+.@i+"$[2]");
                                }
                                if ( getd (".guildinfo"+.@i+"$[4]") != "" ) {
                                //Jobs
                                    mes "^000000Jobs- ^FF0033" + getd(".guildinfo"+.@i+"$[4]");
                                }
                                //Equips
                                for (set .@n,2; .@n <= .@gmaxitem + 1; set .@n, .@n + 1) {
                                    if (getd (".guildinfo"+.@i+"["+.@n+"]") != 32767)
                                        mes "^000000Equips- ^FF00CC" + getitemname( getd (".guildinfo"+.@i+"["+.@n+"]") );
                                }
                                //Castles
                                if ( getd (".guildinfo"+.@i+"[0]") & pow (2,8) ) {
                                    set .@castles$, callfunc("castles#g1", getd(".guildinfo"+.@i+"[1]") );
                                    if ( (.@castles$) == "" )
                                        set .@castles$,"None";
                                    mes "^000000Castles- ^3399FF" + .@castles$;
                                }
                                //Description
                                if ( getd (".guildinfo"+.@i+"$[3]") != "" ) {
                                    mes "^000000Description- ^996600" + getd(".guildinfo"+.@i+"$[3]");
                                }
                                mes "^000000";
                                
                                
                            //Dynamic Menu Selection
                                set .@menu, callfunc ("calcmenu#g2",getd(".guildinfo"+.@i+"[0]"));
                            //    set .@menu, .@menu + 1;
                            //Checks the maximum menu
                                set .@maxmenu, 1;
                                set .@tempbit, 0;
                                for (set .@p, 0; .@p < .maxbitn ; set .@p, .@p + 1) {
                                    set .@o, pow (2,.@p);
                                    if ( getd (".guildinfo"+.@i+"[0]") & (.@o) ) {
                                        if ( (.@p == 0 ) || (.@p == 2) || (.@p == 3) || (.@p == 12) ) {
                                            set .@maxmenu, .@maxmenu + 1;
                                            
                                        //Makes a temporary bitmask reorganized
                                            if (.@p == 0)
                                            set .@tempbit, .@tempbit | pow(2,2);
                                            if (.@p == 2)
                                            set .@tempbit, .@tempbit | pow(2,1);
                                            if (.@p == 3)
                                            set .@tempbit, .@tempbit | pow(2,3);
                                            if (.@p == 12)
                                            set .@tempbit, .@tempbit | pow(2,0);
                                        }
                                    }
                                }
                                
                                //Breaks for "Back" Menu
                                if (.@menu == .@maxmenu) {
                                    next;
                                    break;
                                }
                                
                                //Resets Negates
                                for (set .@t, 1; .@t < .@maxmenu ; set .@t, .@t + 1) {
                                    setd ".@negate"+.@t, 0;
                                }
                                
                                //Change this value for menu modifications.
                                //Input the ABSOLUTE maximum value for this dynamic menu.
                                //Remember to also change the number of negates!
                                set .@totalmax, 5;
                                
                                //Checks ammounts of shifts for each menu
                                for (set .@t, 1; .@t < .@maxmenu ; set .@t, .@t + 1) {
                                    if ( ( .@tempbit & pow(2,(.@t - 1)) ) == 0 ) {
                                        for (set .@k, (.@t + 1) ; .@k < .@totalmax ; set .@k, .@k + 1) {
                                            if ( ( .@tempbit & pow(2,(.@k - 1)) ) != 0 ) {
                                                setd ".@negate"+.@t, .@k - .@t;
                                                set .@tempbit, .@tempbit ^ pow(2,(.@k - 1));
                                                break;
                                            }
                                        }
                                    }    
                                }
                                
                                //Readapt menu to the ammount of shifts
                                for (set .@t, 1; .@t < .@maxmenu ; set .@t, .@t + 1) {
                                    if (.@menu == .@t)
                                        set .@menu, .@menu + getd(".@negate"+.@t);
                                }
                                
                                next;
                                if ( (.@menu != 99) || (.@menu != 98) ) {
                                
                                    //---------------------------------------------------------------------------------------------------------
                                    //--------------------------------------- Announce to Leader ----------------------------------------------
                                    //---------------------------------------------------------------------------------------------------------
                                
                                    if (.@menu == 0) {
                                        if ( (getcharid(0,getd(".guildinfo"+.@i+"$[0]"))) && (!callfunc("checkrest#g1",getd(".guildinfo"+.@i+"$[0]"),getd(".guildinfo"+.@i+"[1]"))) ) {
                                            callfunc("leaderanno#g1", getd(".guildinfo"+.@i+"$[0]"), getd (".guildinfo"+.@i+"[0]"), getd (".guildinfo"+.@i+"[1]"), .gannocd );
                                            break;
                                        }
                                        else {
                                            mes "["+strnpcinfo(1)+"]";
                                            mes "I'm sorry but it seems that the Guild Leader has just become unavailable.";
                                            next;
                                            break;
                                        }
                                    }
                                    
                                    //---------------------------------------------------------------------------------------------------------
                                    //--------------------------------------- Warp to Leader --------------------------------------------------
                                    //---------------------------------------------------------------------------------------------------------
                                    
                                    if ((.@menu + .@negate1) == 1) {
                                        if ( (getcharid(0,getd(".guildinfo"+.@i+"$[0]"))) && (!callfunc("checkrest#g1",getd(".guildinfo"+.@i+"$[0]"),getd(".guildinfo"+.@i+"[1]") )) ) {
                                            //Sets the variable into permanent one, to survive the doevent.
                                            set .i2, .@i;
                                            if ( (getd (".guildinfo"+.@i+"[0]") & (pow(2,13))) == 0)
                                                doevent strnpcinfo(0)+"::OnGCount";
                                            callfunc("leaderwarp#g1", getd(".guildinfo"+.@i+"$[0]"), getd (".guildinfo"+.@i+"[0]"), getd (".guildinfo"+.@i+"[1]") );
                                            break;
                                            
                                            OnRequest:
                                            disable_items;
                                            set .@leadertime, gettimetick(2) + .gwdelay;
                                            //Leader Display Part 2
                                            if (prompt ("Accept:Refuse") == 1) {
                                                if (.@leadertime > gettimetick(2)) {
                                                set .request, 2;
                                                }
                                                else {
                                                next;
                                                mes "["+strnpcinfo(1)+"]";
                                                mes "Sorry but the time for answering has ran out. The warp is no longer avaible.";
                                                }
                                            }
                                            else if (@menu == 2) {
                                                if (.@leadertime > gettimetick(2)) {
                                                set .request, 1;
                                                }
                                                else {
                                                next;
                                                mes "["+strnpcinfo(1)+"]";
                                                mes "Sorry but the time for answering has ran out. The warp is no longer avaible.";
                                                }
                                            }
                                            else {
                                                if (.@leadertime > gettimetick(2)) {
                                                    set .request, 1;
                                                }
                                                end;
                                            }
                                            set .@leadertime, 0;
                                            enable_items;
                                            close;
                                            
                                            
                                            //Threading
                                            OnGCount:
                                            //User Display Part
                                            set .@i, .i2;
                                            set .i2, 0;
                                            set .@rid, getcharid(3);
                                            set .@request, 0;
                                            mes "["+strnpcinfo(1)+"]";
                                            mes "Please ^0000FFWait^000000 while the Guild Leader accepts the warp.";
                                            mes "Time Left: ";
                                            set .@delaytime, gettimetick(2) + .gwdelay;
                                            while (1) {
                                                attachrid (.@rid);
                                                if (.@rid == 0)
                                                    end;
                                                disable_items;
                                                if (.@delaytime > gettimetick(2)) {
                                                    mes "^FF0000" + ( .@delaytime - gettimetick(2) ) + "^000000 seconds...";
                                                    sleep2 990;
                                                    if (.request == 2) {
                                                        set .request, 0;
                                                        set .@rid, getcharid(3);
                                                        getmapxy .@m$,.@x,.@y, 0, getd(".guildinfo"+.@i+"$[0]");
                                                        attachrid(.@rid);
                                                        enable_items;
                                                        warp .@m$,.@x,.@y;
                                                        end;
                                                    }
                                                    if (.request == 1) {
                                                        set .request, 0;
                                                        enable_items;
                                                        next;
                                                        mes "["+strnpcinfo(1)+"]";
                                                        mes "Sorry but the Guild Leader has refused your warp request.";
                                                        close;
                                                    }
                                                }
                                                else {
                                                    enable_items;
                                                    next;
                                                    mes "["+strnpcinfo(1)+"]";
                                                    mes "Sorry but It seems the Guild Leader is not answering the request.";
                                                    close;
                                                }
                                            }
                                        }
                                        else {
                                            mes "["+strnpcinfo(1)+"]";
                                            mes "I'm sorry but it seems that the Guild Leader has just become unavailable.";
                                            next;
                                            break;
                                        }
                                    }
                                    
                                    //---------------------------------------------------------------------------------------------------------
                                    //----------------------------------------- Spy Guild Chat ------------------------------------------------
                                    //---------------------------------------------------------------------------------------------------------
                                    
                                    if ((.@menu + .@negate2) == 2) {
                                        if ( !callfunc("checkrest#g1",getd(".guildinfo"+.@i+"$[0]"),getd(".guildinfo"+.@i+"[1]") ) ) {
                                            callfunc("spychat#g1", getd(".guildinfo"+.@i+"[1]"), getd (".guildinfo"+.@i+"$[0]") );
                                            next;
                                            break;
                                        }
                                        else {
                                            mes "["+strnpcinfo(1)+"]";
                                            mes "I'm sorry but it seems that the Guild has just become unavailable.";
                                            next;
                                            break;
                                        }
                                    }
                                    
                                    //---------------------------------------------------------------------------------------------------------
                                    //------------------------------------------- List Members ------------------------------------------------
                                    //---------------------------------------------------------------------------------------------------------
                                    
                                    if ((.@menu + .@negate3) == 3) {
                                        if ( !callfunc("checkrest#g1",getd(".guildinfo"+.@i+"$[0]"),getd(".guildinfo"+.@i+"[1]") ) ) {
                                            
                                            
                                            
                                            
                                        //This function is very similar to "Map Member Search"
                                        //Due to the functions limitations, I won't be using it for this menu selection.
                                        
                                            if  (.@bitmask & pow(2,0)) {                                    
                                            mes "["+strnpcinfo(1)+"]";
                                            mes "Please wait while the member list is being loaded.";
                                            
                                            //Looks through all accounts for the users in map, then looks if they're in guild.
                                                set .@p, 2000000;
                                                set .@j, 0;
                                                set .@rid, getcharid(3);
                                                detachrid;
                                                while ( .@p < 2010000 ) {
                                                    if ( .@p % 500 == 0 ) sleep .sleeptime; // prevent infinite loop
                                                        if ( attachrid(.@p) ) {
                                                            attachrid(.@p);
                                                            if (getcharid(2) == getd(".guildinfo"+.@i+"[1]")) {
                                                                getmapxy .@m$, .@x, .@y, 0;
                                                                //Display Member Name
                                                                    setd ".@name$["+.@j+"]", strcharinfo(0);
                                                                //Display Member Level
                                                                if ( .@bitmask & pow(2,4) )
                                                                    setd ".@lvl["+.@j+"]", BaseLevel;
                                                                //Display Member Job
                                                                if ( .@bitmask & pow(2,5) )
                                                                    setd ".@job$["+.@j+"]", jobname(Class);
                                                                //Display Member Location
                                                                if ( .@bitmask & pow(2,6) )
                                                                    setd ".@loc$["+.@j+"]", "^2FE954" + .@m$ + " ^000000(^996600" + .@x + "^000000, ^996600" + .@y + "^000000)";
                                                                set .@j, .@j + 1;
                                                            }
                                                        }
                                                set .@p, .@p +1;
                                                }
                                                //Attaches back the rid.
                                                attachrid(.@rid);
                                                
                                                //Sets the found variables into permanent ones
                                                //So that they aren't lost upon the doevent.
                                                for (set .@h, 0; .@h < .@j ; set .@h, .@h + 1) {
                                                        setd ".name2$["+.@h+"]", getd (".@name$["+.@h+"]");
                                                    if ( .@bitmask & pow(2,4) )
                                                        setd ".lvl2["+.@h+"]", getd (".@lvl["+.@h+"]");
                                                    if ( .@bitmask & pow(2,5) )
                                                        setd ".job2$["+.@h+"]", getd (".@job$["+.@h+"]");
                                                    if ( .@bitmask & pow(2,6) )
                                                        setd ".loc2$["+.@h+"]", getd (".@loc$["+.@h+"]");
                                                }
                                                set .j2, .@j;
                                                set .i3, .@i;
                                                set .tbitmask2, .@bitmask;
                                                
                                                //Does THE Event.
                                                //No temporary variable has ever survived it...
                                                doevent strnpcinfo(0) + "::OnContinue6";
                                                end;
                                                
                                                OnContinue6:
                                                
                                                //Resets the variables into temporary ones.
                                                set .@j, .j2;
                                                set .@bitmask, .tbitmask2;
                                                set .@i, .i3;
                                                for (set .@h, 0; .@h < .@j ; set .@h, .@h + 1) {
                                                        setd ".@name$["+.@h+"]", getd (".name2$["+.@h+"]");
                                                    if ( .@bitmask & pow(2,4) )
                                                        setd ".@lvl["+.@h+"]", getd (".lvl2["+.@h+"]");
                                                    if ( .@bitmask & pow(2,5) )
                                                        setd ".@job$["+.@h+"]", getd (".job2$["+.@h+"]");
                                                    if ( .@bitmask & pow(2,6) )
                                                        setd ".@loc$["+.@h+"]", getd (".loc2$["+.@h+"]");
                                                }
                                                
	                                                //Deletes the permanent variables.
                                                set .j2, 0;
                                                set .i3, 0;
                                                set .tbitmask2, 0;
                                                deletearray .name2$;
                                                deletearray .lvl2;
                                                deletearray .job2$;
                                                deletearray .loc2$;
                                                next;                                    
                                                
                                            }
                                            else {
                                            mes "["+strnpcinfo(1)+"]";
                                            mes "Sorry but this guild registry has been cancelled.";
                                            close;
                                            }
                                        
                                            mes "["+strnpcinfo(1)+"]";
                                            if ( (.@bitmask & pow(2,4)) || (.@bitmask & pow(2,5)) || (.@bitmask & pow(2,6)) || (.@bitmask & pow(2,1)) )
                                                mes "Please select a member for further info.";
                                            else {
                                                for (set .@u, 0; .@u < .@j ; set .@u, .@u + 1){
                                                    if ( ( getd(".@name$["+.@u+"]") == getd(".guildinfo"+.@i+"$[0]") ) && (.@bitmask & pow(2,7)) )
                                                        mes "0000FF" + getd(".@name$["+.@u+"]") + " (^FF0000Leader^000000)";
                                                    else
                                                        mes "^0000FF" + getd(".@name$["+.@u+"]");
                                                }
                                                next;
                                                break;
                                            }
                                            
                                            set .@menu$, "";
                                            for (set .@u, 0; .@u < .@j ; set .@u, .@u + 1){
                                                if ( ( getd(".@name$["+.@u+"]") == getd(".guildinfo"+.@i+"$[0]") ) && (.@bitmask & pow(2,7)) ) {
                                                    set .@menu$, .@menu$ + ":" + getd(".@name$["+.@u+"]") + " (^FF0000Leader^000000)";
                                                }
                                                else
                                                    set .@menu$, .@menu$ + ":" + getd(".@name$["+.@u+"]");
                                            }
                                            
                                            next;
                                            set .@menu, select (.@menu$);
                                            set .@menu, .@menu - 2;
                                            set .@j, .@menu;
                                            set .@c, .@menu;
                                            
                                            //Checks for Guild Avaibility
                                            if ( callfunc("checkrest#g1",getd(".guildinfo"+.@i+"$[0]"),getd(".guildinfo"+.@i+"[1]") ) ) {
                                                mes "["+strnpcinfo(1)+"]";
                                                mes "Sorry but the Guild is no longer available.";
                                                close;
                                            }
                                            
                                            //Checks for Offline member
                                            if (!getcharid(3,getd(".@name$["+.@j+"]"))) {
                                                mes "["+strnpcinfo(1)+"]";
                                                mes "Sorry but the Player has just logged off. This function has been terminated.";
                                                close;
                                            }
                                            
                                            if ( (.@bitmask & pow(2,4)) || (.@bitmask & pow(2,5)) || (.@bitmask & pow(2,6)) || (.@bitmask & pow(2,1)) ) {
                                                mes "["+strnpcinfo(1)+"]";
                                                if ( ( getd(".@name$["+.@c+"]") == getd(".guildinfo"+.@i+"$[0]") ) && (.@bitmask & pow(2,7)) )
                                                    mes "^FF0000Leader^000000- ^0000FF" + getd(".@name$["+.@j+"]") + "^000000";
                                                else
                                                    mes "Member- ^0000FF" + getd(".@name$["+.@j+"]") + "^000000";
                                            }
                                            if (.@bitmask & pow(2,4))
                                                mes "Level- ^99CC33" + getd(".@lvl["+.@j+"]") + "^000000";
                                            if (.@bitmask & pow(2,5))
                                                mes "Job- ^FF0033" + getd(".@job$["+.@j+"]") + "^000000";
                                            if (.@bitmask & pow(2,6))
                                                mes "Location- " + getd(".@loc$["+.@j+"]");
                                            
                                            set .@menu$, "";
                                            set .@menu, 0;
                                            if (.@bitmask & pow(2,1)) {
                                                if ( ( getd(".@name$["+.@c+"]") == getd(".guildinfo"+.@i+"$[0]") ) && (.@bitmask & pow(2,7)) )
                                                    set .@menu$, .@menu$ + ":Announce to ^FF0000Leader^000000";
                                                else
                                                    set .@menu$, .@menu$ + ":Announce to Member";
                                            }
                                            set .@menu$, .@menu$ + ":^0000FFBack^000000";
                                            next;
                                            set .@menu, select(.@menu$);
                                            set .@menu, .@menu - 1;
                                            
                                            //Check for Guild Avaibility
                                            if ( callfunc("checkrest#g1",getd(".guildinfo"+.@i+"$[0]"),getd(".guildinfo"+.@i+"[1]") ) ) {
                                                mes "["+strnpcinfo(1)+"]";
                                                mes "Sorry but the Guild is no longer available.";
                                                close;
                                            }
                                            
                                            //Checks for Offline member
                                            if (!getcharid(3,getd(".@name$["+.@j+"]"))) {
                                                mes "["+strnpcinfo(1)+"]";
                                                mes "Sorry but the Player has just logged off. This function has been terminated.";
                                                close;
                                            }
                                            
                                            if ( (.@menu == 1) && (.@bitmask & pow(2,1)) ) {
                                                mes "["+strnpcinfo(1)+"]";
                                                if ( ( getd(".@name$["+.@c+"]") == getd(".guildinfo"+.@i+"$[0]") ) && (.@bitmask & pow(2,7)) )
                                                    mes "You have been announced to the Guild ^FF0000Leader^000000 ^0000FF"+getd(".@name$["+.@j+"]")+"^000000.";
                                                else
                                                    mes "You have been announced to the Guild Member ^0000FF"+getd(".@name$["+.@j+"]")+"^000000.";
                                                set .@pname$, strcharinfo(0);
                                                set .@plvl, BaseLevel;
                                                set .@job$, jobname(Class);
                                                set @g_announce, gettimetick(2) + @announcecd;
                                                close2;
                                                attachrid (getcharid(3,getd(".@name$["+.@j+"]")));
                                                announce .@name$+" level "+.@lvl+" job "+.@job$+" wants to join your guild.",bc_self,0x2FE954,0,0,0;
                                                end;
                                            }
                                            if ( (.@menu == 2) && (.@bitmask & pow(2,1)) ) {
                                                //Deletes Arrays
                                                deletearray .@name$;
                                                deletearray .@lvl;
                                                deletearray .@job$;
                                                deletearray .@loc$;
                                                break;
                                            }
                                            if (.@menu == 1) {
                                                //Deletes Arrays
                                                deletearray .@name$;
                                                deletearray .@lvl;
                                                deletearray .@job$;
                                                deletearray .@loc$;
                                                break;
                                            }
                                            
                                            //Deletes Arrays
                                            deletearray .@name$;
                                            deletearray .@lvl;
                                            deletearray .@job$;
                                            deletearray .@loc$;
                                            break;
                                            
                                            
                                            
                                            
                                        }
                                        else {
                                            mes "["+strnpcinfo(1)+"]";
                                            mes "I'm sorry but it seems that the Guild has just become unavailable.";
                                            next;
                                            break;
                                        }
                                    }
                                    
                                    //---------------------------------------------------------------------------------------------------------
                                    //--------------------------------------- Map Member Search -----------------------------------------------
                                    //---------------------------------------------------------------------------------------------------------
                                    
                                    if ((.@menu + .@negate4) == 4) {
                                        if ( !callfunc("checkrest#g1",getd(".guildinfo"+.@i+"$[0]"),getd(".guildinfo"+.@i+"[1]") ) ) {
                                            
                                        //Due to the functions limitations, I won't be using it for this menu selection.
                                        
                                            mes "["+strnpcinfo(1)+"]";
                                            mes "Please write the map name, then I will search for ammount of guild members inside that map.";
                                            next;
                                            input .@map$;
                                            
                                            //Looks through all accounts for the users in map, then looks if they're in guild.
                                            if (getmapguildusers (.@map$,getd(".guildinfo"+.@i+"[1]")) > 0) {
                                                if ( (.@bitmask & pow(2,4)) || (.@bitmask & pow(2,5)) || (.@bitmask & pow(2,6)) || (.@bitmask & pow(2,1)) ) {
                                                    mes "["+strnpcinfo(1)+"]";
                                                    mes "Please wait while the map is being scanned.";
                                                    set .@p, 2000000;
                                                    set .@j, 0;
                                                    set .@rid, getcharid(3);
                                                    detachrid;
                                                    while ( .@p < 2010000 ) {
                                                        if ( .@p % 500 == 0 ) sleep .sleeptime; // prevent infinite loop
                                                            if ( attachrid(.@p) ) {
                                                                attachrid(.@p);
                                                                getmapxy .@m$, .@x, .@y, 0;
                                                                if ( .@m$ == .@map$) {
                                                                    if (getcharid(2) == getd(".guildinfo"+.@i+"[1]")) {
                                                                        //Display Member Name
                                                                            setd ".@name$["+.@j+"]", strcharinfo(0);
                                                                        //Display Member Level
                                                                        if ( .@bitmask & pow(2,4) )
                                                                            setd ".@lvl["+.@j+"]", BaseLevel;
                                                                        //Display Member Job
                                                                        if ( .@bitmask & pow(2,5) )
                                                                            setd ".@job$["+.@j+"]", jobname(Class);
                                                                        //Display Member Location
                                                                        if ( .@bitmask & pow(2,6) )
                                                                            setd ".@loc$["+.@j+"]", .@x + ", " + .@y;
                                                                        set .@j, .@j + 1;
                                                                    }
                                                                }
                                                            }
                                                    set .@p, .@p +1;
                                                    }
                                                    //Attaches back the rid.
                                                    attachrid(.@rid);
                                                    
                                                    //Sets the found variables into permanent ones
                                                    //So that they aren't lost upon the doevent.
                                                    for (set .@h, 0; .@h < .@j ; set .@h, .@h + 1) {
                                                            setd ".name$["+.@h+"]", getd (".@name$["+.@h+"]");
                                                        if ( .@bitmask & pow(2,4) )
                                                            setd ".lvl["+.@h+"]", getd (".@lvl["+.@h+"]");
                                                        if ( .@bitmask & pow(2,5) )
                                                            setd ".job$["+.@h+"]", getd (".@job$["+.@h+"]");
                                                        if ( .@bitmask & pow(2,6) )
                                                            setd ".loc$["+.@h+"]", getd (".@loc$["+.@h+"]");
                                                    }
                                                    set .j, .@j;
                                                    set .i, .@i;
                                                    set .tbitmask, .@bitmask;
                                                    set .map$, .@map$;
                                                    
                                                    //Does THE Event.
                                                    //No temporary variable has ever survived it...
                                                    doevent strnpcinfo(0) + "::OnContinue5";
                                                    end;
                                                    
                                                    OnContinue5:
                                                    
                                                    //Resets the variables into temporary ones.
                                                    set .@j, .j;
                                                    set .@bitmask, .tbitmask;
                                                    set .@i, .i;
                                                    set .@map$, .map$;
                                                    for (set .@h, 0; .@h < .@j ; set .@h, .@h + 1) {
                                                            setd ".@name$["+.@h+"]", getd (".name$["+.@h+"]");
                                                        if ( .@bitmask & pow(2,4) )
                                                            setd ".@lvl["+.@h+"]", getd (".lvl["+.@h+"]");
                                                        if ( .@bitmask & pow(2,5) )
                                                            setd ".@job$["+.@h+"]", getd (".job$["+.@h+"]");
                                                        if ( .@bitmask & pow(2,6) )
                                                            setd ".@loc$["+.@h+"]", getd (".loc$["+.@h+"]");
                                                    }
                                                    
	                                                    //Deletes the permanent variables.
                                                    set .map$, "";
                                                    set .j, 0;
                                                    set .i, 0;
                                                    set .tbitmask, 0;
                                                    deletearray .name$;
                                                    deletearray .lvl;
                                                    deletearray .job$;
                                                    deletearray .loc$;
                                                    next;                                    
                                                    
                                                }
                                            }
                                            else {
                                            mes "["+strnpcinfo(1)+"]";
                                            mes "No users from ^009900"+getguildname(getd(".guildinfo"+.@i+"[1]"))+"^000000 Guild were found in the selected map.";
                                            next;
                                            break;
                                            }
                                        
                                            mes "["+strnpcinfo(1)+"]";
                                            mes "Guild Members in ^009900"+.@map$+" : ^FF0000"+ getmapguildusers (.@map$,getd(".guildinfo"+.@i+"[1]")) +"^000000";
                                            if ( (.@bitmask & pow(2,4)) || (.@bitmask & pow(2,5)) || (.@bitmask & pow(2,6)) || (.@bitmask & pow(2,1)) )
                                                mes "Please select a member for further info.";
                                            else {
                                                next;
                                                break;
                                            }
                                            
                                            set .@menu$, "";
                                            for (set .@u, 0; .@u < .@j ; set .@u, .@u + 1){
                                                if ( ( getd(".@name$["+.@u+"]") == getd(".guildinfo"+.@i+"$[0]") ) && (.@bitmask & pow(2,7)) ) {
                                                    set .@menu$, .@menu$ + ":" + getd(".@name$["+.@u+"]") + " (^FF0000Leader^000000)";
                                                }
                                                else
                                                    set .@menu$, .@menu$ + ":" + getd(".@name$["+.@u+"]");
                                            }
                                            
                                            next;
                                            set .@menu, select (.@menu$);
                                            set .@menu, .@menu - 2;
                                            set .@j, .@menu;
                                            set .@c, .@menu;
                                            
                                            //Checks for Guild Avaibility
                                            if ( callfunc("checkrest#g1",getd(".guildinfo"+.@i+"$[0]"),getd(".guildinfo"+.@i+"[1]") ) ) {
                                                mes "["+strnpcinfo(1)+"]";
                                                mes "Sorry but the Guild is no longer available.";
                                                close;
                                            }
                                            
                                            //Checks for Offline member
                                            if (!getcharid(3,getd(".@name$["+.@j+"]"))) {
                                                mes "["+strnpcinfo(1)+"]";
                                                mes "Sorry but the Player has just logged off. This function has been terminated.";
                                                close;
                                            }
                                            
                                            if ( (.@bitmask & pow(2,4)) || (.@bitmask & pow(2,5)) || (.@bitmask & pow(2,6)) || (.@bitmask & pow(2,1)) ) {
                                                mes "["+strnpcinfo(1)+"]";
                                                if ( ( getd(".@name$["+.@c+"]") == getd(".guildinfo"+.@i+"$[0]") ) && (.@bitmask & pow(2,7)) )
                                                    mes "^FF0000Leader^000000- ^0000FF" + getd(".@name$["+.@j+"]") + "^000000";
                                                else
                                                    mes "Member- ^0000FF" + getd(".@name$["+.@j+"]") + "^000000";
                                            }
                                            if (.@bitmask & pow(2,4))
                                                mes "Level- ^99CC33" + getd(".@lvl["+.@j+"]") + "^000000";
                                            if (.@bitmask & pow(2,5))
                                                mes "Job- ^FF0033" + getd(".@job$["+.@j+"]") + "^000000";
                                            if (.@bitmask & pow(2,6))
                                                mes "Coords- (^996600" + getd(".@loc$["+.@j+"]") + "^000000)";
                                            
                                            set .@menu$, "";
                                            set .@menu, 0;
                                            if (.@bitmask & pow(2,1)) {
                                                if ( ( getd(".@name$["+.@c+"]") == getd(".guildinfo"+.@i+"$[0]") ) && (.@bitmask & pow(2,7)) )
                                                    set .@menu$, .@menu$ + ":Announce to ^FF0000Leader^000000";
                                                else
                                                    set .@menu$, .@menu$ + ":Announce to Member";
                                            }
                                            set .@menu$, .@menu$ + ":^0000FFBack^000000";
                                            next;
                                            set .@menu, select(.@menu$);
                                            set .@menu, .@menu - 1;
                                            
                                            //Check for Guild Avaibility
                                            if ( callfunc("checkrest#g1",getd(".guildinfo"+.@i+"$[0]"),getd(".guildinfo"+.@i+"[1]") ) ) {
                                                mes "["+strnpcinfo(1)+"]";
                                                mes "Sorry but the Guild is no longer available.";
                                                close;
                                            }
                                            
                                            //Checks for Offline member
                                            if (!getcharid(3,getd(".@name$["+.@j+"]"))) {
                                                mes "["+strnpcinfo(1)+"]";
                                                mes "Sorry but the Player has just logged off. This function has been terminated.";
                                                close;
                                            }
                                            
                                            if ( (.@menu == 1) && (.@bitmask & pow(2,1)) ) {
                                                mes "["+strnpcinfo(1)+"]";
                                                if ( ( getd(".@name$["+.@c+"]") == getd(".guildinfo"+.@i+"$[0]") ) && (.@bitmask & pow(2,7)) )
                                                    mes "You have been announced to the Guild ^FF0000Leader^000000 ^0000FF"+getd(".@name$["+.@j+"]")+"^000000.";
                                                else
                                                    mes "You have been announced to the Guild Member ^0000FF"+getd(".@name$["+.@j+"]")+"^000000.";
                                                set .@pname$, strcharinfo(0);
                                                set .@plvl, BaseLevel;
                                                set .@job$, jobname(Class);
                                                set @g_announce, gettimetick(2) + @announcecd;
                                                close2;
                                                attachrid (getcharid(3,getd(".@name$["+.@j+"]")));
                                                announce .@name$+" level "+.@lvl+" job "+.@job$+" wants to join your guild.",bc_self,0x2FE954,0,0,0;
                                                end;
                                            }
                                            if ( (.@menu == 2) && (.@bitmask & pow(2,1)) ) {
                                                //Deletes Arrays
                                                deletearray .@name$;
                                                deletearray .@lvl;
                                                deletearray .@job$;
                                                deletearray .@loc$;
                                                break;
                                            }
                                            if (.@menu == 1) {
                                                //Deletes Arrays
                                                deletearray .@name$;
                                                deletearray .@lvl;
                                                deletearray .@job$;
                                                deletearray .@loc$;
                                                break;
                                            }
                                            
                                            //Deletes Arrays
                                            deletearray .@name$;
                                            deletearray .@lvl;
                                            deletearray .@job$;
                                            deletearray .@loc$;
                                            break;
                                            
                                        }
                                        else {
                                            mes "["+strnpcinfo(1)+"]";
                                            mes "I'm sorry but it seems that the Guild has just become unavailable.";
                                            next;
                                            break;
                                        }
                                    }
                                    
                                    //Please Add Additionals Menu Here, For NPC Modifying.
                                    
                                    else {
                                        mes "["+strnpcinfo(1)+"]";
                                        mes "^FF0000Critical Error^000000 This Function has been terminated.";
                                        mes "^0000FFDebug:^000000 The number of menus is smaller than it should be.";
                                        close;
                                    }
                                }
                                else if (.@menu == 99)
                                    break;
                                else if (.@menu == 98) {
                                    mes "["+strnpcinfo(1)+"]";
                                    mes "^FF0000Critical Error^000000 This Function has been terminated.";
                                    mes "^0000FFDebug:^000000 Please Modify your ^FF0000.@maxmenu^000000 variable under ^009900calcmenu#g2^000000 function.";
                                    close;
                                }
                            }
                            else {
                                mes "["+strnpcinfo(1)+"]";
                                mes "I'm Sorry but this Guild Registry has been cancelled.";
                                next;
                                break;
                            }
                        }
                    }
                }
            }
        }
    }
    
    L_ultimatecheck:
    if (.@restrict == 2) {
        next;
        mes "["+strnpcinfo(1)+"]";
        mes "Im sorry but this registration has been cancelled. Therefore this function has failed.";
        deletearray getd(".partyinfo"+.@pupnow+"$");
        deletearray getd(".partyinfo"+.@pupnow);
    }
    else if (.@restrict == 3) {
        mes "["+strnpcinfo(1)+"]";
        mes "Im sorry but the Party Leader (^0000FF"+getd(".partyinfo"+.@pupnow+"$[4]")+"^000000) is currently ^FF0000Offline^000000";
    }
    next;
    set .@menu$,"";
    goto L_return;
	    OnTimer1800000:
    for (set .@don,0; .@don <.@maxptnum ; set .@don,.@don + 1){
        if (getarraysize(getd(".partyinfo"+.@don+"$")) != 0){
            if (getcharid(0,getd(".partyinfo"+.@don+"$[4]")) == 0){
                deletearray getd(".partyinfo"+.@don+"$");
                deletearray getd(".partyinfo"+.@don);
                attachrid (getcharid(3,getd(".partyinfo"+.@don+"$[4]")));
                setd "puprdy"+.@don,0;
            }
        }
    }
    npctalk "Parties Refreshed";
    initnpctimer;
    end;
    
    OnInit:
    //thanks to AnnieRuru for the attachrid on all accs
    set .reload,1;
    set .@i, 2000000;
    while ( .@i < 2010000 ) {
        if ( .@i % 500 == 0 ) sleep 50;
        if ( attachrid(.@i) ) {
            for (set .@dun,0; .@dun <.@maxptnum; set .@dun,.@dun+1){
            if (getd("puprdy"+.@dun) == 1) setd "puprdy"+.@dun,0;
            }
        }
        set .@i, .@i +1;
    }
    set .reload,0;
    startnpctimer;
    end;
	}
	//---------------------------------------------------------------------------------------------------------
//------------------------------------------- Functions ---------------------------------------------------
//---------------------------------------------------------------------------------------------------------
	function    script    checkonline#pt1    {
	    if (getarg(0) != 99) {
        if (getcharid(0,getarg(1)) == 0) {
            return 3;
        }
        if ( (getcharid(0,getarg(1)) != getpartyleader(getarg(2),2)) || (getcharid(1,getarg(1)) == 0) || (getcharid(1,getarg(1)) != getarg(2)) ) {
            return 2;
        }
    }
    else {
        if (getcharid(0,getarg(1)) != 0) {
            if ( (getcharid(1,getarg(1)) == 0) || (getcharid(0,getarg(1)) != getpartyleader(getarg(2),2)) || (getcharid(1,getarg(1)) != getarg(2)) ){
                return 1;
            }
        }
    }
    
    return 0;
}
	//Receives :
//Max Loops (Number of Menus), Max Selections (Options), Menu1,Menu2,Menu3...
//Returns Selection of Menus in a string.
	function    script    calcmenu#g1    {
	set .@menu3$,"";
set .@maxopt, getarg(1);
	    while (1) {
    
        next;
        mes "["+strnpcinfo(1)+"]";
        mes "You can select ^FF0000"+.@maxopt+"^000000 more "+getarg(2)+", and then confirm.";
        mes "Current "+getarg(2)+" :";
        mes "^FF0000"+.@return$+"^000000";
	        set .@menu3$,"";
        for (set .@i,0; .@i < getarg(0) ; set .@i,.@i + 1) {
        
            for (set .@j,0; .@j < getarg(0) ; set .@j, .@j + 1 ) {
                if (.@i == .@j)
                    set .@menuname$, getarg(.@j + 3);
            }
            
            if ( getd(".@menuopt"+.@i) == 1 )
                set .@menu3$, .@menu3$ + ":^009900"+.@menuname$+"^000000";
            else
                set .@menu3$, .@menu3$ + ":^FF0000"+.@menuname$+"^000000";
        }
        set .@menu3$,.@menu3$ + ":^0000FFConfirm";
        set .@menu3, select (.@menu3$);
        set .@menu3,.@menu3 - 2;
        
        for (set .@targ,0; .@targ < getarg(0) ; set .@targ, .@targ+1) {
            if (.@menu3 == .@targ) {
                if (.@maxopt > 0) {
                    if (getd(".@menuopt"+.@targ) == 0) {
                        setd ".@menuopt"+.@targ,1;
                        set .@maxopt,.@maxopt - 1;
                    }
                    else {
                        setd ".@menuopt"+.@targ,0;
                        set .@maxopt,.@maxopt + 1;
                    }
                }
                else {
                    if (getd(".@menuopt"+.@targ) == 0)
                        break;
                    else {
                        setd ".@menuopt"+.@targ,0;
                        set .@maxopt, .@maxopt + 1;
                    }
                }
            }
        }
        
        set .@return$, "";
        for (set .@targ,0; .@targ < getarg(0); set .@targ, .@targ+1) {
            for (set .@j,0; .@j < getarg(0) ; set .@j, .@j + 1 ) {
                if ( (getd(".@menuopt"+.@targ) == 1) && (.@targ == .@j) )
                    set .@return$,.@return$ + getarg(.@j + 3) + " ";
            }
        }
        if ( .@menu3 == getarg(0) ) {
            next;
            break;
        }
        
    }
    return .@return$;
}
	//Receives the looping argument and displays the list of options
function    script    displaylist#g1    {
	    set .@display$,"";
    if (getarg(0) == 0)
        set .@display$,"Allow Member Listing";
    if (getarg(0) == 1)
        set .@display$,"Allow Announce to Member";
    if (getarg(0) == 2)
        set .@display$,"Allow Spy Guild Chat";
    if (getarg(0) == 3)
        set .@display$,"Allow Map Member Search";
    if (getarg(0) == 4)
        set .@display$,"Display Online Member Level";
    if (getarg(0) == 5)
        set .@display$,"Display Online Member Job";
    if (getarg(0) == 6)
        set .@display$,"Display Online Member Location";
    if (getarg(0) == 7)
        set .@display$,"Display Guild Leader Name";
    if (getarg(0) == 8)
        set .@display$,"Display Guild Castles";
    if (getarg(0) == 9)
        set .@display$,"Show Guild Leader Level";
    if (getarg(0) == 10)
        set .@display$,"Show Guild Leader Job";
    if (getarg(0) == 11)
        set .@display$,"Show Guild Leader Location";
    if (getarg(0) == 12)
        set .@display$,"Allow Warp to Guild Leader";
    if (getarg(0) == 13)
        set .@display$,"Always Accept Warps";
	    return .@display$;
    
}
	//Receives :
//Guild Leader Name, Guild ID
//Returns 1 for unavaible Guild
//Returns 0 for avaible Guild
function    script    checkrest#g1    {
	    //Registered Player is not Guild Master of Registered Guild Anymore
    if ( getarg(0) != getguildmaster(getarg(1)))
        return 1;
    
    else    
        return 0;
}
	//Receives:
//The guild bitmask
//Returns :
//The new menu (numeric)
function    script    calcmenu#g2    {
	//For Modifications, Change this number to allow bigger menus
set .@maxmenu, 6;
	    set .@menu$,"";
    set .@cn,0;
    set .@menu$, .@menu$ + ":Announce to Leader";
    set .@cn, .@cn + 1;
    if (getarg(0) & pow(2,12)) {
        set .@menu$, .@menu$ + ":Warp to Leader";
        set .@cn, .@cn + 1;
    }
    if (getarg(0) & pow(2,2)) {
        set .@menu$, .@menu$ + ":Spy Guild Chat";
        set .@cn, .@cn + 1;
    }
    if (getarg(0) & pow(2,0)) {
        set .@menu$, .@menu$ + ":List Guild Members";
        set .@cn, .@cn + 1;
    }
    if (getarg(0) & pow(2,3)) {
        set .@menu$, .@menu$ + ":Map Member Search";
        set .@cn, .@cn + 1;
    }
    
    //Please Add Additonal Menus Here, For NPC Modifying.
    
    set .@menu$, .@menu$ + ":^0000FFBack";
    set .@cn, .@cn + 1;
    set .@menu, select(.@menu$);
    set .@menu, .@menu - 2;
    for (set .@i, 0; .@i < .@maxmenu ; set .@i, .@i + 1) {
        if (.@menu == .@maxmenu)
            return 99;
        if (.@menu == .@i)
            return .@menu;
    }
    
    //Critical Error
    return 98;
    
}
	//Receives :
//Leader Name, Bitmask
//Returns :
//Leader Information
function    script    leaderinfo#g1    {
    
    set .@leaderinfo$,"";
	    if ( getcharid(0,(getarg(0))) ){
        set .@leaderinfo$,"^000000Status- ^009900On^000000";
        set .@rid, getcharid(3);
        attachrid( getcharid(3,getarg(0)) );
        if ( getarg(1) & pow(2,9) ) {
            set .@lvl,BaseLevel;
            set .@leaderinfo$, .@leaderinfo$ + "^000000 Lvl- ^0066CC" + .@lvl;
        }
        if ( getarg(1) & pow(2,10) ) {
            set .@job$,jobname(Class);
            set .@leaderinfo$, .@leaderinfo$ + "^000000 Job- ^FF0033" + .@job$;
        }
        if ( getarg(1) & pow(2,11) ) {
            getmapxy .@map$,.@x,.@y,0;
            set .@leaderinfo$, .@leaderinfo$ + "^000000 Location- ^FF9933" + .@map$ + " " + .@x + ", " + .@y + "^000000";
        }
        attachrid(.@rid);
    }
    else {
        set .@leaderinfo$,"^000000Status- ^FF0000Off^000000";
    }
	    return .@leaderinfo$;
    
}
	//Receives :
//Guild ID
//Returns :
//Guild Castles
function    script    castles#g1    {
	    set .@castles$, "";
    if ( getarg(0) == getcastledata("n_castle",1) ) set .@castles$, .@castles$ + getcastlename("n_castle");
    if ( getarg(0) == getcastledata("nguild_gef",1) ) set .@castles$, .@castles$ + getcastlename("nguild_gef");
    if ( getarg(0) == getcastledata("nguild_prt",1) ) set .@castles$, .@castles$ + getcastlename("nguild_prt");
    if ( getarg(0) == getcastledata("nguild_pay",1) ) set .@castles$, .@castles$ + getcastlename("nguild_pay");
    if ( getarg(0) == getcastledata("nguild_alde",1) ) set .@castles$, .@castles$ + getcastlename("nguild_alde");
    if ( getarg(0) == getcastledata("schg_cas01",1) ) set .@castles$, .@castles$ + getcastlename("schg_cas01");
    if ( getarg(0) == getcastledata("schg_cas02",1) ) set .@castles$, .@castles$ + getcastlename("schg_cas02");
    if ( getarg(0) == getcastledata("schg_cas03",1) ) set .@castles$, .@castles$ + getcastlename("schg_cas03");
    if ( getarg(0) == getcastledata("schg_cas04",1) ) set .@castles$, .@castles$ + getcastlename("schg_cas04");
    if ( getarg(0) == getcastledata("schg_cas05",1) ) set .@castles$, .@castles$ + getcastlename("schg_cas05");
    if ( getarg(0) == getcastledata("arug_cas01",1) ) set .@castles$, .@castles$ + getcastlename("arug_cas01");
    if ( getarg(0) == getcastledata("arug_cas02",1) ) set .@castles$, .@castles$ + getcastlename("arug_cas02");
    if ( getarg(0) == getcastledata("arug_cas03",1) ) set .@castles$, .@castles$ + getcastlename("arug_cas03");
    if ( getarg(0) == getcastledata("arug_cas04",1) ) set .@castles$, .@castles$ + getcastlename("arug_cas04");
    if ( getarg(0) == getcastledata("arug_cas05",1) ) set .@castles$, .@castles$ + getcastlename("arug_cas05");
    if ( getarg(0) == getcastledata("aldeg_cas01",1) ) set .@castles$, .@castles$ + getcastlename("aldeg_cas01");
    if ( getarg(0) == getcastledata("aldeg_cas02",1) ) set .@castles$, .@castles$ + getcastlename("aldeg_cas02");
    if ( getarg(0) == getcastledata("aldeg_cas03",1) ) set .@castles$, .@castles$ + getcastlename("aldeg_cas03");
    if ( getarg(0) == getcastledata("aldeg_cas04",1) ) set .@castles$, .@castles$ + getcastlename("aldeg_cas04");
    if ( getarg(0) == getcastledata("aldeg_cas05",1) ) set .@castles$, .@castles$ + getcastlename("aldeg_cas05");
    if ( getarg(0) == getcastledata("gefg_cas01",1) ) set .@castles$, .@castles$ + getcastlename("gefg_cas01");
    if ( getarg(0) == getcastledata("gefg_cas02",1) ) set .@castles$, .@castles$ + getcastlename("gefg_cas02");
    if ( getarg(0) == getcastledata("gefg_cas03",1) ) set .@castles$, .@castles$ + getcastlename("gefg_cas03");
    if ( getarg(0) == getcastledata("gefg_cas04",1) ) set .@castles$, .@castles$ + getcastlename("gefg_cas04");
    if ( getarg(0) == getcastledata("gefg_cas05",1) ) set .@castles$, .@castles$ + getcastlename("gefg_cas05");
    if ( getarg(0) == getcastledata("payg_cas01",1) ) set .@castles$, .@castles$ + getcastlename("payg_cas01");
    if ( getarg(0) == getcastledata("payg_cas02",1) ) set .@castles$, .@castles$ + getcastlename("payg_cas02");
    if ( getarg(0) == getcastledata("payg_cas03",1) ) set .@castles$, .@castles$ + getcastlename("payg_cas03");
    if ( getarg(0) == getcastledata("payg_cas04",1) ) set .@castles$, .@castles$ + getcastlename("payg_cas04");
    if ( getarg(0) == getcastledata("payg_cas05",1) ) set .@castles$, .@castles$ + getcastlename("payg_cas05");
    if ( getarg(0) == getcastledata("prtg_cas01",1) ) set .@castles$, .@castles$ + getcastlename("prtg_cas01");
    if ( getarg(0) == getcastledata("prtg_cas02",1) ) set .@castles$, .@castles$ + getcastlename("prtg_cas02");
    if ( getarg(0) == getcastledata("prtg_cas03",1) ) set .@castles$, .@castles$ + getcastlename("prtg_cas03");
    if ( getarg(0) == getcastledata("prtg_cas04",1) ) set .@castles$, .@castles$ + getcastlename("prtg_cas04");
    if ( getarg(0) == getcastledata("prtg_cas05",1) ) set .@castles$, .@castles$ + getcastlename("prtg_cas05");
    //Add More Castles Here
	    return .@castles$;
    
}
	//Receives: Leader Name, Bitmask,Guild ID
function    script    leaderwarp#g1    {
    
    if (getcharid(0,getarg(0))) {
        if (!callfunc ("checkrest#g1",getarg(0),getarg(2) )) {
            if (getarg(1) & pow(2,13)) {
                set .@rid,getcharid(3);
                attachrid(getcharid(3,getarg(0)));
                getmapxy(.@m$,.@x,.@y,0);
                if (!callfunc ("checkrest#g2",.@m$)) {
                    attachrid(.@rid);
                    warp .@m$,.@x,.@y;
                    end;
                }
                else {
                    attachrid(.@rid);
                    mes "["+strnpcinfo(1)+"]";
                    mes "The Guild Leader is currently in a non-warpable location.";
                    next;
                }
            }
            else {
                getmapxy(.@m$,.@x,.@y,0,getarg(0));
                if (!callfunc ("checkrest#g2",.@m$)) {
                    //Player Info
                    set .@name$, strcharinfo(0);
                    set .@job$, jobname(Class);
                    set .@lvl, BaseLevel;
                    
                    //Leader Display Part 1
                    attachrid(getcharid(3,getarg(0)));
                    mes "["+strnpcinfo(1)+"]";
                    mes "The Player ^0000FF"+.@name$+"^000000 requested a warp.";
                    mes "You have 10 seconds to accept.";
                    mes "Job- ^0000FF"+.@job$+"^000000";
                    mes "Level- ^009900"+.@lvl+"^000000";
                    doevent strnpcinfo(0)+"::OnRequest";
                    end;
                    
                }
                else {
                    attachrid(.@rid);
                    next;
                    mes "["+strnpcinfo(1)+"]";
                    mes "The Guild Leader is currently in a non-warpable location.";
                    next;
                }
            }
        }
        else {
            next;
            mes "["+strnpcinfo(1)+"]";
            mes "Im sorry but this guild registry has been cancelled.";
            next;
        }
    }
    else {
        next;
        mes "["+strnpcinfo(1)+"]";
        mes "Sorry but the Guild Leader has just logged off. Therefore the warp function has failed.";
        next;
    }
    
    return;
	}
    
//Receives:
//Leader Name, Bitmask, Guild ID, Announce Cool Down
function    script    leaderanno#g1    {
	    if (@g_announce < gettimetick(2)) {
        if (getcharid(0,getarg(0))) {
            if (!callfunc ("checkrest#g1",getarg(0),getarg(2) )) {
                //User Part
                set .@rid,getcharid(3);
                set .@gannodel, getarg(3);
                mes "["+strnpcinfo(1)+"]";
                mes "You have been announced to the Guild Leader.";
                set @g_announce, gettimetick(2) + .@gannodel;
                set .@name$, strcharinfo(0);
                set .@job$, jobname(Class);
                set .@lvl, BaseLevel;
                
                //Guild Leader Part
                attachrid(getcharid(3,getarg(0)));
                announce .@name$+" level "+.@lvl+" job "+.@job$+" wants to join your guild.",bc_self,0x2FE954,0,0,0;
                
                //User Part
                attachrid(.@rid);
                next;
            }
            else {
                mes "["+strnpcinfo(1)+"]";
                mes "Im sorry but this guild registry has been cancelled.";
                next;
            }
        }
        else {
            mes "["+strnpcinfo(1)+"]";
            mes "Sorry but the Guild Leader has just logged off. Therefore the warp function has failed.";
            next;
        }
    }
    else {
        mes "["+strnpcinfo(1)+"]";
        set .@temp, @g_announce - gettimetick(2);
        mes "You must wait ^0000FF" + .@temp + "^000000 more seconds to use this function again.";
        next;
    }
    
    return;
    
}
	//Receives :
//Guild ID, Leader Name
//Returns :
//Nothing
function    script    spychat#g1    {
	    disable_items;
    pcblockmove getcharid(3),1;
    atcommand "@guildspy " + getarg(0);
    mes "["+strnpcinfo(1)+"]";
    mes "You are spying the selected guild chat. Please select ^0000FFReturn^000000 to cancel.";
    if (prompt ("Return") == 1) {
        atcommand "@guildspy " + getarg(0);
        pcblockmove getcharid(3),0;
        enable_items;
        return;
    }
    else {
        atcommand "@guildspy " + getarg(0);
        pcblockmove getcharid(3),0;
        enable_items;
        end;
    }
    
    return;
    
}
	//Receives:
//Map Name
//Return:
//1 - Map Restricted
//0 - Map Avaible
function    script    checkrest#g2    {
    if ( (getmapflag(getarg(0),gvg) == 1) || (getmapflag (getarg(0),gvg_castle) == 1) || (getmapflag (getarg(0),gvg_dungeon) == 1 ) || (getmapflag (getarg(0),battleground) == 1) ) {
        if ( (getarg(0) != "abbey01") || (getarg(0) != "abbey01") || (getarg(0) != "abbey01") || (getarg(0) != "1@cata") || (getarg(0) != "2@cata") ||
        (getarg(0) != "1@tower") || (getarg(0) != "2@tower") || (getarg(0) != "3@tower") || (getarg(0) != "4@tower") || (getarg(0) != "5@tower") || (getarg(0) != "6@tower") )
            return 1;
    }
    else
        return 0;
    
}
morocc,161,97,5    duplicate(Recruiter#h1-0)    Recruiter#h1-2    758
ayothaya,145,121,5    duplicate(Recruiter#h1-0)    Recruiter#h1-3    758
geffen,114,58,0    duplicate(Recruiter#h1-0)    Recruiter#h1-4    758
umbala,94,162,5    duplicate(Recruiter#h1-0)    Recruiter#h1-5    758
payon,25,240,5    duplicate(Recruiter#h1-0)    Recruiter#h1-6    758
alberta,25,240,4    duplicate(Recruiter#h1-0)    Recruiter#h1-7    758
aldebaran,147,120,4    duplicate(Recruiter#h1-0)    Recruiter#h1-8    758
izlude,122,98,5    duplicate(Recruiter#h1-0)    Recruiter#h1-9    758
xmas,152,134,3    duplicate(Recruiter#h1-0)    Recruiter#h1-10    758
comodo,197,160,4    duplicate(Recruiter#h1-0)    Recruiter#h1-11    758
amatsu,204,97,4    duplicate(Recruiter#h1-0)    Recruiter#h1-12    758
gonryun,165,122,4    duplicate(Recruiter#h1-0)    Recruiter#h1-13    758
yuno,147,184,5    duplicate(Recruiter#h1-0)    Recruiter#h1-14    758
niflheim,200,188,4    duplicate(Recruiter#h1-0)    Recruiter#h1-15    758
louyang,224,107,4    duplicate(Recruiter#h1-0)    Recruiter#h1-16    758
veins,220,127,4    duplicate(Recruiter#h1-0)    Recruiter#h1-17    758
rachel,136,115,4    duplicate(Recruiter#h1-0)    Recruiter#h1-18    758
moscovia,218,196,5    duplicate(Recruiter#h1-0)    Recruiter#h1-19    758
hugel,93,154,5    duplicate(Recruiter#h1-0)    Recruiter#h1-20    758
einbroch,184,169,4    duplicate(Recruiter#h1-0)    Recruiter#h1-21    758
einbech,199,83,4    duplicate(Recruiter#h1-0)    Recruiter#h1-22    758
lighthalzen,163,96,4    duplicate(Recruiter#h1-0)    Recruiter#h1-23    758
brasilis,200,183,4    duplicate(Recruiter#h1-0)    Recruiter#h1-24    758
dicastes01,191,194,5    duplicate(Recruiter#h1-0)    Recruiter#h1-25    758
//ATTENTION : the city bellow belongs to a new patch! it may give errors in your server!
//mora,120,86,4    duplicate(Recruiter#h1-0)    Recruiter#h1-26    758
mid_camp,222,243,4    duplicate(Recruiter#h1-0)    Recruiter#h1-27    758


its the part where the people register for their guilds... the npc accepts all the guild and show them on the list of guild available for join.. however when the player modify their recruitment and delete their registry.. only the first one who's able to register can delete the and modify their registry the 2nd guild and the 3rd guild and so on..  the NPC just says i dont have your registry or your not registered yet but when i register.. the npc would say your already register... this happen only to the 2nd registered guild and so on. it does not happen to the 1st guild who register. can anyone please help... thank you so much in advance.

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...