viewing paste Unknown #425 | C

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267
//===== rAthena Script =======================================
// Ranking Script
//===== By: ==================================================
//= Masao
//===== Current Version: =====================================
//= 1.0
//===== Compatible With: =====================================
//= Any rAthena SVN
//===== Description: =========================================
//= An simple Ranker Script which lists PvP Kills & Deaths,
//= MvP kills and Emperium kills.
//=
//= Resets all the Rankings every Monday and on every Sunday
//= the Top Player of each Ranking List receives a Prize.
//===== Additional Comments: =================================
//= 1.0 First Version.
//============================================================
-       script  ranker_funcs    -1,{
 
OnInit:
        // Create Database Table:
        query_sql "CREATE TABLE IF NOT EXISTS `ranker` (`char_id` int(11) unsigned NOT NULL default '0' PRIMARY KEY, `name` varchar(30) NOT NULL default '', `pvp_kills` smallint(4) unsigned NOT NULL default '0', `pvp_deaths` smallint(4) unsigned NOT NULL default '0', `emp_breaks` smallint(4) unsigned NOT NULL default '0', `mvp_kills` smallint(4) unsigned NOT NULL default '0')";
        setarray .mvps[0],1511,1647,1785,1630,1039,1874,2068,1272,1719,1046,1389,1112,1115,1418,1871,1252,1768,1086,1885,1649,1651,1832,1492,1734,1251,1779,1688,2156,1646,1373,1147,1059,1150,2022,1087,1190,1038,1157,1159,2087,2165,1623,1650,1583,1708,1312,1751,1685,1648,1917,1658;
        end;
 
OnPCDieEvent:
        if(getgmlevel() < 40) {
                getmapxy .@m$,.@x,.@y,0;
                if(.@m$ == "rwc03" || .@m$ == "rwc02" || .@m$ == "guild_vs1-1" || .@m$ == "rwc01")
                {
                        set @i,killerrid;
                        query_sql "SELECT `char_id` FROM `char` WHERE `account_id` = '"+@i+"'",@cid;
                        query_sql "SELECT `char_id` FROM `ranker` WHERE `char_id` = '"+@cid+"'",@cid2;
                        if(!@cid2)
                        {
                                query_sql "INSERT `ranker` (`char_id`,`name`,`pvp_kills`,`pvp_deaths`,`emp_breaks`,`mvp_kills`) VALUES ('"+@cid+"','"+escape_sql(strcharinfo(0))+"','0','0','0','0')";
                        }
                        query_sql "UPDATE `ranker` SET `pvp_kills` = `pvp_kills` + 1 WHERE `char_id` = '"+@cid+"'";
                }
        }
        end;
 
OnPCKillEvent:
        if(getgmlevel() < 40) {
                getmapxy .@m$,.@x,.@y,0;
                if(.@m$ == "rwc03" || .@m$ == "rwc02" || .@m$ == "guild_vs1-1" || .@m$ == "rwc01")
                {
                        set @j,killedrid;
                        query_sql "SELECT `char_id` FROM `char` WHERE `account_id` = '"+@j+"'",@cid3;
                        query_sql "SELECT `char_id` FROM `ranker` WHERE `char_id` = '"+@cid3+"'",@cid4;
                        if(!@cid4)
                        {
                                query_sql "INSERT `ranker` (`char_id`,`name`,`pvp_kills`,`pvp_deaths`,`emp_breaks`,`mvp_kills`) VALUES ('"+@cid3+"','"+escape_sql(strcharinfo(0))+"','0','0','0','0')";
                        }
                        query_sql "UPDATE `ranker` SET `pvp_deaths` = `pvp_deaths` + 1 WHERE `char_id` = '"+@cid3+"'";
                }
        }
        end;
 
OnNPCKillEvent:
        if(getgmlevel() < 40) {
                for(set.@i,0; .@i <= 51; set .@i,.@i+1)
                {
                        if(.mvps[.@i] == killedrid)
                        {
                                query_sql "SELECT `char_id` FROM `ranker` WHERE `char_id` = '"+getcharid(0)+"'",@cid;
                                if(!@cid)
                                {
                                        query_sql "INSERT `ranker` (`char_id`,`name`,`pvp_kills`,`pvp_deaths`,`emp_breaks`,`mvp_kills`) VALUES ('"+getcharid(0)+"','"+escape_sql(strcharinfo(0))+"','0','0','0','0')";
                                }
                                query_sql "UPDATE `ranker` SET `mvp_kills` = `mvp_kills` + 1 WHERE `char_id` = '"+getcharid(0)+"'";
                        }
                }
        }
        end;
 
OnClock0001:
        // Clear variables and Table every Monday:
        if(gettime(4) == 1)
        {
                set $@pvpp,0;
                set $@mvpp,0;
                set $@empp,0;
                query_sql "TRUNCATE TABLE `ranker`";
        }
        end;
}
 
