Jump to content
  • 0
powkda

rank pvp ratio is not counted

Question

Good night guys, I'm using this table

CREATE TABLE `rankpvp01` (
  `char_id` int(11) NOT NULL,
  `name` varchar(23) DEFAULT NULL,
  `kills_pvp1` int(11) DEFAULT NULL,
  `deaths_pvp1` int(11) DEFAULT NULL,
  `saldo_pvp1` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

and the following commands

-	script	OnPCDieEvent#1	-1,{

OnPCDieEvent:

getmapxy @mapdie1$,@x,@y;

if (@mapdie1$ != "coca_cola") end;

		set @CID,getcharid(0);set @name$,"";set @points,0;
					query_sql "SELECT `deaths_pvp1` FROM `rankpvp01` WHERE `char_id`="+@CID+"",@points;
					query_sql "SELECT `name` FROM `rankpvp01` WHERE `char_id`="+@CID+"",@name$;
			if ( @name$ == "" ) { query_sql "INSERT INTO `rankpvp01` (`char_id`,`name`,`deaths_pvp1`) VALUES ("+@CID+",'"+strcharinfo(0)+"',1)",@esc$; end; }
					query_sql "UPDATE `rankpvp01` SET `deaths_pvp1` = `deaths_pvp1` + 1 WHERE `char_id`="+@CID+"",@esc$;
						end;
}

and

-	script	OnPCKillEvent#pvp1	-1,{

OnPCKillEvent:

getmapxy @map1$,@x,@y;
if ( @map1$ != "coca_cola" ) end;

		set @CID,getcharid(0);set @name$,"";set @points,0;
					query_sql "SELECT `kills_pvp1` FROM `rankpvp01` WHERE `char_id`="+@CID+"",@points;
					query_sql "SELECT `saldo_pvp1` FROM `rankpvp01` WHERE `char_id`="+@CID+"",@saldo;
					query_sql "SELECT `name` FROM `rankpvp01` WHERE `char_id`="+@CID+"",@name$;

			if ( @name$ == "" ) { query_sql "INSERT INTO `rankpvp01` (`char_id`,`name`,`kills_pvp1`) VALUES ("+@CID+",'"+strcharinfo(0)+"',1)",@esc$; dispbottom "Você Matou seu primeiro jogador"; end; }
					query_sql "UPDATE `rankpvp01` SET `kills_pvp1` = `kills_pvp1` +1 WHERE `char_id`="+@CID+"",@esc$;
					query_sql "UPDATE `rankpvp01` SET `saldo_pvp1` = `saldo_pvp1` +1 WHERE `char_id`="+@CID+"",@esc$;
		set @points,@points+1;
		announce "Você matou [ "+rid2name(killedrid)+" ] e chegou a "+@points+" jogadores mortos.",bc_self,0x90FFFF;
						end;

}

 

but the saldo_pvp1 is not being accounted for
I want that every time the player dies she loses 1 point in the saldo_pvp1 and every time he kills he gets 1 point
already tried everything and does not leave 0

 

someone who can help me? thank you very much 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

You can use both events in one npc...
I have modify it for you, please give a try..

