Jump to content
  • 0

Promo Codes NPC


Linkin Park

Question


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  227
  • Reputation:   11
  • Joined:  11/16/11
  • Last Seen:  

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
Link to comment
Share on other sites

12 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  782
  • Reputation:   82
  • Joined:  01/01/12
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  227
  • Reputation:   11
  • Joined:  11/16/11
  • Last Seen:  

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
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  782
  • Reputation:   82
  • Joined:  01/01/12
  • Last Seen:  

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.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  227
  • Reputation:   11
  • Joined:  11/16/11
  • Last Seen:  

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.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  782
  • Reputation:   82
  • Joined:  01/01/12
  • Last Seen:  

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

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  227
  • Reputation:   11
  • Joined:  11/16/11
  • Last Seen:  

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?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  782
  • Reputation:   82
  • Joined:  01/01/12
  • Last Seen:  

Well now I understand what's your point.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  227
  • Reputation:   11
  • Joined:  11/16/11
  • Last Seen:  

Well now I understand what's your point.

Thanks, also with SQL I can hook up the codes anywhere in the website.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  61
  • Reputation:   1
  • Joined:  06/29/12
  • Last Seen:  

Can have Promo Code Generator, automatic make and add promo code in sql ??

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  42
  • Topics Per Day:  0.01
  • Content Count:  227
  • Reputation:   11
  • Joined:  11/16/11
  • Last Seen:  

NVM, I made one myself.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  2
  • Reputation:   0
  • Joined:  11/05/12
  • Last Seen:  

How to Promo Codes NPC On SQL

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  13
  • Topics Per Day:  0.00
  • Content Count:  28
  • Reputation:   0
  • Joined:  02/17/12
  • Last Seen:  

NVM, I made one myself.

can you share your script? with sql?

Link to comment
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.   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.

×
×
  • Create New...