prontera,164,174,4      script  Ranker  859,{
 
        set .@n$,"[Ranker]";
 
        mes .@n$;
        mes "Hello "+strcharinfo(0)+",";
        mes "what can i do for you today?";
        next;
        menu "PvP Ranking",-,"MvP Ranking",L_M,"Emperium Ranking",L_E,"Collect Prize",L_CP,"Cancel",L_C;
 
        mes .@n$;
        mes "Would you like to see the Top 10 PvP Ranking or your personal Ranking?";
        next;
        menu "Top 10",-,"Your current PvP Kills / Deaths",L_PvPPP;
 
        query_sql "SELECT `name`, `pvp_kills`, `pvp_deaths` FROM `ranker` ORDER BY `pvp_kills` DESC LIMIT 10",@name$,@pvp_kills,@pvp_deaths;
        mes .@n$;
        mes "Pos. Name | Kills | Deaths";
        mes "1. "+@name$[0]+" | "+@pvp_kills[0]+" | "+@pvp_deaths[0]+"";
        mes "2. "+@name$[1]+" | "+@pvp_kills[1]+" | "+@pvp_deaths[1]+"";
        mes "3. "+@name$[2]+" | "+@pvp_kills[2]+" | "+@pvp_deaths[2]+"";
        mes "4. "+@name$[3]+" | "+@pvp_kills[3]+" | "+@pvp_deaths[3]+"";
        mes "5. "+@name$[4]+" | "+@pvp_kills[4]+" | "+@pvp_deaths[4]+"";
        mes "6. "+@name$[5]+" | "+@pvp_kills[5]+" | "+@pvp_deaths[5]+"";
        mes "7. "+@name$[6]+" | "+@pvp_kills[6]+" | "+@pvp_deaths[6]+"";
        mes "8. "+@name$[7]+" | "+@pvp_kills[7]+" | "+@pvp_deaths[7]+"";
        mes "9. "+@name$[8]+" | "+@pvp_kills[8]+" | "+@pvp_deaths[8]+"";
        mes "10. "+@name$[9]+" | "+@pvp_kills[9]+" | "+@pvp_deaths[9]+"";
        close;
 
L_PvPPP:
        query_sql "SELECT `pvp_kills`, `pvp_deaths` FROM `ranker` WHERE `name` = '"+escape_sql(strcharinfo(0))+"'",@pvp_kills,@pvp_deaths;
        if(!@pvp_kills && !@pvp_deaths)
        {
                mes .@n$;
                mes "Sorry but you haven't killed any Players yet.";
                close;
        }
        mes .@n$;
        mes "Name | Kills | Deaths";
        mes ""+strcharinfo(0)+" | "+@pvp_kills+" | "+@pvp_deaths+"";
        close;
 
L_M:
        mes .@n$;
        mes "Would you like to see the Top 10 MvP Ranking or your personal Ranking?";
        next;
        menu "Top 10",-,"Your current MvP Kills",L_MvPPP;
 
        query_sql "SELECT `name`, `mvp_kills` FROM `ranker` ORDER BY `mvp_kills` DESC LIMIT 10",@name$,@mvp_kills;
        mes .@n$;
        mes "Pos. Name | Kills";
        mes "1. "+@name$[0]+" | "+@mvp_kills[0]+"";
        mes "2. "+@name$[1]+" | "+@mvp_kills[1]+"";
        mes "3. "+@name$[2]+" | "+@mvp_kills[2]+"";
        mes "4. "+@name$[3]+" | "+@mvp_kills[3]+"";
        mes "5. "+@name$[4]+" | "+@mvp_kills[4]+"";
        mes "6. "+@name$[5]+" | "+@mvp_kills[5]+"";
        mes "7. "+@name$[6]+" | "+@mvp_kills[6]+"";
        mes "8. "+@name$[7]+" | "+@mvp_kills[7]+"";
        mes "9. "+@name$[8]+" | "+@mvp_kills[8]+"";
        mes "10. "+@name$[9]+" | "+@mvp_kills[9]+"";
        close;
 
L_MvPPP:
        query_sql "SELECT `mvp_kills` FROM `ranker` WHERE `name` = '"+escape_sql(strcharinfo(0))+"'",@mvp_kills;
        if(!@mvp_kills)
        {
                mes .@n$;
                mes "Sorry but you haven't killed any MvP's yet.";
                close;
        }
        mes .@n$;
        mes "Name | Kills";
        mes ""+strcharinfo(0)+" | "+@mvp_kills+"";
        close;
 
L_E:
        mes .@n$;
        mes "Would you like to see the Top 10 Empe Rranking or your personal Ranking?";
        next;
        menu "Top 10",-,"Your current Emp. Kills",L_EMPPP;
 
        query_sql "SELECT `name`, `emp_breaks` FROM `ranker` ORDER BY `emp_breaks` DESC LIMIT 10",@name$,@emp_breaks;
        mes .@n$;
        mes "Pos. Name | Kills";
        mes "1. "+@name$[0]+" | "+@emp_breaks[0]+"";
        mes "2. "+@name$[1]+" | "+@emp_breaks[1]+"";
        mes "3. "+@name$[2]+" | "+@emp_breaks[2]+"";
        mes "4. "+@name$[3]+" | "+@emp_breaks[3]+"";
        mes "5. "+@name$[4]+" | "+@emp_breaks[4]+"";
        mes "6. "+@name$[5]+" | "+@emp_breaks[5]+"";
        mes "7. "+@name$[6]+" | "+@emp_breaks[6]+"";
        mes "8. "+@name$[7]+" | "+@emp_breaks[7]+"";
        mes "9. "+@name$[8]+" | "+@emp_breaks[8]+"";
        mes "10. "+@name$[9]+" | "+@emp_breaks[9]+"";
        close;
 
L_EMPPP:
        query_sql "SELECT `emp_breaks` FROM `ranker` WHERE `name` = '"+escape_sql(strcharinfo(0))+"'",@emp_breaks;
        if(!@emp_breaks)
        {
                mes .@n$;
                mes "Sorry but you haven't killed any Emperiums yet.";
                close;
        }
        mes .@n$;
        mes "Name | Kills";
        mes ""+strcharinfo(0)+" | "+@emp_breaks+"";
        close;
 
L_CP:
        if(gettime(4) != 0)
        {
                mes .@n$;
                mes "Sorry but the prizes can only be collected during Sundays.";
                close;
        }
        query_sql "SELECT `name` FROM `ranker` ORDER BY `pvp_kills` DESC LIMIT 1",@name$;
        query_sql "SELECT `name` FROM `ranker` ORDER BY `mvp_kills` DESC LIMIT 1",@name1$;
        query_sql "SELECT `name` FROM `ranker` ORDER BY `emp_breaks` DESC LIMIT 1",@name2$;
        if((strcharinfo(0) != @name$[0]) && (strcharinfo(0) != @name1$[0]) && (strcharinfo(0) != @name2$[0]))
        {
                mes .@n$;
                mes "I'm sorry but you're not in the first Position of any Ranking!";
                close;
        }
        if((strcharinfo(0) == @name$[0]) && ($@pvpp != 1))
        {
                mes .@n$;
                mes "Congratulations!";
                mes "You're this weeks Number 1 PvP Killer!";
                mes "You've been rewarded with 500 Cashpoints.";
                set #CASHPOINTS,#CASHPOINTS+500;
                set $@pvpp,1;
                close;
        }
        else if((strcharinfo(0) == @name1$[0]) && ($@mvpp != 1))
        {
                mes .@n$;
                mes "Congratulations!";
                mes "You're this weeks Number 1 MvP Killer!";
                mes "Here is your Prize and have fun with it.";
                getitem 12103,3; // Bloody Branch 3ea.
                set $@mvpp,1;
                close;
        }
        else if((strcharinfo(0) == @name2$[0]) && ($@empp != 1))
        {
                mes .@n$;
                mes "Congratulations!";
                mes "You're this weeks Number 1 Emp. Killer!";
                mes "Here is your Prize and have fun with it.";
                getitem 14288,2; // Guardian Stone Repairkit 2ea.
                set $@empp,1;
                close;
        }
        mes .@n$;
        mes "I'm sorry but it seems like you've already collected your Prize this week.";
        close;
 
L_C:
        mes .@n$;
        mes "Ok, bye.";
        close;
}
 
function        script  ranker_woe      {
 
        if(getgmlevel() < 40) {
                query_sql "SELECT `char_id` FROM `ranker` WHERE `char_id` = '"+getcharid(0)+"'",@cid;
                if(!@cid)
                {
                        query_sql "INSERT `ranker` (`char_id`,`name`,`pvp_kills`,`pvp_deaths`,`emp_breaks`,`mvp_kills`) VALUES ('"+getcharid(0)+"','"+escape_sql(strcharinfo(0))+"','0','0','0','0')";
                }
                query_sql "UPDATE `ranker` SET `emp_breaks` = `emp_breaks` + 1 WHERE `char_id` = '"+getcharid(0)+"'";
        }
        end;
}
Viewed 275 times, submitted by unknown.