Jump to content
  • 0

Question

Posted

I'm an error that appears on the console of a npc, I would like to correct

 

 Console

: DB error - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1') ON DUPLICATE KEY UPDATE mvpkills = mvpkills + '1'' at line 1
[Debug]: at script.c:14636 - INSERT INTO mvprank (id, name, mvpkills) values('150880','ParanoiD'','1') ON DUPLICATE KEY UPDATE mvpkills = mvpkills + '1'
[Debug]: Source (NPC): Rank MvP#1 (invisible/not on a map)
[Error]: buildin_rid2name: invalid RID
[sql]: DB error - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1') ON DUPLICATE KEY UPDATE mvpkills = mvpkills + '1'' at line 1
[Debug]: at script.c:14636 - INSERT INTO mvprank (id, name, mvpkills) values('150880','ParanoiD'','1') ON DUPLICATE KEY UPDATE mvpkills = mvpkills + '1'
[Debug]: Source (NPC): Rank MvP#1 (invisible/not on a map)

 

 

Npc

 

- script Rank MvP#1 -1,{
OnInit:
query_sql "CREATE TABLE IF NOT EXISTS `mvprank` (`id` INT( 11 ) UNSIGNED NOT NULL DEFAULT '0',`name` VARCHAR( 23 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL ,`mvpkills` BIGINT UNSIGNED NOT NULL ,UNIQUE (`id`)) ENGINE = MYISAM";
set $a, 1;
set $topmvp, 5;
setarray $mvpid[0],1511,1251,1734,1647,1651,1785,1873,1388,1630,1399,1039,1874,2068,1272,1719,1046,1389,1885,1876,1112,1115,1957,1418,1871,1252,1768,1086,1688,1646,1373,1147,1492,1059,1150,1956,2022,1087,1190,1038,1157,1159,1502,1623,1650,1583,1779,1708,1312,1751,1685,1648,1649,1917,1658,1832,1916,2000,2001,2002,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2021,2024,2025,2026,2027,2028,2032;
end;
 
OnNPCKillEvent:
for (set .@i, 0; .@i < getarraysize($mvpid); set .@i, .@i + 1) {
if (killedrid == $mvpid[.@i]) set .@s,1;
}
if (!.@s) end;
if ($a) announce "",bc_blue|bc_all;
query_sql "INSERT INTO mvprank (id, name, mvpkills) values('"+getcharid(0)+"','"+strcharinfo(0)+"','1') ON DUPLICATE KEY UPDATE mvpkills = mvpkills + '1'";
end;
}
 

3 answers to this question

Recommended Posts

Posted


- script Rank MvP#1 -1,{

OnInit:

query_sql "CREATE TABLE IF NOT EXISTS `mvprank` (`id` INT( 11 ) UNSIGNED NOT NULL DEFAULT '0',`name` VARCHAR( 23 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL ,`mvpkills` BIGINT UNSIGNED NOT NULL ,UNIQUE (`id`)) ENGINE = MYISAM";

$a = 1;

$topmvp = 5;

setarray $mvpid[0],1511,1251,1734,1647,1651,1785,1873,1388,1630,1399,1039,1874,2068,1272,1719,1046,1389,1885,1876,1112,1115,1957,1418,1871,1252,1768,1086,1688,1646,1373,1147,1492,1059,1150,1956,2022,1087,1190,1038,1157,1159,1502,1623,1650,1583,1779,1708,1312,1751,1685,1648,1649,1917,1658,1832,1916,2000,2001,2002,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2021,2024,2025,2026,2027,2028,2032;

end;

OnNPCKillEvent:

for (.@i = 0; .@i < getarraysize($mvpid); .@i++) {

if (killedrid == $mvpid[.@i]) {

if ($a) announce strcharinfo(0)+" got +1 Point on MVP Rank!",bc_blue|bc_all;

query_sql("INSERT INTO `mvprank` SET `id`='"+getcharid(0)+"',`name`='"+strcharinfo(0)+"',`mvpkills`='1' ON DUPLICATE KEY UPDATE `mvpkills`=`mvpkills`+'1'");

}

}

end;

}

Posted

the data type is integer ....

query_sql("INSERT INTO `mvprank` SET `id`='"+getcharid(0)+"',`name`='"+strcharinfo(0)+"',`mvpkills`= 1 ON DUPLICATE KEY UPDATE `mvpkills`=`mvpkills`+ 1");

dont add unneccesary quote to the integer numbers ...

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