Jump to content

Utility : Promotional Code


Lil Troll

Recommended Posts


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  248
  • Reputation:   34
  • Joined:  11/19/11
  • Last Seen:  

Hi,

 

bug report.

 

Sample you generate a code : welcome123

them if player get it already, then someone "player"  type : WELCOME123 players can spam it.\

 

or

 

Welcome123 - uppercase W   it will spam code.

 

Did you put these queries?

DROP TABLE IF EXISTS `reward_codes`;
DROP TABLE IF EXISTS `reward_logs`;
CREATE TABLE IF NOT EXISTS `reward_codes` (
	`promo` VARCHAR(26) NOT NULL DEFAULT '',
	`nameid` INT(11) UNSIGNED NOT NULL DEFAULT '0',
	`item_name` VARCHAR(50) NOT NULL DEFAULT '',
	`amount` SMALLINT(6) UNSIGNED NOT NULL DEFAULT '0',
	`time_created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
	`limit` INT(10) UNSIGNED NOT NULL DEFAULT '0',
	`pool` INT(10) UNSIGNED NOT NULL DEFAULT '0',
	PRIMARY KEY (`promo`)
) ENGINE = MYISAM;
CREATE TABLE `reward_logs` (
  `code` VARCHAR( 26 ) NOT NULL DEFAULT '',
	`account_id` int(11) unsigned NOT NULL default '0',
	`last_ip` BINARY( 9 ) NOT NULL DEFAULT '',
  `name` VARCHAR( 26 ) NOT NULL DEFAULT '',
	`redeem_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
	`claim` INT( 10 ) NOT NULL default '0',
	PRIMARY KEY (`code`)
) ENGINE = MYISAM;

 

 

Yes. still player's can spam it. with upper case letter.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  276
  • Reputation:   24
  • Joined:  07/06/13
  • Last Seen:  

 

Hi,

 

bug report.

 

Sample you generate a code : welcome123

them if player get it already, then someone "player"  type : WELCOME123 players can spam it.\

 

or

 

Welcome123 - uppercase W   it will spam code.

 

Did you put these queries?

DROP TABLE IF EXISTS `reward_codes`;
DROP TABLE IF EXISTS `reward_logs`;
CREATE TABLE IF NOT EXISTS `reward_codes` (
	`promo` VARCHAR(26) NOT NULL DEFAULT '',
	`nameid` INT(11) UNSIGNED NOT NULL DEFAULT '0',
	`item_name` VARCHAR(50) NOT NULL DEFAULT '',
	`amount` SMALLINT(6) UNSIGNED NOT NULL DEFAULT '0',
	`time_created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
	`limit` INT(10) UNSIGNED NOT NULL DEFAULT '0',
	`pool` INT(10) UNSIGNED NOT NULL DEFAULT '0',
	PRIMARY KEY (`promo`)
) ENGINE = MYISAM;
CREATE TABLE `reward_logs` (
  `code` VARCHAR( 26 ) NOT NULL DEFAULT '',
	`account_id` int(11) unsigned NOT NULL default '0',
	`last_ip` BINARY( 9 ) NOT NULL DEFAULT '',
  `name` VARCHAR( 26 ) NOT NULL DEFAULT '',
	`redeem_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
	`claim` INT( 10 ) NOT NULL default '0',
	PRIMARY KEY (`code`)
) ENGINE = MYISAM;

 

 

Yes. still player's can spam it. with upper case letter.

I upload a quick fix.

Thanks for the report,

shatowolf and uDe

@ude found no close button bug for you, I replaced end with close, in my current svn end is working fine.

from this:

announce "No exisiting codes.",bc_self;
end;

to this:

announce "No exisiting codes.",bc_self;
close;

@shatowolf i add small caps letters, let see if this fix will work, please do reply if you see more of them.

For random code generation,

from this:

setarray .@s$,"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","1","2","3","4","5","6","7","8","9","0";

to this:

setarray .@s$[0],"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","1","2","3","4","5","6","7","8","9","0";	

Or if both of you guys referring to promo code pool count? (Maximum claim limit)

Change this:

setarray $@ClaimLimit[0],1,2,3,4,5,6,7,8,9,10;

To:

setarray $@ClaimLimit[0],1; or set $@ClaimLimit,1;

And in-game if you are manually creating a code.

Set the max claim limit to 1(means the pool count of the code will be 1, after 1 player get a code, it turns to 0 and then the code cannot be claimed again.) See pic Below:

