Jump to content
  • 0
keough

Event Rewarder

Question

Okay i need this kind of npc and it was cool event rewarder in my past official server.

 

Cool Event Rewarder
 
GM Side
- The GM will manually insert the character name of the player who won in the event on the NPC.
- He can give Items, zeny or cashpoint.
- He can give reward even if the player is offline.
 
Player Side
- Player who win can talk to the NPC to get their prizes.
- Player who did not win will not get any.
- Player can get the reward even if offline and he can get when he gets online and talk to the npc.
 
NPC Side
- The npc can give "zeny, items or cashpoint"
- The NPC will give the reward of player who won anytime.
- as mention above, it is a convenient npc rewarder, they can get their rewards anytime they want.
  its like it is stored in sql or something.
 

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Here, I made this for you:

-	script	@give	FAKE_NPC,{
    end;

OnCall:
    .@full$ = implode(.@atcmd_parameters$[0], " "); // put the string back together

    if ((.@full$ ~= "^([1-9]{1,10}) ([Zz]enys?|[Ii]tems? ([0-9]+)|[Cc]ash(?: ?point)?s?) to (.{1,23})$") == false) {
        dispbottom("@give : Invalid syntax!");
        dispbottom("@give : Proper syntax is @give <amount> <zeny | item <name> | cash> to <player name>");
        end;
    }

    .@amount = max(1, atoi($@regexmatch$[1]));
    .@type = ord(strtolower($@regexmatch$[2]));
    .@item = atoi($@regexmatch$[3]);
    .@player$ = escape_sql($@regexmatch$[4]);
    .@player = getcharid(CHAR_ID_ACCOUNT, .@player$);
    .@char = getcharid(CHAR_ID_CHAR, .@player$);

    .@count = query_sql(sprintf("SELECT `name`, `char_id`, `account_id` "
                                "FROM `char` "
                                "WHERE `name` = '%s' LIMIT 1;",
                                .@player$), .@player$, .@char, .@player);

    if (.@count < 1 || .@player < 1 || .@char < 1) {
        dispbottom("@give : Player not found in database!");
        end;
    }

    switch (.@type) {
    case 122: // ZENY
        if (isloggedin(.@player, .@char)) {
            charcommand(sprintf("#zeny \"%s\" %i", .@player$, .@amount));
        } else {
            query_sql(sprintf("INSERT INTO `mail` (send_name,dest_name,dest_id,title,time,zeny) "
                        "VALUES ('%s','%s',%i,'%s',%i,%i);",
                        "SRV", .@player$, .@char, "Event Reward", gettimetick(2), .@amount));
        }
        break;

    case 105: // ITEM
        if (.@item < 1 || getiteminfo(.@item, 0) < 0) {
            dispbottom("@give : Item not found!");
            end;
        }

        if (isloggedin(.@player, .@char)) {
            getitem(.@item, .@amount, .@player);
        } else {
            query_sql(sprintf("INSERT INTO `mail` (send_name,dest_name,dest_id,title,time,amount,nameid) "
                            "VALUES ('%s','%s',%i,'%s',%i,%i,%i);",
                            "SRV", .@player$, .@char, "Event Reward", gettimetick(2), .@amount, .@item));
        }
        break;

    case 99: // CASH
        if (isloggedin(.@player, .@char)) {
            set(getvariableofpc(#CASHPOINTS, .@player), getvariableofpc(#CASHPOINTS, .@player) + .@amount);
        } else {
            query_sql(sprintf("UPDATE `acc_reg_num_db` "
                            "SET `index` = `index` + %i "
                            "WHERE `account_id` = %i AND `key` = '#CASHPOINTS';",
                            .@amount, .@player));
        }
    }

    dispbottom(sprintf("@give : Reward has been delivered to `%s`.", .@player$));
    end;

OnInit:
    bindatcmd("give", "@give::OnCall", 0, 99, 0); // <<< MAKE SURE YOU CHANGE THE GROUP ID HERE
}

 

Example usage:

@give 50 zeny to meko
@give 69 cash to meko
@give 1 item 508 to meko

 

If the player is online the reward is delivered instantly; If the player is offline the reward is delivered via the mail system (except for Cash rewards)

Share this post


Link to post
Share on other sites
  • 0

@meko

 

I do not have a mail system, it is disabled on my server. Thats why i need an NPC based rewarder.

So every player just go to the npc and talk to him whenever thay want. :)

 

I want all players will have to talk to the npc first. 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.