Jump to content

Coupon NPC [1.1.2]


tr0n

Recommended Posts


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

^its instant.

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

Changelogs 1.1.1:

  • Fixed a bug that caused duplicating items (Thanks to Emistry)

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:  

@tr0n

I hope this works, Thanks Emistry and tr0n !

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:  

@tron

A lil typo..

Replace:

mes "You get ^0000FF" + getitemname(@available_item[@i]) + " - " + @available_item[@i] + " ea.^000000";

to

mes "You get ^0000FF" + getitemname(@available_item[@i]) + " - " + @available_amount[@i] + " ea.^000000";

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:  

argh, I copied it from Emistry :( i'll fix that quick. thanks

EDIT: DONE

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

@tr0n

I got a problem while giving out the codes to the players as an event for a test. I just input the "amount" from 10 and I made lots of Coupon Codes. Then suddenly some of my players got atleast 400~500 amount of the item I input.

if i was right.....then i think those player are using this method to achieve above situation...

  • GM Generate Coupon for Items and give the Code to Players.
  • Players gain items from the NPC by giving the right Code.
  • but then...unfortunately.....they found a way to Duplicate your Items / Coupons...
  • this is the way how they do it....
  • Give the Correct Code , then get items. before they Close the Message Window .... they ...Relog / ALT + F4

so....after they relog / Alt +F4 ......the Coupon actually is not deleted from the SQL. ....because...the command line that delete the SQL only executed right after they closed the message window of NPC.

mes "[^FF7700Coupon Jack^000000]";
mes "You get ^0000FF" + getitemname(@available_item[@i]) + " - " + @available_item[@i] + " ea.^000000";
close2;
query_sql "DELETE FROM `coupons` WHERE `code`='"+@my_code$+"'";
getitem @available_item[@i],@available_amount[@i];
end;

if you want...you can try it like this...i think it should be able to solve above problems.


mes "[^FF7700Coupon Jack^000000]";
mes "You get ^0000FF" + getitemname(@available_item[@i]) + " - " + @available_item[@i] + " ea.^000000";
query_sql "DELETE FROM `coupons` WHERE `code`='"+@my_code$+"'";
getitem @available_item[@i],@available_amount[@i];
close;

and....make sure you dont generate alot Coupon with SAME Code.

I also monitored my SQL, and it has been deleted right away. In just a few minutes, after that I got reports that players got 400~500 amount.

ya...the query will be delete if player click on "Close" button to close the NPC Message.

Emistry, how it can be that you get the item before it gets deleted in sql ? the query is before getitem.

Does the query need a bit of time ?

erm..i was refer the close2 command you using. because you run the query deletion line right after....

aw....i just now only saw what tr0n try to tell me ..... >.<

you get item only after the query is deleted... >.< swt i missed this...LOL...

erm...

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:  

Ahm, what is MD5-hash?

I tried the latest coupon, The Code doesn't erase and can be abuse.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.00
  • Content Count:  713
  • Reputation:   70
  • Joined:  11/08/11
  • Last Seen:  

2 tips:

- that label isn't really necessary, would look nicer if you used {}

- why don't you set the variables on the OnInit label instead of setting them everytime the user clicks the npc?

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:  

@Emistry

how could this be bugged then when the query deletes the data before it gets the item ?

2 tips:

- that label isn't really necessary, would look nicer if you used {}

- why don't you set the variables on the OnInit label instead of setting them everytime the user clicks the npc?

- would look nicer ? it checks '@coupon_item' 2 times so I would need to write it down again. that's why I use label to avoid this.

That's better. And why I shouldn't use a label ?

- that's just a style of me. But yea you're right. Would be better if I put it in OnInit.

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 latest release can still be abused.

Suggestion sir, what if the last message will not leave a dialog box.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  386
  • Reputation:   15
  • Joined:  11/17/11
  • Last Seen:  

+1 the latest is still abuse, when i input the code and after i got it, and i input it again it still continueing giving me a Main Guachce #1207

Is there any problem with the script tr0n?

Thanks for this!

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 will check it and find the bug. Last time I tested it, it worked bugless :(

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:  

Hehe, you can do it ! The script you made is awesome <3 Good for implementing Donation Codes or anything XD THANKS FOR THE RELEASE & I hope some bugs will be fixed soon...

Suggestion : Just remove the last message of the script "mes" i think..

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:  

Im not a pro in script but i already fix the bug, i am using simple script lets check this.

Find

if(@my_code$==@available_code$[@i])

{

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];

close;

}

Replace this

if(@my_code$==@available_code$[@i])

{

mes "[^FF7700Coupon Jack^000000]";

mes "After you enter the code you will be disconnect in 3 secs.";

next;

mes "[^FF7700Coupon Jack^000000]";

mes "3.";

next;

mes "[^FF7700Coupon Jack^000000]";

mes "2.";

next;

mes "[^FF7700Coupon Jack^000000]";

mes "1.";

next;

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];

atcommand "@kick " +strcharinfo(0);

close;

}

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:  

@Khaii

Why don you just make him use @refresh instead of kicking or warping back to the save point...

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:  

Refresh is not working. on my mind this code query_sql "DELETE FROM `coupons` WHERE `code`='"+@my_code$+"'"; will be effect if you are going to character select.

Why dont you try.

Edited by Khaii
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:  

query works after it is triggered not after you're going to character select.

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:  

Oh i see..Well i shared my fix script working on 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:  

I uploaded it again with changes:

{
  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$+"'";
  sleep2 3000;
  close2;
  getitem @available_item[@i],@available_amount[@i];
  end;
}

this should work maybe.

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:  

The code is abuse again.

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 don't understand how this is possible..

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:  

@tr0n

Maybe try making it a delay.. Receiving in 3-2-1.. then the dialog box closes then the item will be received something like that sir. The code is being abused on what sir Emistry said, character select or warping in its place..

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:  

For example ill add the code then after input the code they give me item, then ill try twice input they will give me again item.

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:  

does the server gives you any errors ? if something is wrong with the query the server should output a error

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:  

Nope script working fine. this is posible bug

For example ill add the code then after input the code they give me item, then ill try twice input they will give me again item.

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