shatowolf Posted September 26, 2013 Posted September 26, 2013 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. Quote
Lil Troll Posted September 26, 2013 Author Posted September 26, 2013 (edited) 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: 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 September 27, 2013 by Lil Troll Quote
Drakkus Posted September 27, 2013 Posted September 27, 2013 When will be the final release of this? including the WIP features. Quote
shatowolf Posted September 27, 2013 Posted September 27, 2013 (edited) 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 September 27, 2013 by shatowolf 1 Quote
uDe Posted September 27, 2013 Posted September 27, 2013 Good day Lil Troll, Still it can spam using caps lock. if you caps lock the code it can spam. Ya.. Me too. Quote
Lil Troll Posted September 27, 2013 Author Posted September 27, 2013 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. Quote
shatowolf Posted September 27, 2013 Posted September 27, 2013 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. Quote
Lil Troll Posted October 1, 2013 Author Posted October 1, 2013 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. Quote
shatowolf Posted October 1, 2013 Posted October 1, 2013 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, Quote
Lil Troll Posted October 1, 2013 Author Posted October 1, 2013 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? Quote
uDe Posted October 2, 2013 Posted October 2, 2013 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. Quote
Lil Troll Posted October 2, 2013 Author Posted October 2, 2013 (edited) 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 October 2, 2013 by Lil Troll Quote
shatowolf Posted October 4, 2013 Posted October 4, 2013 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. Quote
orange Posted November 7, 2013 Posted November 7, 2013 @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 !!! Quote
leondedios Posted January 6, 2014 Posted January 6, 2014 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. Quote
AnnieRuru Posted January 7, 2014 Posted January 7, 2014 (edited) 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 tableso 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 January 7, 2014 by AnnieRuru Quote
GM Henry Posted January 28, 2017 Posted January 28, 2017 : 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. Quote
Imbecile Posted October 17, 2017 Posted October 17, 2017 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 Quote
Leic Posted April 2, 2018 Posted April 2, 2018 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. Quote
AinsLord Posted October 21, 2018 Posted October 21, 2018 (edited) it can still claim multiple times by one account and its not bounded Edited October 21, 2018 by AinsLord Quote
PsyOps Posted December 10, 2018 Posted December 10, 2018 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. Quote
xJhay Posted September 2, 2020 Posted September 2, 2020 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? Quote
PsyOps Posted September 3, 2020 Posted September 3, 2020 21 hours ago, xJhay said: Experiencing this too. Any update for this wonderful script? Probably there is actually. Just need to refine it really Quote
xJhay Posted September 4, 2020 Posted September 4, 2020 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. Quote
xerxesbreak Posted January 12, 2021 Posted January 12, 2021 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. Quote
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.