4 errors on almost the same line
#1

Hey,

I have a problem here, I'm following a tutorial and now I have 4 error's on almost the same line.
My errors:
Код:
C:\Users\Jordy\Desktop\SAMP server\gamemodes\server.pwn(202) : error 037: invalid string (possibly non-terminated string)
C:\Users\Jordy\Desktop\SAMP server\gamemodes\server.pwn(202) : error 017: undefined symbol "INSERT"
C:\Users\Jordy\Desktop\SAMP server\gamemodes\server.pwn(202) : error 017: undefined symbol "INTO"
C:\Users\Jordy\Desktop\SAMP server\gamemodes\server.pwn(202) : fatal error 107: too many error messages on one line
And the code on that line:
pawn Код:
case 2: //register dialog
        {
            if(!response) return Kick(playerid);
            if(strlen(inputtext) < 6) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Register", "In order to play, you need to register.\nYour password must be at least 6 characters long!", "Register", "Quit");
                new query[300];
            WP_Hash(pInfo[playerid][Password], 129, inputtext); //hashing inputtext
            mysql_format(mysql, query, sizeof(query), "INSERT INTO `players` (`Username`, `Password`, `IP`, `Admin`, `VIP`, `Money`, `PosX` ,`PosY`, `PosZ`, `Weapon1`, `Weapon2` , `Weapon3`, `Seeds`, `Weed`, `Cocaine`,
            `Faction`, `OOCGroup`, `Phone`, `Phnr`, `House1`, `House2`, `Business1`, `Business2`, `Car1`, `Car2`, `Car3`, `Metal, MP`, `Job`, `Products`) VALUES ('%e', '%s', '%s', 0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)"
, Name[playerid], pInfo[playerid][Password], IP[playerid]);
           
            mysql_tquery(mysql, query, "OnAccountRegister", "i", playerid);
           
        }
If someone can help me..

Thanks in advance!
Reply
#2

You try to split the string at the next line. Use it in one line:
pawn Код:
mysql_format(mysql, query, sizeof(query), "INSERT INTO `players` (`Username`, `Password`, `IP`, `Admin`, `VIP`, `Money`, `PosX` ,`PosY`, `PosZ`, `Weapon1`, `Weapon2` , `Weapon3`, `Seeds`, `Weed`, `Cocaine`, `Faction`, `OOCGroup`, `Phone`, `Phnr`, `House1`, `House2`, `Business1`, `Business2`, `Car1`, `Car2`, `Car3`, `Metal, MP`, `Job`, `Products`) VALUES ('%e', '%s', '%s', 0, 0, 0, 0.0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)",
Name[playerid], pInfo[playerid][Password], IP[playerid]);
and you should use default values while creating the table because you wouldn't need to use the last values and the query would be just:
pawn Код:
mysql_format(mysql, query, sizeof(query), "INSERT INTO `players` (`Username`, `Password`, `IP`) VALUES ('%e', '%s', '%s')", Name[playerid], pInfo[playerid][Password], IP[playerid]);
Reply
#3

Thanks that helped!

But how can I split this line? If I try to split it, I get more errors and now only one error (the too long error).
pawn Код:
mysql_format(mysql, query, sizeof(query),
    "UPDATE `players` SET `Admin`=%d, `VIP`=%d, `Money`=%d, `posX`=%f, `posY`=%f, `posZ`=%f, `Weapon1`=%d, `Weapon2`=%d, `Weapon3`=%d, `Seeds`=%d, `Weed`=%d, `Cocaine`=%d,`Faction`=%d, `OOCGroup`=%d, `Phone`=%d, `Phnr`=%d,`House1`=%d, `House2`=%d, `Business1`=%d, `Business2`=%d, `Car1`=%d, `Car2`=%d, `Car3`=%d, `Metal`=%d, `MP`=%d, `Job`=%d, `Products`=%d WHERE `ID`=%d",\
Reply
#4

Try like this:
pawn Код:
mysql_format(mysql, query, sizeof(query),
"UPDATE ...",
... // arguments
);
If the line is still too long, you can remove `` around the fields' name. It's not necessary to use it and it's -58 characters from the query.

If the line is still too long, you can use (mysql) format again. An example would be:
pawn Код:
mysql_format(mysql, query, sizeof(query), "UPDATE players SET Admin=%d, VIP=%d, Money=%d, posX=%f, posY=%f, posZ=%f, Weapon1=%d, Weapon2=%d, Weapon3=%d, Seeds=%d, Weed=%d, Cocaine=%d,Faction=%d, ", /* ARGUMENTS */);
mysql_format(mysql, query, sizeof(query), "%sOOCGroup=%d, Phone=%d, Phnr=%d,House1=%d, House2=%d, Business1=%d, Business2=%d, Car1=%d, Car2=%d, Car3=%d, Metal=%d, MP=%d, Job=%d, Products=%d WHERE ID=%d", query, /* ARGUMENTS */);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)