WtRKtlv.png

 
Currently i`m working on a big update for this script but i don't yet have spare time to do the project.

 

I added random code generation length detection, from 5-15 supported chars in this fix.

I used hard coded random code generator,  not the one a using now, because some might caught an errors. 

setarray $@length,5,15; // <MIN>,<MAX> LENGTH CHECK    
// 5 Recommended Minimum due to not recognizing 1234 from garbage deletion.
// 15 maximum characters supported in random code generation.
Edited by Lil Troll
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:  

When will be the final release of this? including the WIP features.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  248
  • Reputation:   34
  • Joined:  11/19/11
  • Last Seen:  

Good day Lil Troll,

 

 

Still it can spam using caps lock. if you caps lock the code it can spam.

 

we are using the latest 1.2.1

Edited by shatowolf
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  400
  • Reputation:   5
  • Joined:  12/05/11
  • Last Seen:  

Good day Lil Troll,

 

 

Still it can spam using caps lock. if you caps lock the code it can spam.

 

Ya.. Me too.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  276
  • Reputation:   24
  • Joined:  07/06/13
  • Last Seen:  

Thanks guys for stating errors,  got to look over it. I think ima re-write the whole sql part. Give me a bit over here. :)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  248
  • Reputation:   34
  • Joined:  11/19/11
  • Last Seen:  

Thanks guys for stating errors,  got to look over it. I think ima re-write the whole sql part. Give me a bit over here. :)

 

 

Sure mate. :)

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  276
  • Reputation:   24
  • Joined:  07/06/13
  • Last Seen:  

Thanks guys for stating errors,  got to look over it. I think ima re-write the whole sql part. Give me a bit over here. :)

 

 

Sure mate. :)

Updated to 1.2.2 actually guys, I do not know what causing you the bug, but it was working fine on me, I think the bug is because of SQL Administrative issues or using older SVN's.

 

YMSXufC.png

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  248
  • Reputation:   34
  • Joined:  11/19/11
  • Last Seen:  

Hi Lil Troll,

 

Create a code like this sir, welcome123

 

and claim it using this Welcome123 uppercase "W"

 

it will trigger the spam. you can get unlimited item using the code Welcome123 uppercase "W"

 

Thanks,

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  276
  • Reputation:   24
  • Joined:  07/06/13
  • Last Seen:  

Its working fine on me, me and my homie also tried connecting to Hamachi to test the script and the video shows the result, do errors appear on your map server?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  43
  • Topics Per Day:  0.01
  • Content Count:  400
  • Reputation:   5
  • Joined:  12/05/11
  • Last Seen:  

Hi Lil Troll,

 

Create a code like this sir, welcome123

 

and claim it using this Welcome123 uppercase "W"

 

it will trigger the spam. you can get unlimited item using the code Welcome123 uppercase "W"

 

Thanks,

 

Or can be abuse with WELCOME123. Try it.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  276
  • Reputation:   24
  • Joined:  07/06/13
  • Last Seen:  

Hi Lil Troll,

 

Create a code like this sir, welcome123

 

and claim it using this Welcome123 uppercase "W"

 

it will trigger the spam. you can get unlimited item using the code Welcome123 uppercase "W"

 

Thanks,

 

Or can be abuse with WELCOME123. Try it.

Using input string is case sensitive. Sorry guys it took long, because I cant get what you both want to say to me. I`m not really good in English. 

 

Now this is the fix:

input .@pcode$;
set .@pc$,strtoupper(.@pcode$);

All inputted codes will be set to uppercase.

 

Also all random codes is generated in upper case.

 

Updated to new version.

 

Please tell me guys if you found new bugs/errors, so that my next release will be much stable. (Includes mailing of codes and referral system.)

Edited by Lil Troll
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  248
  • Reputation:   34
  • Joined:  11/19/11
  • Last Seen:  

As of now, i don't find any bug,

 

it's working fine now,

 

i'll update once i find bug on this. thanks man.

Link to comment
Share on other sites

  • 1 month later...

  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  175
  • Reputation:   7
  • Joined:  09/13/12
  • Last Seen:  

@Lil Troll  u r doing a great job!! I feel u r  improving a lot !!!  kee up the progress! i am sure if u continue this way u will get a user award too !!!

Link to comment
Share on other sites

  • 1 month later...

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

help please

I have problems

I have these errors, any solution?

 

: DB error - Unknown column 'codes' in 'field list'
[Debug]: at script.c:14834 - SELECT `codes`,`redeem_time` FROM `reward_logs` ORDER BY pool ASC LIMIT 25

[Debug]: Source (NPC): LilTrollPCodes (invisible/not on a map)

[Debug]: script debug : 0 110015856 : reward_logs garbage has been deleted.

 

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  2044
  • Reputation:   682
  • Joined:  10/09/12
  • Last Seen:  

http://dba.stackexchange.com/questions/15250/how-to-do-a-case-sensitive-search-in-where-clause

by default, the table creation use charset = latin1;

means it couldn't do a case-sensitive search

if you want to do a case-sensitive in a query, use BINARY

select * from `char` where name = binary('AnnieRuru');
however using BINARY might have performance hit if it is a big table

so its more recommend to convert your sql table to collate with latin1_general_cs

let's say this is a sample table

create table testtest (
id int(11) primary key auto_increment,
name varchar(23)
)engine = innodb;
do an alter table syntax

alter table testtest modify column name varchar(23) collate latin1_general_cs;
or just put it into the table creation

create table testtest (
id int(11) primary key auto_increment,
name varchar(23)
)engine = innodb default charset = latin1 collate latin1_general_cs;

