Jump to content

Question

Posted (edited)

Hi,

I want to request something similar to this one http://rathena.org/b...ional-code-npc/ , but just want to use the promotional codes system.

What I want is just the promotional codes system where the Admin can insert a code and an item that will be given out when the player entered the code.

Let's say for example, Admin talked to the NPC, added code HJ78SD with the prize of 100x TCG Cards. The player that will enter HJ78SD when he tries to redeem the code, he'll get the specific prize.

There will be different prizes for each code, of course to be set by the Admin. 1 code is only redeemable ONCE. So once the code has been redeemed, it will be automatically removed from the database instead of having the status set to 1 like from the link above.

Already made my own.

Edited by RaGERO

12 answers to this question

Recommended Posts

Posted (edited)

No need of SQL db tho. Just use following elements:

// CP
input .PromoCode$;
mes "Promo code is set to " + .PromoCode$ + ".";
set .PromoClaimed,0;
close;
// Redeem
input @PromoCode$;
if (@PromoCode$ != .PromoCode$) {
mes "Code not exist!";
close;
}
if (.PromoClaimed == 1) {
mes "Code has redeemed by someone else.";
close;
}
getitem <item id>,<quantity>;
set .PromoClaimed,1;
close;

Edited by darristan
Posted (edited)

No need of SQL db tho. Just use following elements:

// CP
input .PromoCode$;
mes "Promo code is set to " + .PromoCode$ + ".";
set .PromoClaimed,0;
close;
// Redeem
input @PromoCode$;
if (@PromoCode$ != .PromoCode$) {
mes "Code not exist!";
close;
}
if (.PromoClaimed == 1) {
mes "Code has redeemed by someone else.";
close;
}
getitem <item id>,<quantity>;
set .PromoClaimed,1;
close;

Did you ever read the whole post? That's exactly what the link I posted does. The reason I want to use SQL is so that I can add codes anytime without having to reload the NPC again or using up variables.

Edited by RaGERO
Posted

Not sure why you need to use the SQL, unless you want to keep a log of those codes. You don't have to reload the NPC everytime because it uses temp var that your GM account input.

Posted

Not sure why you need to use the SQL, unless you want to keep a log of those codes. You don't have to reload the NPC everytime because it uses temp var that your GM account input.

Geez, your example uses 1 variable for the code, what if I want to add 100 codes with different prizes for EACH code? Got my point?

Table structure would be

code, item id, amount

Once the code has been redeemed, it will be automatically removed from the database.

Posted

You can still use string array. and the way you talk is a lil bit arrogant.

How to insert a value on a string array whenever I want to add a new code? and how would I remove it from the array once it has been redeemed?

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.   Paste as plain text instead

  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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...