-	script	pvp1	-1,{

OnPCDieEvent:
	getmapxy @mapdie1$,@x,@y;
	if (@mapdie1$ != "coca_cola") end;

	set @CID,getcharid(0);
	set @name$,"";
	set @points,0;
	query_sql "SELECT `deaths_pvp1` FROM `rankpvp01` WHERE `char_id`="[email protected]CID+"",@points;
	query_sql "SELECT `name` FROM `rankpvp01` WHERE `char_id`="[email protected]CID+"",@name$;
	if ( @name$ == "" ) {
		query_sql "INSERT INTO `rankpvp01` (`char_id`,`name`,`deaths_pvp1`,`saldo_pvp1`) VALUES ("[email protected]CID+",'"+strcharinfo(0)+"',1,-1)";
		end;
	}
	query_sql "UPDATE `rankpvp01` SET `deaths_pvp1` = `deaths_pvp1` + 1, `saldo_pvp1` = `saldo_pvp1` - 1 WHERE `char_id`="[email protected]CID;

	end;


OnPCKillEvent:
	getmapxy @map1$,@x,@y;
	if ( @map1$ != "coca_cola" ) end;
	set @CID, getcharid(0);
	set @name$, "";
	set @points, 0;
	query_sql "SELECT `kills_pvp1` FROM `rankpvp01` WHERE `char_id`="[email protected]CID+"", @points;
	query_sql "SELECT `name` FROM `rankpvp01` WHERE `char_id`="[email protected]CID+"", @name$;

	if ( @name$ == "" ) {
		query_sql "INSERT INTO `rankpvp01` (`char_id`,`name`,`kills_pvp1`,`saldo_pvp1`) VALUES ("[email protected]CID+",'"+strcharinfo(0)+"',1,1)";
		dispbottom "Você Matou seu primeiro jogador";
		end;
	}
	query_sql "UPDATE `rankpvp01` SET `kills_pvp1` = `kills_pvp1` + 1, `saldo_pvp1` = `saldo_pvp1` + 1 WHERE `char_id`="[email protected]CID;
	set @points, @points + 1;
	announce "Você matou [ "+rid2name(killedrid)+" ] e chegou a "[email protected]points+" jogadores mortos.",bc_self,0x90FFFF;
	
	end;
}

 

  • Upvote 1
Link to comment
Share on other sites

  • 0
7 hours ago, -Chuck- said:

You can use both events in one npc...
I have modify it for you, please give a try..

-	script	pvp1	-1,{

OnPCDieEvent:
	getmapxy @mapdie1$,@x,@y;
	if (@mapdie1$ != "coca_cola") end;

	set @CID,getcharid(0);
	set @name$,"";
	set @points,0;
	query_sql "SELECT `deaths_pvp1` FROM `rankpvp01` WHERE `char_id`="[email protected]CID+"",@points;
	query_sql "SELECT `name` FROM `rankpvp01` WHERE `char_id`="[email protected]CID+"",@name$;
	if ( @name$ == "" ) {
		query_sql "INSERT INTO `rankpvp01` (`char_id`,`name`,`deaths_pvp1`,`saldo_pvp1`) VALUES ("[email protected]CID+",'"+strcharinfo(0)+"',1,-1)";
		end;
	}
	query_sql "UPDATE `rankpvp01` SET `deaths_pvp1` = `deaths_pvp1` + 1, `saldo_pvp1` = `saldo_pvp1` - 1 WHERE `char_id`="[email protected]CID;

	end;


OnPCKillEvent:
	getmapxy @map1$,@x,@y;
	if ( @map1$ != "coca_cola" ) end;
	set @CID, getcharid(0);
	set @name$, "";
	set @points, 0;
	query_sql "SELECT `kills_pvp1` FROM `rankpvp01` WHERE `char_id`="[email protected]CID+"", @points;
	query_sql "SELECT `name` FROM `rankpvp01` WHERE `char_id`="[email protected]CID+"", @name$;

	if ( @name$ == "" ) {
		query_sql "INSERT INTO `rankpvp01` (`char_id`,`name`,`kills_pvp1`,`saldo_pvp1`) VALUES ("[email protected]CID+",'"+strcharinfo(0)+"',1,1)";
		dispbottom "Você Matou seu primeiro jogador";
		end;
	}
	query_sql "UPDATE `rankpvp01` SET `kills_pvp1` = `kills_pvp1` + 1, `saldo_pvp1` = `saldo_pvp1` + 1 WHERE `char_id`="[email protected]CID;
	set @points, @points + 1;
	announce "Você matou [ "+rid2name(killedrid)+" ] e chegou a "[email protected]points+" jogadores mortos.",bc_self,0x90FFFF;
	
	end;
}

 

Thank you very much friend, it was exactly the way I wanted

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

Important Information

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