Hello Need Urgent Help
#1

Hello friends,

I am trying to convert my Gamemode from Y/ini to mysql but this giving errors

Код:
    mysql_tquery(mysql, "CREATE TABLE IF NOT EXISTS `players`(\
                        `ID` int(10) NOT NULL AUTO_INCREMENT, \
                        `Username` varchar(24) NOT NULL, \
                        `Password` varchar(129) NOT NULL, \
                        `IP` varchar(16) NOT NULL, \
                        `Admin` int(10) NOT NULL, \
                        `VIP` int(10) NOT NULL, \
                        `Ban` int(10) NOT NULL, \
						`Kills` int(10) NOT NULL, \
						`Deaths` int(10) NOT NULL, \
						`Score` int(10) NOT NULL, \
						`Cash` int(10) NOT NULL, \
						`Skin` int(10) NOT NULL, \
						`Jail` int(10) NOT NULL, \
						`Headshots` int(10) NOT NULL, \
						`Bombs` int(10) NOT NULL, \
						`Veh1` int(10) NOT NULL, \
						`Veh2` int(10) NOT NULL, \
						`Veh3` int(10) NOT NULL, \
						`Veh4` int(10) NOT NULL, \
						`Veh5` int(10) NOT NULL, \
						`Veh6` int(10) NOT NULL, \
						`Veh7` int(10) NOT NULL, \
						`Veh8` int(10) NOT NULL, \
						`Veh9` int(10) NOT NULL, \
						`Veh10` int(10) NOT NULL, \
						`Lock` int(10) NOT NULL, \
						`Cloths` int(10) NOT NULL, \
						`Helper` int(10) NOT NULL, \
						`AK47` int(10) NOT NULL, \
						`M4` int(10) NOT NULL, \
						`SP` int(10) NOT NULL, \
						`Balance` int(10) NOT NULL, \
						`Duelwon` int(10) NOT NULL, \
						`Duellose` int(10) NOT NULL, \
						`Kick` int(10) NOT NULL, \
						`Warns` int(10) NOT NULL, \
						`Mathwin` int(10) NOT NULL, \
						`Moneybag` int(10) NOT NULL, \
						`BanAdmin` varchar(24) NOT NULL, \
						`BanReason` varchar(32) NOT NULL, \
                        PRIMARY KEY (`ID`))", "", "");
Errors

(1971) : error 075: input line too long (after substitutions)
(1972) : error 037: invalid string (possibly non-terminated string)
(1972) : error 017: undefined symbol "CREATE"
(1972) : error 017: undefined symbol "TABLE"
(1972) : fatal error 107: too many error messages on one line

I know how to use strcat to divide long line in small but i dont know how to do that in this case
Kindly help

Thanks.
Reply
#2

https://sampwiki.blast.hk/wiki/Strins
Reply
#3

Kindly help me I cant fix that .
Reply
#4

Just install xampp and make your table in the phpmyadmin.
Reply
#5

I already have that but thats not the solution .
if player dont have table every time i have to make my self no
I need to fix that.
Reply
#6

A table holds the data. It's not a single table per user, it's a row. Then a row has fields. Do your research on SQL.
Reply
#7

You could use again strcat but doing it with strcat or format is just inefficient and repetitive, do it like that
pawn Код:
static
        query[] =
            "CREATE TABLE IF NOT EXISTS `players`(\
                `ID` int(10) NOT NULL AUTO_INCREMENT, \
                `Username` varchar(24) NOT NULL, \
                `Password` varchar(129) NOT NULL, \
                `IP` varchar(16) NOT NULL, \
                `Admin` int(10) NOT NULL, \
                `VIP` int(10) NOT NULL, \
                `Ban` int(10) NOT NULL, \
                `Kills` int(10) NOT NULL, \
                `Deaths` int(10) NOT NULL, \
                `Score` int(10) NOT NULL, \
                `Cash` int(10) NOT NULL, \
                `Skin` int(10) NOT NULL, \
                `Jail` int(10) NOT NULL, \
                `Headshots` int(10) NOT NULL, \
                `Bombs` int(10) NOT NULL,"
