viewing paste Agit Reward | Athena

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
//Author    :   Goddameit
//Version   :   2012/06/24 - 04:19
//Web       :   http://goo.gl/8Nedn
/*
I added some checks to make sure that will not happen some errors what I didn't expect for.
Test in eA15*** SQL
*/
function    script  AllGuildMemberEvent {
    if(!set(.@gid,getcastledata(getarg(0),1)))
        return;
    query_sql("select account_id, char_id from `guild_member` where guild_id = '"+.@gid+"'", .@gmaid, .@gmcid);
    set .@amount,getarraysize(.@gmcid);
    for(set .@i,0;.@i<.@amount;set .@i,.@i+1)
    {
        if(!.@gmaid[.@i])
            continue;
        query_sql("select last_ip from `login` where account_id = '"+.@gmaid[.@i]+"'",.@ip$);
        query_sql("select account_id from `login` where last_ip= '"+.@ip$+"'",.@aa);
        set .@bb,getarraysize(.@aa);        
        for(set .@i2,1;.@i2<.@bb;set .@i2,.@i2+1)
        {
            for(set .@i3,0;.@i3<.@amount;set .@i3,.@i3+1)
            {
                if(.@aa[.@i2]==.@gmaid[.@i3])
                {
                    set .@gmaid[.@i3],0;
                    set .@gmcid[.@i3],0;
                }
            }
        }
        if(attachrid(.@gmaid[.@i]))
        {
            message strcharinfo(0),"VICTOR!!";
            getitem 607,1;
            detachrid;
        }
    }
    return;
}
-   script  AGME    -1,{
OnAgitEnd:
    setarray .@maps$[0],"aldeg_cas01","aldeg_cas02","aldeg_cas03","aldeg_cas04","aldeg_cas05",
        "gefg_cas01","gefg_cas02","gefg_cas03","gefg_cas04","gefg_cas05",
        "payg_cas01","payg_cas02","payg_cas03","payg_cas04","payg_cas05",
        "prtg_cas01","prtg_cas02","prtg_cas03","prtg_cas04","prtg_cas05";
    for( set .@i,0; .@i <= 19; set .@i, .@i+1)
    {
        callfunc "AllGuildMemberEvent",.@maps$[.@i];
    }
    end;
}
Viewed 770 times, submitted by Guest.