Jump to content
  • 0
Sign in to follow this  
Louis T Steinhil

Pvp countdown on waiting room

Question

Hello guys I would like to make my waiting room to have a countdown from until when my pvp/mvp top event will end. (pvp script is not mine, credits to the owner.)

 

Note: Pvp ends on saturdays and starts on mondays.

 

//===== 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;
	OnInit:
	while(1) {
		delwaitingroom;
		waitingroom "Pvp ends on saturdays",0;
		sleep 1000;
    }
}

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;
}

 

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.