Jump to content
  • 0

Getpartymember problem please help.


Question

Posted (edited)

Hello.. I need help in script specially at this part http://rathena.org/wiki/Getpartymember

 

 

Here is the full script.

-    script    mainevent    -1,{
OnInit:
    set .ARefine,4;
    set .MaxMembers,7;
    setarray .AItem[0],2310,2102,2504,2404;
    setarray .ACard[0],4031,4058,4133,4381;

    bindatcmd "ready","mainevent::OnDoReady",99,99;
    bindatcmd "team","mainevent::OnDoTeam",99,99;
end;

OnDoTeam:
    if ( compare( .@atcmd_parameters$, "A" || compare( .@atcmd_parameters$, "a"  ) ) {
    input $teama$;


        for(set .@i,0; .@i<.MaxMembers; set .@i,.@i+1)
            query_sql ("SELECT `party_id`,`name` FROM `login` WHERE `name` = '"+$teama$+"'",.@pid,.@teama);
            getpartymember .@pid, 2;

                if ($@partymembercount < .MaxMembers || $@partymembercount > .MaxMembers ){
                    dispbottom "Party members is more than or less than "+.MaxMembers+" members.";
                    end;
                }
                if (!.@teama){
                    dispbottom "Invalid party name";
                    end;
                }

        set .@team$, $teama$;
        set .@x,73;
        set .@y,69;
    }
    else if ( compare( .@atcmd_parameters$, "B") || compare( .@atcmd_parameters$, "b"  ) {
    input $teamb$;
    

        for(set .@i,0; .@i<.MaxMembers; set .@i,.@i+1)
            query_sql ("SELECT `party_id`,`name` FROM `login` WHERE `name` = '"+$teamb$+"'",.@pid,.@teamb);
            getpartymember .@pid, 2;

                if ($@partymembercount < .MaxMembers || $@partymembercount > .MaxMembers ){
                    dispbottom "Party members is more than or less than "+.MaxMembers+" members.";
                    end;
                }
                if (!.@teamb){
                    dispbottom "Invalid party name";
                    end;
                }

        set .@team$, $teamb$;
        set .@x,127;
        set .@y,69;
    }
    else {
        end;
    }

    dispbottom "Team "+.@team$+" are warped.";
    warpparty "06guild_r",.@x,.@y,.@pid;

    for( set .@i, 0; .@i < ; set .@i, .@i + 1 ){

    attachrid $@partymemberaid[.@i];

    unequip EQI_HEAD_TOP;
    unequip EQI_ARMOR;
    unequip EQI_HAND_L;
    unequip EQI_HAND_R;
    unequip EQI_GARMENT;
    unequip EQI_SHOES;
    unequip EQI_ACC_L;
    unequip EQI_ACC_R;
    unequip EQI_HEAD_MID;
    unequip EQI_HEAD_LOW;

    atcommand "@storeall";
    savepoint "06guild_r",.@x,.@y;
    }
end;

OnDoReady:
    if ( compare( .@atcmd_parameters$, "A" || compare( .@atcmd_parameters$, "a"  ) ) {
    if ($teama){end;}
    set $teama,1;
    set .@team$, $teama$;
    dispbottom "Team "+.@team$+" are ready.";
    }
    else if ( compare( .@atcmd_parameters$, "B") || compare( .@atcmd_parameters$, "b"  ) {
    if ($teamb){end;}
    set $teamb,1;
    set .@team$, $teamb$;
    dispbottom "Team "+.@team$+" are ready.";
    }
    else {
    end;
    }



query_sql ("SELECT `leader_id` FROM `login` WHERE `name` = '"+.@team$+"'",.@accid);
for( set .@a, 0; .@a < getarraysize(.@accid); set .@a, .@a + 1 ){

attachrid .@accid[.@a];


if (Class == Job_Lord_Knight){

getitem 5800,1;                        // Blush of Groom
getitem 5377,1;                        // Gentleman's Pipe
getitem2 1408,1,1,7,0,4035,4035,4035,4092;    // Pike 3 Hydra 1 Skeleton Worker
getitem2 5170,1,1,4,0,0,0,0,0;            // Feather Beret
getitem2 2285,1,1,4,0,0,0,0,0;            // Apple of Archer
getitem2 2621,2,1,0,0,4079,0,0,0;            // Ring[1]

}else if(Class == Job_Paladin){

getitem 5800,1;                        // Blush of Groom
getitem 5377,1;                        // Gentleman's Pipe
getitem2 1408,1,1,7,0,4035,4035,4035,4092;    // Pike 3 Hydra 1 Skeleton Worker
getitem2 1408,1,1,7,0,4004,4004,4004,4004;    // Pike 4 Drops
getitem2 5170,1,1,4,0,0,0,0,0;            // Feather Beret
getitem2 2285,1,1,4,0,0,0,0,0;            // Apple of Archer
getitem2 2624,2,1,0,0,4064,0,0,0;            // Glove[1]

}else if(Class == Job_Assassin_Cross){

getitem 5389,1;                        // Angel Spirit
getitem 5377,1;                        // Gentleman's Pipe
getitem2 1266,1,1,5,0,4092,0,0,0;            // Infiltrator 1 Skeleton Worker
getitem2 5170,1,1,4,0,0,0,0,0;            // Feather Beret
getitem2 2621,2,1,0,0,4079,0,0,0;            // Ring[1]

}else if(Class == Job_Stalker){

getitem 5325,1;                        // Robo Eye
getitem 5377,1;                        // Gentleman's Pipe
getitem2 1231,1,1,0,0,0,0,0,0;            // Bazerald
getitem2 1202,1,1,7,0,4004,4004,4004,4004;    // Knife 4 Drops
getitem2 5170,1,1,4,0,0,0,0,0;            // Feather Beret
getitem2 2285,1,1,4,0,0,0,0,0;            // Apple of Archer
getitem2 2624,2,1,0,0,4064,0,0,0;            // Glove[1]

}else if(Class != Job_Sniper){

getitem 5325,1;                        // Robo Eye
getitem 5361,1;                        // Gangster Scarf
getitem2 1705,1,1,7,0,4035,4035,4092,4092;    // Composite Bow 2 Hydra 2 Skeleton Worker
getitem2 5170,1,1,4,0,0,0,0,0;            // Feather Beret
getitem2 2285,1,1,4,0,0,0,0,0;            // Apple of Archer
getitem2 2624,2,1,0,0,4064,0,0,0;            // Glove[1]

}else if(Class != Job_Clown){

getitem 5800,1;                        // Blush of Groom
getitem 5377,1;                        // Gentleman's Pipe
getitem2 1925,2,1,5,0,4035,4035,4035,0;         // Cello 3 Hydra
getitem2 5170,1,1,4,0,0,0,0,0;            // Feather Beret
getitem2 2285,1,1,4,0,0,0,0,0;            // Apple of Archer
getitem2 2624,2,1,0,0,4064,0,0,0;            // Glove[1]

}else if(Class != Job_Gypsy){

getitem 5800,1;                        // Blush of Groom
getitem 5377,1;                        // Gentleman's Pipe
getitem2 1980,2,1,5,0,4035,4035,4035,0;         // Whip of Balance 3 Hydra
getitem2 5170,1,1,4,0,0,0,0,0;            // Feather Beret
getitem2 2285,1,1,4,0,0,0,0,0;            // Apple of Archer
getitem2 2624,2,1,0,0,4064,0,0,0;            // Glove[1]

}else if(Class != Job_High_Wizard){

getitem 5325,1;                        // Robo Eye
getitem 5463,1;                        // Rainbow Scarf
getitem 1628,1;                        // Refined Survivor's Rod
getitem2 5170,1,1,4,0,0,0,0,0;            // Feather Beret
getitem2 2285,1,1,4,0,0,0,0,0;            // Apple of Archer
getitem2 2624,2,1,0,0,4064,0,0,0;            // Glove[1]

}else if(Class != Job_Professor){

getitem 5325,1;                        // Robo Eye
getitem 5463,1;                        // Rainbow Scarf
getitem 1628,1;                        // Refined Survivor's Rod
getitem2 5170,1,1,4,0,0,0,0,0;            // Feather Beret
getitem2 2285,1,1,4,0,0,0,0,0;            // Apple of Archer
getitem2 2624,2,1,0,0,4064,0,0,0;            // Glove[1]

}else if(Class != Job_High_Priest){

getitem 5800,1;                        // Blush of Groom
getitem 5377,1;                        // Gentleman's Pipe
getitem 1628,1;                        // Refined Survivor's Rod
getitem2 5170,1,1,4,0,0,0,0,0;            // Feather Beret
getitem2 2285,1,1,4,0,0,0,0,0;            // Apple of Archer
getitem2 2624,2,1,0,0,4064,0,0,0;            // Glove[1]

}else if(Class != Job_Champion){

getitem 5325,1;                        // Robo Eye
getitem 5377,1;                        // Gentleman's Pipe
getitem2 1544,1,1,5,0,4035,4035,4035,0;        // Lunakaligo 2 Hydra
getitem2 5170,1,1,4,0,0,0,0,0;            // Feather Beret
getitem2 2285,1,1,4,0,0,0,0,0;            // Apple of Archer
getitem2 2624,2,1,0,0,4064,0,0,0;            // Glove[1]

}else if(Class == Job_Whitesmith){

getitem 5389,1;                        // Angel Spirit
getitem 5377,1;                        // Gentleman's Pipe
getitem2 1309,1,1,5,0,4281,4281,4281,4281;    // Orcish 4 Zipper Bear
getitem2 5170,1,1,4,0,0,0,0,0;            // Feather Beret
getitem2 2285,1,1,4,0,0,0,0,0;            // Apple of Archer
getitem2 2621,2,1,0,0,4079,0,0,0;            // Ring[1]

}else if(Class == Job_Creator){

getitem 5325,1;                        // Robo Eye
getitem 5463,1;                        // Rainbow Scarf
getitem2 1231,1,1,0,0,0,0,0,0;            // Bazerald
getitem2 1202,1,1,7,0,4004,4004,4004,4004;    // Knife 4 Drops
getitem2 5170,1,1,4,0,0,0,0,0;            // Feather Beret
getitem2 2285,1,1,4,0,0,0,0,0;            // Apple of Archer
getitem2 2624,2,1,0,0,4064,0,0,0;            // Glove[1]

}

// Item Process
for( set .@i, 0; .@i < getarraysize(.AItem); set .@i, .@i + 1 ){
getitem2 .AItem[.@i],1,1,.ARefine,0,.ACard[.@i],0,0,0;
}

}
end;


}

But I just want to fix this part.

OnDoTeam:
    if ( compare( .@atcmd_parameters$, "A" || compare( .@atcmd_parameters$, "a"  ) ) {
    input $teama$;


        for(set .@i,0; .@i<.MaxMembers; set .@i,.@i+1)
            query_sql ("SELECT `party_id`,`name` FROM `login` WHERE `name` = '"+$teama$+"'",.@pid,.@teama);
            getpartymember .@pid, 2;

                if ($@partymembercount < .MaxMembers || $@partymembercount > .MaxMembers ){
                    dispbottom "Party members is more than or less than "+.MaxMembers+" members.";
                    end;
                }
                if (!.@teama){
                    dispbottom "Invalid party name";
                    end;
                }

        set .@team$, $teama$;
        set .@x,73;
        set .@y,69;
    }
    else if ( compare( .@atcmd_parameters$, "B") || compare( .@atcmd_parameters$, "b"  ) {
    input $teamb$;
    

        for(set .@i,0; .@i<.MaxMembers; set .@i,.@i+1)
            query_sql ("SELECT `party_id`,`name` FROM `login` WHERE `name` = '"+$teamb$+"'",.@pid,.@teamb);
            getpartymember .@pid, 2;

                if ($@partymembercount < .MaxMembers || $@partymembercount > .MaxMembers ){
                    dispbottom "Party members is more than or less than "+.MaxMembers+" members.";
                    end;
                }
                if (!.@teamb){
                    dispbottom "Invalid party name";
                    end;
                }

        set .@team$, $teamb$;
        set .@x,127;
        set .@y,69;
    }
    else {
        end;
    }

    dispbottom "Team "+.@team$+" are warped.";
    warpparty "06guild_r",.@x,.@y,.@pid;

    for( set .@i, 0; .@i < ; set .@i, .@i + 1 ){

    attachrid $@partymemberaid[.@i];

    unequip EQI_HEAD_TOP;
    unequip EQI_ARMOR;
    unequip EQI_HAND_L;
    unequip EQI_HAND_R;
    unequip EQI_GARMENT;
    unequip EQI_SHOES;
    unequip EQI_ACC_L;
    unequip EQI_ACC_R;
    unequip EQI_HEAD_MID;
    unequip EQI_HEAD_LOW;

    atcommand "@storeall";
    savepoint "06guild_r",.@x,.@y;
    }
end;

I don't know if my $@partymemberaid or $@partymembercount is correct. is my  getpartymember .@pid, 2; correct?

 

 

Main goal of this script is easy warping of 7 v 7 parties. example I want to warp the "Team A" party name. I will just input the name of the party then system will count the party members that must be exact to 7 members. if there is no party name existing to the database it will say "Invalid party name".  If the input process is successful, the party will we be warped to "warpparty "06guild_r",.@x,.@y,.@pid;". After that all party members will be unequipped and all of their item will automatically stored to the storage.

 

 

 

I hope that some will help be debug my script. Thank You!!

Edited by gmprestige

2 answers to this question

Recommended Posts

Posted

Aside from copying the values into temporary NPC variables (since multiple accesses to this script will continuously change the temporary global variables' values), a couple comparisons could be changed.

 

This would be better written as one comparison:

if ($@partymembercount < .MaxMembers || $@partymembercount > .MaxMembers ){

This is a single comparison and reads as "is not equal to":

if ($@partymembercount != .MaxMembers ){

This could also be shortened:

if ( compare( .@atcmd_parameters$, "A" || compare( .@atcmd_parameters$, "a"  ) ) {
if ( compare( .@atcmd_parameters$, "A|a" ) {

And this line:

if ( compare( .@atcmd_parameters$, "B" || compare( .@atcmd_parameters$, "b"  ) ) {
if ( compare( .@atcmd_parameters$, "B|b" ) {

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...