@leondedios

	set .@garbage,query_sql("SELECT `codes`,`redeem_time` FROM `reward_logs` ORDER BY pool ASC LIMIT 25",.@code$);
	for(set .@i,1; .@i <= .@garbage; set .@i,.@i++) {
	query_sql "DELETE FROM `reward_logs` WHERE `codes` = '" + escape_sql(.@code$[0]) + "'";  // Number 1 row will be deleted.
	query_sql "DELETE FROM `reward_logs` WHERE `codes` = '" + escape_sql(.@code$[.@i]) + ""; // Numbers from 2-25 rows will be deleted.
	}
change into

	set .@garbage,query_sql("SELECT `code`,`redeem_time` FROM `reward_logs` ORDER BY pool ASC LIMIT 25",.@code$);
	for(set .@i,1; .@i <= .@garbage; set .@i,.@i++) {
	query_sql "DELETE FROM `reward_logs` WHERE `code` = '" + escape_sql(.@code$[0]) + "'";  // Number 1 row will be deleted.
	query_sql "DELETE FROM `reward_logs` WHERE `code` = '" + escape_sql(.@code$[.@i]) + ""; // Numbers from 2-25 rows will be deleted.
	}
Edited by AnnieRuru
Link to comment
Share on other sites

  • 3 years later...

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  44
  • Reputation:   9
  • Joined:  03/07/13
  • Last Seen:  

: DB error - Data too long for column 'last_ip' at row 1
[Debug]: at c:\#\src\map\script.c:16173 - INSERT INTO `reward_logs` (`account_id`,`last_ip`,`code`,`redeem_time`,`claim`) VALUES ('2000001','#','ROOSTER',NOW(),'1')
[Debug]: Source (NPC): LilTrollPCodes (invisible/not on a map)

Gives this error every time i claim an code.
Seems its not getting the last ip data.
Any idea how to solve this.

Link to comment
Share on other sites

  • 8 months later...

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  48
  • Reputation:   1
  • Joined:  04/14/17
  • Last Seen:  

Hi sir! I'm using your script and it's awesome! But i want to make a npc for it. But if i input the atcommand "@claim" in the script, it says @claim is unknown command. How do i fix this? Thanks

Link to comment
Share on other sites

  • 5 months later...

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.01
  • Content Count:  48
  • Reputation:   0
  • Joined:  02/27/18
  • Last Seen:  

although it works. it still has some bugs.

 

1. when you type "test111" and type "test111 " "test111  " with spaces it doesn't recognize the code as already received.

Link to comment
Share on other sites

  • 6 months later...

  • Group:  Members
  • Topic Count:  257
  • Topics Per Day:  0.08
  • Content Count:  737
  • Reputation:   18
  • Joined:  11/21/15
  • Last Seen:  

it can still claim multiple times by one account and its not bounded

Edited by AinsLord
Link to comment
Share on other sites

  • 1 month later...

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  150
  • Reputation:   11
  • Joined:  12/03/18
  • Last Seen:  

i think that it is still not updated. I tried and i experienced case sensitive issues with same account can still claim the prize. If i switch to one account and i go for another account with the same IP, it can still claim.

Link to comment
Share on other sites

  • 1 year later...

  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.01
  • Content Count:  38
  • Reputation:   0
  • Joined:  11/22/16
  • Last Seen:  

On 12/10/2018 at 6:34 PM, Dev G Inc said:

i think that it is still not updated. I tried and i experienced case sensitive issues with same account can still claim the prize. If i switch to one account and i go for another account with the same IP, it can still claim.

Experiencing this too. Any update for this wonderful script?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  150
  • Reputation:   11
  • Joined:  12/03/18
  • Last Seen:  

21 hours ago, xJhay said:

Experiencing this too. Any update for this wonderful script?

Probably there is actually. Just need to refine it really

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  14
  • Topics Per Day:  0.01
  • Content Count:  38
  • Reputation:   0
  • Joined:  11/22/16
  • Last Seen:  

If you don't mind, could you help us to improve this script? Like I mean this is really a good script and very useful but somehow, players can abuse it.

Link to comment
Share on other sites

  • 4 months later...

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  5
  • Reputation:   0
  • Joined:  10/06/20
  • Last Seen:  

    if(query_sql("SELECT `claim` FROM `reward_logs` WHERE `code` = '" + escape_sql(.@pc$) + "'",.@claim)) { 
        set .@claim,0;
        query_sql("UPDATE `reward_logs` SET `claim` = '"+1+"' WHERE `code` = '" + escape_sql(.@pc$) + "'"); 
    }   
    else {
        query_sql("INSERT INTO `reward_logs` (`account_id`,`last_ip`,`code`,`redeem_time`,`claim`) VALUES ('"+getcharid(3)+"','"+getcharip(strcharinfo(0))+"','"+escape_sql(.@pc$)+"',NOW(),'"+1+"')"); 
    }

 

the problem lies in this line. The reason why everyone can spam it is because it doesn't put any data after the first one so the only that wouldn't be able to spam it is the 1st ip to claim it, if anyone can fix it it would be really great.

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