Altimage Posted October 31, 2012 Group: Members Topic Count: 23 Topics Per Day: 0.01 Content Count: 96 Reputation: 1 Joined: 03/07/12 Last Seen: January 19, 2023 Share Posted October 31, 2012 (edited) - script cutrue_refill -1,{ //--- Check Timer OnPCLoginEvent: query_sql "select SUM(refill_amount) as sum_refill_amount from cutrue where account_id='"+getcharid(3)+"' and refill='NO'",.@sum_refill_amount; if (.@sum_refill_amount>0) { set #CASHPOINTS,(#CASHPOINTS + .@sum_refill_amount); query_sql "update cutrue set refill='YES' where account_id='"+getcharid(3)+"' and refill='NO'"; dispbottom "you got CASH "+.@sum_refill_amount+" cash"; close; } end; } - script cutrue_refill_auto 111,{ //--- Check credit card every 10 second OnTimer10000: query_sql "select id,account_id,refill_amount from cutrue where refill='NO' and refill_amount>0",.id,.account_id,.refill_amount; sleep2 500; if (getarraysize(.id) > 0) { for (set .i,0; .i < getarraysize(.id); set .i,.i+1) { if(attachrid(.account_id[.i])==1) { query_sql "select refill from cutrue where id='"+.id[.i]+"'",.check_refill$; if(.check_refill$=="NO") { dispbottom "You got cash " +.refill_amount[.i]+" Cash"; set #CASHPOINTS,(#CASHPOINTS + .refill_amount[.i]); query_sql "update cutrue set refill='YES' where id='"+.id[.i]+"'"; } } detachrid; } } deletearray .id,getarraysize(.id); deletearray .account_id,getarraysize(.account_id); deletearray .refill_amount,getarraysize(.refill_amount); //--- Bonus credit query_sql "select id,account_id,item_id,item_name,item_amount from cutrue_item_bonus where bonus_refill='NO' and item_amount>0",.idb,.account_idb,.item_id,.item_name$,.item_amount; sleep2 500; if (getarraysize(.idb) > 0) { for (set .j,0; .j < getarraysize(.idb); set .j,.j+1) { if(attachrid(.account_idb[.j])==1) { query_sql "select bonus_refill from cutrue_item_bonus where id='"+.idb[.j]+"'",.check_refill$; if(.check_refill$=="NO") { dispbottom "You got bonus Item : "+.item_name$[.j]+" "+.item_amount[.j]+" ea"; getitem .item_id[.j],.item_amount[.j]; query_sql "update cutrue_item_bonus set bonus_refill='YES' where id='"+.idb[.j]+"'"; } } detachrid; } } deletearray .id,getarraysize(.idb); deletearray .account_id,getarraysize(.account_idb); deletearray .item_id$,getarraysize(.item_id$); deletearray .item_name$,getarraysize(.item_name$); deletearray .item_amount,getarraysize(.item_amount); setnpctimer 0; startnpctimer; end; OnInit: initnpctimer; startnpctimer; end; } Why ontimer not check? //--- Check credit card every 10 second OnTimer10000: This script auto add cash when user add the credit card "http://www.latte-ro.com/tmpay/" eAthena + 3Ceam is working. Edited October 31, 2012 by AnnieRuru use [codebox] if the script > 10 lines Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted October 31, 2012 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share Posted October 31, 2012 (edited) at least post out your SQL table for cutrue Create Table `cutrue` ( id int(11) .... .... ) engine = blahblah your script doesn't have a SELECT * FROM `cutrue` to shows the full table information for us Edited October 31, 2012 by AnnieRuru Quote Link to comment Share on other sites More sharing options...
Altimage Posted November 1, 2012 Group: Members Topic Count: 23 Topics Per Day: 0.01 Content Count: 96 Reputation: 1 Joined: 03/07/12 Last Seen: January 19, 2023 Author Share Posted November 1, 2012 CREATE TABLE IF NOT EXISTS `cutrue` ( `id` BIGINT( 20 ) NOT NULL AUTO_INCREMENT PRIMARY KEY , `account_id` VARCHAR( 20 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL , `ip` varchar(15) collate utf8_unicode_ci NOT NULL, `serial` VARCHAR( 14 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL , `amount` INT( 4 ) NOT NULL DEFAULT '0', `dt` DATETIME NOT NULL , `status` ENUM( 'เน€เธเนเธฒเธชเธนเนเธฃเธฐเธเธ', 'เธเธณเธฅเธฑเธเธ”เธณเน€เธเธดเธเธเธฒเธฃ', 'เธชเธณเน€เธฃเนเธ', 'เนเธกเนเธชเธณเน€เธฃเนเธ', 'เนเธเนเนเธเนเธฅเนเธง' ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL , `refill_amount` INT( 7 ) NOT NULL DEFAULT '0', `refill` ENUM( 'YES', 'NO' ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT 'YES' ) ENGINE = MYISAM ; CREATE TABLE IF NOT EXISTS `cutrue_item_bonus` ( `id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY , `account_id` VARCHAR( 20 ) NOT NULL , `item_id` VARCHAR( 20 ) NOT NULL , `item_name` varchar(255) collate utf8_unicode_ci NOT NULL, `item_amount` INT( 11 ) NOT NULL , `bonus_rate` VARCHAR( 10 ) NOT NULL, `bonus_date` DATE NOT NULL, `bonus_refill` ENUM( 'YES', 'NO' ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT 'YES' ) ENGINE = MYISAM ; Quote Link to comment Share on other sites More sharing options...
Ryokem Posted November 1, 2012 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 205 Reputation: 19 Joined: 10/12/12 Last Seen: November 7, 2013 Share Posted November 1, 2012 (edited) I'm not really solving the problem, but I was wondering about some parts of your script... OnInit: initnpctimer; startnpctimer; end; } Uh? Why are you starting the timer with initnpctimer; and then starting back again with startnpctimer; ? You can't really start an already started timer lol. just use one. Better initnpctimer; as it automatically sets the npc timer to 0. - script cutrue_refill_auto 111,{ I'm wondering about the 111 sprite. 111 is an invisible sprite that allows an npc to still be clickable (it appears the dialogue icon when scrolling the cursor over the npc location). But how can a clickable npc have no maps and no coords? This actually can work, but it can fall into weird server debugings. - script cutrue_refill_auto -1,{ Edited November 1, 2012 by Ryokem Quote Link to comment Share on other sites More sharing options...
AnnieRuru Posted November 1, 2012 Group: Members Topic Count: 18 Topics Per Day: 0.00 Content Count: 2044 Reputation: 682 Joined: 10/09/12 Last Seen: December 20, 2020 Share Posted November 1, 2012 (edited) @Ryokem I think this guy come from some company ... that SQL table and the website is really professionally design @_@ he is learning how to make rathena script language that's why he is asking here anyway if you think a script is not working can always use *Debugmes script command and this is how I debug your script //--- Check credit card every 10 second OnTimer10000: debugmes "asdf"; // <-- I added this line to see your timer is running or not query_sql "select id,account_id,refill_amount from cutrue where refill='NO' and refill_amount>0",.id,.account_id,.refill_amount; sleep2 500; so the fix is setnpctimer 0; startnpctimer; end; OnInit: initnpctimer; startnpctimer; end; change into initnpctimer; end; OnInit: initnpctimer; end; EDIT: the reason is because if you want to change a npc timer, you have to stop the npc timer 1st like stopnpctimer; setnpctimer 5000; // you can set the timer freely to any value startnpctimer; but since you only wants to repeat itself every 10 seconds initnpctimer; <-- did the job itself Edited November 1, 2012 by AnnieRuru Quote Link to comment Share on other sites More sharing options...
Ryokem Posted November 1, 2012 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 205 Reputation: 19 Joined: 10/12/12 Last Seen: November 7, 2013 Share Posted November 1, 2012 @Ryokem I think this guy come from some company ... that SQL table and the website is really professionally design @_@ he is learning how to make rathena script language that's why he is asking here Oh.. I'm actually studying SQL and databases at university at the moment, only half course done till now and honestly I can say that's not really something so advanced, what was really hard to do was just to find out every attribute of the table he used, but that's just boringly long more than difficult... He sure has some DB knowledges, but that's not really hard. Quote Link to comment Share on other sites More sharing options...
Altimage Posted November 1, 2012 Group: Members Topic Count: 23 Topics Per Day: 0.01 Content Count: 96 Reputation: 1 Joined: 03/07/12 Last Seen: January 19, 2023 Author Share Posted November 1, 2012 thkz so mush Quote Link to comment Share on other sites More sharing options...
Question
Altimage
Why ontimer not check?
This script auto add cash when user add the credit card "http://www.latte-ro.com/tmpay/"
eAthena + 3Ceam is working.
Edited by AnnieRuruuse [codebox] if the script > 10 lines
Link to comment
Share on other sites
6 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.