viewing paste Bounty Hunter | 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 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865
//===== rAthena Script =======================================
//= Bounty Hunter
//===== By: ==================================================
//= Forgot who now.. =/ | Being revised by Mysterious
//===== Current Version: =====================================
//= 1.9
//===== Compatible With: =====================================
//= rAthena SVN
//===== Description: =========================================
//= Place a bounty on a Player while using a SQL Table
//===== Other Information: ===================================
// There's a Ladder included
//===== TODO: ================================================
// - Revise whole script
//===== Additional Comments: =================================
//= v1.0 - First release
//= v1.1 - Removed unneccessary Spacing [Mysterious]
//= v1.2 - Fixed Sentence structures [Mysterious]
//= v1.3 - Fixed massive typos [Mysterious]
//= v1.4 - Reorganized parts [Mysterious]
//= v1.5 - Edited Credits [Mysterious]
//= v1.6 - Organized SQL DB Creation [Mysterious]
//= v1.7 - Fixed more issues [Mysterious]
//= v1.8 - Fixed more spacing [Mysterious]
//= v1.9 - Fixed Sentence structures [Mysterious]
//============================================================
// =========== Create SQL Tables ========
/*
CREATE TABLE IF NOT EXISTS `bountyladder` (`char_id` int(10) unsigned NOT NULL default '0',`name` varchar(255) NOT NULL,`earned` int(10) unsigned NOT NULL default '0',`assasinated` int(10) unsigned NOT NULL default '0',`target1` varchar(255) NOT NULL,`target2` varchar(255) NOT NULL,`target3` varchar(255) NOT NULL,PRIMARY KEY  (`char_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
CREATE TABLE IF NOT EXISTS `bountys` (`char_id` bigint(20) unsigned NOT NULL,`name` varchar(255) NOT NULL,`bounty` bigint(20) unsigned NOT NULL,`onoff` tinyint(4) unsigned NOT NULL default '0',`des` varchar(255) NOT NULL,`reason` varchar(255) default NULL,`id` bigint(20) unsigned default '0',`basexp` bigint(20) unsigned NOT NULL,`jobxp` bigint(20) unsigned NOT NULL,`itemid` bigint(20) unsigned NOT NULL,`itemat` bigint(20) unsigned NOT NULL,PRIMARY KEY  (`char_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*
// ======================================
prontera,144,144,4      script  Bounty Hunter   65,{
 
// =========== Settings ==========
        set nn$,"[ Bounty Hunter ]"; //Name of NPC
        set $mingm,40; //Minimum GM level to access NPC and change settings Note: You can set 'getgmlevel' to 'getgroupid' as well.
// ===============================
 
        // Do not remove this. This is used to prevent SQL Error.
        query_sql ("INSERT bountyladder (char_id,name,earned,assasinated,target1,target2,target3) VALUES ("+getcharid(0)+",'"+strcharinfo(0)+"',0,0,'Empty','Empty','Empty') ON DUPLICATE KEY UPDATE char_id="+getcharid(0)+"");
       
// Start of Main Script
        mes nn$;
        mes "Hello there "+strcharinfo(0)+"! What would you like to do?";
        if (getgmlevel() >= $mingm) {
        menu "- Set a Bounty",L_B,"- View Ladder",L_tl,"- Staff Menu",L_GM;
        }
        menu "- Set a Bounty",L_B,"- View Ladder",L_tl;
        close;
        end;
       
 
//Players will set a Bounty or view whose a Bounty
L_B:
next;
        mes nn$;
        mes "Order by:";
        menu "Zeny",-,"Name",L_BN,"ID",L_BI,"Search",L_Sb;
        query_sql ("SELECT count(name) FROM bountys",.@rows);
        next;
        mes nn$;
        mes "Explantation: ^DF0101ID^000000# ^FA5858Name^000000 Bounty";
        next;
        set .@i,-1;
        query_sql ("SELECT name,bounty,id FROM bountys WHERE onoff=1 ORDER BY bounty DESC LIMIT "+.@rows+"",@name$,@bounty,.@id);
        while (.@i < .@rows-1) {
                set .@i,.@i + 1;       
                mes "^DF0101"+.@id[.@i]+"^000000# ^FA5858"+@name$[.@i]+"^000000  "+@bounty[.@i]+"";
                }
                mes " ";
                mes "Input the Characters ID you want to set as a Target or read information about:";
                input .@ida;
                if (query_sql ("SELECT name FROM bountys WHERE id="+.@ida+"") == 0) {
                next;
                mes nn$;
                mes "Sorry, it seems I couldn't find "+.@ida+" ID.";
                close;
                end;
                }
                menu "- Read Info",-,"- Set as a Target",L_ST;
                        query_sql ("SELECT name,bounty,id,des,reason,basexp,jobexp,itemid,itemat FROM bountys WHERE id="+.@ida+"",@name$,@bounty,.@id,@des$,@reason$,@bxp,@jxp,@iid,@iat);
                        next;
                        mes "^04B404Bounty ID^000000: "+.@id+"";
                        mes "^04B404Name^000000: "+@name$+"";
                        mes "^04B404Bounty^000000: "+@bounty+"";
                        mes "^04B404Reason^000000: "+@reason$+"";
                        mes "^04B404Description^000000: "+@des$+"";
                        mes "^04B404BaseExp^000000: "+@bxp+"";
                        mes "^04B404JobExp^000000: "+@jxp+"";
                        mes "^04B404Itemname(ID)^000000: "+getitemname(@iid)+"("+@iid+")";
                        mes "^04B404Itemamount^000000: "+@iat+"";
                close;
                end;
               
               
L_BN:
query_sql ("SELECT count(name) FROM bountys",.@rows);
        next;
        mes nn$;
        mes "Explantation: ^DF0101ID^000000# ^FA5858Name^000000 Bounty";
        next;
        set .@i,-1;
        query_sql ("SELECT name,bounty,id FROM bountys WHERE onoff=1 ORDER BY name ASC LIMIT "+.@rows+"",@name$,@bounty,.@id);
        while (.@i < .@rows-1) {
                set .@i,.@i + 1;       
                mes "^DF0101"+.@id[.@i]+"^000000# ^FA5858"+@name$[.@i]+"^000000  "+@bounty[.@i]+"";
                }
                mes " ";
                mes "Input the Characters ID you want to set as a Target or read information about:";
                input .@ida;
                if (query_sql ("SELECT name FROM bountys WHERE id="+.@ida+"") == 0) {
                next;
                mes nn$;
                mes "Sorry, but it seems I can't find "+.@ida+" ID.";
                close;
                end;
                }
                menu "- Read Info",-,"- Set as a Target",L_ST;
                        query_sql ("SELECT name,bounty,id,des,reason,basexp,jobexp,itemid,itemat FROM bountys WHERE id="+.@ida+"",@name$,@bounty,.@id,@des$,@reason$,@bxp,@jxp,@iid,@iat);
                        next;
                        mes "^04B404Bounty ID^000000: "+.@id+"";
                        mes "^04B404Name^000000: "+@name$+"";
                        mes "^04B404Bounty^000000: "+@bounty+"";
                        mes "^04B404Reason^000000: "+@reason$+"";
                        mes "^04B404Description^000000: "+@des$+"";
                        mes "^04B404BaseExp^000000: "+@bxp+"";
                        mes "^04B404JobExp^000000: "+@jxp+"";
                        mes "^04B404Itemname(ID)^000000: "+getitemname(@iid)+"("+@iid+")";
                        mes "^04B404Itemamount^000000: "+@iat+"";
                close;
                end;
 
 
L_BI:
query_sql ("SELECT count(name) FROM bountys",.@rows);
        next;
        mes nn$;
        mes "Explantation: ^DF0101ID^000000# ^FA5858Name^000000 Bounty";
        next;
        set .@i,-1;
        query_sql ("SELECT name,bounty,id FROM bountys WHERE onoff=1 ORDER BY id ASC LIMIT "+.@rows+"",@name$,@bounty,.@id);
        while (.@i < .@rows-1) {
                set .@i,.@i + 1;       
                mes "^DF0101"+.@id[.@i]+"^000000# ^FA5858"+@name$[.@i]+"^000000  "+@bounty[.@i]+"";
                }
                mes " ";
                mes "Input the Characters ID you want to set as a Target or read information about:";
                input .@ida;
                if (query_sql ("SELECT name FROM bountys WHERE id="+.@ida+"") == 0) {
                next;
                mes nn$;
                mes "Sorry, but I couldn't find "+.@ida+" ID.";
                close;
                end;
                }
                menu "- Read Info",-,"- Set as a Target",L_ST;
                        query_sql ("SELECT name,bounty,id,des,reason,basexp,jobexp,itemid,itemat FROM bountys WHERE id="+.@ida+"",@name$,@bounty,.@id,@des$,@reason$,@bxp,@jxp,@iid,@iat);
                        next;
                        mes "^04B404Bounty ID^000000: "+.@id+"";
                        mes "^04B404Name^000000: "+@name$+"";
                        mes "^04B404Bounty^000000: "+@bounty+"";
                        mes "^04B404Reason^000000: "+@reason$+"";
                        mes "^04B404Description^000000: "+@des$+"";
                        mes "^04B404BaseExp^000000: "+@bxp+"";
                        mes "^04B404JobExp^000000: "+@jxp+"";
                        mes "^04B404Itemname(ID)^000000: "+getitemname(@iid)+"("+@iid+")";
                        mes "^04B404Itemamount^000000: "+@iat+"";
                close;
                end;
               
L_sb:
        next;
        mes nn$;
        mes "Would you like to search by..";
        menu "- Name",-,"- ID",L_stlid;
        next;
        mes "Please input their Name:";
        input @sname$;
        if (query_sql("SELECT id FROM bountys WHERE name='"+escape_sql(@sname$)+"'") == 0) {
        next;
        mes nn$;
        mes "Sorry, but I couldn't find "+@sname$+"!";
        close;
        end;
        }
        next;
        mes nn$;
        mes "I was able to find "+@sname$+". What would you like to do?";
                set @search,1;
                menu "- Read Info",-,"- Set as a Target",L_STS;
                query_sql ("SELECT name,bounty,id,des,reason,basexp,jobexp,itemid,itemat FROM bountys WHERE name='"+escape_sql(@sname$)+"'",@name$,@bounty,.@id,@des$,@reason$,@bxp,@jxp,@iid,@iat);
                next;
                mes "^04B404Bounty ID^000000: "+.@id+"";
                mes "^04B404Name^000000: "+@name$+"";
                mes "^04B404Bounty^000000: "+@bounty+"";
                mes "^04B404Reason^000000: "+@reason$+"";
                mes "^04B404Description^000000: "+@des$+"";
                mes "^04B404BaseExp^000000: "+@bxp+"";
                mes "^04B404JobExp^000000: "+@jxp+"";
                mes "^04B404Itemname(ID)^000000: "+getitemname(@iid)+"("+@iid+")";
                mes "^04B404Itemamount^000000: "+@iat+"";
                close;
                end;
 
L_STS:
                next;
                query_sql ("SELECT name FROM bountys WHERE name='"+escape_sql(@sname$)+"'",@name$);
                if (@name$ == strcharinfo(0)) {
                mes nn$;
                mes "Sorry, but you can't set yourself.";
                close;
                end;
                }
                query_sql ("SELECT name FROM bountys WHERE name='"+escape_sql(@sname$)+"'");
                query_sql ("SELECT target1,target2,target3 FROM bountyladder WHERE char_id="+getcharid(0)+"",@t1$,@t2$,@t3$);
                if (@t1$ == "") {
                query_sql ("UPDATE bountyladder SET target1='Empty'");
                }
                if (@t2$ == "") {
                query_sql ("UPDATE bountyladder SET target2='Empty'");
                }
                if (@t3$ == "") {
                query_sql ("UPDATE bountyladder SET target3='Empty'");
                }
                query_sql ("SELECT target1,target2,target3 FROM bountyladder WHERE char_id="+getcharid(0)+"",@t1$,@t2$,@t3$);
                menu ""+@t1$+"",-,""+@t2$+"",L_STS2,""+@t3$+"",L_STS3;
                if (@t1$ != "Empty") {
                mes nn$;
                mes "Please choose an empty target slot.";
                close;
                end;
                }
                if (@name$ == @t2$) {
                mes nn$;
                mes "Sorry, but you can only set one target.";
                close;
                end;
                }
                if (@name$ == @t3$) {
                mes nn$;
                mes "Sorry, but you can only set one target.";
                close;
                end;
                }
                query_sql ("SELECT name FROM bountys WHERE name='"+escape_sql(@sname$)+"'",@name$);
                query_sql ("UPDATE bountyladder SET target1='"+@name$+"' WHERE char_id="+getcharid(0)+"");
                query_sql ("SELECT target1 FROM bountyladder WHERE char_id="+getcharid(0)+"",@target1$);
                next;
                mes nn$;
                mes "Target 1: "+@target1$+"";
                close;
                end;
 
L_STS2:
                if (@t2$ != "Empty") {
                mes nn$;
                mes "Please choose an empty slot.";
                close;
                end;
                }
                query_sql ("SELECT name FROM bountys WHERE name='"+escape_sql(@sname$)+"'",@name$);
                query_sql ("UPDATE bountyladder SET target2='"+@name$+"' WHERE char_id="+getcharid(0)+"");
                query_sql ("SELECT target2 FROM bountyladder WHERE char_id="+getcharid(0)+"",@target2$);
                mes nn$;
                mes "Target 2: "+@target2$+"";
                close;
                end;
               
L_STS3:
                if (@t3$ != "Empty") {
                mes nn$;
                mes "Please choose an empty slot.";
                close;
                end;
                }
                query_sql ("SELECT name FROM bountys WHERE name='"+escape_sql(@sname$)+"'",@name$);
                query_sql ("UPDATE bountyladder SET target3='"+@name$+"' WHERE char_id="+getcharid(0)+"");
                query_sql ("SELECT target3 FROM bountyladder WHERE char_id="+getcharid(0)+"",@target3$);
                mes nn$;
                mes "Target 3: "+@target3$+"";
                close;
                end;
               
                               
               
L_stlid:
                next;
                mes nn$;
                mes "Please input an ID:";
                input .@ida;
                if (query_sql ("SELECT name FROM bountys WHERE id="+.@ida+"") == 0) {
                        next;
                        mes nn$;
                        mes "Sorry, but I couldn't find "+.@ida+" ID.";
                        close;
                        end;
                        }
                                menu "- Read Info",-,"- Set as a Target",L_ST;
                        query_sql ("SELECT name,bounty,id,des,reason,basexp,jobexp,itemid,itemat FROM bountys WHERE id="+.@ida+"",@name$,@bounty,.@id,@des$,@reason$,@bxp,@jxp,@iid,@iat);
                        next;
                        mes "^04B404Bounty ID^000000: "+.@id+"";
                        mes "^04B404Name^000000: "+@name$+"";
                        mes "^04B404Bounty^000000: "+@bounty+"";
                        mes "^04B404Reason^000000: "+@reason$+"";
                        mes "^04B404Description^000000: "+@des$+"";
                        mes "^04B404BaseExp^000000: "+@bxp+"";
                        mes "^04B404JobExp^000000: "+@jxp+"";
                        mes "^04B404Itemname(ID)^000000: "+getitemname(@iid)+"("+@iid+")";
                        mes "^04B404Itemamount^000000: "+@iat+"";
                                close;
                                end;
               
 
L_ST:
                next;
                query_sql ("SELECT name FROM bountys WHERE id="+.@ida+"",@name$);
                if (@name$ == strcharinfo(0)) {
                        mes nn$;
                        mes "You don't can target yourself.";
                        close;
                        end;
                        }
                query_sql ("SELECT name FROM bountys WHERE id="+.@ida+"");
                query_sql ("SELECT target1,target2,target3 FROM bountyladder WHERE char_id="+getcharid(0)+"",@t1$,@t2$,@t3$);
                if (@t1$ == "") {
                        query_sql ("UPDATE bountyladder SET target1='Empty'");
                        }
                if (@t2$ == "") {
                        query_sql ("UPDATE bountyladder SET target2='Empty'");
                        }
                if (@t3$ == "") {
                        query_sql ("UPDATE bountyladder SET target3='Empty'");
                        }
                query_sql ("SELECT target1,target2,target3 FROM bountyladder WHERE char_id="+getcharid(0)+"",@t1$,@t2$,@t3$);
                menu ""+@t1$+"",-,""+@t2$+"",L_ST2,""+@t3$+"",L_ST3;
                if (@t1$ != "Empty") {
                        mes nn$;
                        mes "This target slot is in using,choose an empty target slot.";
                        close;
                        end;
                        }
                if (@name$ == @t2$) {
                        mes nn$;
                        mes "You only once can set target 1 character.";
                        close;
                        end;
                }
                if (@name$ == @t3$) {
                mes nn$;
                mes "You only once can set target 1 character.";
                close;
                end;
                }
                query_sql ("SELECT name FROM bountys WHERE id="+.@ida+"",@name$);
                query_sql ("UPDATE bountyladder SET target1='"+@name$+"' WHERE char_id="+getcharid(0)+"");
                query_sql ("SELECT target1 FROM bountyladder WHERE char_id="+getcharid(0)+"",@target1$);
                next;
                mes nn$;
                mes "Target 1: "+@target1$+"";
                close;
                end;
 
L_ST2:
                if (@t2$ != "Empty") {
                mes nn$;
                mes "This target slot is in using,choose an empty target slot.";
                close;
                end;
                }
                query_sql ("SELECT name FROM bountys WHERE id="+.@ida+"",@name$);
                query_sql ("UPDATE bountyladder SET target2='"+@name$+"' WHERE char_id="+getcharid(0)+"");
                query_sql ("SELECT target2 FROM bountyladder WHERE char_id="+getcharid(0)+"",@target2$);
                mes nn$;
                mes "Target 2: "+@target2$+"";
                close;
                end;
               
L_ST3:
                if (@t3$ != "Empty") {
                mes nn$;
                mes "This target slot is in using,choose an empty target slot.";
                close;
                end;
                }
                query_sql ("SELECT name FROM bountys WHERE id="+.@ida+"",@name$);
                query_sql ("UPDATE bountyladder SET target3='"+@name$+"' WHERE char_id="+getcharid(0)+"");
                query_sql ("SELECT target3 FROM bountyladder WHERE char_id="+getcharid(0)+"",@target3$);
                mes nn$;
                mes "Target 3: "+@target3$+"";
                close;
                end;
               
               
// Top of the list
L_tl:
        mes nn$;
        mes "Order by:";
        menu "Earned Zeny",-,"Name",TL_n,"Assasinated players",TL_k,"Search",L_stl;
        query_sql ("SELECT count(name) FROM bountyladder",.@rows);
        next;
        mes nn$;
        mes "Explantation:";
        mes     "^DF0101|Positison|^FF0000 |Name| ^FA5858|earned zeny|^000000 |assasinated .. player|";
        set .@i,-1;
        set .@o,0;
        query_sql ("SELECT name,earned,assasinated FROM bountyladder ORDER BY earned DESC LIMIT "+.@rows+"",@name$,@eazeny,@kills);
        while (.@i < .@rows-1) {
                set .@i,.@i+1;
                set .@o,.@o+1; 
                mes "^DF0101"+.@o+"^000000 ^FF0000"+@name$[.@i]+" ^FA5858"+@eazeny[.@i]+"^000000 "+@kills[.@i]+"";
                }
                close;
                end;
       
TL_k:  
        query_sql ("SELECT count(name) FROM bountyladder",.@rows);
        next;
        mes nn$;
        mes "Explantation:";
        mes     "^DF0101|Positison|^FF0000 |Name| ^FA5858|earned zeny| |assasinated .. player|^000000";
        set .@i,-1;
        set .@o,0;
        query_sql ("SELECT name,earned,assasinated FROM bountyladder ORDER BY assasinated DESC LIMIT "+.@rows+"",@name$,@eazeny,@kills);
        while (.@i < .@rows-1) {
                set .@i,.@i+1;
                set .@o,.@o+1; 
                mes "^DF0101"+.@o+"^000000 ^FF0000"+@name$[.@i]+" ^FA5858"+@eazeny[.@i]+" "+@kills[.@i]+"";
                }
                close;
                end;
 
TL_n:
        query_sql ("SELECT count(name) FROM bountyladder",@rows);
        next;
        mes nn$;
        mes "Explantation:";
        mes     "^DF0101|Positison|^FF0000 |Name| ^FA5858|earned zeny|^000000 |assasinated .. player|";
        set .@i,-1;
        set .@o,0;
        query_sql ("SELECT name,earned,assasinated FROM bountyladder ORDER BY name DESC LIMIT "+.@rows+"",@name$,@eazeny,@kills);
        while (.@i < .@rows-1) {
                set .@i,.@i+1;
                set .@o,.@o+1; 
                mes "^DF0101"+.@o+"^000000 ^FF0000"+@name$[.@i]+" ^FA5858"+@eazeny[.@i]+"^000000 "+@kills[.@i]+"";
                }
                close;
                end;
               
               
L_stl:
        next;
        mes nn$;
        mes "Input the searchable name:";
        input @sname$;
        if (query_sql("SELECT name FROM bountyladder WHERE name='"+escape_sql(@sname$)+"'") == 0) {
        next;
        mes nn$;
        mes "Sorry i'm not found "+@sname$+"";
        }
        next;
        mes nn$;
        query_sql ("SELECT name,earned,assasinated FROM bountyladder WHERE name='"+escape_sql(@sname$)+"'",@name$,@eazeny,@kills);
        mes "^FF0000"+@name$[0]+" ^FA5858"+@eazeny[0]+"^000000 "+@kills[0]+"";
        close;
        end;
 
// Staff Menu
L_GM:  
        next;
        mes nn$;
        mes "Hey there! What would you like to do?";
        menu "- Add bounty",GM_addbounty,"- Edit bounty",GM_edit,"- Delete bounty",GM_delbounty,"- Delete all bounties",GM_delallb;
 
 
GM_delbounty:
        query_sql ("SELECT count(name) FROM bountys",.@rows);
        next;
        mes nn$;
        mes "Explantation: ^DF0101ID^000000# ^FA5858Name^000000 Bounty";
        next;
        set .@i,-1;
        query_sql ("SELECT name,bounty,id FROM bountys WHERE onoff=1 ORDER BY id DESC LIMIT "+.@rows+"",@name$,@bounty,.@id);
        while (.@i < .@rows-1) {
                set .@i,.@i + 1;       
                mes "^DF0101"+.@id[.@i]+"^000000# ^FA5858"+@name$[.@i]+"^000000  "+@bounty[.@i]+"";
                }
                mes " ";
                mes "Please input the ID you wish to delete:";
                input .@ida;
                if (query_sql ("SELECT name FROM bountys WHERE id="+.@ida+"") == 0) {
                next;
                mes nn$;
                mes "Sorry i'm not found "+.@ida+" Bounty ID.";
                close;
                end;
                }
                query_sql ("SELECT name,bounty,id,des,reason,basexp,jobexp,itemid,itemat FROM bountys WHERE id="+.@ida+"",@name$,@bounty,.@id,@des$,@reason$,@bxp,@jxp,@iid,@iat);
                next;
                mes "^04B404Bounty ID^000000: "+.@id+"";
                mes "^04B404Name^000000: "+@name$+"";
                mes "^04B404Bounty^000000: "+@bounty+"";
                mes "^04B404Reason^000000: "+@reason$+"";
                mes "^04B404Description^000000: "+@des$+"";
                mes "^04B404BaseExp^000000: "+@bxp+"";
                mes "^04B404JobExp^000000: "+@jxp+"";
                mes "^04B404Itemname(ID)^000000: "+getitemname(@iid)+"("+@iid+")";
                mes "^04B404Itemamount^000000: "+@iat+"";
                next;
                mes "Please choose a name:";
                input @verify$;
                if (@verify$ != @name$) {
                next;
                mes nn$;
                mes "Sorry, but that's a wrong name.";
                close;
                end;
                }
                if (@verify$ == @name$) {
                next;
                mes nn$;
                mes "Thank you.";
                query_sql ("DELETE FROM bountys WHERE id="+.@ida+"");
                mes "Name: "+@verify$+" has been deleted.";
                close;
                end;
                }
               
 
GM_delallb:
        next;
        mes nn$;
        mes "Are you sure you want to delete all bounties?";
        menu "- Yes",-,"- No",L_no;
        next;
        mes nn$;
        query_sql ("DELETE FROM bountys");
        mes "All bounties have been deleted.";
        close;
        end;
 
 
GM_edit:
        query_sql ("SELECT count(name) FROM bountys",.@rows);
        next;
        mes nn$;
        mes "Explantation: ^DF0101ID^000000# ^FA5858Name^000000 Bounty";
        next;
        set .@i,-1;
        query_sql ("SELECT name,bounty,id FROM bountys WHERE onoff=1 ORDER BY id DESC LIMIT "+.@rows+"",@name$,@bounty,.@id);
        while (.@i < .@rows-1) {
                set .@i,.@i + 1;       
                mes "^DF0101"+.@id[.@i]+"^000000# ^FA5858"+@name$[.@i]+"^000000  "+@bounty[.@i]+"";
                }
                mes " ";
                mes "Please input the ID of the Bounty you wish to edit:";
                input .@ida;
                if (query_sql ("SELECT name FROM bountys WHERE id="+.@ida+"") == 0) {
                next;
                mes nn$;
                mes "Sorry, but I couldn't find "+.@ida+" ID.";
                close;
                end;
                }
                query_sql ("SELECT name,bounty,id,des,reason,basexp,jobexp,itemid,itemat FROM bountys WHERE id="+.@ida+"",@name$,@bounty,.@id,@des$,@reason$,@bxp,@jxp,@iid,@iat);
                next;
                mes "^04B404Bounty ID^000000: "+.@id+"";
                mes "^04B404Name^000000: "+@name$+"";
                mes "^04B404Bounty^000000: "+@bounty+"";
                mes "^04B404Reason^000000: "+@reason$+"";
                mes "^04B404Description^000000: "+@des$+"";
                mes "^04B404BaseExp^000000: "+@bxp+"";
                mes "^04B404JobExp^000000: "+@jxp+"";
                mes "^04B404Itemname(ID)^000000: "+getitemname(@iid)+"("+@iid+")";
                mes "^04B404Itemamount^000000: "+@iat+"";
                mes " ";
                mes "What would you like to change?";
                menu "- Bounty",GM_editbounty,"- Reason",GM_editreason,"- Description",GM_editdes,"- BaseExp",GM_editbexp,"- JobExp",GM_editjexp,"- Item ID",GM_edititemid,"- Item Amount",GM_edititemat,"- Change Settings Together",-;
                next;
                mes "Now input the bounty (How much Zeny):";
                mes "Input '0' if you don't want Zeny as a reward.";
                input @r;      
                next;
                mes "Now input the reason:";           
                input @rea$;
                mes "Now input the description:";      
                input @d$;
                next;
                mes "Now input the BaseExp:";
                mes "Note: Please input ' 0 ' if you don't want to give BaseEXP as a reward.";
                input @bxp;
                next;
                mes "Now input the JobExp:";
                mes "Note: Please input ' 0 ' if you don't want to give JobEXP as a reward.";
                input @jxp;
                next;
                mes "Now input the itemid:";
                mes "Note: Please input less than ' 541 ' if you don't want to give an Item as a reward.";
                input @iid;
                next;
                if (@iid >= 1) {
                mes "How much should I give out of "+@iid+"?";
                mes "If you input ' 0 ', I'll automatically give out 1.";
                input @iat;
                if (@iat == 0) {set @iat,1;
                next;
                }
                }
                mes "^04B404Bounty ID^000000: "+.@id+"";
                mes "^04B404Name^000000: "+@name$+"";
                mes "^04B404Bounty^000000: "+@r+"";
                mes "^04B404Reason^000000: "+@rea$+"";
                mes "^04B404Description^000000: "+@d$+"";
                mes "^04B404BaseExp^000000: "+@bxp$+"";
                mes "^04B404JobExp^000000: "+@jxp+"";
                mes "^04B404Itemname(ID)^000000: "+getitemname(@iid)+"("+@iid+")";
                mes "^04B404DItemamount^000000: "+@iat+"";
                mes " ";
                mes "Is everything fine?";
                menu "- Yes",-,"- No",L_no;
                query_sql ("UPDATE bountys SET des='"+@d$+"',reason='"+@rea$+"',bounty="+@r+",basexp="+@bxp+",jobexp="+@jxp+",itemid="+@iid+",itemat="+@iat+" WHERE id="+.@ida+"");
                close;
                end;
 
GM_editbounty:
                next;
                mes nn$;
                mes "Now input the bounty (How much Zeny):";
                mes "Please input '0' if you dont to set Zeny as a reward.";
                input @r;
                mes "^04B404Bounty^000000: "+@r+"";
                mes nn$;
                mes "Is this okay?";
                menu "Yes",-,"No",L_no;
                query_sql ("UPDATE bountys SET bounty="+@r+" WHERE id="+.@ida+"");
                close;
                end;
               
GM_editreason:
                next;  
                mes nn$;               
                mes "Please input a reason:";  
                input @rea$;
                mes "^04B404Reason^000000: "+@rea$+""; 
                mes nn$;
                mes "Is this okay?";
                menu "Yes",-,"No",L_no;        
                query_sql ("UPDATE bountys SET reason="+@rea$+" WHERE id="+.@ida+"");
                close;
                end;
 
GM_editdes:
                next;
                mes nn$;               
                mes "Please enter a description:";
                input @des$;
                mes "^04B404Description^000000: "+@des$+"";
                mes nn$;
                mes "Is this okay?";
                menu "Yes",-,"No",L_no;        
                query_sql ("UPDATE bountys SET des="+@des$+" WHERE id="+.@ida+"");
                close;
                end;
 
GM_editbexp:
                next;
                mes nn$;               
                mes "Please input your desired BaseEXP:";      
                input @bexp;
                mes "^04B404BaseExp^000000: "+@bexp+"";
                mes nn$;
                mes "Is this okay?";
                menu "Yes",-,"No",L_no;        
                query_sql ("UPDATE bountys SET basexp="+@bexp+" WHERE id="+.@ida+"");                  
                close;
                end;           
               
GM_editjexp:
                next;
                mes nn$;               
                mes "Please input your desired JobEXP:";
                input @jexp;
                mes "^04B404JobExp^000000: "+@jexp+"";
                mes nn$;
                mes "Is this okay?";
                menu "Yes",-,"No",L_no;
                query_sql ("UPDATE bountys SET jobxp="+@jexp+" WHERE id="+.@ida+"");
                close;
                end;           
 
GM_edititemid:
                next;
                mes nn$;
                mes "Please input your desired Item:";
                input @iid;
                mes "^04B404Itemname(ID)^000000: "+@iid+"";
                mes nn$;
                mes "Is this okay?";
                menu "Yes",-,"No",L_no;        
                query_sql ("UPDATE bountys SET itemid="+@iid+" WHERE id="+.@ida+"");
                close;
                end;           
 
GM_edititemat:
                next;
                mes nn$;
                mes "How much of the item would you like to give?";
                input @itemat;
                mes "^04B404Iteamamount^000000: "+@itemat+"";
                mes nn$;
                mes "Is this okay?";
                menu "Yes",-,"No",L_no;        
                query_sql ("UPDATE bountys SET itemat="+@itemat+" WHERE id="+.@ida+"");
                close;
                end;
 
GM_addbounty:
        next;
        mes nn$;
        mes "^FF0000WARNING^000000: Please do not add quotations in your around the characters name!";
        next;
        mes "Insert his/her name:";
        input @pname$;
        if (query_sql ("SELECT name FROM bountys WHERE name='"+escape_sql(@pname$)+"'") == 0) {
        if (query_sql ("SELECT char_id FROM `char` WHERE name='"+escape_sql(@pname$)+"'") == 0) {
        next;
        mes nn$;
        mes "Sorry, I couldn't find ^04B404"+@pname$+"^000000.";
        close;
        end;
        }
        next;
        mes "Now input the bounty (How much Zeny):";
        mes "Input 0 if you don't want zeny as a reward.";
        input @r;      
        next;
        mes "Now input the reason:";           
        input @rea$;
        mes "Now input the description:";      
        input @d$;
        next;
        mes "Now input the BaseExp.";
        mes "Input 0 if you don't want BaseExp reward.";
        input @bxp;
        next;
        mes "Now input the JobExp.";
        mes "Input 0 if you don't want JobExp reward.";
        input @jxp;
        next;
        mes "Now input the itemid.";
        mes "Input lesser than 501 if you don't want Item Reward reward.";
        input @iid;
        next;
        if (@iid >= 501) {
        mes "Now input the reward amount of "+@iid+" itemid.";
        mes "If you input 0 it's automatically setted to 1.";
        input @iat;
        if (@iat == 0) {set @iat,1;
        }
        next;
        }
        query_sql ("SELECT MAX(id) FROM bountys",.@ik);
                set .@ikk,.@ik+1;
                mes "^04B404Bounty ID^000000: "+.@ikk+"";
                mes "^04B404Name^000000: "+@pname$+"";
                mes "^04B404Bounty^000000: "+@r+"";
                mes "^04B404Reason^000000: "+@rea$+"";
                mes "^04B404Description^000000: "+@d$+"";
                mes "^04B404BaseExp^000000: "+@bxp+"";
                mes "^04B404JobExp^000000: "+@jxp+"";
                mes "^04B404Itemname(ID)^000000: "+getitemname(@iid)+"("+@iid+")";
                mes "^04B404Itemamount^000000: "+@iat+"";
                mes " ";
                mes nn$;
                mes "Is this fine?";
                menu "Yes",-,"No",GM_addbountyno;
                query_sql ("SELECT char_id FROM `char` WHERE name='"+escape_sql(@pname$)+"'",@cid);
                query_sql ("INSERT bountys (char_id,name,bounty,onoff,des,reason,id,basexp,jobxp,itemid,itemat) VALUES ("+@cid+",'"+escape_sql(@pname$)+"',"+@r+",1,'"+escape_sql(@d$)+"','"+escape_sql(@rea$)+"',"+.@ikk+","+@bxp+","+@jxp+","+@iid+","+@iat+")");
                close;
                end;
                }
               
                 next;
                mes nn$;
                mes "Sorry there is a bounty on "+@pname$+"'s head.";
                close;
                end;
 
GM_maxzeny:
        mes nn$;
        mes "What is your current Maximum of Zeny in the server?";
        input .@new;
        if (.@new == 0) {
        next;
        mes nn$;
        mes "You need to input a number higher than 0!";
        next;
        goto GM_maxzeny;
        }
        set $maxzeny,.@new;
        goto L_GM;             
               
 
GM_addbountyno:
        next;
        mes nn$;
        mes "Then try again.";
        goto GM_addbounty;
        end;
L_no:
        close;
        end;   
 
// Labels
OnPCKillEvent:
        set @name2$,rid2name(killedrid);
        query_sql ("SELECT bounty,name,basexp,jobxp,itemid,itemat FROM bountys WHERE name='"+escape_sql(@name2$)+"'",@bountyr,@name$,@bexp,@jexp,@iid,@iamount);
        query_sql ("SELECT target1,target2,target3 FROM bountyladder WHERE char_id="+getcharid(0)+"",@t1$,@t2$,@t3$);
 
        if (@t1$ == @name2$)    {
        if (@bexp >= 1) {dispbottom "You have earned "+@bexp+" BaseExp.";set JobExp,JobExp+@jexp;}
        if (@jexp >= 1) {dispbottom "You have earned "+@jexp+" JobExp.";set BaseExp,BaseExp+@bexp;}
        if (@iid >= 501) {getitem @iid,@iamount;dispbottom "You have got "+@iamount+" of "+getitemname(@iid)+"."; }
        if (@bountyr >= 1) {dispbottom "You have killed "+@name$+" and you have got "+@bountyr+" Zeny.";set Zeny,Zeny+@bountyr;}
        query_sql ("UPDATE bountyladder SET target1='Empty'");
        query_sql ("DELETE FROM bountys WHERE name='"+escape_sql(@name2$)+"'");
        query_sql ("UPDATE bountyladder SET earned=earned+"+@bountyr+" WHERE char_id="+getcharid(0)+"");
        query_sql ("UPDATE bountyladder SET assasinated=assasinated+1 WHERE char_id="+getcharid(0)+"");
        announce "[Bounty Hunter]:"+@name$+" killed by "+strcharinfo(0)+".",bc_all;
        end;
        }
 
        else if (@t2$ == @name2$) {
 
        if (@bexp >= 1) {dispbottom "You have earned "+@bexp+" BaseExp.";set JobExp,JobExp+@jexp;}
        if (@jexp >= 1) {dispbottom "You have earned "+@jexp+" JobExp.";set BaseExp,BaseExp+@bexp;}
        if (@iid >= 501) {getitem @iid,@iamount;dispbottom "You have got "+@iamount+" of "+getitemname(@iid)+"."; }
        if (@bountyr >= 1) {dispbottom "You have killed "+@name$+" and you have got "+@bountyr+" Zeny.";set Zeny,Zeny+@bountyr;}
        query_sql ("DELETE FROM bountys WHERE name='"+escape_sql(@name2$)+"'");
        query_sql ("UPDATE bountyladder SET earned=earned+"+@bountyr+" WHERE char_id="+getcharid(0)+"");
        query_sql ("UPDATE bountyladder SET assasinated=assasinated+1 WHERE char_id="+getcharid(0)+"");
        query_sql ("UPDATE bountyladder SET target2='Empty'");
        announce "[Bounty Hunter]:"+@name$+" killed by "+strcharinfo(0)+".",bc_all;
        }
 
        else if (@t3$ == @name2$) {
        if (@bexp >= 1) {dispbottom "You have earned "+@bexp+" BaseExp.";set JobExp,JobExp+@jexp;}
        if (@jexp >= 1) {dispbottom "You have earned "+@jexp+" JobExp.";set BaseExp,BaseExp+@bexp;}
        if (@iid >= 501) {getitem @iid,@iamount;dispbottom "You have got "+@iamount+" of "+getitemname(@iid)+"."; }
        if (@bountyr >= 1) {dispbottom "You have killed "+@name$+" and you have got "+@bountyr+" Zeny.";set Zeny,Zeny+@bountyr;}
        dispbottom "You have killed "+@name$+" and you have got "+@bountyr+" Zeny.";
        query_sql ("DELETE FROM bountys WHERE name='"+escape_sql(@name2$)+"'");
        query_sql ("UPDATE bountyladder SET earned=earned+"+@bountyr+" WHERE char_id="+getcharid(0)+"");
        query_sql ("UPDATE bountyladder SET assasinated=assasinated+1 WHERE char_id="+getcharid(0)+"");
        query_sql ("UPDATE bountyladder SET target3='Empty'");
        announce "[Bounty Hunter]:"+@name$+" killed by "+strcharinfo(0)+".",bc_all;
        }
 
        else if (@t1 != @enemy$ & @t2 != @enemy$ & @t3 != @enemy$) {
        end;
        }
 
// End Bracket
        }
Viewed 238 times, submitted by unknown.