Jump to content

jpnazar

Members
  • Posts

    170
  • Joined

  • Last visited

Posts posted by jpnazar

  1. 14m6tc4.jpg

     

    here is my script

    //===== rAthena Script =======================================
    //= Run for Your Life
    //===== By: ==================================================
    //= Mysterious
    //===== Current Version: =====================================
    //= 2.8
    //===== Compatible With: =====================================
    //= rAthena SVN
    //===== Description: =========================================
    //= A Run for Your Life event (Based for Novices)
    //===== TODO: ================================================
    // - Change more coding
    //===== Additional Comments: =================================
    //= v1.0 - First release [Mysterious]
    //= v2.0 - Overhaul of Entire Script [Mysterious]
    //= v2.1 - Fixed Sentence structures [Mysterious]
    //= v2.2 - Fixed a Typo and made it obvious what players had to change [Mysterious]
    //= v2.3 - Removed unnecessary 'next;' thanks to soUPas [Mysterious]
    //= v2.4 - Fixed an issue where the prize giver was showing up when not supposed to [Mysterious]
    //= v2.5 - Added Friendly Messages [Mysterious]
    //= v2.6 - Removed duplicated OnInIt labels [Mysterious]
    //= v2.7 - Cleaning and organizing [Mysterious]
    //= v2.8 - Optimized a little better [Mysterious]
    //============================================================
    - script RFYL#disable -1,{
    OnInit:
    disablenpc "Zombie Master";
    disablenpc "Present#RFYL";
    }
    prt_in,44,95,5 script Zombie Minion 1015,{
    set .@name$,"^228B22[ Minion ]^000000";
    if (getgmlevel() >= 40) goto LMS_Admin;
      mes .@name$;
    if (!.Status) {
       mes .@name$;
       mes "My master seems to be slacking..";
    } else {
      mes "My master is currently busy! He has an invasion scheduled!";
    }
    close;
    LMS_Admin:
    next;
    if (!.Status)
      mes .@name$;
      mes "My master has no invasion planned at the moment. Do you wish to schedule an invasion?";
      menu "- Start Event",M_RFYL,"- Spectate",M_warp,"- End Event",M_EndEvent,"- No Thanks",M_Leave;
    else {
      mes .@name$;
      mes "Sorry! But there's already an invasion scheduled! Come back later.";
    }
    close;
    M_RFYL:
      next;
      mes .@name$;
      mes "Hold on while I call my master.";
      close2;
      goto StartEvent;
    M_warp:
      next;
      mes .@name$;
      mes "Very well, I will warp you to the map!";
      warp "quiz_01",42,369;
      close;
    M_Leave:
      next;
      mes .@name$;
      mes "Ok " + strcharinfo(0) +"! Please come back after.";
      close;
    
    M_EndEvent:
      next;
      mes .@name$;
      mes "Ok master, I will stop the event for you right away!";
      next;
      set .Status,0;
      disablenpc "Zombie Master";
      disablenpc "Present#RFYL";
      killmonsterall "quiz_01";
      areawarp "quiz_01",10,10,450,450,"prontera",156,156;
      stopnpctimer;
      disablenpc "Zombie Minion";
      warp "prontera",156,156;
      sleep 180000;
      enablenpc "Zombie Minion";
    // =========================
    OnHour1203: // Triggers at 3 AM every day.
    OnHour09: // Triggers at 9 AM every day.
    OnHour15: // Triggers at 3 PM every day.
    OnHour21: // Triggers at 9 PM every day.
    StartEvent: //Announcement to notify all players
    // =========================
    set .Status,1;
    announce "Zombie Vs. Novice event Will begin in 3 minutes. Head @ Prontera 156 169",0;
    killmonsterall "quiz_01";
    sleep 55000;
    announce "Zombie Vs. Novice event will begin in 2 minutes! Head @ Prontera 156 169",0;
    sleep 5000;
    announce "Zombie Master: I have now appeared in Prontera!",0;
    enablenpc "Zombie Master";
    sleep 60000;
    announce "Zombie Vs. Novice event will begin in 1 minute!",0;
    sleep 30000;
    mapannounce "quiz_01","In 30 seconds the zombies will spawn!",0;
    sleep 25000;
    announce "Zombie Vs. Novice event will begin in ~5~",0;
    sleep 1000;
    announce "Zombie Vs. Novice event will begin in ~4~",0;
    sleep 1000;
    announce "Zombie Vs. Novice event will begin in ~3~",0;
    sleep 1000;
    announce "Zombie Vs. Novice event will begin in ~2~",0;
    sleep 1000;
    announce "Zombie Vs. Novice event will begin in ~1~",0;
    sleep 1000;
    announce "Zombie Vs. Novice event has now begun!",0,0x00FF00;
    disablenpc "Zombie Master";
    // =========================
    // Round 1
    // =========================
    sleep 10000;
    monster "quiz_01",42,369,"Zombie",1015,1;
    sleep 10000;
    monster "quiz_01",42,369,"Zombie",1015,1;
    sleep 10000;
    monster "quiz_01",42,369,"Zombie",1015,1;
    sleep 10000;
    monster "quiz_01",42,369,"Zombie",1015,1;
    sleep 55000;
    // =========================
    // Round 2
    // =========================
    mapannounce "quiz_01","Round 2!",0;
    sleep 10000;
    monster "quiz_01",42,369,"Zombie-2",1015,1;
    sleep 55000;
    monster "quiz_01",42,369,"Zombie-2",1015,1;
    // =========================
    // Round 3
    // =========================
    mapannounce "quiz_01","Round 3!",0;
    sleep 10000;
    monster "quiz_01",42,369,"Zombie-3",1015,1;
    sleep 55000;
    monster "quiz_01",42,369,"Zombie-3",1015,1;
    // =========================
    // Round 4
    // =========================
    mapannounce "quiz_01","Round 4!",0;
    sleep 10000;
    monster "quiz_01",42,369,"Zombie-4",1015,1;
    sleep 10000;
    monster "quiz_01",42,369,"Zombie-4",1015,1;
    sleep 55000;
    monster "quiz_01",42,369,"Zombie-4",1015,1;
    // =========================
    // Round 5
    // =========================
    mapannounce "quiz_01","Round 5!",0;
    sleep 10000;
    monster "quiz_01",42,369,"Zombie-5",1015,1;
    sleep 55000;
    monster "quiz_01",42,369,"Zombie-5",1015,1;
    // =========================
    // Round 6
    // =========================
    mapannounce "quiz_01","Round 6!",0;
    sleep 10000;
    monster "quiz_01",42,369,"Zombie-6",1015,1;
    sleep 55000;
    monster "quiz_01",42,369,"Zombie-6",1015,1;
    // =========================
    // Round 7
    // =========================
    mapannounce "quiz_01","Round 7! Final Round!",0;
    sleep 10000;
    monster "quiz_01",42,369,"Zombie-7",1015,1;
    sleep 20000;
    monster "quiz_01",42,369,"Zombie-7",1015,1;
    sleep 30000;
    monster "quiz_01",42,369,"Zombie-7",1015,1;
    sleep 40000;
    monster "quiz_01",42,369,"Zombie-7",1036,1;
    sleep 50000;
    monster "quiz_01",42,369,"Zombie-7",1036,1;
    sleep 60000;
    monster "quiz_01",42,369,"Zombie-7",1015,1;
    initnpctimer;
    end;
    // =========================
    // End of Rounds
    // =========================
    OnTimer0500:
    if ( getmapusers("quiz_01") == 0 ) {
      killmonsterall "quiz_01";
      announce "RFYL Event: Event has ended. No one has joined.",0;
      stopnpctimer;
      end;
    } else if ( getmapusers("quiz_01") > 1 ) {
      mapannounce "quiz_01",getmapusers("quiz_01") +" has survived the event.",0,0x00FF00;;
      initnpctimer;
      end;
    }
    initnpctimer;
    end;
    // =========================
    // When players die
    // =========================
    OnPCDieEvent:
    getmapxy .@mapnvz$,.@xnvz,.@ynvz,0;
    if ( .@mapnvz$ == "quiz_01") {
      sleep2 100;
      warp "prontera",156,156;
      atcommand "@alive "+ strcharinfo(0);
      dispbottom "Sorry, but you were killed.";
    }
    sleep2 500;
    if (.@mapnvz$ == "quiz_01" && getmapusers("quiz_01") == 1 ) {
      killmonsterall "quiz_01";
      mapannounce "quiz_01","You have won, approach the Present NPC please.",0;
      enablenpc "Present#RFYL";
      stopnpctimer;
      end;
    }
    end;
    }
    quiz_01,42,378,3 script Present#RFYL 72,{
    mes "[Present for You]";
    mes "Please tell me Your name:";
    next;
    input .@name$;
    if(.@name$ != strcharinfo(0)) {
      mes "[ Present for You ]";
      mes "Are you sure that is Your name?";
      close;
    }
    mes "[ Present for You ]";
    mes "Congrats. You've won.";
    close2;
    announce "Present for You: We have a winner! "+.@name$+" has won the Novice vs Zombie event!",0;
    getitem 673, 5; // 5 Bronze Coin = 5,000,000z
    warp "prontera",156,156;
    disablenpc "Present#RFYL";
    set .Status,0;
    end;
    }
    prontera,156,172,4 script Zombie Master 1298,{
    if (BaseLevel > 1) goto L_ClassLevel; //Change '1' to Your desired level
    if (class == 0) goto L_Event; //Checks if the player is a Novice, if so, proceeds into the event.
    if (class > 0) goto L_ClassLevel; //Checks if the Player is NOT a Novice. If they aren't, they are not allowed to participate.
    L_Event:
    mes "[ ^0000FFZombie Master^000000 ]";
    mes "You wish to participate the Zombie Vs. Novice event?";
    next;
    switch(select("- Yes","- No")) {
    case 1:
    sc_end SC_ALL;
    percentheal 100,100;
    warp "quiz_01",42,369;
    end;
    break;
    case 2:
    next;
    mes "[ ^0000FFZombie Master^000000 ]";
    mes "Come back when Your ready.";
    close;
    break;
    L_ClassLevel:
    mes "[ ^0000FFZombie Master^000000 ]";
    mes "Sorry, but it seems you are not a Novice and Level 1.";
    close;
    }
    // =========================
    // Mapflags
    // =========================
    quiz_01 mapflag nowarpto
    quiz_01 mapflag nowarp
    quiz_01 mapflag noteleport
    quiz_01 mapflag nomemo
    quiz_01 mapflag nosave SavePoint
    quiz_01 mapflag nobranch
    quiz_01 mapflag noicewall
    quiz_01 mapflag nopenalty
    quiz_01 mapflag nobranch
    quiz_01 mapflag noexp
    quiz_01 mapflag noreturn
    quiz_01 mapflag pvp_noparty
    quiz_01 mapflag restricted 1
    

     

     

  2. 
    
    gonryun,167,98,3 script Novice vs. Zombie 1015,{
    if ( BaseLevel != 1 || Class != 0){ 
    mes "[^0000FFZombie Vs. Novice^000000]";
    mes "You must be a level 1 Novice.";
    close;
    }
    if(Weight > 0) {
    mes "Lower your weight, Remove all your items.";
    close;
    }
    mes "[^0000FFZombie Vs. Novice^000000]";
    mes "You want to join the Event?";
    next;
    switch(select("Yes","No")) {
    case 1:
    npctalk ""+strcharinfo(0)+" has registered for the Zombie v.s. Novice.";
    sc_end SC_ALL;
    sc_start SC_DECREASEAGI,1200000,10;
    percentheal 100,100;
    sc_start SC_STRIPSHIELD,1200000,5;
    sc_start SC_STRIPWEAPON,1200000,5;
    sc_start SC_STRIPARMOR,1200000,5;
    sc_start SC_STRIPHELM,1200000,5;
    statusup2 bStr,-999;
    statusup2 bAgi,-999;
    statusup2 bVit,-999;
    statusup2 bInt,-999;
    statusup2 bDex,-999;
    statusup2 bLuk,-999;
    warp "quiz_01",42,369;
    end;
    case 2:
    mes "[^0000FFZombie Vs. Novice^000000]";
    mes "Come Again, if you want to join.";
    break;
    }
    close;
    
    OnInit:
    disablenpc "Novice vs. Zombie";
    disablenpc "Prize";
    end;
    
    OnSat0800:
    OnSat1100:
    OnSat1400:
    OnSat1700:
    OnSun0800:
    OnSun1100:
    OnSun1400:
    OnSun1700:
    announce "Manager: Zombie Vs. Novice Event Registration is now Open, 3 minutes",0;
    killmonsterall "quiz_01";
    sleep 5000;
    announce "Manager: NPC Appeared at Gonryun Town' Register Now!",0;
    enablenpc "Novice vs. Zombie";
    sleep 55000;
    announce "Manager: Zombie Vs. Novice Registration will be closed in 2 minutes!",0;
    sleep 60000;
    announce "Manager: Zombie Vs. Novice Registration will be closed in 1 minute!",0;
    sleep 50000;
    mapannounce "quiz_01","Registration Closed!! in 10 seconds the Event will Start!",0;
    disablenpc "Novice vs. Zombie";
    sleep 5000;
    for( set .@a,5; .@a > 0; set .@a,.@a - 1 ){
    announce "Manager: Monster will spawn in ~"+.@a+"~",0;
    sleep 1000;
    }
    if(getmapusers("guild_vs5") == 1){
    mapannounce "guild_vs5","Manager: Event Ended 1 Participant Only..",0;
    disablenpc "Prize";
    announce "Manager: Event Ended 1 Participant Only",0;
    disablenpc "Novice vs. Zombie";
    sleep 1000;
    }
    for( set .@a,3; .@a > 0; set .@a,.@a - 1 ){
    monster "quiz_01",42,369,"Zombie",1015,2;
    sleep 10000;
    }
    while( getmapusers("quiz_01") > 1 ){
    mapannounce "quiz_01",getmapusers("quiz_01") +" players still alive in the Event.",0,0x00FF00;;
    sleep 2000;
    }
    killmonsterall "quiz_01";
    announce "'Manager: No Player win the Event, due to all participant die.,0;
    mapannounce "quiz_01","Manager: You survive the zombie waves, talk to the Prize NPC to get the reward.",0;
    enablenpc "Prize";
    end;
    
    OnPCDieEvent:
    getmapxy .@mapnvz$,.@xnvz,.@ynvz,0;
    if ( .@mapnvz$ == "quiz_01") {
    sleep2 100;
    warp "prontera",0,0;
    atcommand "@alive "+ strcharinfo(0);
    dispbottom "Sorry, but you were killed.";
    }
    sleep2 100;
    if (.@mapnvz$ == "sec_pri" && getmapusers("quiz_01") == 1 ) {
    killmonsterall "sec_pri";
    sc_start SC_BASILICA,30000,1;
    mapannounce "sec_pri","You have won, approach the R.F.Y.L. Banker NPC please.",0;
    enablenpc "Prize";
    stopnpctimer;
    end;
    }
    end;
    }
    
    quiz_01,42,369,3 script Prize 72,{
    if(getmapusers("quiz_01") > 1){
    npctalk "Only the last Survivor can talk with me.";
    end;
    }
    announce "In ' Zombie Vs. Novice ' has won" + strcharinfo (0) + "! We congratulate "+(( Sex )? "HIM":"HER")+"!",0;
    getitem 7227,1;
    warp "prontera",156,223;
    disablenpc "Prize";
    end;
    }
    
    // == Mapflags
    quiz_01 mapflag gvg
    quiz_01 mapflag nowarp
    quiz_01 mapflag nowarpto
    quiz_01 mapflag noteleport
    quiz_01 mapflag nosave
    quiz_01 mapflag nomemo
    quiz_01 mapflag nobranch
    quiz_01 mapflag pvp_noparty
    quiz_01 mapflag nocommand 80
    quiz_01 mapflag restricted 5
    

     

     

  3. How to add broadcast announcer when you input the reward . Example "  (WHO GIVE the reward) has rewarded (Player gets the reward) with (Package 1.)

    //===== eAthena Script =======================================
    //= Item Rewards NPC
    //===== By: ==================================================
    //= Euphy
    //===== Current Version: =====================================
    //= 1.8
    //===== Description: =========================================
    //= Useful for event rewards, when a player is not necessarily online.
    //= Logging is available, if needed (holds 128 names).
    //= Note: Unclaimed rewards are limited to 64 at a time.
    //============================================================
     
    prontera,156,180,6    script    Item Rewards    836,{
     
    // --------------------- Config ---------------------
    // Package format is "ID1,Count1,ID2,Count2,..."
    // GM Access: Level required to open the GM menu.
    // GM Delete: Level required to erase entries.
    // GM Logging: Level required to manage logs.
     
        set .GMAccess,2;
        set .GMDelete,99;
        set .GMLogging,99;
        set .PackageCount,3;
        setarray .Package1[0],501,1,502,2,503,3;
        setarray .Package2[0],601,5,602,10;
        setarray .Package3[0],607,10;
     
    // --------------------------------------------------
     
        if (getgmlevel() >= .GMAccess) goto GM_Menu;
        mes "[Item Rewards]";
        set .@i,0;
        while (.@i < getarraysize($itemreward$)) {
            if (strcharinfo(0) == $itemreward$[.@i]) goto GetReward;
            set .@i, .@i+2; }
        mes "You have no rewards pending.";
        close;
     
    GetReward:
        if (((Weight*100)/MaxWeight) > 49) {
            mes "You are over the weight limit."; close; }
        if (!checkweight(5055,getarraysize(getd(".Package"+$itemreward$[.@i+1])))) {
            mes "Clear space in your inventory."; close; }
        set .@j,0;
        while (.@j < getarraysize(getd(".Package"+$itemreward$[.@i+1]))) {
            getitem getd(".Package"+$itemreward$[.@i+1]+"["+.@j+"]"),getd(".Package"+$itemreward$[.@i+1]+"["+(.@j+1)+"]");
            set .@j, .@j+2; }
        specialeffect2 248;
        deletearray $itemreward$[.@i],2;
        mes "Here you go!";
        close;
     
    OnMinute00:
    OnMinute30:
        if (!getarraysize($itemreward$)) end;
        set .@i,0;
        while (.@i < getarraysize($itemreward$)) {
            message $itemreward$[.@i],"[You have a reward pending.  See the Item Rewards NPC.]";
            sleep 10;
            set .@i, .@i+2; }
        end;
     
    GM_Menu:
        mes "[Item Rewards]";
        mes "What would you like to do?";
        next;
        switch(select(" ~ ^FF55FFPackage information^000000: ~ ^FF55FFList unclaimed rewards^000000: ~ ^00D900Give a reward^000000: ~ "+((getgmlevel()<.GMDelete)?"^777777":"^DE0000")+"Delete a reward^000000: ~ "+((getgmlevel()<.GMDelete)?"^777777":"^DE0000")+"Delete all unclaimed rewards^000000: ~ "+((getgmlevel()<.GMLogging)?"^777777":"^55AAFF")+"Manage logs^000000: ~ [Close]")) {
            case 1:
                mes "[Item Rewards]";
                set .@j,1;
                while (getd(".Package"+.@j)) {
                    mes "^660099Package " + .@j + ":^000000";
                    set .@i,0;
                    while (.@i < getarraysize(getd(".Package"+.@j))) {
                        mes " ~ " + getd(".Package"+.@j+"["+(.@i+1)+"]") + "x " + getitemname(getd(".Package"+.@j+"["+(.@i)+"]"));
                        set .@i, .@i+2; }
                    set .@j, .@j+1; }
                next;
                goto GM_Menu;
            case 2:
                mes "[Item Rewards]";
                mes "Used space: ^F52887" + (getarraysize($itemreward$)/2) + "^000000/64";
                mes "--------------------------------";
                set .@i,0;
                while (.@i < getarraysize($itemreward$)) {
                    mes "^B041FF" + $itemreward$[.@i] + "^000000: package #" + $itemreward$[.@i+1];
                    set .@i, .@i+2; }
                next;
                goto GM_Menu;
            case 3:
                mes "[Item Rewards]";
                if (getarraysize($itemreward$) > 127) {
                    mes "No more names can be stored.";
                    mes "Delete some values and try again.";
                    next;
                    goto GM_Menu; }
                mes "Input a name, then a package number.";
                input .@name$;
                    query_sql "SELECT `char_id` FROM `char` WHERE `name` = '"+.@name$+"'",.@charid;
                    if (!.@charid) { mes "The name is invalid."; next; goto GM_Menu; }
                        else set .@charid,0;
                input .@package,1,.PackageCount;
                next;
                mes "[Item Rewards]";
                mes "Player: ^B041FF" + .@name$ + "^000000";
                mes "Package: ^B041FF#" + .@package + "^000000";
                mes " ";
                mes "Are you sure?";
                if (select("Yes:No") == 2) { mes "Request cancelled."; next; goto GM_Menu; }
                setarray $itemreward$[getarraysize($itemreward$)],.@name$,.@package;
                message .@name$,"[You have a reward pending.  See the Item Rewards NPC.]";
                if ($itemlog) {
                    if (getarraysize($itemlog1$) > 127) {
                        deletearray $itemlog1$[0],1;
                        deletearray $itemlog2$[0],1; }
                    setarray $itemlog1$[getarraysize($itemlog1$)],strcharinfo(0);
                    setarray $itemlog2$[getarraysize($itemlog2$)],.@name$; }
                mes "Reward added.";
                next;
                goto GM_Menu;
            case 4:
                mes "[Item Rewards]";
                if (getgmlevel() < .GMDelete) {
                    mes "You are not permitted to delete entries."; next; goto GM_Menu; }
                mes "Input a name to cancel a reward.";
                input .@name$;
                set .@i,0;
                while (.@i < getarraysize($itemreward$)) {
                    if ($itemreward$[.@i] == .@name$) {
                        deletearray $itemreward$[.@i],2;
                        mes "Name cleared."; next; goto GM_Menu; }
                    set .@i, .@i+2; }
                mes "The name is invalid.";
                next;
                goto GM_Menu;
            case 5:
                mes "[Item Rewards]";
                if (getgmlevel() < .GMDelete) {
                    mes "You are not permitted to delete entries."; next; goto GM_Menu; }
                mes "^FF0000This action cannot be undone.^000000";
                mes "Are you sure?";
                mes " ";
                if (select("Yes:No") == 2) { mes "Request cancelled."; next; goto GM_Menu; }
                deletearray $itemreward$[0],getarraysize($itemreward$);
                mes "All entries cleared.";
                next;
                goto GM_Menu;
            case 6:
            Log_Menu:
                mes "[Item Rewards]";
                if (getgmlevel() < .GMLogging) {
                    mes "You are not permitted to manage logs."; next; goto GM_Menu; }
                mes "Logs are currently "+(($itemlog)?"^00D900enabled^000000":"^FF0000disabled^000000")+".";
                next;
                switch(select(" ~ ^55AAFFView Logs^000000: ~ "+((!$itemlog)?"^00D900Enable":"^777777Disable")+" logging^000000: ~ ^DE0000Delete all logs^000000: ~ [Go back]")) {
                    case 1:
                        mes "[Item Rewards]";
                        mes "Used space: ^F52887" + (getarraysize($itemlog1$)) + "^000000/128";
                        mes "--------------------------------";
                        set .@i,0;
                        while (.@i < getarraysize($itemlog1$)) {
                            mes "^B041FF" + $itemlog1$[.@i] + "^000000: sent to ^55AAFF" + $itemlog2$[.@i] + "^000000";
                            set .@i, .@i+1; }
                        next;
                        goto Log_Menu;
                    case 2:
                        set $itemlog, ((!$itemlog)?1:0);
                        goto Log_Menu;
                    case 3:
                        mes "[Item Rewards]";
                        mes "^FF0000This action cannot be undone.^000000";
                        mes "Are you sure?";
                        mes " ";
                        if (select("Yes:No") == 2) { mes "Request cancelled."; next; goto Log_Menu; }
                        deletearray $itemlog1$[0],getarraysize($itemlog1$);
                        deletearray $itemlog2$[0],getarraysize($itemlog2$);
                        mes "Logs cleared.";
                        next;
                        goto Log_Menu;
                    case 4:
                        next;
                        goto GM_Menu;
                }
            case 7:
                close;
        }
    } 

     

     

  4. how to edit give prize menu. example i have apple in my inventory then i input it in prize giver then the apple in my inventory lost

    here is the script . sorry for bad english

     

    //===== eAthena Script ======================================= 
    //= Itemizer
    //===== By: ================================================== 
    //= Latheesan (HeliosRO Server Admin) © 2009 HeliosRO.Com
    //===== Current Version: ===================================== 
    //= 1.5
    //===== Compatible With: ===================================== 
    //= Any SQL eAthena Version 
    //===== Description: ========================================= 
    //= To prevent GM Corruption, you can disable all item related
    //= commands and use this NPC to distribute Items and/or KCP.
    //===== Additional Comments: =================================
    //= v1.0 - Initial Release (Report Bugs On eAthena Board)
    //= v1.1 - Fixed A Few Typo In Script
    //= v1.2 - Fixed GM Detection Bug and Cleaned Up The Code
    //= v1.3 - Added User Menu In GM Menu
    //= v1.4 - Added New @check_online and @notify_player Config
    //= v1.5 - Added Announce Feature and code optimized
    //============================================================
    
    //===== SQL Table ============================================ 
    //= Execute This Query On Your Ragnarok Database Prior To Use.
    //= 
    //CREATE TABLE IF NOT EXISTS `itemizer` (
    //  `id` int(11) unsigned NOT NULL auto_increment,
    //  `item_id` int(11) NOT NULL,
    //  `item_amount` int(11) NOT NULL,
    //  `item_name` varchar(255) NOT NULL,
    //  `char_id` int(11) NOT NULL,
    //  `char_name` varchar(255) NOT NULL,
    //  `reason` varchar(255) NOT NULL,
    //  `by_gm` varchar(255) NOT NULL,
    //  `when` datetime NOT NULL,
    //  `for` varchar(255) NOT NULL,
    //  `collected` tinyint(1) NOT NULL,
    //  PRIMARY KEY  (`id`)
    //) ENGINE=MyISAM ;
    
    //
    // Script Interface For Event Prize NPC
    //
    prontera,156,177,4    script    Prize Giver    906,{
    
    // Script Config
    set @npc$,"^008000[ Itemizer ]^000000"; // NPC Name
    
    // Advance Script Config
    set @dummy_kcp_id,123;        // Dummy Item ID Used To Identify If Collection Item == KCP
    set @check_weight,1;        // 1 == Yes | 0 == No (Check If Player Is Over Weight)
    set @min_gm_lvl,60;            // Minimum GM Level Required To "Make Item"
    set @min_eventgm_lvl,60;    // Minimum GM Level Required To "Give Item" and "Give KCP"
    set @min_item_amount,1;        // Minimum Item Amount
    set @max_item_amount,1000;    // Maximum Item Amount
    set @min_kcp_amount,1;        // Minimum KCP Amount
    set @max_kcp_amount,10;        // Maximum KCP Amount
    set @check_online,1;        // Check If Target Player Is Online Before Giving Item
    set @notify_player,1;        // 1 == Yes | 0 == No (Notify Player When GM Gives Them Item)
    set @allow_announce,1;        // 1 == Yes | 0 == No (Let GM Choose If He/She Wants To Announce)
    setarray @announce_loc$,    // Possible Announce Locations
                "bc_all",
                "bc_map",
                "bc_area"; 
    
    // Main Script
    L_Main:
        mes @npc$;
        mes " ";
        if (getgmlevel() > @min_gm_lvl)
        {
            mes "Hello GM "+ strcharinfo(0) +".";
            mes " ";
            mes "What would you like today?";
            switch(select("Make Item","Give Item","Player Menu","Nothing"))
            {
                // Make Item
                case 1: goto L_EP_MakeItem; break;
                
                // Give Item
                case 2: goto L_EP_GiveItem; break;
                
                // Player Menu
                case 4: goto L_EP_Collect; break;
                
                // Nothing
                default: close; break;
            }
        }
        else
        {
            mes "Hello, what would you like today?";
            switch(select("Collect Event Prize","Collection Log","Nothing"))
            {
                // Collect Event Prize
                case 1: goto L_EP_Collect; break;
                
                // Collection Log
                case 2: goto L_EP_CLog; break;
                
                // Nothing
                default: close; break;
            }
        }
    
    // Make Item [GM]
    L_EP_MakeItem:
        next;
        mes @npc$;
        mes " ";
        mes "What item would you like?";
        mes "Enter the ID.";
        input @ep_item_id;
        next;
        if (getitemname(@ep_item_id) == "" || getitemname(@ep_item_id) == "null")
        {
            mes @npc$;
            mes " ";
            mes "^CC0000Sorry, "+ @ep_item_id +" is an invalid item ID.^000000";
            close;
        }
        mes @npc$;
        mes " ";
        mes "Okay, how many "+ getitemname(@ep_item_id) +" do you want?";
        mes " ";
        mes "Min "+ @min_item_amount +" and Max "+ @max_item_amount +".";
        input @ep_item_count;
        next;
        if (@ep_item_count < @min_item_amount || @ep_item_count > @max_item_amount)
        {
            mes @npc$;
            mes " ";
            mes "^CC0000Sorry, "+ @ep_item_count +" is an invalid amount.";
            mes " ";
            mes "Min "+ @min_item_amount +" and Max "+ @max_item_amount +".^000000";
            close;
        }
        if (@check_weight && checkweight(@ep_item_id, @ep_item_count) == 0)
        {
            mes @npc$;
            mes " ";
            mes "^CC0000Sorry, you cannot hold "+ @ep_item_count +"x "+ getitemname(@ep_item_id) +".";
            mes " ";
            mes "Your inventory is full.^000000";
            close;
        }
        set @when$,callfunc("makeTimestamp");
        set @nb,query_sql("INSERT INTO `itemizer` VALUES(NULL,'"+ escape_sql(@ep_item_id) +"','"+ escape_sql(@ep_item_count) +"','"+ escape_sql(getitemname(@ep_item_id)) +"','"+ escape_sql(getcharid(0)) +"','"+ escape_sql(strcharinfo(0)) +"','N/A','[GM] "+ escape_sql(strcharinfo(0)) +"','"+ escape_sql(@when$) +"','gm','1')");
        getitem @ep_item_id,@ep_item_count;
        mes @npc$;
        mes " ";
        mes "All done ~";    
        close;
    
    // Give Item [GM]
    L_EP_GiveItem:
        next;
        mes @npc$;
        mes " ";
        if (getgmlevel() < @min_eventgm_lvl)
        {
            mes "^CC0000Access Denied!";
            mes " ";
            mes "You must be atleast level "+ @min_eventgm_lvl +" GM.^000000";
            close;
        }
        mes "Enter the ID of the Item you would like to give a player.";
        mes " ";
        mes "E.g. ^0000FFID 512^000000 == ^008000Apple^000000";
        input @ep_item_id;
        next;
        if (getitemname(@ep_item_id) == "" || getitemname(@ep_item_id) == "null")
        {
            mes @npc$;
            mes " ";
            mes "^CC0000Sorry, "+ @ep_item_id +" is an invalid item ID.^000000";
            close;
        }
        mes @npc$;
        mes " ";
        mes "Okay, how many "+ getitemname(@ep_item_id) +" do you want to give a player?";
        mes " ";
        mes "Min "+ @min_item_amount +" and Max "+ @max_item_amount +".";
        input @ep_item_count;
        next;
        if (@ep_item_count < @min_item_amount || @ep_item_count > @max_item_amount)
        {
            mes @npc$;
            mes " ";
            mes "^CC0000Sorry, "+ @ep_item_count +" is an invalid amount.";
            mes " ";
            mes "Min "+ @min_item_amount +" and Max "+ @max_item_amount +".^000000";
            close;
        }
        mes @npc$;
        mes " ";
        mes "Okay, who do you want to give "+ @ep_item_count +"x "+ getitemname(@ep_item_id) +"?";
        mes " ";
        mes "Enter player name"+ (@check_online ? " (must be online)." : " .");
        input @ep_char_name$;
        next;
        set @ep_char_id,getcharid(0,@ep_char_name$);
        if (@check_online && !isloggedin(getcharid(3,@ep_char_name$)))
        {
            mes @npc$;
            mes " ";
            mes "^CC0000Sorry, "+ @ep_char_name$ +" is invalid.";
            mes " ";
            mes "This player either doesn't exist or s/he is not online now.^000000";
            close;
        }
        mes @npc$;
        mes " ";
        mes "Now, enter the reason for giving "+ @ep_item_count +"x "+ getitemname(@ep_item_id) +" to "+ @ep_char_name$ +".";
        input @ep_reason$;
        next;
        if (@ep_reason$ == "")
        {
            mes @npc$;
            mes " ";
            mes "^CC0000Sorry, that is not a valid reason.^000000";
            close;
        }
        if (@allow_announce)
        {
            mes @npc$;
            mes " ";
            mes "Do you want to announce the following message?";
            mes " ";
            set @anounce_msg$,"[GM] "+ strcharinfo(0) +" Gave "+ @ep_item_count +"x "+ getitemname(@ep_item_id) +" to "+ @ep_char_name$ +". Reason - "+ @ep_reason$;
            mes @anounce_msg$;
            if (select("Yes:No") == 1) { set @do_announce,1; } else { set @do_announce,0; }
            next;
            if (@do_announce)
            {
                mes @npc$;
                mes " ";
                mes "Where would you like to announce this message?";
                mes " ";
                mes @anounce_msg$;
                set @options$,"";
                for (set @i,0; @i < getarraysize(@announce_loc$); set @i,@i+1)
                {
                    if (@announce_loc$[@i] == "bc_all") {
                        set @options$,@options$+"Server Wide";
                    } else if (@announce_loc$[@i] == "bc_map") {
                        set @options$,@options$+"Everyone In The Same Map";
                    } else if (@announce_loc$[@i] == "bc_area") {
                        set @options$,@options$+"Everyone Near You";
                    }
                    if (@i != (getarraysize(@announce_loc$) - 1)) { set @options$,@options$+":"; }
                }
                set @choice,select(@options$);
                set @a_loc$,@announce_loc$[@choice];
                next;
                mes @npc$;
                mes " ";
                mes "What color do you want to announce in?";
                if (select("Yello:Blue") == 1) { set @a_color$,"bc_yellow"; } else { set @a_color$,"bc_blue"; }
                next;
            }
        }
        mes @npc$;
        mes " ";
        mes "Is this correct?";
        mes " ";
        mes "Give ^0000FF"+ @ep_item_count +"x^000000 ^008000"+ getitemname(@ep_item_id) +"^000000 to ^CC0000"+ @ep_char_name$ +"^000000.";
        mes " ";
        mes "Reason : "+ @ep_reason$;
        if (select("Yes:No") == 1)
        {
            next;
            set @when$,callfunc("makeTimestamp");
            set @nb,query_sql("INSERT INTO `itemizer` VALUES(NULL,'"+ escape_sql(@ep_item_id) +"','"+ escape_sql(@ep_item_count) +"','"+ escape_sql(getitemname(@ep_item_id)) +"','"+ escape_sql(@ep_char_id) +"','"+ escape_sql(@ep_char_name$) +"','"+ escape_sql(@ep_reason$) +"','[GM] "+ escape_sql(strcharinfo(0)) +"','"+ escape_sql(@when$) +"','player','0')");
            mes @npc$;
            mes " ";
            mes "All Done~";
            close2;
            if (@notify_player) { message @ep_char_name$,"[GM] "+ strcharinfo(0) +" Has Given You "+ @ep_item_count +"x "+ getitemname(@ep_item_id) +"."; }
            if (@do_announce)
            {
                if (@a_color$ == "bc_yellow")
                {
                    if (@a_loc$ == "bc_all") {
                        announce @anounce_msg$,bc_yellow|bc_all;
                    } else if (@a_loc$ == "bc_map") {
                        announce @anounce_msg$,bc_yellow|bc_map;
                    } else {
                        announce @anounce_msg$,bc_yellow|bc_area;
                    }
                }
                else
                {
                    if (@a_loc$ == "bc_all") {
                        announce @anounce_msg$,bc_blue|bc_all;
                    } else if (@a_loc$ == "bc_map") {
                        announce @anounce_msg$,bc_blue|bc_map;
                    } else {
                        announce @anounce_msg$,bc_blue|bc_area;
                    }
                }
            }
            end;
        }
        close;
    
    // Give KCP [GM]
    L_EP_GiveKCP:
        next;
        mes @npc$;
        mes " ";
        if (getgmlevel() < @min_eventgm_lvl)
        {
            mes "^CC0000Access Denied!";
            mes " ";
            mes "You must be atleast level "+ @min_eventgm_lvl +" GM.^000000";
            close;
        }
        mes "Okay, how many KCP would you like to give?";
        mes " ";
        mes "Min "+ @min_kcp_amount +" and Max "+ @max_kcp_amount +".";
        input @ep_kcp_count;
        next;
        if (@ep_kcp_count < @min_kcp_amount || @ep_kcp_count > @max_kcp_amount)
        {
            mes @npc$;
            mes " ";
            mes "^CC0000Sorry, "+ @ep_kcp_count +" is an invalid amount.";
            mes " ";
            mes "Min "+ @min_kcp_amount +" and Max "+ @max_kcp_amount +".^000000";
            close;
        }
        mes @npc$;
        mes " ";
        mes "Okay, who do you want to give "+ @ep_kcp_count +" KCP?";
        mes " ";
        mes "Enter player name"+ (@check_online ? " (must be online)." : " .");
        input @ep_char_name$;
        next;
        set @ep_char_id,getcharid(0,@ep_char_name$);
        if (@check_online && !isloggedin(getcharid(3,@ep_char_name$)))
        {
            mes @npc$;
            mes " ";
            mes "^CC0000Sorry, "+ @ep_char_name$ +" is invalid.";
            mes " ";
            mes "This player either doesn't exist or s/he is not online now.^000000";
            close;
        }
        mes @npc$;
        mes " ";
        mes "Now, enter the reason for giving "+ @ep_kcp_count +" KCP to "+ @ep_char_name$ +".";
        input @ep_reason$;
        next;
        if (@ep_reason$ == "")
        {
            mes @npc$;
            mes " ";
            mes "^CC0000Sorry, that is not a valid reason.^000000";
            close;
        }
        if (@allow_announce)
        {
            mes @npc$;
            mes " ";
            mes "Do you want to announce the following message?";
            mes " ";
            set @anounce_msg$,"[GM] "+ strcharinfo(0) +" Gave "+ @ep_kcp_count +"x Kafra Credit Point (KCP) to "+ @ep_char_name$ +". Reason - "+ @ep_reason$;
            mes @anounce_msg$;
            if (select("Yes:No") == 1) { set @do_announce,1; } else { set @do_announce,0; }
            next;
            if (@do_announce)
            {
                mes @npc$;
                mes " ";
                mes "Where would you like to announce this message?";
                mes " ";
                mes @anounce_msg$;
                set @options$,"";
                for (set @i,0; @i < getarraysize(@announce_loc$); set @i,@i+1)
                {
                    if (@announce_loc$[@i] == "bc_all") {
                        set @options$,@options$+"Server Wide";
                    } else if (@announce_loc$[@i] == "bc_map") {
                        set @options$,@options$+"Everyone In The Same Map";
                    } else if (@announce_loc$[@i] == "bc_area") {
                        set @options$,@options$+"Everyone Near You";
                    }
                    if (@i != (getarraysize(@announce_loc$) - 1)) { set @options$,@options$+":"; }
                }
                set @choice,select(@options$);
                set @a_loc$,@announce_loc$[@choice];
                next;
                mes @npc$;
                mes " ";
                mes "What color do you want to announce in?";
                if (select("Yello:Blue") == 1) { set @a_color$,"bc_yellow"; } else { set @a_color$,"bc_blue"; }
                next;
            }
        }
        mes @npc$;
        mes " ";
        mes "Is this correct?";
        mes " ";
        mes "Give ^0000FF"+ @ep_kcp_count +"^000000 ^008000KCP^000000 to ^CC0000"+ @ep_char_name$ +"^000000.";
        mes " ";
        mes "Reason : "+ @ep_reason$;
        if (select("Yes:No") == 1)
        {
            next;
            set @when,callfunc("makeTimestamp");
            set @nb,query_sql("INSERT INTO `itemizer` VALUES(NULL,'"+ @dummy_kcp_id +"','"+ @ep_kcp_count +"','Kafra Credit Point (KCP)','"+ @ep_char_id +"','"+ @ep_char_name$ +"','"+ @ep_reason$ +"','[GM] "+ strcharinfo(0) +"','"+ @when +"','player','0')");
            mes @npc$;
            mes " ";
            mes "All Done~";
            close2;
            if (@notify_player) { message @ep_char_name$,"[GM] "+ strcharinfo(0) +" Has Given You "+ @ep_kcp_count +" Kafra Credit Point (KCP)."; }
            if (@do_announce)
            {
                if (@a_color$ == "bc_yellow")
                {
                    if (@a_loc$ == "bc_all") {
                        announce @anounce_msg$,bc_yellow|bc_all;
                    } else if (@a_loc$ == "bc_map") {
                        announce @anounce_msg$,bc_yellow|bc_map;
                    } else {
                        announce @anounce_msg$,bc_yellow|bc_area;
                    }
                }
                else
                {
                    if (@a_loc$ == "bc_all") {
                        announce @anounce_msg$,bc_blue|bc_all;
                    } else if (@a_loc$ == "bc_map") {
                        announce @anounce_msg$,bc_blue|bc_map;
                    } else {
                        announce @anounce_msg$,bc_blue|bc_area;
                    }
                }
            }
            end;
        }
        close;
    
    // Collect Event Prize (Part 1) [Player]
    L_EP_Collect:
        next;
        mes @npc$;
        mes " ";
        mes "Would you like to check if any item is waiting to be collected?";
        if (select("Yes Please:No Thanks") == 1)
        {
            next;
            if (getarraysize(@db_id))
            {
                deletearray @db_id,127;
                deletearray @item_id,127;
                deletearray @item_name$,127;
                deletearray @item_amount,127;
                deletearray @reason$,127;
                deletearray @by_gm$,127;
            }
            set @result,query_sql("SELECT `id`,`item_id`,`item_name`,`item_amount`,`reason`,`by_gm` FROM `itemizer` WHERE (`char_id` = '"+ getcharid(0) +"' AND `for` = 'player' AND `collected` = 0) LIMIT 127",
                                  @db_id,
                                  @item_id,
                                  @item_name$,
                                  @item_amount,
                                  @reason$,
                                  @by_gm$);
            if (!@result)
            {
                mes @npc$;
                mes " ";
                mes "^CC0000No items are waiting to be collected by you.^000000";
                close;
            }
            else
            {
                goto L_EP_C_Final;
            }
        }
        close;
    
    // Collect Event Prize (Part 2) [Player]
    L_EP_C_Final:
        set @options$,"";
        for (set @i,0; @i < @result; set @i,@i+1)
        {
            set @options$,@options$+@item_amount[@i] +"x "+@item_name$[@i]+":";
        }
        mes @npc$;
        mes " ";
        mes "Here is a list of item(s) waiting to be collected by you.";
        mes " ";
        mes "Pick the item you want to collect now.";
        set @choice,select(@options$) - 1;
        next;
        mes @npc$;
        mes " ";
        if (@item_id[@choice] != @dummy_kcp_id) { mes "ID - "+ @item_id[@choice]; }
        mes "Name - "+ @item_name$[@choice];
        mes "Amount - "+ @item_amount[@choice] +"x";
        mes "By - "+ @by_gm$[@choice];
        mes " ";
        mes "Reason - "+ @reason$[@choice];
        if (select("Collect Now:Collect Later") == 1)
        {
            next;
            if (@item_id[@choice] != @dummy_kcp_id)
            {
                if (@check_weight && checkweight(@item_id[@choice], @item_amount[@choice]) == 0)
                {
                    mes @npc$;
                    mes " ";
                    mes "^CC0000Sorry, you cannot hold "+ @item_amount[@choice] +"x "+ @item_name$[@choice] +".";
                    mes " ";
                    mes "Your inventory is full.^000000";
                    close;
                }
            }
            set @nb,query_sql("UPDATE `itemizer` SET `collected` = 1 WHERE (`id` = '"+ @db_id[@choice] +"') LIMIT 1");
            if (@item_id[@choice] != @dummy_kcp_id)
            {
                getitem @item_id[@choice],@item_amount[@choice];
            }
            else
            {
                set #CASHPOINTS,(#CASHPOINTS + @item_amount[@choice]);
            }
            set @result,(@result - 1);
            deletearray @db_id[@choice],1;
            deletearray @item_id[@choice],1;
            deletearray @item_name$[@choice],1;
            deletearray @item_amount[@choice],1;
            deletearray @reason$[@choice],1;
            deletearray @by_gm$[@choice],1;
            goto L_EP_C_Final;
        }
        else
        {
            next;
            goto L_EP_C_Final;
        }
    
    // Collection Log [Player]
    L_EP_CLog:
        next;
        mes @npc$;
        mes " ";
        if (getarraysize(@item_name$))
        {
            deletearray @item_name$,127;
            deletearray @item_amount,127;
            deletearray @reason$,127;
            deletearray @by_gm$,127;
            deletearray @when$,127;
        }
        if (!@offset){ set @offset,0; }
        if (!@rows_per_page) { set @rows_per_page,10; }
        set @result,query_sql("SELECT `item_name`,`item_amount`,`reason`,`by_gm`,`when` FROM `itemizer` WHERE (`char_id` = '"+ getcharid(0) +"' AND `for` = 'player' AND `collected` = 1) ORDER BY `when` DESC LIMIT "+ @offset +","+ @rows_per_page,
                    @item_name$,
                    @item_amount,
                    @reason$,
                    @by_gm$,
                    @when$);
        if(!@result)
        {
            if (@offset == 10) {
                mes "^CC0000You have not collected any items from me yet.^000000";
            } else {
                mes "^CC0000Sorry, there is no more data.^000000";
            }
            close2;
            if (@offset) { set @offset,0; }
            end;
        }
        else
        {
            for (set @i,0; @i < @result; set @i,@i+1)
            {
                mes "^0000FF"+ @item_amount[@i] +"x^000000 ^008000"+ @item_name$[@i] +"^000000";
                mes "Reason - "+ @reason$[@i];
                mes "By - "+ @by_gm$[@i];
                mes "When - "+ @when$[@i];
                if (@i != (@result - 1)) { mes " "; }
            }
            set @offset,(@offset + @rows_per_page);
            if (select("Next "+ @rows_per_page +" Logs:Cancel") == 2)
            {
                close2;
                if (@offset) { set @offset,0; }
                end;
            }
            goto L_EP_CLog;
        }
    
    }
    
    //
    // Func To Make MySQL Friendly Timestamp
    //
    function    script    makeTimestamp    {
    
    // Get Current Date & Time Variables
    set @curYear,gettime(7);
    set @curMonth,gettime(6);
    set @curDay,gettime(5);
    set @curHour,gettime(3);
    set @curMinute,gettime(2);
    set @curSecond,gettime(1);
    
    // Start A New Timestamp Variable
    set @timestamp$,"";
    
    // MySQL Timestamp Friendly :: Year
    set @timestamp$,@timestamp$+@curYear+"-";
    
    // MySQL Timestamp Friendly :: Month
    if (@curMonth <= 9) {
        set @timestamp$,@timestamp$+"0"+@curMonth+"-";
    } else {
        set @timestamp$,@timestamp$+@curMonth+"-";
    }
    
    // MySQL Timestamp Friendly :: Day
    if (@curDay <= 9) {
        set @timestamp$,@timestamp$+"0"+@curDay+" ";
    } else {
        set @timestamp$,@timestamp$+@curDay+" ";
    }
    
    // MySQL Timestamp Friendly :: Hour
    if (@curHour <= 9) {
        set @timestamp$,@timestamp$+"0"+@curHour+":";
    } else {
        set @timestamp$,@timestamp$+@curHour+":";
    }
    
    // MySQL Timestamp Friendly :: Minute
    if (@curMinute <= 9) {
        set @timestamp$,@timestamp$+"0"+@curMinute+":";
    } else {
        set @timestamp$,@timestamp$+@curMinute+":";
    }
    
    // MySQL Timestamp Friendly :: Second
    if (@curSecond <= 9) {
        set @timestamp$,@timestamp$+"0"+@curSecond;
    } else {
        set @timestamp$,@timestamp$+@curSecond;
    }
    
    // Return MySQL Friendly Timestamp
    return @timestamp$;
    
    }
    
×
×
  • Create New...