Jump to content

Question

Posted

hello anybody know how to fix this error everytime the player enter the pvp room this error appears
heres the scripterror.png.024a0c30b47a4ac1eec4109cff95922d.png
 

Quote

    // https://rathena.org/board/topic/107986-requesting-for-a-pvp-ranking-w-reset/

/*
ALTER TABLE `char` ADD `pvp_kill` INT(11) UNSIGNED NOT NULL DEFAULT '0'  AFTER `fame`;
*/

payon,193,104,4    script    PVP Warper    630,{
    doevent "pvp_rank_main::OnTalk";
}

-    script    pvp_rank_main    -1,{

    OnTalk:
        mes "[PvP Room Master]";
        mes "Where do you wanna go?";
        next;
        switch ( select ( 
            "Grand Arena [ "+getmapusers("grandarena")+" ]",
            "^ff0000[ No Points ]^000000 Prontera  [ "+getmapusers("grandarena")+" ]",
            ( getgmlevel() >= 99 ) ? "^FF0000[GM] Reset PVP Ranking^000000":""
        )) {
    case 1:    // Grand Arena
        if (getmapusers("grandarena") > 99) callsub S_full;
        if (BaseLevel <49) { 
        mes "Excuse me, but";
        mes "did you not come prepared?";
        mes "you need to be";
        mes "atleast level 50 above!";
        close;
        }
        warp "grandarena",0,0;
        announce ""+strcharinfo(0)+" entered Grand Arena PVP ROOM !",bc_all,0xCCFFFF;
        end;
        
    case 2:    // Izlude PVP Rooom
        if (getmapusers("pvp_y_1-2") > 99) callsub S_full;
        if (BaseLevel <49) { 
        mes "Excuse me, but";
        mes "did you not come prepared?";
        mes "you need to be";
        mes "atleast level 50 above!";
        close;
        }
        warp "pvp_y_1-2",0,0;
        announce ""+strcharinfo(0)+" entered Izlude PVP ROOM !",bc_all,0xCCFFFF;
        end;
        
            default:
                mes "[PvP Room Master]";
                mes "PVP Ranking";
                query_sql( "SELECT `name`,`pvp_kill` FROM `char` WHERE `pvp_kill` > 0 ORDER BY `pvp_kill` DESC LIMIT 10", .@name$, .@pvp_kill );
                .@size = getarraysize( .@name$ );
                for ( .@i = 0; .@i < .@size; .@i++ ) {
                    mes "["+(.@i + 1 )+"] "+.@name$[.@i]+" - "+.@pvp_kill[.@i]+" kill(s)";
                }
                break;
            case 3:
                mes "[PvP Room Master]";
                mes "Reset Ranking? Action cant be undo. Confirm your action.";
                if ( select( "Confirm","Cancel" ) == 1 ) {
                    query_sql( "UPDATE `char` SET `pvp_kill` = 0 WHERE `pvp_kill` > 0" );
                    mes "Done.";
                }
                break;
        }
        close;
    
    L_Enter:
        .@title$ = getarg( 0,"" );
        .@map$ = getarg( 1,"" );
        .@max_player = getarg( 2,0 );
        .@getmapusers = getmapusers( .@map$ );
        
        mes "[PvP Room Master]";
        if ( .@getmapusers == -1 ) {
            mes "Invalid map.";
        }
        else if ( .@max_player > 0 && .@getmapusers >= .@max_player ) {
            mes "I'm sorry but the PVP Room is already full!";
        }
        else {
            mes .@title$ + " ["+.@getmapusers+"/"+.@max_player+"]";
            if ( select( "Enter" ) == 1 ) {
                warp .@map$,0,0;
            }
        }

        end;
}

 

 

8 answers to this question

Recommended Posts

  • 0
Posted
58 minutes ago, Sallycantdance said:

hello anybody know how to fix this error everytime the player enter the pvp room this error appears
heres the scripterror.png.024a0c30b47a4ac1eec4109cff95922d.png
 

 

You know its hard to script.

If you want, i fix script for just 5 dollar 🙂

  • 0