,
        query1[] = "\
                `Veh1` int(10) NOT NULL, \
                `Veh2` int(10) NOT NULL, \
                `Veh3` int(10) NOT NULL, \
                `Veh4` int(10) NOT NULL, \
                `Veh5` int(10) NOT NULL, \
                `Veh6` int(10) NOT NULL, \
                `Veh7` int(10) NOT NULL, \
                `Veh8` int(10) NOT NULL, \
                `Veh9` int(10) NOT NULL, \
                `Veh10` int(10) NOT NULL, \
                `Lock` int(10) NOT NULL, \
                `Cloths` int(10) NOT NULL, \
                `Helper` int(10) NOT NULL, \
                `AK47` int(10) NOT NULL, \
                `M4` int(10) NOT NULL, \
                `SP` int(10) NOT NULL, \
                `Balance` int(10) NOT NULL, \
                `Duelwon` int(10) NOT NULL,"
,
        query2[] = "\
                `Duellose` int(10) NOT NULL, \
                `Kick` int(10) NOT NULL, \
                `Warns` int(10) NOT NULL, \
                `Mathwin` int(10) NOT NULL, \
                `Moneybag` int(10) NOT NULL, \
                `BanAdmin` varchar(24) NOT NULL, \
                `BanReason` varchar(32) NOT NULL, \
                PRIMARY KEY (`ID`) \
            )"

    ;
    if(query[sizeof query - 1] == EOS) {
        query[sizeof query - 1] = ' ';
        query1[sizeof query1 - 1] = ' ';
        query2[sizeof query2 - 1] = EOS;
    }
    mysql_tquery(mysql, query, "", "");
Reply
#8

Try to use two formats:

Код:
new query[1000];

format(query, sizeof(query), "CREATE TABLE IF NOT EXISTS `players`(\
                        `ID` int(10) NOT NULL AUTO_INCREMENT, \
                        `Username` varchar(24) NOT NULL, \
                        `Password` varchar(129) NOT NULL, \
                        `IP` varchar(16) NOT NULL, \
                        `Admin` int(10) NOT NULL, \
                        `VIP` int(10) NOT NULL, \
                        `Ban` int(10) NOT NULL, \
						`Kills` int(10) NOT NULL, \
						`Deaths` int(10) NOT NULL, \
						`Score` int(10) NOT NULL, \
						`Cash` int(10) NOT NULL, \
						`Skin` int(10) NOT NULL, \
						`Jail` int(10) NOT NULL, \
						`Headshots` int(10) NOT NULL, \
						`Bombs` int(10) NOT NULL, \
						`Veh1` int(10) NOT NULL, \
						`Veh2` int(10) NOT NULL, \
						`Veh3` int(10) NOT NULL, \
						`Veh4` int(10) NOT NULL, \
						`Veh5` int(10) NOT NULL, ");
//second format
format(query, sizeof(query), "%s`Veh6` int(10) NOT NULL, \
						`Veh7` int(10) NOT NULL, \
						`Veh8` int(10) NOT NULL, \
						`Veh9` int(10) NOT NULL, \
						`Veh10` int(10) NOT NULL, \
						`Lock` int(10) NOT NULL, \
						`Cloths` int(10) NOT NULL, \
						`Helper` int(10) NOT NULL, \
						`AK47` int(10) NOT NULL, \
						`M4` int(10) NOT NULL, \
						`SP` int(10) NOT NULL, \
						`Balance` int(10) NOT NULL, \
						`Duelwon` int(10) NOT NULL, \
						`Duellose` int(10) NOT NULL, \
						`Kick` int(10) NOT NULL, \
						`Warns` int(10) NOT NULL, \
						`Mathwin` int(10) NOT NULL, \
						`Moneybag` int(10) NOT NULL, \
						`BanAdmin` varchar(24) NOT NULL, \
						`BanReason` varchar(32) NOT NULL, \
                        PRIMARY KEY (`ID`))", query);

mysql_tquery(mysql, query, "", "");
Reply
#9

Thanks Nero_3D

It compile no error let me check if it work or not.
Reply
#10

Quote:
Originally Posted by MBilal
Посмотреть сообщение
I already have that but thats not the solution .
if player dont have table every time i have to make my self no
I need to fix that.
I think whoever tutorial's did you read, you read it wrong or the tutorial is wrong. A table holds the data, you don't create a table for each player, you create rows. A table holds the rows, rows holds the fields. If that's not how it is at least that's how I understand it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)