sparkle Posted June 29, 2021 Group: Members Topic Count: 7 Topics Per Day: 0.01 Content Count: 13 Reputation: 0 Joined: 08/19/20 Last Seen: August 27, 2023 Share Posted June 29, 2021 I managed to make a Hercules script compatible to rAthena last rev, but i don't know how to update these sql lines to rathena. Full Code by AnnieRuru: https://github.com/AnnieRuru/Release/blob/master/scripts/Games%20%26%20Events/MVP%20Rank/Monthly%20MVP%20Rank%201.3.txt Code. OnClock0000: //if (gettime(6) != 1) end; L_give: // query_sql "TRUNCATE TABLE `mvp_rank_archive`"; // uncomment this line if you love to periodically clean your data $mvp_ladder_last_given = atoi(gettime(7) +""+ gettime(6)); .@nb = query_sql("SELECT `char_id`, `name`, `kills` FROM `mvp_rank` ORDER BY `kills` DESC LIMIT 10", .@cid, .@name$, .@kills); if (!.@nb) end; setarray .@reward, 501, 502, 503, 504, 505; setarray .@amount, 10, 9, 8, 7, 6; for (.@i = 0; .@i < .@nb; ++.@i) mail .@cid[.@i], "[MVP Rank]", "MVP Ranking", "Congratulations for earning pos number "+(.@i +1)+".", 0, .@reward[.@i], .@amount[.@i]; if (gettime(6) > 10) .@store_date$ = gettime(7) +"-"+(gettime(6) -1)+"-00 00:00:00"; // how to update this to rathena else if (gettime(6) > 1) .@store_date$ = gettime(7) +"-0"+(gettime(6) -1)+"-00 00:00:00"; // how to update this to rathena else .@store_date$ = (gettime(7) -1) +"-12-00 00:00:00"; // how to update this to rathena for (.@i = 0; .@i < .@nb; ++.@i) .@store$[.@i] = "('"+ .@store_date$ +"', "+(.@i +1)+", "+ .@cid[.@i] +", '"+ escape_sql(.@name$[.@i]) +"', "+ .@kills[.@i] +")"; // how to update this to rathena query_sql "INSERT INTO `mvp_rank_archive` VALUES "+ implode(.@store$, ","); // how to update this to rathena query_sql "TRUNCATE `mvp_rank`"; end; // SQL FILES /* CREATE TABLE `mvp_rank_archive` ( `date` datetime NOT NULL, `pos` tinyint(6) unsigned NOT NULL default '0', `char_id` int(11) NOT NULL default '0', `name` varchar(25) NOT NULL default '', `kills` int(11) NOT NULL default '0', PRIMARY KEY(`date`, `pos`) ) ENGINE=MyISAM AUTO_INCREMENT=1; CREATE TABLE `mvp_rank` ( `char_id` int(11) NOT NULL default '0', `name` varchar(25) NOT NULL default '', `kills` int(11) NOT NULL default '0', KEY `kills` (`kills`) ) ENGINE=MyISAM; */ Error in map-serv [SQL]: DB error - Incorrect datetime value: '2021-05-00 00:00:00' for column 'date' at row 1 [Debug]: at script.cpp:17335 - INSERT INTO `mvp_rank_archive` VALUES ('2021-05-00 00:00:00', 1, 150000, 'd', 2) Thanks in advance. Quote Link to comment Share on other sites More sharing options...
0 sparkle Posted June 30, 2021 Group: Members Topic Count: 7 Topics Per Day: 0.01 Content Count: 13 Reputation: 0 Joined: 08/19/20 Last Seen: August 27, 2023 Author Share Posted June 30, 2021 Solved by nitrous and Gardosen in discord Quote Link to comment Share on other sites More sharing options...
Question
sparkle
I managed to make a Hercules script compatible to rAthena last rev, but i don't know how to update these sql lines to rathena.
Full Code by AnnieRuru: https://github.com/AnnieRuru/Release/blob/master/scripts/Games%20%26%20Events/MVP%20Rank/Monthly%20MVP%20Rank%201.3.txt
Code.
OnClock0000: //if (gettime(6) != 1) end; L_give: // query_sql "TRUNCATE TABLE `mvp_rank_archive`"; // uncomment this line if you love to periodically clean your data $mvp_ladder_last_given = atoi(gettime(7) +""+ gettime(6)); .@nb = query_sql("SELECT `char_id`, `name`, `kills` FROM `mvp_rank` ORDER BY `kills` DESC LIMIT 10", .@cid, .@name$, .@kills); if (!.@nb) end; setarray .@reward, 501, 502, 503, 504, 505; setarray .@amount, 10, 9, 8, 7, 6; for (.@i = 0; .@i < .@nb; ++.@i) mail .@cid[.@i], "[MVP Rank]", "MVP Ranking", "Congratulations for earning pos number "+(.@i +1)+".", 0, .@reward[.@i], .@amount[.@i]; if (gettime(6) > 10) .@store_date$ = gettime(7) +"-"+(gettime(6) -1)+"-00 00:00:00"; // how to update this to rathena else if (gettime(6) > 1) .@store_date$ = gettime(7) +"-0"+(gettime(6) -1)+"-00 00:00:00"; // how to update this to rathena else .@store_date$ = (gettime(7) -1) +"-12-00 00:00:00"; // how to update this to rathena for (.@i = 0; .@i < .@nb; ++.@i) .@store$[.@i] = "('"+ .@store_date$ +"', "+(.@i +1)+", "+ .@cid[.@i] +", '"+ escape_sql(.@name$[.@i]) +"', "+ .@kills[.@i] +")"; // how to update this to rathena query_sql "INSERT INTO `mvp_rank_archive` VALUES "+ implode(.@store$, ","); // how to update this to rathena query_sql "TRUNCATE `mvp_rank`"; end; // SQL FILES /* CREATE TABLE `mvp_rank_archive` ( `date` datetime NOT NULL, `pos` tinyint(6) unsigned NOT NULL default '0', `char_id` int(11) NOT NULL default '0', `name` varchar(25) NOT NULL default '', `kills` int(11) NOT NULL default '0', PRIMARY KEY(`date`, `pos`) ) ENGINE=MyISAM AUTO_INCREMENT=1; CREATE TABLE `mvp_rank` ( `char_id` int(11) NOT NULL default '0', `name` varchar(25) NOT NULL default '', `kills` int(11) NOT NULL default '0', KEY `kills` (`kills`) ) ENGINE=MyISAM; */
Error in map-serv
[SQL]: DB error - Incorrect datetime value: '2021-05-00 00:00:00' for column 'date' at row 1 [Debug]: at script.cpp:17335 - INSERT INTO `mvp_rank_archive` VALUES ('2021-05-00 00:00:00', 1, 150000, 'd', 2)
Thanks in advance.
Link to comment
Share on other sites
1 answer 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.