Jump to content

Coupon NPC [1.1.2]


tr0n

Recommended Posts


  • Group:  Members
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  562
  • Reputation:   152
  • Joined:  02/21/12
  • Last Seen:  

but that could only mean that the code wasn't deleted. Or am I wrong ?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  142
  • Topics Per Day:  0.03
  • Content Count:  511
  • Reputation:   7
  • Joined:  02/15/12
  • Last Seen:  

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.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  562
  • Reputation:   152
  • Joined:  02/21/12
  • Last Seen:  

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.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  47
  • Topics Per Day:  0.01
  • Content Count:  323
  • Reputation:   9
  • Joined:  11/19/11
  • Last Seen:  

Exactly thats why ill put the kick commands.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  562
  • Reputation:   152
  • Joined:  02/21/12
  • Last Seen:  

Fixed. please test!

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  210
  • Reputation:   10
  • Joined:  11/20/11
  • Last Seen:  

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.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  562
  • Reputation:   152
  • Joined:  02/21/12
  • Last Seen:  

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

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  210
  • Reputation:   10
  • Joined:  11/20/11
  • Last Seen:  

Glad it helped. :)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  142
  • Topics Per Day:  0.03
  • Content Count:  511
  • Reputation:   7
  • Joined:  02/15/12
  • Last Seen:  

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


  • Group:  Members
  • Topic Count:  47
  • Topics Per Day:  0.01
  • Content Count:  323
  • Reputation:   9
  • Joined:  11/19/11
  • Last Seen:  

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

Suggestion is possible to add the logs?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.00
  • Content Count:  210
  • Reputation:   10
  • Joined:  11/20/11
  • Last Seen:  

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


  • Group:  Members
  • Topic Count:  142
  • Topics Per Day:  0.03
  • Content Count:  511
  • Reputation:   7
  • Joined:  02/15/12
  • Last Seen:  

@quesoph

Thank you sir ~ It's working now :)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  562
  • Reputation:   152
  • Joined:  02/21/12
  • Last Seen:  

UPDATE TO 1.1.2

Now you're able to activate announce if a player gets a item.

uncomment line '104' to activate it.

Link to comment
Share on other sites

  • 4 years later...

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  1
  • Reputation:   0
  • Joined:  02/18/17
  • Last Seen:  

+99 for this ! thanks!

Link to comment
Share on other sites

  • 5 months later...

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  27
  • Reputation:   0
  • Joined:  10/18/13
  • Last Seen:  

You can set the number of records in the account at what time to use this serial number to get the serial number of items

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  84
  • Topics Per Day:  0.02
  • Content Count:  309
  • Reputation:   82
  • Joined:  11/15/11
  • Last Seen:  

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

×
×
  • Create New...