Posted
10 hours ago, Sallycantdance said:

hello anybody know how to fix this error everytime the player enter the pvp room this error appears
heres the scripterror.png.024a0c30b47a4ac1eec4109cff95922d.png
 

 

try this. i haven't tested it.

 

/*
ALTER TABLE `char` ADD `pvp_kill` INT(11) UNSIGNED NOT NULL DEFAULT '0'  AFTER `fame`;
*/

payon,193,104,4	script	PVP Warper	630,{
    doevent "pvp_rank_main::OnTalk";
}

-	script	pvp_rank_main	-1,{

    OnTalk:
        mes "[PvP Room Master]";
        mes "Where do you want to go?";
        next;
        switch ( select ( 
            "Grand Arena [ "+getmapusers("grandarena")+" ]",
            "^ff0000[ No Points ]^000000 Izlude PVP Room [ "+getmapusers("pvp_y_1-2")+" ]",
            ( getgmlevel() >= 99 ) ? "^FF0000[GM] Reset PVP Ranking^000000":""
        )) {
        
        case 1: // Grand Arena
            if ( getmapusers("grandarena") >= 100 ) {
                mes "The Grand Arena is full!";
                close;
            }
            if ( BaseLevel < 50 ) { 
                mes "Excuse me, but";
                mes "you need to be at least level 50 or above!";
                close;
            }
            warp "grandarena",0,0;
            announce ""+strcharinfo(0)+" entered Grand Arena PVP ROOM!", bc_all, 0xCCFFFF;
            end;
        
        case 2: // Izlude PVP Room
            if ( getmapusers("pvp_y_1-2") >= 100 ) {
                mes "The Izlude PVP Room is full!";
                close;
            }
            if ( BaseLevel < 50 ) { 
                mes "Excuse me, but";
                mes "you need to be at least level 50 or above!";
                close;
            }
            warp "pvp_y_1-2",0,0;
            announce ""+strcharinfo(0)+" entered Izlude PVP ROOM!", bc_all, 0xCCFFFF;
            end;

        case 3: // GM Reset Ranking
            if ( getgmlevel() < 99 ) {
                mes "You do not have permission to perform this action.";
                close;
            }
            mes "[PvP Room Master]";
            mes "Reset Ranking? This action cannot be undone.";
            if ( select( "Confirm", "Cancel" ) == 1 ) {
                query_sql( "UPDATE `char` SET `pvp_kill` = 0 WHERE `pvp_kill` > 0" );
                mes "PvP ranking has been reset.";
            }
            close;
        
        default: // PvP Rankings
            mes "[PvP Room Master]";
            mes "PvP Rankings:";
            query_sql( "SELECT `name`, `pvp_kill` FROM `char` WHERE `pvp_kill` > 0 ORDER BY `pvp_kill` DESC LIMIT 10", .@name$, .@pvp_kill );
            .@size = getarraysize( .@name$ );
            if ( .@size == 0 ) {
                mes "No PvP rankings available yet.";
            } else {
                for ( .@i = 0; .@i < .@size; .@i++ ) {
                    mes "["+(.@i + 1 )+"] "+.@name$[.@i]+" - "+.@pvp_kill[.@i]+" kill(s)";
                }
            }
            close;
        }
}

 

  • 0
Posted
1 hour ago, Brynner said:

try this. i haven't tested it.

 

/*
ALTER TABLE `char` ADD `pvp_kill` INT(11) UNSIGNED NOT NULL DEFAULT '0'  AFTER `fame`;
*/

payon,193,104,4	script	PVP Warper	630,{
    doevent "pvp_rank_main::OnTalk";
}

