rokimoki 19 Posted September 11, 2016 PvP Rank (needs SQL version) Hello, This is another script I made years ago and I updated for Hercules and made SQL version, just put in your server and @reloadscript in order to implement the waiting room and create the sql table (you don't need to create anything, the script will do for you). Or just reboot the server. Screenshot 1 Screenshot 2 Screenshot 3 Screenshot 4 Screenshot 5 Screenshot 6 What it really does? Warps you to a PvP Map: "pvp_n_1-5". If you kill someone you gain 1 pvp point and will broadcast a map announce. If you die you don't loose anything. If you commit suicide you don't gain/loose anything, but will show a map announce that you commited suicide. Shows the PvP Rank Ladder. Every time you enter the pvp map it will be displayed your current pvp points. How does it work? Join PvP map through prontera warp. Read the pvp ladder through bulletin board in prontera npc. If you want to change the pvp map I think it's pretty easy, just read the script and do it. You can download from GitHub link the attached file is the initial release, use GitHub for the lastest version. pvpRank.txt 1 Legend reacted to this Quote Share this post Link to post Share on other sites
Emistry 145 Posted September 12, 2016 Hey, Rokimoki. It's been awhile since I last saw you in forum (probably back in eA forum) Some tips for you to improve it, if you want. 1. query_sql("SELECT `char_id` FROM `custom_pvprank` WHERE `char_id` = " + getcharid(0) + ";", .@flag[0]); if (!.@flag[0]) { // create kill_count query_sql("INSERT INTO `custom_pvprank` (char_id, kill_count) VALUES ('" + getcharid(0) + "','" + kill_count + "');"); } else { // update kill_count query_sql("UPDATE `custom_pvprank` SET `kill_count` = " + kill_count + ";"); } this part can actually be simplified into 1 query.. which is INSERT INTO..... ON DUPLICATE KEY UPDATE ..... but, you have to set the `char_id` as primary key for the table. Since the ladder only store 1 row per characters, so you won't need to worry on duplicate `char_id`. Anyway you already made it as primary key... 2. cleararray .@players$[0], "", 10; // defining 10 positions cleararray .@kill_count[0], 0, 10; if (strcmp(.@players$[.@i], "") == 0) break; // if some is empty, stop printing these are not really necessary .... those npc scope variable will be auto cleared once the conversation with the NPC ended. char name shall never be empty unless somewhere in your query gone wrong... but yet you can skip this by adding another checking in the query which is better if you really need it. another reason for that would be, IF it happen one of the player having empty name, the ranking display will be a mess. 3. getmapxy(.@map$,.@x,.@y,0); since the .@x and .@y variable are not used, you can actually replace the getmapxy() into strcharinfo(3) which work the same, return the current map name. 4. if (rid2name(killedrid) == strcharinfo(0)) { // prevent suicide for gaining points can be replace by this ... if ( killedrid == getcharid(0) ) 5. sleep 50; haha, you dont really need to update the waitingroom display that frequent, it keep resources. 1 seconds are better Quote Share this post Link to post Share on other sites
rokimoki 19 Posted September 12, 2016 Hi, I was fully active in eA forums. I will probabbly update those tips soon and I just recycled the script in order to get into this again, of course new scripts will be more clean and optimized than this, anyway there are lot of new script functions and changes. I wanted to do for everyone without changing anything. I prefer sending the job to the db engine instead of coding but... well... it's enough and simple xD. I did the break because I loop 0 to 9 instead of using getarraysize (or whatever) because it didn't work for me, or I did it in a wrong way. Yeah, I forgot lot of things and that's was recycled. That's much better optimization, but was recycled too. Anyway, I don't think that will hurt, but I don't know... maybe you are right. I really appreciate your feedback I will update soon. Thanks. Quote Share this post Link to post Share on other sites
@kippoy 0 Posted September 13, 2016 Thank you for this! Quote Share this post Link to post Share on other sites