Alexandrite Posted January 8, 2018 Group: Members Topic Count: 21 Topics Per Day: 0.01 Content Count: 54 Reputation: 0 Joined: 02/19/14 Last Seen: September 10, 2024 Share Posted January 8, 2018 I mean if I edit acc_reg_num > #CASHPOINTS while i'm still logining in game my #CASHPOINTS won't update until I relogin, I want it to refresh without re-login , is it possible? because I saw some server can do this without re login the game Quote Link to comment Share on other sites More sharing options...
0 Balfear Posted January 9, 2018 Group: Members Topic Count: 13 Topics Per Day: 0.00 Content Count: 256 Reputation: 245 Joined: 07/24/13 Last Seen: March 24 Share Posted January 9, 2018 (edited) On 1/9/2018 at 3:19 AM, Alexandrite said: It's not work when there multiple same of account_id only donation 100 work while 555 not work but status all become 1 - script DonationUpdate -1,{ OnInit: start: initnpctimer; end; OnTimer5000: set $@nb2,query_sql("SELECT COUNT(*) FROM test_donation WHERE status=0",$@count); if($@count != 0) { set $@nb,query_sql("SELECT id, account_id,donate,status FROM test_donation WHERE status='0'",$@id,$@account_id,$@donate,$@status); for (.@i = 0; .@i < $@nb; .@i++) { if (isloggedin($@account_id[.@i])) { // check if player online atcommand "#cash \""+rid2name($@account_id[.@i])+"\" "+$@donate[.@i]; query_sql("UPDATE test_donation SET status='1' WHERE id='"+$@id[.@i]+"' AND account_id='"+$@account_id[.@i]+"'"); } } } else finish: stopnpctimer; goto start; } CREATE TABLE `test_donation` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `account_id` INT(11) NOT NULL, `donate` INT(11) NOT NULL, `status` INT(11) NOT NULL DEFAULT '0', `time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) COLLATE='cp1251_general_ci' ENGINE=InnoDB AUTO_INCREMENT=1 ; Fixed. Edited November 12, 2019 by Balfear Quote Link to comment Share on other sites More sharing options...
0 Alexandrite Posted January 8, 2018 Group: Members Topic Count: 21 Topics Per Day: 0.01 Content Count: 54 Reputation: 0 Joined: 02/19/14 Last Seen: September 10, 2024 Author Share Posted January 8, 2018 Can anyone help me (Or understand me?) I'm not good at explain thing in English Quote Link to comment Share on other sites More sharing options...
0 Balfear Posted January 8, 2018 Group: Members Topic Count: 13 Topics Per Day: 0.00 Content Count: 256 Reputation: 245 Joined: 07/24/13 Last Seen: March 24 Share Posted January 8, 2018 (edited) Why you don`t want use script command or atcommand?set #CASHPOINTS,#CASHPOINTS + XXX; or@cash XXX / #cash charnick XXX Edited January 8, 2018 by Balfear Quote Link to comment Share on other sites More sharing options...
0 Alexandrite Posted January 8, 2018 Group: Members Topic Count: 21 Topics Per Day: 0.01 Content Count: 54 Reputation: 0 Joined: 02/19/14 Last Seen: September 10, 2024 Author Share Posted January 8, 2018 (edited) 5 minutes ago, Balfear said: Why you don`t want use script command or atcommand?set #CASHPOINTS,#CASHPOINTS + XXX; or@cash XXX / #cash charnick XXX Because I'm planing to make it as a script to php for make it as website donation :3 (Not sure im explaining well) Edited January 8, 2018 by Alexandrite Quote Link to comment Share on other sites More sharing options...
0 Balfear Posted January 8, 2018 Group: Members Topic Count: 13 Topics Per Day: 0.00 Content Count: 256 Reputation: 245 Joined: 07/24/13 Last Seen: March 24 Share Posted January 8, 2018 (edited) 23 minutes ago, Alexandrite said: Because I'm planing to make a script to php to make it as website donation :3 Try use this script: //===== rAthena Script ======================================= //= Donate converter //===== By: ================================================== //= Balfear //===== Last Updated: ======================================== //= 20171207 //===== Description: ========================================= //= Automatic convert player balance("cp_credits") to cashpoint in game when player login. //============================================================ - script balance2cashpoint -1,{ OnPCLoginEvent: query_sql("select balance from `cp_credits` WHERE account_id = " + getcharid(3) + "", .@balance); if (.@balance != 0) { query_sql ("UPDATE `cp_credits` SET balance = 0 WHERE account_id = " + getcharid(3) + ""); set #CASHPOINTS,(#CASHPOINTS + .@balance); announce "Gain cash point: "+.@balance+"",bc_self, 0xADFFC5, FW_BOLD; } end; } Read player ballance from `cp_credits` an converting to Cashpoints. Edited January 8, 2018 by Balfear Quote Link to comment Share on other sites More sharing options...
0 Alexandrite Posted January 8, 2018 Group: Members Topic Count: 21 Topics Per Day: 0.01 Content Count: 54 Reputation: 0 Joined: 02/19/14 Last Seen: September 10, 2024 Author Share Posted January 8, 2018 Well I didn't have fluxcp install anymore, is it work on manual table if I made? Quote Link to comment Share on other sites More sharing options...
0 Alexandrite Posted January 8, 2018 Group: Members Topic Count: 21 Topics Per Day: 0.01 Content Count: 54 Reputation: 0 Joined: 02/19/14 Last Seen: September 10, 2024 Author Share Posted January 8, 2018 Error :V player not attached! Quote Link to comment Share on other sites More sharing options...
0 Alexandrite Posted January 8, 2018 Group: Members Topic Count: 21 Topics Per Day: 0.01 Content Count: 54 Reputation: 0 Joined: 02/19/14 Last Seen: September 10, 2024 Author Share Posted January 8, 2018 (edited) 14 minutes ago, Balfear said: Try use this script: //===== rAthena Script ======================================= //= Donate converter //===== By: ================================================== //= Balfear //===== Last Updated: ======================================== //= 20171207 //===== Description: ========================================= //= Automatic convert player balance("cp_credits") to cashpoint in game when player login. //============================================================ - script balance2cashpoint -1,{ OnPCLoginEvent: query_sql("select balance from `cp_credits` WHERE account_id = " + getcharid(3) + "", .@balance); if (.@balance != 0) { query_sql ("UPDATE `cp_credits` SET balance = 0 WHERE account_id = " + getcharid(3) + ""); set #CASHPOINTS,(#CASHPOINTS + .@balance); announce "Gain cash point: "+.@balance+"",bc_self, 0xADFFC5, FW_BOLD; } end; } Read player ballance from `cp_credits` an converting to Cashpoints. from what i read, your code only work for new login I mean for player who actually logined for a long time and not even logout to get cash refresh > < I mean, I want #CASHPOINTS alway uptime whenever it get update from outside the game, while player still logined in game Edited January 8, 2018 by Alexandrite Quote Link to comment Share on other sites More sharing options...
0 Balfear Posted January 8, 2018 Group: Members Topic Count: 13 Topics Per Day: 0.00 Content Count: 256 Reputation: 245 Joined: 07/24/13 Last Seen: March 24 Share Posted January 8, 2018 (edited) Script automaticly check sql table every 10 sec and find line where status = 0 then it use atcommand in game #cash nick xxx Script: (update) - script DonationUpdate -1,{ OnInit: start: initnpctimer; end; OnTimer5000: set $@nb2,query_sql("SELECT COUNT(*) FROM test_donation WHERE status=0",$@count); if($@count != 0) { set $@nb,query_sql("SELECT id, account_id,donate,status FROM test_donation WHERE status='0'",$@id,$@account_id,$@donate,$@status); for (.@i = 0; .@i < $@nb; .@i++) { if (isloggedin($@account_id[.@i])) { // check if player online atcommand "#cash "+rid2name($@account_id[.@i])+" "+$@donate[.@i]; query_sql("UPDATE test_donation SET status='1' WHERE id='"+$@id[.@i]+"' AND account_id='"+$@account_id[.@i]+"'"); } } } else finish: stopnpctimer; goto start; } SQL table: CREATE TABLE `test_donation` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `account_id` INT(11) NOT NULL, `donate` INT(11) NOT NULL, `status` INT(11) NOT NULL DEFAULT '0', `time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`id`) ) COLLATE='cp1251_general_ci' ENGINE=InnoDB AUTO_INCREMENT=24 ; INSERT INTO `test_donation` (`id`, `account_id`, `donate`, `status`) VALUES (1, 2000000, 100, 0); I`ll check it, all work fine. Edited January 9, 2018 by Balfear Quote Link to comment Share on other sites More sharing options...
0 Alexandrite Posted January 8, 2018 Group: Members Topic Count: 21 Topics Per Day: 0.01 Content Count: 54 Reputation: 0 Joined: 02/19/14 Last Seen: September 10, 2024 Author Share Posted January 8, 2018 It still not working :V Quote Link to comment Share on other sites More sharing options...
0 Balfear Posted January 8, 2018 Group: Members Topic Count: 13 Topics Per Day: 0.00 Content Count: 256 Reputation: 245 Joined: 07/24/13 Last Seen: March 24 Share Posted January 8, 2018 3 minutes ago, Alexandrite said: It still not working :V Do you have any error? Quote Link to comment Share on other sites More sharing options...
0 Alexandrite Posted January 8, 2018 Group: Members Topic Count: 21 Topics Per Day: 0.01 Content Count: 54 Reputation: 0 Joined: 02/19/14 Last Seen: September 10, 2024 Author Share Posted January 8, 2018 4 minutes ago, Balfear said: Do you have any error? oh ok it's work now , but i wonder if this code can handle massive player online? Quote Link to comment Share on other sites More sharing options...
0 Alexandrite Posted January 9, 2018 Group: Members Topic Count: 21 Topics Per Day: 0.01 Content Count: 54 Reputation: 0 Joined: 02/19/14 Last Seen: September 10, 2024 Author Share Posted January 9, 2018 It's also work now just like this - script DonationUpdate -1,{ OnInit: OnTimer1000: set $@nb2,query_sql("SELECT COUNT(*) FROM test_donation WHERE status=0",$@count); if($@count != 0) { set $@nb,query_sql("SELECT account_id,donate,status FROM test_donation WHERE status='0'",$@account_id,$@donate,$@status); atcommand "#cash "+rid2name($@account_id)+" "+$@donate; query_sql("UPDATE test_donation SET status='1' WHERE account_id='"+$@account_id+"'"); } initnpctimer; end; } But I'm not sure if this code can handle massive player online? Or is it check if player online or not? Quote Link to comment Share on other sites More sharing options...
0 Balfear Posted January 9, 2018 Group: Members Topic Count: 13 Topics Per Day: 0.00 Content Count: 256 Reputation: 245 Joined: 07/24/13 Last Seen: March 24 Share Posted January 9, 2018 (edited) I think is better to use the function OnPCLoginEvent: I`ll update script. Yes it check. Edited January 9, 2018 by Balfear Quote Link to comment Share on other sites More sharing options...
0 Alexandrite Posted January 9, 2018 Group: Members Topic Count: 21 Topics Per Day: 0.01 Content Count: 54 Reputation: 0 Joined: 02/19/14 Last Seen: September 10, 2024 Author Share Posted January 9, 2018 The Code still change status to 1 even if i'm offline too lol... So if i'm not online it won't work > <" Quote Link to comment Share on other sites More sharing options...
0 Balfear Posted January 9, 2018 Group: Members Topic Count: 13 Topics Per Day: 0.00 Content Count: 256 Reputation: 245 Joined: 07/24/13 Last Seen: March 24 Share Posted January 9, 2018 (edited) 31 minutes ago, Balfear said: Script automaticly check sql table every 10 sec and find line where status = 0 then it use atcommand in game #cash nick xxx Script: (update) - script DonationUpdate -1,{ OnInit: start: initnpctimer; end; OnTimer10000: set $@nb2,query_sql("SELECT COUNT(*) FROM test_donation WHERE status=0",$@count); if($@count != 0) { set $@nb,query_sql("SELECT account_id,donate,status FROM test_donation WHERE status='0'",$@account_id,$@donate,$@status); if (isloggedin($@account_id)) { // check if player online atcommand "#cash "+rid2name($@account_id)+" "+$@donate; query_sql("UPDATE test_donation SET status='1' WHERE account_id='"+$@account_id+"'"); } } else finish: stopnpctimer; goto start; } Just update your script if (isloggedin([email protected]_id)) { // check if player online atcommand "#cash "+rid2name([email protected]_id)+" "[email protected]; query_sql("UPDATE test_donation SET status='1' WHERE account_id='"[email protected]_id+"'"); } Edited January 9, 2018 by Balfear Quote Link to comment Share on other sites More sharing options...
0 Alexandrite Posted January 9, 2018 Group: Members Topic Count: 21 Topics Per Day: 0.01 Content Count: 54 Reputation: 0 Joined: 02/19/14 Last Seen: September 10, 2024 Author Share Posted January 9, 2018 2 minutes ago, Balfear said: if (isloggedin($@account_id)) { // check if player online Yeah ! It's work perfectly fine now Thank you - script DonationUpdate -1,{ OnTimer1000: OnInit: set $@nb2, query_sql("SELECT COUNT(*) FROM test_donation WHERE status=0", $@count); if($@count != 0) { set $@nb,query_sql("SELECT account_id,donate,status FROM test_donation WHERE status='0'",$@account_id,$@donate,$@status); if (isloggedin($@account_id)) { // check if player online atcommand "#cash "+rid2name($@account_id)+" "+$@donate; query_sql("UPDATE test_donation SET status='1' WHERE account_id='"+$@account_id+"'"); } } initnpctimer; end; } Still wonder if it's work on multiple donation? massive donation? Quote Link to comment Share on other sites More sharing options...
0 Alexandrite Posted January 9, 2018 Group: Members Topic Count: 21 Topics Per Day: 0.01 Content Count: 54 Reputation: 0 Joined: 02/19/14 Last Seen: September 10, 2024 Author Share Posted January 9, 2018 Testing on 2 Account And It's worked fine! :3 Not able to test more tough > < Quote Link to comment Share on other sites More sharing options...
0 Alexandrite Posted January 9, 2018 Group: Members Topic Count: 21 Topics Per Day: 0.01 Content Count: 54 Reputation: 0 Joined: 02/19/14 Last Seen: September 10, 2024 Author Share Posted January 9, 2018 It's not work when there multiple same of account_id only donation 100 work while 555 not work but status all become 1 Quote Link to comment Share on other sites More sharing options...
0 Alexandrite Posted January 9, 2018 Group: Members Topic Count: 21 Topics Per Day: 0.01 Content Count: 54 Reputation: 0 Joined: 02/19/14 Last Seen: September 10, 2024 Author Share Posted January 9, 2018 worked fine now, THX! :3 Quote Link to comment Share on other sites More sharing options...
Question
Alexandrite
I mean if I edit acc_reg_num > #CASHPOINTS while i'm still logining in game
my #CASHPOINTS won't update until I relogin, I want it to refresh without re-login , is it possible? because I saw some server can do this without re login the game
Link to comment
Share on other sites
20 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.