Jump to content
  • 0

gold room how remove ranking !


BlindRO

Question


  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.01
  • Content Count:  25
  • Reputation:   0
  • Joined:  01/28/22
  • Last Seen:  

/*
create table gold_ranking (
char_id int(11) primary key,
name varchar(23) default '',
gold_points int(11) default 0,
key (gold_points)
) engine = innodb;

create table gold_ranking_today (
char_id int(11) primary key,
name varchar(23) default '',
gold_points_today int(11) default 0,
key (gold_points_today)
) engine = innodb;

*/


prontera,165,195,5    script    Gold Room    848,{

OnMenu:

        OnMain:
        mes "[ Gold Room ]";
        mes "Welcome, ^ff0000" +strcharinfo(0)+ "!^000000";
        mes "We rank players based on their performance on farming Gold.";
        mes " ";

        .@query$  = "SELECT `name`, IF(@d=t.`gold_points`, @r, @r:=@i), @d:=t.`gold_points`, @i:=@i+1 ";
        .@query$ += "FROM `gold_ranking` t, (SELECT @d:=0, @r:=0, @i:=1)q ";
        .@query$ += "ORDER BY `gold_points` DESC LIMIT 1";
        .@nb = query_sql(.@query$, .@name$, .@rank, .@kills, .@dummy);
        

        query_sql "select gold_points from `gold_ranking` where char_id = "+ getcharid(0), .@killed;


    menu "Enter ^ff0000Gold Room^000000 ^3333cc(" + getmapusers("ordeal_1-2") + ")^000000",L_Enter,"",L_Total,"",L_Today,"Cancel",L_Cancel;

        L_Total:
        clear;
        mes "[ Gold Ladder ]";
        mes "^73acde<Rank>^000000 ^40cc39<Name>^000000 ^cc4f39<Points>^000000";

        .@query$  = "SELECT `name`, IF(@d=t.`gold_points`, @r, @r:=@i), @d:=t.`gold_points`, @i:=@i+1 ";
        .@query$ += "FROM `gold_ranking` t, (SELECT @d:=0, @r:=0, @i:=1)q ";
        .@query$ += "ORDER BY `gold_points` DESC LIMIT 10";
        .@nb = query_sql(.@query$, .@name$, .@rank, .@kills, .@dummy);

        if ( !.@nb ) {
            mes " ^777777-- Ladder is currently empty.^000000";
            close;
        }
        for ( .@i = 0; .@i < .@nb; ++.@i )
            mes "^73acde"+ .@rank[.@i] +".^000000 ^40cc39"+ .@name$[.@i] +" : ^000000 ^cc4f39<"+ .@kills[.@i] +">^000000";
        end;
        
        L_Today:
        clear;
        mes "[ Gold Ladder ]";
        mes "^73acde<Rank>^000000 ^40cc39<Name>^000000 ^ffad33<Points>^000000";

        .@query$  = "SELECT `name`, IF(@d=t.`gold_points_today`, @r, @r:=@i), @d:=t.`gold_points_today`, @i:=@i+1 ";
        .@query$ += "FROM `gold_ranking_today` t, (SELECT @d:=0, @r:=0, @i:=1)q ";
        .@query$ += "ORDER BY `gold_points_today` DESC LIMIT 10";
        .@nb = query_sql(.@query$, .@name$, .@rank, .@kills, .@dummy);

        if ( !.@nb ) {
            mes " ^777777-- Ladder is currently empty.^000000";
            close;
        }
        for ( .@i = 0; .@i < .@nb; ++.@i )
            mes "^73acde"+ .@rank[.@i] +".^000000 ^40cc39"+ .@name$[.@i] +" : ^000000 ^ffad33<"+ .@kills[.@i] +">^000000";
        end;

L_Enter:
    specialeffect 253;
    showscript "'" + strcharinfo(0) + "' entered!",getnpcid(0),AREA;
    warp "ordeal_1-2",0,0;
    end;

L_Cancel:
    end;

OnNPCKillEvent:
    if (killedrid == 1369) {
        if(!$gold_hour) {
            .@i = 1;            
        }
        else if($gold_hour) {
            .@i = rand(1,3);
        }
            getitem 969,.@i;
            if(.@i == 1){
            query_sql "insert into gold_ranking values ( "+ getcharid(0) +", '"+ escape_sql( strcharinfo(0) ) +"', 1 ) on duplicate key update name = '"+ escape_sql( strcharinfo(0) )+"', gold_points = gold_points + 1";
            query_sql "insert into gold_ranking_today values ( "+ getcharid(0) +", '"+ escape_sql( strcharinfo(0) ) +"', 1 ) on duplicate key update name = '"+ escape_sql( strcharinfo(0) )+"', gold_points_today = gold_points_today + 1";
            }
            if(.@i == 2){
            query_sql "insert into gold_ranking values ( "+ getcharid(0) +", '"+ escape_sql( strcharinfo(0) ) +"', 1 ) on duplicate key update name = '"+ escape_sql( strcharinfo(0) )+"', gold_points = gold_points + 2";
            query_sql "insert into gold_ranking_today values ( "+ getcharid(0) +", '"+ escape_sql( strcharinfo(0) ) +"', 1 ) on duplicate key update name = '"+ escape_sql( strcharinfo(0) )+"', gold_points_today = gold_points_today + 2";
            }
            query_sql "select gold_points from `gold_ranking` where char_id = "+ getcharid(0), .@killed;
            query_sql "select gold_points_today from `gold_ranking_today` where char_id = "+ getcharid(0), .@killed_today;
            end;
    }
    end;

OnClock0000:
    npctalk "Daily ladder has been reset!";
    query_sql "TRUNCATE TABLE `gold_ranking_today`";
    end;

    
}

