viewing paste Mercurial - Guild Banker | 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 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278
//===== Custom eAthena Script =======================================
//= Guild Bank
//===== By: =========================================================
//= Mercurial
//===== Description =================================================
//= A Guild Bank where every member of a guild can deposit/withdraw
//= money.
//===== Version Change Log ==========================================
//= 1.3 - Added Guild Rank Security(darkpurple) and optimized it a bit lol.(need more suggestions)
//= 1.2 - Optimized the script and changed the way script works. not supports unlimited Bank Accounts :).
//= 1.1 - Added Guild Master Control Panel(Theres only Set Password Option for now)
//=       128x5 Guild Bank Account Limit
//= 1.0 - First Guild Banker Release
//===================================================================
 
prontera,140,182,4  script  Guild Banker    964,{
    set .@gb$,"[Guild Banker]";
if( getcharid(2) == 0 )
{
    mes .@gb$;
    mes "Sorry, But you cannot have a guild bank without a guild.";
    close;
}
else if(strcharinfo(0)==getguildmaster(getcharid(2)))
{
    mes .@gb$;
    mes "I am the Guild Banker";
    next;
    mes .@gb$;
    mes "What would you like todo?";
    switch(select("Register Guild","Set/Change Guild Password","Withdraw","Deposit","Set Rank Number Privilege"))
    {
    case 1:
        next;
        mes .@gb$;
        mes "Guild Bank Registration requires 100,000z";
        mes "Would you like to continue?";
        switch(select("Yes","No"))
        {
        case 1:
            if(zeny<100000)
            {
                next;
                mes .@gb$;
                mes "Sorry, but you don't have enough zeny to register a Guild Bank";
                close;
            } 
            else
            {
                    if(getd("$greg"+getcharid(2))==1)
                    {
                        next;
                        mes .@gb$;
                        mes "The Guild "+strcharinfo(2)+" is already registered in our database";
                        mes "Thank you.";
                        close;
                    }
                    else
                    {
                        set zeny,zeny-100000;
                        setd "$gzeny"+getcharid(2),0;
                        setd "$greg"+getcharid(2),1;
                        setd "$gpassword"+getcharid(2)+"$","empty";
                        next;
                        mes .@gb$;
                        mes "The Guild "+strcharinfo(2)+" has been register.";
                        mes "You now have access to guild bank";
                        close;
                    }
            }
            break;
        case 2:
            goto GB_End;
            break;
        }
        break;
    case 2:
                    if(getd("$greg"+getcharid(2))==1)
                    {
                        next;
                        mes .@gb$;
                        mes "Are you sure you want to set a password or change password for the guild bank?";
                        switch(select("Yes","No"))
                        {
                        case 1:
gpas_return:
                            next;
                            mes .@gb$;
                            mes "Please enter the password.";
                            mes "Note: if you don't want any password input 'empty' without quotes";
                            mes "If you have just registered recently you might need to set a password before using Guild Bank.";
                            input .gpassword$;
                            setd "$gpassword"+getcharid(2)+"$",.gpassword$;
                            next;
                            mes .@gb$;
                            mes "Please enter the password again for verification.";
                            input .gpassword$;
                            if(getd("$gpassword"+getcharid(2)+"$")!=.gpassword$)
                                {
                                next;
                                mes .@gb$;
                                mes "Password does not match, Please try again.";
                                setd "$gpassword"+getcharid(2)+"$","empty";
                                goto gpas_return;
                                end;
                                }
                                else
                                {
                                next;
                                mes .@gb$;
                                mes "You have succesfully set a password for your Guild Bank";
                                mes "Thank you, Come again.";
                                close;
                                }
                            break;
                        case 2:
                            goto GB_End;
                            break;
                        }
                        close;
                    }
                        
                    else
                        goto GB_NoReg;
        break;
    case 3:
        goto gb_withdraw;
        break;
    case 4:
        goto gb_deposit;
        break;
    case 5:
        next;
        mes .@gb$;
        mes "Please Input the Rank that will be able to withdraw.";
        mes "0-19";
        mes "0-Guild Master & 19-Newbie";
        mes "Example: you input 18... therefore 18 and below can withdraw in this guild bank";
        input .position;
        setd "$position"+getcharid(2),.position;
        close;
        break;
        }
}
else
{
    mes .@gb$;
    mes "I am the Guild Banker";
    next;
    mes .@gb$;
    mes "What would you like todo?";
    switch(select("Withdraw","Deposit"))
    {
    case 1:
gb_withdraw:
                        query_sql "SELECT `position` FROM `guild_member` WHERE `name` = '"+strcharinfo(0) +"'",.position;
                        if(.position>getd("$position"+getcharid(2)))
                            goto GB_NoWithdraw;
                        else if(getd("$greg"+getcharid(2))==1)
                        {
                        next;
                        mes .@gb$;
                        mes "Your Guild has "+getd("$gzeny"+getcharid(2))+" zeny.";
                        mes "Would you like to withdraw some zeny?";
                        switch(select("Yes","No"))
                        {
                        case 1:
gpassword_x:
                            if(getd("$gpassword"+getcharid(2)+"$")!="empty")
                            {
                            next;
                            mes .@gb$;
                            mes "You are required to enter a password before you can withdraw some zeny";
                            mes "Please enter the password";
                            input .gpassword$;
                                if(.gpassword$!=getd("$gpassword"+getcharid(2)+"$"))
                                {
                                next;
                                mes .@gb$;
                                mes "Incorrect Password Please Try again.";
                                goto gpassword_x;
                                }
                                else
                                    goto password_o;
                            }
                            else
                            {
password_o:
                            next;
                            mes .@gb$;
                            mes "How much zeny would you like to withdraw?";
                            input @gwithdraw;
                            if(@gwithdraw>getd("$gzeny"+getcharid(2)))
                            {
                                next;
                                mes .@gb$;
                                mes "The Guild Bank doesn't have enough zeny.";
                                close;
                            }
                            else
                            {
                                set zeny,zeny+@gwithdraw;
                                setd "$gzeny"+getcharid(2),getd("$gzeny"+getcharid(2))-@gwithdraw;
                                next;
                                mes .@gb$;
                                mes "There you go, Come again!";
                                close;
                            }
                            }
                            break;
                        case 2:
                            goto GB_End;
                            break;
                        }
                        close;
                    }
                    else
                        goto GB_NoReg;
        break;
    case 2:
gb_deposit:
                    if(getd("$greg"+getcharid(2))==1)
                    {
                        next;
                        mes .@gb$;
                        mes "Your have "+zeny+" zeny.";
                        mes "Would you like to deposit some zeny?";
                        switch(select("Yes","No"))
                        {
                        case 1:
                            next;
                            mes .@gb$;
                            mes "How much zeny would you like to deposit?";
                            input @gdeposit;
                            if(@gdeposit>zeny)
                            {
                                next;
                                mes .@gb$;
                                mes "You don't have enough zeny.";
                                close;
                            }
                            else
                            {
                                set zeny,zeny-@gdeposit;
                                setd "$gzeny"+getcharid(2),getd("$gzeny"+getcharid(2))+@gdeposit;
                                next;
                                mes .@gb$;
                                mes "There you go, Come again!";
                                close;
                            }
                            break;
                        case 2:
                            goto GB_End;
                            break;
                        }
                    } 
                    else
                        goto GB_NoReg;
        break;
    }
}
end;
GB_NoWithdraw:
    next;
    mes .@gb$;
    mes "Your Guild Rank is not authorized to withdraw zeny, Thank you";
    close;
GB_NoReg:
    next;
    mes .@gb$;
    mes "Your Guild is not registered in the Guild Bank Database";
    close;
GB_End:
    next;
    mes .@gb$;
    mes "Ok, Good Bye!";
    close;
}
Viewed 931 times, submitted by Guest.