-	script	pvp_rank_main	-1,{

    OnTalk:
        mes "[PvP Room Master]";
        mes "Where do you want to go?";
        next;
        switch ( select ( 
            "Grand Arena [ "+getmapusers("grandarena")+" ]",
            "^ff0000[ No Points ]^000000 Izlude PVP Room [ "+getmapusers("pvp_y_1-2")+" ]",
            ( getgmlevel() >= 99 ) ? "^FF0000[GM] Reset PVP Ranking^000000":""
        )) {
        
        case 1: // Grand Arena
            if ( getmapusers("grandarena") >= 100 ) {
                mes "The Grand Arena is full!";
                close;
            }
            if ( BaseLevel < 50 ) { 
                mes "Excuse me, but";
                mes "you need to be at least level 50 or above!";
                close;
            }
            warp "grandarena",0,0;
            announce ""+strcharinfo(0)+" entered Grand Arena PVP ROOM!", bc_all, 0xCCFFFF;
            end;
        
        case 2: // Izlude PVP Room
            if ( getmapusers("pvp_y_1-2") >= 100 ) {
                mes "The Izlude PVP Room is full!";
                close;
            }
            if ( BaseLevel < 50 ) { 
                mes "Excuse me, but";
                mes "you need to be at least level 50 or above!";
                close;
            }
            warp "pvp_y_1-2",0,0;
            announce ""+strcharinfo(0)+" entered Izlude PVP ROOM!", bc_all, 0xCCFFFF;
            end;

        case 3: // GM Reset Ranking
            if ( getgmlevel() < 99 ) {
                mes "You do not have permission to perform this action.";
                close;
            }
            mes "[PvP Room Master]";
            mes "Reset Ranking? This action cannot be undone.";
            if ( select( "Confirm", "Cancel" ) == 1 ) {
                query_sql( "UPDATE `char` SET `pvp_kill` = 0 WHERE `pvp_kill` > 0" );
                mes "PvP ranking has been reset.";
            }
            close;
        
        default: // PvP Rankings
            mes "[PvP Room Master]";
            mes "PvP Rankings:";
            query_sql( "SELECT `name`, `pvp_kill` FROM `char` WHERE `pvp_kill` > 0 ORDER BY `pvp_kill` DESC LIMIT 10", .@name$, .@pvp_kill );
            .@size = getarraysize( .@name$ );
            if ( .@size == 0 ) {
                mes "No PvP rankings available yet.";
            } else {
                for ( .@i = 0; .@i < .@size; .@i++ ) {
                    mes "["+(.@i + 1 )+"] "+.@name$[.@i]+" - "+.@pvp_kill[.@i]+" kill(s)";
                }
            }
            close;
        }
}

 

hello thank you for your effort but it has the same error

  • 0
Posted
22 minutes ago, Sallycantdance said:

hello thank you for your effort but it has the same error

i just tried it no error on my side. i don't have Grand Arena map so I replace it with another existing map but it works fine on me no error on map server image.thumb.jpeg.e5d7c7b36de06a92634976ffb087a5e6.jpegimage.png.a1199a80a3482500a68199ad882f0372.pngimage.thumb.jpeg.9d9a1a8c8637fadbdb3c6d64ed333be5.jpeg

  • 0
Posted
17 hours ago, Brynner said:

i just tried it no error on my side. i don't have Grand Arena map so I replace it with another existing map but it works fine on me no error on map server image.thumb.jpeg.e5d7c7b36de06a92634976ffb087a5e6.jpegimage.png.a1199a80a3482500a68199ad882f0372.pngimage.thumb.jpeg.9d9a1a8c8637fadbdb3c6d64ed333be5.jpeg

mine is error but we have the same script huhu

image.thumb.png.eccf0992b808c6d53d4c8eb918300a48.png

  • 0
Posted (edited)

I did this basic script, maybe it will help you.

