Jump to content
  • 0

top 2 who died the most


luizinhomt

Question


  • Group:  Members
  • Topic Count:  36
  • Topics Per Day:  0.01
  • Content Count:  111
  • Reputation:   1
  • Joined:  01/05/13
  • Last Seen:  

Good evening everyone, could someone show me an example of how to create two scripts where it will show the two players who died the most on the server, when clicking on the script, show the number of times they died and a menu to reset the NPC, thank you very much everyone

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  211
  • Reputation:   92
  • Joined:  06/02/12
  • Last Seen:  

Hi

prontera,161,220,5	script	Top 2 who died the most	4_BOARD3,{
	mes "[Top 2 who died the most]";
	
	.@nb = query_sql( "SELECT count(2) as deaths, (SELECT name FROM `char` where char_id = died_id) FROM diedlog GROUP BY died_id ORDER BY deaths DESC LIMIT 2", .@kills, .@name$ );
	query_sql( "SELECT count(2) as deaths FROM diedlog where died_id = '" + getcharid(0) + "'", .@personal );
	if (.@nb) {
		for ( .@i = 0; .@i < .@nb; ++.@i )
			mes F_GetNumSuffix(.@i+1) + " ^0000FF" + .@name$[.@i] + "^000000 - "+ .@kills[.@i] + " death" + (.@kills==1?"":"s");
	} 
	else
		mes "no entry";
	mes " ", "Your deaths : " + .@personal;	

	if (getgroupid() > 80) {
		if (select("Cancel.", "^FF0000Reset^000000") == 2) {
			query_sql(" TRUNCATE TABLE `diedlog`; ");
			mes "Reset done.";
		}
	}
	close;

OnInit:
	query_sql("CREATE TABLE IF NOT EXISTS `diedlog` (`id` mediumint(9) unsigned NOT NULL auto_increment, `date` datetime NOT NULL, `died_id` int(11) NOT NULL default '0', PRIMARY KEY  (`id`)) ENGINE=MyISAM AUTO_INCREMENT=1;");
	end;

OnPCDieEvent:
	query_sql("INSERT INTO `diedlog` (`date`, `died_id`) VALUES (now(), '" + getcharid(0) + "');");
	end;
}

 

  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  63
  • Topics Per Day:  0.02
  • Content Count:  1016
  • Reputation:   191
  • Joined:  11/27/14
  • Last Seen:  

Here i have top 30 or you can adjust it using the configuration

 

//=============================
// NPC Script: Top 30 Deaths
//=============================
prontera,150,150,4	script	Top Deaths	837,{

    // Configuration Section
    OnInit:
        // Configurable variables
        .npc_name$ = "[Top Deaths]";
        .limit = 30; // Limit of players to display

        // End of Configuration
        end;

    OnTalk:
        // Fetch the top 30 players with the most deaths
        query_sql("SELECT `name`, `death` FROM `char` ORDER BY `death` DESC LIMIT " + .limit, .@name$, .@deaths);

        // Display the top 30 players
        mes .npc_name$;
        mes "Top " + .limit + " Players Who Died the Most:";
        for (.@i = 0; .@i < getarraysize(.@name$); .@i++) {
            mes (.@i + 1) + ". " + .@name$[.@i] + " - " + .@deaths[.@i] + " deaths";
        }
        close;
}

 

Edited by Poring King
  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  36
  • Topics Per Day:  0.01
  • Content Count:  111
  • Reputation:   1
  • Joined:  01/05/13
  • Last Seen:  

Thank you very much I will test

Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

×
×
  • Create New...