Jump to content

Recommended Posts

Posted

The code is deleted in the sql but the codes in-game doesn't erased. I restarted my server and everything. The first version is working fine but the problem is, it has some bugs that can dupe.

Posted

I think i found the bug ! the codes will be selected from database and saved into a array and it doesn't erase before relog. so i need to clean them ! FINALLY ! I'm going to fix that now.

Posted

You don't need to add newlines.. you just simply change these:

@available_code$, @available_item, @available_amount

to these:

.@available_code$, .@available_item, .@available_amount

and every line that contains these variable.

works fine with me.

Posted

You don't need to add newlines.. you just simply change these:

@available_code$, @available_item, @available_amount

to these:

.@available_code$, .@available_item, .@available_amount

and every line that contains these variable.

works fine with me.

WTF IS WRONG WITH ME ? I totally lost my brain! <.<

and yes this works, thanks.

Fixed it finally

Posted (edited)

It's working now ! Thanks tr0n and quesoph..

I added the codes and gave it to my testing char, and finally... it was deleted immediately and I tried even typing the same code, it has no bugs at all, instant delete in "Show Coupons" and in database, looking forward to have improvements and others ~ THANKS !

Suggestions :

Try adding some broadcast on it, example <name> obtained <amount> <item id> in Coupon Jack !

.[/b].
Edited by Paulinds
Posted (edited)

It's working now ! Thanks tr0n and quesoph..

I added the codes and gave it to my testing char, and finally... it was deleted immediately and I tried even typing the same code, it has no bugs at all, instant delete in "Show Coupons" and in database, looking forward to have improvements and others ~ THANKS !

Suggestions :

Try adding some broadcast on it, example <name> obtained <amount> <item id> in Coupon Jack !

.[/b].
[/quote]

try this:
[code]
mes "[^FF7700Coupon Jack^000000]";
mes "You get ^0000FF" + getitemname(.@available_item[@i]) + " - " + .@available_amount[@i] + " ea.^000000";
query_sql "DELETE FROM `coupons` WHERE `code`='"+@my_code$+"'";
getitem .@available_item[@i],.@available_amount[@i];
announce strcharinfo(0)+" Has Claimed "+ .@available_amount[@i] +"x "+ getitemname(.@available_item[@i]) +" for entering the coupon number: "+@my_code$,0;
close;

Thank you for fast update more power!. im not using @kick script command now.

Suggestion is possible to add the logs?

../conf/log_athena.conf

enable this:

0x00020 - (N) Log Script transactions (items deleted/acquired through quests)

Edited by quesoph
  • 4 years later...
  • 5 months later...
Posted (edited)
On 12/05/2012 at 11:36 PM, tr0n said:

Coupon NPC

I had the idea from here: http://rathena.org/b...ional-code-npc/

I decided to make my own script. How does this works ?

The admin speaks to the npc and he/she can add a new coupon. The code will be

generated randomly and automatic and everything will be saved in database.

You can set the code length in script. You only need to enter the item id and the amount.

If a player speaks to the npc he/she can submit a coupon and get the stuff.

The code will be deleted from database after it was used.

Notice: Coupon Codes are limited to 128 (array limit)

Files

 

Changelogs

  • 1.0.0 Release
  • 1.1.0 Added code type feature (normal|md5-hash)
  • 1.1.0 Added prevention for typing 0 into Item ID or Amount
  • 1.1.0 Added a feature for gms to see available coupons
  • 1.1.0 Minor bug fixes
  • 1.1.1 Fixed a bug that caused duplicating items
  • 1.1.2 Added announce if player got a item

 

Features

  • Saves coupons in database
  • randomly generated codes
  • very easy to use

 

How can you help me ?

  • Give me feedback
  • Report bugs
  • Tell me if you like it

 

tr0n

1. How to add the duration of a coupon? ex: valid only for 1 week, valid for 1 month...

2. how to use code on account, not to be used repeatedly in other chars

3. has some way the code stays in this form: aaaa-bbbb-cccc  separated by: - from 3 in 3 code

4. how to add multiple items to win in just 1 coupon

Edited by Haikenz

Join the conversation

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

Guest
Reply to this topic...

×   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...