Help! - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Help! (
/showthread.php?tid=591230)
Help! -
Hybris - 09.10.2015
Hello this line is too long I was wondering if there was a way to put the query's under eachother or something
Код:
db_query(Database, "CREATE TABLE IF NOT EXISTS Users (Userid INTEGER PRIMARY KEY AUTOINCREMENT, Username VARCHAR(24) COLLATE NOCASE, Password VARCHAR(129), Admin INTEGER DEFAULT 0 NOT NULL, Premium INTEGER DEFAULT 0 NOT NULL, Money INTEGER DEFAULT 0 NOT NULL, Score INTEGER DEFAULT 0 NOT NULL, Kills INTEGER DEFAULT 0 NOT NULL, Deaths INTEGER DEFAULT 0 NOT NULL, KD INTEGER DEFAULT 0 NOT NULL)");
Re: Help! -
Face9000 - 09.10.2015
Use strcat. One tip: Save just the more important variables like Username, Password and if you have it, IP. For others save them manually.
Re: Help! -
Hybris - 09.10.2015
Aren't there faster ways to do this?
Re: Help! -
Face9000 - 09.10.2015
Yes. With that code you're creating the table "Users", probably you're running it on OnGameModeInit, instead, open your database with phpmyadmin, and execute this query:
PHP код:
CREATE TABLE IF NOT EXISTS `Users` (
`Userid` int(10) NOT NULL,
`Username` varchar(24) NOT NULL,
`Password` varchar(129) NOT NULL,
`Admin` int(11) NOT NULL,
`Premium` int(11) NOT NULL,
`Money` int(11) NOT NULL,
`Score` int(11) NOT NULL,
`Kills` int(11) NOT NULL,
`Deaths` int(11) NOT NULL,
`Deaths` int(11) NOT NULL,
`KG` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Re: Help! -
Hybris - 09.10.2015
Sorry but im using SQL not MySQL I just need an efficient and fast way to make the columns without reducing speed...
Re: Help! -
Face9000 - 09.10.2015
Emh....SQL is MySql...with the code your provided us it will create everytime the table, with my code just once.
Re: Help! -
Hybris - 09.10.2015
Im not creating the table everytime only if the table is non existant in scriptfiles while mysql needs a mysql server I only need a efficient way of creating the query's but Im not sure if there is a better way than strcat
Re: Help! -
gurmani11 - 09.10.2015
PHP код:
new tquery[512];
strcat(tquery,"CREATE TABLE IF NOT EXISTS Users (Userid INTEGER PRIMARY KEY AUTOINCREMENT,\
Username VARCHAR(24) COLLATE NOCASE,\
Password VARCHAR(129),\
Admin INTEGER DEFAULT 0 NOT NULL,\
Premium INTEGER DEFAULT 0 NOT NULL,\
Money INTEGER DEFAULT 0 NOT NULL,");
strcat(tquery,"Score INTEGER DEFAULT 0 NOT NULL,\
Kills INTEGER DEFAULT 0 NOT NULL,\
Deaths INTEGER DEFAULT 0 NOT NULL,\
KD INTEGER DEFAULT 0 NOT NULL)");
db_query(Database,tquery);