Ninjamon Posted March 12, 2013 Posted March 12, 2013 I need a npc that if you will designate a specific code. Example the code is "jdsa41jd" and if a player put that code on the npc he will receive a specific Item(s) (Can only be used 1 per IP or 1 Per Account) Quote
Ninjamon Posted March 12, 2013 Author Posted March 12, 2013 It looks like this http://rathena.org/board/topic/63332-coupon-npc-112/ But it gives a player the item when he just know the code. Unlike that after you type the code, no one can retype it again. Quote
Shakto Posted March 15, 2013 Posted March 15, 2013 (edited) Use the sql table with all you coupon You have to delete the row in the script : query_sql "DELETE FROM `coupons` WHERE `code`='"+@my_code$+"'"; query_sql "SELECT `code`, `item_id`, `item_amount` FROM `coupons`", .@available_code$, .@available_item, .@available_amount; for (set @i, 0; @i < getarraysize(.@available_code$); set @i, @i+1) { if(@my_code$==.@available_code$[@i]) { mes "[^FF7700Coupon Jack^000000]"; mes "You get ^0000FF" + getitemname(.@available_item[@i]) + " - " + .@available_amount[@i] + " ea.^000000"; getitem .@available_item[@i],.@available_amount[@i]; //announce "Coupon Jack: " + strcharinfo(0) + " got " + .@available_amount[@i] + getitemname(.@available_item[@i]) + "(s).",0; close; } } And for IP verification : create an other table (code of coupon,player ip), you can have player ip by checking the login table : query_sql "SELECT `last_ip` FROM `login` WHERE `account_id` = "+getcharid(3)+"", .@IP; You can do that for both account_id or ip, like you want And you fill the new table with a query ; INSERT INTO After you just have to check if the player already used his coupon Edited March 15, 2013 by Shakto Quote
Question
Ninjamon
I need a npc that if you will designate a specific code.
Example the code is "jdsa41jd" and if a player put that code on the npc he will receive a specific Item(s)
(Can only be used 1 per IP or 1 Per Account)
5 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.