ordeal_1-2    mapflag    pvp
ordeal_1-2    mapflag    nowarpto
ordeal_1-2    mapflag    nodrop
ordeal_1-2    mapflag    nobranch
ordeal_1-2    mapflag    nosave
ordeal_1-2    mapflag    nomemo
ordeal_1-2    mapflag    noloot


ordeal_1-2    monster    Golden Peco    1369,500
ordeal_1-2    monster    Golden Peco    1369,500
ordeal_1-2    monster    Golden Peco    1369,300

 

Edited by Patskie
code
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  177
  • Reputation:   25
  • Joined:  12/24/14
  • Last Seen:  

prontera,165,195,5    script    Gold Room    848,{

	mes "[ Gold Room ]";
	mes "Welcome, ^ff0000" +strcharinfo(0)+ "!^000000";
	next;
	menu
		"Enter ^ff0000Gold Room^000000 ^3333cc(" + getmapusers("ordeal_1-2") + ")^000000",L_Enter,
		"Cancel",L_Cancel;
	end;

L_Enter:
	specialeffect 253;
	showscript "'" + strcharinfo(0) + "' entered!",getnpcid(0),AREA;
	warp "ordeal_1-2",0,0;
	end;

L_Cancel:
	mes "[ Gold Room ]";
	mes "Bye !!
	close;

OnNPCKillEvent:
	if (killedrid == 1369) {
		if(!$gold_hour) {
			.@i = 1;
		}
		else if($gold_hour) {
			.@i = rand(1,3);
		}
		getitem 969,.@i;
		end;
	}
	end;
}

ordeal_1-2    mapflag    pvp
ordeal_1-2    mapflag    nowarpto
ordeal_1-2    mapflag    nodrop
ordeal_1-2    mapflag    nobranch
ordeal_1-2    mapflag    nosave
ordeal_1-2    mapflag    nomemo
ordeal_1-2    mapflag    noloot


ordeal_1-2    monster    Golden Peco    1369,500
ordeal_1-2    monster    Golden Peco    1369,500
ordeal_1-2    monster    Golden Peco    1369,300

 

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...