Jump to content
  • 0

problem with pvp sqp error


powkda

Question


  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  89
  • Reputation:   1
  • Joined:  11/11/17
  • Last Seen:  


-	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
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  49
  • Topics Per Day:  0.01
  • Content Count:  1533
  • Reputation:   235
  • Joined:  08/03/12
  • Last Seen:  

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.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  30
  • Topics Per Day:  0.01
  • Content Count:  89
  • Reputation:   1
  • Joined:  11/11/17
  • Last Seen:  

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;
			
}

 

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