Problem with a_mysql
#1

Hi,
When i enter this code there no error:
Код:
SetupPlayerTable()
{
	mysql_tquery(g_SQL, "CREATE TABLE IF NOT EXISTS `players` (`id` int(11) NOT NULL AUTO_INCREMENT,`username` varchar(24) NOT NULL,`password` char(64) NOT NULL,`salt` char(16) NOT NULL,`kills` mediumint(8) NOT NULL DEFAULT '0',`deaths` mediumint(8) NOT NULL DEFAULT '0',`x` float NOT NULL DEFAULT '0',`y` float NOT NULL DEFAULT '0',`z` float NOT NULL DEFAULT '0',`angle` float NOT NULL DEFAULT '0',`interior` tinyint(3) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`))");
	return 1;
}
but when i customize it and add score it gives me error:

Code:
Код:
SetupPlayerTable()
{
	mysql_tquery(g_SQL, "CREATE TABLE IF NOT EXISTS `players` (`id` int(11) NOT NULL AUTO_INCREMENT,`username` varchar(24) NOT NULL,`password` char(64) NOT NULL,`salt` char(16) NOT NULL,`kills` mediumint(8) NOT NULL DEFAULT '0',`deaths` mediumint(8) NOT NULL DEFAULT '0',`x` float NOT NULL DEFAULT '0',`y` float NOT NULL DEFAULT '0',`z` float NOT NULL DEFAULT '0',`angle` float NOT NULL DEFAULT '0',`interior` tinyint(3) NOT NULL DEFAULT '0',`Score` mediumint(8) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`))");
	return 1;
}
Error:
Код:
D:\GTA San Andreas\Server\gamemodes\mysql1.pwn(334) : error 075: input line too long (after substitutions)
D:\GTA San Andreas\Server\gamemodes\mysql1.pwn(335) : error 037: invalid string (possibly non-terminated string)
D:\GTA San Andreas\Server\gamemodes\mysql1.pwn(335) : error 017: undefined symbol "CREATE"
D:\GTA San Andreas\Server\gamemodes\mysql1.pwn(335) : error 017: undefined symbol "TABLE"
D:\GTA San Andreas\Server\gamemodes\mysql1.pwn(335) : fatal error 107: too many error messages on one line
Reply
#2

Sorry fixed!
Reply
#3

No still problem :3 same error
Reply
#4

PHP код:
new query[500];
strcat(query"CREATE TABLE IF NOT EXISTS `players` (`id` int(11) NOT NULL AUTO_INCREMENT,`username` varchar(24) NOT NULL,`password` char(64) NOT NULL,");
strcat(query"`salt` char(16) NOT NULL,`kills` mediumint(8) NOT NULL DEFAULT '0',`deaths` mediumint(8) NOT NULL DEFAULT '0',`x` float NOT NULL DEFAULT '0'");
strcat(query",`y` float NOT NULL DEFAULT '0',`z` float NOT NULL DEFAULT '0',`angle` float NOT NULL DEFAULT '0',`interior` tinyint(3) NOT NULL DEFAULT '0'");
strcat(query", PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`))");
mysql_tquery(g_SQLquery""""); 
Should work, try it.
Reply
#5

No error but also not saving
Reply
#6

Try this:
PHP код:
new query[500];
strcat(query"CREATE TABLE IF NOT EXISTS `players` (`id` int(11) NOT NULL AUTO_INCREMENT,`username` varchar(24) NOT NULL,`password` char(64) NOT NULL, `salt` char(16) NOT NULL,`kills` mediumint(8) NOT NULL DEFAULT '0',`deaths` mediumint(8) NOT NULL DEFAULT '0',`x` float NOT NULL DEFAULT '0',`y` float NOT NULL DEFAULT '0',`z` float NOT NULL DEFAULT '0',`angle` float NOT NULL DEFAULT '0',`interior` tinyint(3) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`))");
mysql_tquery(g_SQLquery""""); 
Reply
#7

dude make a score saving system :/
Reply
#8

Consider understanding the method instead of requesting everything pre-made, anyway here you go:

PHP код:
new query[500];
strcat(query"CREATE TABLE IF NOT EXISTS `players` (`id` int(11) NOT NULL AUTO_INCREMENT,`username` varchar(24) NOT NULL,`password` char(64) NOT NULL,`salt` char(16) NOT NULL,`kills` mediumint(8) NOT NULL DEFAULT '0',`deaths` mediumint(8) NOT NULL DEFAULT '0',`x` float NOT NULL DEFAULT '0',`y` float NOT NULL DEFAULT '0',`z` float NOT NULL DEFAULT '0',`angle` float NOT NULL DEFAULT '0',`interior` tinyint(3) NOT NULL DEFAULT '0',`Score` mediumint(8) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `username` (`username`))");
mysql_tquery(g_SQLquery""""); 
Reply
#9

bro make a code that also save scores :/ i am having problem while do score save

errors
Код:
D:\GTA San Andreas\Server\gamemodes\mysql1.pwn(336) : error 075: input line too long (after substitutions)
D:\GTA San Andreas\Server\gamemodes\mysql1.pwn(337) : error 037: invalid string (possibly non-terminated string)
D:\GTA San Andreas\Server\gamemodes\mysql1.pwn(337) : error 017: undefined symbol "CREATE"
D:\GTA San Andreas\Server\gamemodes\mysql1.pwn(337) : error 017: undefined symbol "TABLE"
D:\GTA San Andreas\Server\gamemodes\mysql1.pwn(337) : fatal error 107: too many error messages on one line
Reply
#10

Quote:
Originally Posted by akib
Посмотреть сообщение
No error but also not saving
You do realize you posted CREATE TABLE query, not saving one...Its job is to create table if one does not exists, not save something.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)