viewing paste Unknown #21693 | 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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
eden,115,64,4   script  testingalzz 89,{
    if( getgmlevel() >= 99 ){
        mes "[^FF0000Server & Map Giveaway NPC^000000]";
        mes "Please  choose your reward type: Items or Zeny?";
        next;
        switch(select("Item Reward: Zeny Reward")){
            case 1:
                callsub OnItemRewardz;
                end;
 
            case 2:
                callfunc ("ZenyRewardz");
                end;
        }
    }
    if (getgmlevel() <= 1){
        if(ClaimReward == 0){
            mes "There is no current rewards pending.";
            close;
        } else if(ClaimReward >= 1){
                ClaimReward--;
                mes "You have a reward currently pending!";
                mes "I will now hand you the reward.";
                getitem citemid,camount;
                close;
            }
    }
    
OnItemRewardz:
    if( getgmlevel() >= 99 ){
        mes "[^FF0000Server & Map Giveaway NPC^000000]";
        mes "Please choose your input type. Type 'map' to give items on the current map you're on or 'all' to reward all players in the server.";
        input @whispervar0$;
        next;
        // check map
        if( @whispervar0$ == "all" ) .@type$ = "";
        else if( @whispervar0$ == "map" ) .@type$ = strcharinfo(3);
        else {  
    //      announce "Come to Prontera, a giveaway is under way!!!",bc_all; 
            dispbottom "Error, pick 'map' or 'all' ";
            callsub OnItemRewardz;
            end;
        }
    }
OnItemID:
    mes "[^FF0000Server & Map Giveaway NPC^000000]";
    mes "Please input the item ID you want.";
    input .@itemid;
    if( getitemname( .@itemid ) == "null" ){
        mes "Enter valid item id";
        close;
    }
    next;
OnItemAmount:
    mes "[^FF0000Server & Map Giveaway NPC^000000]";
    mes "Now input the amount of the items you want to giveaway.";
    input .@amount;
    if(.@amount < 1 ){
        mes "Enter valid amount. Please retry.";
        close;
    }
    .@self_id = getcharid(3);
    query_sql( "SELECT COUNT(`account_id`) FROM `char` WHERE `online` = 1 ", .@total );
    while( .@count < .@total ){
        query_sql( "SELECT `account_id`,`name` FROM `char` WHERE `online` = 1 ORDER BY `account_id` LIMIT 128 OFFSET "+.@offset, .@aid,.@name$ );
        .@i = 0;
        .@size = getarraysize( .@aid );
        while( .@i < .@size ){
            if( .@aid[.@i] != .@self_id ){
                if( .@type$ != "" ){
                    getmapxy( .@map$,.@x,.@y,0,.@name$[.@i] );
                    if( .@map$ == .@type$ ){
                        .@gave++;
                        /*if( getitemname( .@itemid ) == "null" || .@amount < 1 ){
                                mes "Enter valid item id and amount.";
                                close2;
                                end;
                            } 
                        */
//                      announce "[GM] "+strcharinfo(0)+" Gave "+.@amount+" x "+getitemname( .@itemid )+" to "+.@gave+" Player(s).",bc_all;
                        if (attachrid(.@aid[.@i])){
                            citemid = .@itemid;
                            camount = .@amount;
                            ClaimReward++;
                        }
                        //getitem .@itemid,.@amount,.@aid[.@i];
                    }
                }else{
                    .@gave++;
                    /*if( getitemname( .@itemid ) == "null" || .@amount < 1 ){
                            mes "Enter valid item id and amount.";
                            close2;
                            end;
                        }
                    */
//                  announce "[GM] "+strcharinfo(0)+" Gave "+.@amount+" x "+getitemname( .@itemid )+" to "+.@gave+" Player(s).",bc_all;
                    if (attachrid(.@aid[.@i])){
                        ClaimReward++;
                        citemid = .@itemid;
                        camount = .@amount;
                    }
//                  getitem .@itemid,.@amount,.@aid[.@i];
                }
            }
            .@count++;
            .@i++;
        }
        .@offset = .@offset + .@size;
        deletearray .@aid,.@size;
        deletearray .@name$,.@size;
    }
    mes "Gave "+.@amount+" x "+getitemname( .@itemid )+" to "+.@gave+" Player(s).";
    close2;
    end;
}
Viewed 1016 times, submitted by Guest.