CREATE TABLE IF NOT EXISTS `pvp_rank` (
  `char_id` int(11) unsigned NOT NULL,
  `kills` int(11) unsigned NOT NULL DEFAULT 0,
  `deaths` int(11) unsigned NOT NULL DEFAULT 0,
  PRIMARY KEY (`char_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

 

And here's the script.

prontera,196,142,5	script	PVP Warper	100,{
	mes "[ ^FF0000PVP Warper^000000 ]";
	mes "Welcome, ^0000FF"+strcharinfo(0)+"^000000.";
	mes "Please select a PVP room:";
	next;

	// Dynamic menu with player counts
	.@menu$ = "";
	for (.@i = 0; .@i < getarraysize(.pvp_map$); .@i++) {
		.@users = getmapusers(.pvp_map$[.@i]);
		.@menu$ += .pvp_name$[.@i]+" ["+.@users+"/"+.pvp_max[.@i]+"]:";
	}

	.@sel = select(.@menu$) - 1;

	if (BaseLevel < .pvp_level[.@sel]) {
		mes "[ ^FF0000PVP Warper^000000 ]";
		mes "You must be at least level "+.pvp_level[.@sel]+" to enter this room.";
		close;
	}

	if (getmapusers(.pvp_map$[.@sel]) >= .pvp_max[.@sel]) {
		mes "[ ^FF0000PVP Warper^000000 ]";
		mes "This room has reached its player limit ("+.pvp_max[.@sel]+").";
		close;
	}

	warp .pvp_map$[.@sel],0,0;
	end;


OnPCKillEvent:
	// Validate if map is a valid PVP room
	.@valid = 0;
	for (.@i = 0; .@i < getarraysize(.pvp_map$); .@i++) {
		if (strcharinfo(3) == .pvp_map$[.@i]) {
			.@valid = 1;
			break;
		}
	}
	if (!.@valid) end;

	// Get Killer and Victim Char IDs safely
	.@killer_cid = getcharid(0);
	.@victim_cid = getcharid(0, rid2name(killedrid));

	if (!.@killer_cid || !.@victim_cid || .@killer_cid == .@victim_cid) end;

	// Always register kills and deaths for all maps
	query_sql("INSERT INTO pvp_rank (`char_id`, `kills`, `deaths`) VALUES ("+.@killer_cid+",1,0),("+.@victim_cid+",0,1) ON DUPLICATE KEY UPDATE `kills`=`kills`+VALUES(`kills`), `deaths`=`deaths`+VALUES(`deaths`)");

	// Only grant special points in the GM-selected map
	if (strcharinfo(3) != .points_map$) end;

	// IP check validation (enabled or disabled by admin)
	if (.ip_check_enabled) {
		query_sql("SELECT last_ip FROM login WHERE account_id="+getcharid(3), .@killer_ip$);
		query_sql("SELECT last_ip FROM login WHERE account_id="+killedrid, .@victim_ip$);
		if (.@killer_ip$ == .@victim_ip$) {
			dispbottom "[PVP Warper]: No points granted. Same IP detected.";
			end;
		}
	}

	// Kill cooldown validation
	.@current_time = gettimetick(2);
	.@cooldown = .kill_cooldown;

	.@kill_cd_var$ = "kill_cd_"+.@killer_cid+"_"+.@victim_cid;
	if (getd(.@kill_cd_var$) + .@cooldown > .@current_time) {
		dispbottom "[PVP Warper]: You recently killed this player. Wait before earning more points.";
		end;
	}
	setd .@kill_cd_var$, .@current_time;

	// Add your special points reward code here.
	// Example: set pvp_points, pvp_points + 1;

	dispbottom "[PVP Warper]: You've earned special points for defeating a player.";
	end;

OnCheckRank:
	mes "[ ^FF0000PVP Warper^000000 ]";
	query_sql("SELECT kills, deaths FROM pvp_rank WHERE char_id="+ getcharid(0), .@kills, .@deaths);
	mes "Tus estadísticas actuales:";
	mes "^0000FFKills:^000000 "+ (.@kills ? .@kills : 0);
	mes "^FF0000Muertes:^000000 "+ (.@deaths ? .@deaths : 0);
	close;

OnGMResetRank:
	if (getgmlevel() < 60) {
		dispbottom "No tienes permisos para usar este comando.";
		end;
	}
	query_sql("TRUNCATE TABLE pvp_rank");
	dispbottom "Ranking PVP reiniciado correctamente.";
	end;

OnInit:
	// General Configuration
	setarray .pvp_map$[0], "guild_vs1", "guild_vs2", "pvp_y_1-2";
	setarray .pvp_name$[0], "PVP Room 1", "PVP Room 2", "PVP Prontera";
	setarray .pvp_level[0], 1, 50, 99;
	setarray .pvp_max[0], 10, 15, 20;

	// Enable or disable IP check (1 = ON, 0 = OFF)
	.ip_check_enabled = 0;

	// Kill cooldown in seconds (recommended: 60-120 sec)
	.kill_cooldown = 60;
	
	// GM configuration: Set the map that gives special points here (default is room 1)
	.points_map$ = .pvp_map$[0]; // Change [0] to [1] or [2] to switch rooms

	// Commands for player and GM
	bindatcmd "pvprank",strnpcinfo(3)+"::OnCheckRank";
	bindatcmd "resetpvprank",strnpcinfo(3)+"::OnGMResetRank",60,60;
	end;
}

 

Feel free to ask for a change.

 

Edited by Scanty
  • Love 1
  • 0
Posted
2 hours ago, Scanty said:

I did this basic script, maybe it will help you.

CREATE TABLE IF NOT EXISTS `pvp_rank` (
  `char_id` int(11) unsigned NOT NULL,
  `kills` int(11) unsigned NOT NULL DEFAULT 0,
  `deaths` int(11) unsigned NOT NULL DEFAULT 0,
  PRIMARY KEY (`char_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;

 

And here's the script.

prontera,196,142,5	script	PVP Warper	100,{
	mes "[ ^FF0000PVP Warper^000000 ]";
	mes "Welcome, ^0000FF"+strcharinfo(0)+"^000000.";
	mes "Please select a PVP room:";
	next;

	// Dynamic menu with player counts
	.@menu$ = "";
	for (.@i = 0; .@i < getarraysize(.pvp_map$); .@i++) {
		.@users = getmapusers(.pvp_map$[.@i]);
		.@menu$ += .pvp_name$[.@i]+" ["+.@users+"/"+.pvp_max[.@i]+"]:";
	}

	.@sel = select(.@menu$) - 1;

	if (BaseLevel < .pvp_level[.@sel]) {
		mes "[ ^FF0000PVP Warper^000000 ]";
		mes "You must be at least level "+.pvp_level[.@sel]+" to enter this room.";
		close;
	}

	if (getmapusers(.pvp_map$[.@sel]) >= .pvp_max[.@sel]) {
		mes "[ ^FF0000PVP Warper^000000 ]";
		mes "This room has reached its player limit ("+.pvp_max[.@sel]+").";
		close;
	}

	warp .pvp_map$[.@sel],0,0;
	end;


OnPCKillEvent:
	// Validate if map is a valid PVP room
	.@valid = 0;
	for (.@i = 0; .@i < getarraysize(.pvp_map$); .@i++) {
		if (strcharinfo(3) == .pvp_map$[.@i]) {
			.@valid = 1;
			break;
		}
	}
	if (!.@valid) end;

	// Get Killer and Victim Char IDs safely
	.@killer_cid = getcharid(0);
	.@victim_cid = getcharid(0, rid2name(killedrid));

	if (!.@killer_cid || !.@victim_cid || .@killer_cid == .@victim_cid) end;

	// Always register kills and deaths for all maps
	query_sql("INSERT INTO pvp_rank (`char_id`, `kills`, `deaths`) VALUES ("+.@killer_cid+",1,0),("+.@victim_cid+",0,1) ON DUPLICATE KEY UPDATE `kills`=`kills`+VALUES(`kills`), `deaths`=`deaths`+VALUES(`deaths`)");

	// Only grant special points in the GM-selected map
	if (strcharinfo(3) != .points_map$) end;

	// IP check validation (enabled or disabled by admin)
	if (.ip_check_enabled) {
		query_sql("SELECT last_ip FROM login WHERE account_id="+getcharid(3), .@killer_ip$);
		query_sql("SELECT last_ip FROM login WHERE account_id="+killedrid, .@victim_ip$);
		if (.@killer_ip$ == .@victim_ip$) {
			dispbottom "[PVP Warper]: No points granted. Same IP detected.";
			end;
		}
	}

	// Kill cooldown validation
	.@current_time = gettimetick(2);
	.@cooldown = .kill_cooldown;

	.@kill_cd_var$ = "kill_cd_"+.@killer_cid+"_"+.@victim_cid;
	if (getd(.@kill_cd_var$) + .@cooldown > .@current_time) {
		dispbottom "[PVP Warper]: You recently killed this player. Wait before earning more points.";
		end;
	}
	setd .@kill_cd_var$, .@current_time;

	// Add your special points reward code here.
	// Example: set pvp_points, pvp_points + 1;

	dispbottom "[PVP Warper]: You've earned special points for defeating a player.";
	end;

OnCheckRank:
	mes "[ ^FF0000PVP Warper^000000 ]";
	query_sql("SELECT kills, deaths FROM pvp_rank WHERE char_id="+ getcharid(0), .@kills, .@deaths);
	mes "Tus estadísticas actuales:";
	mes "^0000FFKills:^000000 "+ (.@kills ? .@kills : 0);
	mes "^FF0000Muertes:^000000 "+ (.@deaths ? .@deaths : 0);
	close;

OnGMResetRank:
	if (getgmlevel() < 60) {
		dispbottom "No tienes permisos para usar este comando.";
		end;
	}
	query_sql("TRUNCATE TABLE pvp_rank");
	dispbottom "Ranking PVP reiniciado correctamente.";
	end;

OnInit:
	// General Configuration
	setarray .pvp_map$[0], "guild_vs1", "guild_vs2", "pvp_y_1-2";
	setarray .pvp_name$[0], "PVP Room 1", "PVP Room 2", "PVP Prontera";
	setarray .pvp_level[0], 1, 50, 99;
	setarray .pvp_max[0], 10, 15, 20;

	// Enable or disable IP check (1 = ON, 0 = OFF)
	.ip_check_enabled = 0;

	// Kill cooldown in seconds (recommended: 60-120 sec)
	.kill_cooldown = 60;
	
	// GM configuration: Set the map that gives special points here (default is room 1)
	.points_map$ = .pvp_map$[0]; // Change [0] to [1] or [2] to switch rooms

	// Commands for player and GM
	bindatcmd "pvprank",strnpcinfo(3)+"::OnCheckRank";
	bindatcmd "resetpvprank",strnpcinfo(3)+"::OnGMResetRank",60,60;
	end;
}

 

Feel free to ask for a change.

 

thank you so much sir for this script !!!!!

  • 0
Posted

sir @Scanty i know now heres the error coming from this script

 

Quote

-    script    dualclientkicker    -1,{
OnPCLoadMapEvent:
set .@charmap$, strcharinfo(3);
if(!compare(.tmp$,.@charmap$)) end;
set .@len, query_sql("SELECT DISTINCT `account_id` FROM `char` WHERE`account_id` IN (SELECT `account_id` FROM `login` WHERE `last_ip` =(SELECT `last_ip` FROM `login` WHERE `account_id`="+getcharid(3)+")) AND`online` <> 0;",.@a);
for(set(.@d,0);.@d<.@len;set(.@d,.@d+1)) {
    if(!getmapxy(.@map$,.@x,.@y,BL_PC,rid2name(.@a[.@d])) && .@charmap$==.@map$)
    set .@c,.@c+ 1;     
    }
if(.@c > .limitacc ) {
dispbottom "dual accounts not allowed in this map.";
    warp "maintown",97,30;
    }    
    end;
OnInit:
set .limitacc,1;
setarray .maps$, "pvp_y_1-2", "prt_pvp", "br_ifrit", "grandarena", "bombring", "gh10", "gh11", "gh12";
set .lens ,    getarraysize(.maps$) ;
for(set(.a,0);.a<.lens;set(.a,.a+1)) {
    setmapflag .maps$[.a],    mf_loadevent ;
    set .tmp$ ,.tmp$+.maps$[.a]+",";
}
}

 

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...