Jump to content
  • 0

problem with pvp sqp error


Question

Posted (edited)

-	script	OnPCDieEvente#pvp1	-1,{
OnPCDieEvent:
getmapxy @mapdie1$,@x,@y;
if (@mapdie1$ != "coca_cola")end;
set @id,getcharid(0); set @name$,"";
query_sql "SELECT `name` FROM `rankpvp01` WHERE `char_id`="+@id+"",@name$;
if ( @name$ == "" ) {
	query_sql "INSERT INTO `rankpvp01` (`char_id`,`name`,`deaths_pvp1`,`saldo_pvp1`) VALUES ("+@id+",'"+strcharinfo(0)+"',1)";
	query_sql "UPDATE `rankpvp01` SET `saldo_pvp1` = `saldo_pvp1` - 1 WHERE `char_id`='"+getcharid(0)+"'";
	end;
	}
query_sql "UPDATE `rankpvp01` SET `deaths_pvp1` = `deaths_pvp1` + 1 WHERE `char_id`='"+getcharid(0)+"'";
query_sql "UPDATE `rankpvp01` SET `saldo_pvp1` = `saldo_pvp1` - 1 WHERE `char_id`='"+getcharid(0)+"'";
set @kill1,0;
end;
}

Good morning guys, I'm having difficulties with the sql of the pvp arena I'm doing, the balance is not counting

 

Would you help me? I thank you for your attention

Edited by powkda

2 answers to this question

Recommended Posts

  • 0
Posted
16 minutes ago, powkda said:


-	script	OnPCDieEvente#pvp1	-1,{
OnPCDieEvent:
getmapxy @mapdie1$,@x,@y;
if (@mapdie1$ != "coca_cola")end;
set @id,getcharid(0); set @name$,"";
query_sql "SELECT `name` FROM `rankpvp01` WHERE `char_id`="+@id+"",@name$;
if ( @name$ == "" ) {
	query_sql "INSERT INTO `rankpvp01` (`char_id`,`name`,`deaths_pvp1`,`saldo_pvp1`) VALUES ("+@id+",'"+strcharinfo(0)+"',1)";
	query_sql "UPDATE `rankpvp01` SET `saldo_pvp1` = `saldo_pvp1` - 1 WHERE `char_id`='"+getcharid(0)+"'";
	end;
	}
query_sql "UPDATE `rankpvp01` SET `deaths_pvp1` = `deaths_pvp1` + 1 WHERE `char_id`='"+getcharid(0)+"'";
query_sql "UPDATE `rankpvp01` SET `saldo_pvp1` = `saldo_pvp1` - 1 WHERE `char_id`='"+getcharid(0)+"'";
set @kill1,0;
end;
}

Good morning guys, I'm having difficulties with the sql of the pvp arena I'm doing, the balance is not counting

 

Would you help me? I thank you for your attention

Have you run the SQL ? I think this script should have their own SQL which need to be query first so that the table rankpvp01 are exist.

  • 0
Posted
11 hours ago, Chaos92 said:

Have you run the SQL ? I think this script should have their own SQL which need to be query first so that the table rankpvp01 are exist.

yes, I made the table, follow below

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;

the ratio that is "saldo_pvp1" is not being accounted for

I'll post the npc here for you to take a look

 

-	script	OnPCDieEvente#pvp1	-1,{
OnPCDieEvent:
getmapxy @mapdie1$,@x,@y;
if (@mapdie1$ != "coca_cola")end;
set @id,getcharid(0); set @name$,"";
query_sql "SELECT `name` FROM `rankpvp01` WHERE `char_id`="+@id+"",@name$;
if ( @name$ == "" ) {
	query_sql "INSERT INTO `rankpvp01` (`char_id`,`name`,`deaths_pvp1`,`saldo_pvp1`) VALUES ("+@id+",'"+strcharinfo(0)+"',1)";
	query_sql "UPDATE `rankpvp01` SET `saldo_pvp1` = `saldo_pvp1` - 1 WHERE `char_id`='"+getcharid(0)+"'";
	end;
	}
query_sql "UPDATE `rankpvp01` SET `deaths_pvp1` = `deaths_pvp1` + 1 WHERE `char_id`='"+getcharid(0)+"'";
query_sql "UPDATE `rankpvp01` SET `saldo_pvp1` = `saldo_pvp1` - 1 WHERE `char_id`='"+getcharid(0)+"'";
set @kill1,0;
end;
}

 

-	script	OnPCKillEvent#pvp1	-1,{

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

set Antifk,killedrid;
set @id,getcharid(0); set @name$,"";
query_sql "SELECT `name` FROM `rankpvp01` WHERE `char_id`="+@id+"",@name$;
if ( @name$ == "" ) {
	query_sql "INSERT INTO `rankpvp01` (`char_id`,`name`,`kills_pvp1`) VALUES ("+@id+",'"+strcharinfo(0)+"',1)";
	query_sql "UPDATE `rankpvp01` SET `saldo_pvp1` = `kills_pvp1` - `deaths_pvp1` WHERE `char_id`='"+getcharid(0)+"'";
	end;
	}
query_sql "UPDATE `rankpvp01` SET `kills_pvp1` = `kills_pvp1` + 1 WHERE `char_id`='"+getcharid(0)+"'";
query_sql "UPDATE `rankpvp01` SET `saldo_pvp1` = `kills_pvp1` - `deaths_pvp1` WHERE `char_id`='"+getcharid(0)+"'";
set @kill1,@kill1+1;
			
}

 

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