viewing paste Unknown #21889 | 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 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229
/* 
        Created by: Aeromesi
        Version: 1.0
        Comments: None
        Built for Hercules
*/
function    script  ClaimRewardz    {
if(ClaimReward >= 2) {
ClaimReward = 1;
}
if(ClaimZReward >= 2) {
ClaimZReward = 1;
}
 
        mes "[^FF0000Giveaway Reward NPC^000000]";
        mes "Current Rewards Pending:";
        next;
        switch(select("Items Pending - "+((ClaimReward == 0)?"^f94a32":"^0000ff")+""+ClaimReward+"^000000","Zeny Pending - "+((ClaimZReward == 0)?"^f94a32":"^0000ff")+""+ClaimZReward+"^000000"))
{
        case 1:
        if(ClaimReward == 0){
            mes "[^FF0000Giveaway Reward NPC^000000]";
            mes "There is no item rewards currently pending.";
            close;
        } else if(ClaimReward == 1){
                ClaimReward--;
                mes "[^FF0000Giveaway Reward NPC^000000]";
                mes "You have a reward currently pending!";
                mes "I will now hand you the reward.";
                getitem citemid,camount;
                close;
}
        case 2:
        if(ClaimZReward == 0){
            mes "[^FF0000Giveaway Reward NPC^000000]";
            mes "There is no Zeny rewards currently pending.";
            close;
        } else if(ClaimZReward == 1){
                ClaimZReward--;
                mes "[^FF0000Giveaway Reward NPC^000000]";
                mes "You have a reward currently pending!";
                mes "I will now hand you the reward.";
                dispbottom "Gained a total of "+zamount+" Zeny!";
                Zeny = Zeny+zamount;
                close;
}
}
}
eden,115,64,4   script  Giveaway Reward NPC 89,{
    if( getgmlevel() >= 99 ){
        mes "[^FF0000Giveaway Reward NPC^000000]";
        mes "Please  choose your reward type: Items or Zeny?";
        next;
        switch(select("Item Reward: Zeny Reward")){
            case 1:
                callfunc ("ItemReward");
                end;
 
            case 2:
                callfunc ("ZenyReward");
                end;
        }
    }
    if (getgmlevel() <= 1){
                callfunc ("ClaimRewardz");
                end;
        }
}
function    script  ItemReward  {
OnItemRewardz:
    if( getgmlevel() >= 99 ){
        mes "[^FF0000Giveaway Reward 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 {  
            dispbottom "Error, pick 'map' or 'all' ";
            callsub OnItemRewardz;
            end;
        }
    }
OnItemID:
    mes "[^FF0000Giveaway Reward NPC^000000]";
    mes "Please input the item ID you want.";
    input .@itemid;
    if( getitemname( .@itemid ) == "null" ){
        dispbottom "Enter valid item id";
        close2;
        end;
    }
    next;
OnItemAmount:
    mes "[^FF0000Giveaway Reward NPC^000000]";
    mes "Now input the amount of the items you want to giveaway.";
    input .@amount;
    if(.@amount < 1 ){
        dispbottom "Enter valid amount. Please retry.";
        close2;
        end;
    }
    close2;
    .@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++;
                        announce "[GM] "+strcharinfo(0)+" Gave "+.@amount+" x "+getitemname( .@itemid )+" to "+.@gave+" Player(s). Proceed to the Giveaway Rewards NPC to claim your reward!",bc_all;
                        if (attachrid(.@aid[.@i])){
                        if ( !checkcell( .@map$, .@x, .@y, cell_water ))  {
                        dispbottom "you have to stand on a body of water";
                        } else
                        if ( checkcell( .@map$, .@x, .@y, cell_water ))  {
                        dispbottom "activated";
                            citemid = .@itemid;
                            camount = .@amount;
                            ClaimReward++;
                        end;
                        }
                    
                    }
                    end;
                }else{
                    .@gave++;
                    announce "[GM] "+strcharinfo(0)+" Gave "+.@amount+" x "+getitemname( .@itemid )+" to "+.@gave+" Player(s). Proceed to the Giveaway Rewards NPC to claim your reward!",bc_all;
                    if (attachrid(.@aid[.@i])){
                        ClaimReward++;
                        citemid = .@itemid;
                        camount = .@amount;
                    }
                }
            }
            .@count++;
            .@i++;
        }
        .@offset = .@offset + .@size;
        deletearray .@aid,.@size;
        deletearray .@name$,.@size;
    }
    end;
}
}
function    script  ZenyReward  {
OnZenyRewardz:
    if( getgmlevel() >= 99 ){
        mes "[^FF0000Giveaway Reward 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 {  
            dispbottom "Error, pick 'map' or 'all' ";
            callsub OnZenyRewardz;
            end;
        }
    }
//  next;
OnZenyAmount:
    mes "[^FF0000Giveaway Reward NPC^000000]";
    mes "Now input the amount of the Zeny you want to giveaway.";
    input .@Zamount;
    if(.@Zamount < 1 ){
        dispbottom "Enter valid amount. Please retry.";
        close2;
        end;
}
    if(.@Zamount == MAX_ZENY) {
        dispbottom "You cannot input that much Zeny, as it exceeds the servers MAX_ZENY integer.";
        end;
    }
    close2;
    .@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++;
                        announce "[GM] "+strcharinfo(0)+" Gave "+.@Zamount+" Zeny to "+.@gave+" Player(s). Proceed to the Giveaway Rewards NPC to claim your reward!",bc_all;
                        if (attachrid(.@aid[.@i])){
                            zamount = .@Zamount;
                            ClaimZReward++;
                        }
                    }
                }else{
                    .@gave++;
                        announce "[GM] "+strcharinfo(0)+" Gave "+.@Zamount+" Zeny to "+.@gave+" Player(s). Proceed to the Giveaway Rewards NPC to claim your reward!",bc_all;
                    if (attachrid(.@aid[.@i])){
                        ClaimZReward++;
                        zamount = .@Zamount;
                    }
                }
            }
            .@count++;
            .@i++;
        }
        .@offset = .@offset + .@size;
        deletearray .@aid,.@size;
        deletearray .@name$,.@size;
    }
    end;
}
eden,112,58,4   script  DipaDoo 89,{
    getmapxy .@map$, .@x, .@y, 0;
    if ( !checkcell( .@map$, .@x, .@y, cell_water ) ) {
        dispbottom "Not in water!";
        end;
    }
    dispbottom "In Water";
    end;
OnInit:
    setitemscript Red_Potion, "{ getmapxy .@map$, .@x, .@y, 0; if ( !checkcell( .@map$, .@x, .@y, call_water ) ) { dispbottom \"you have to stand on a body of water\"; end; } else dispbottom \"let's go fishing\"; }", 0;
}
Viewed 1107 times, submitted by Guest.