format - input line too long (after substitutions)
#1

How to write very long format lines? I get this: input line too long (after substitutions) . How to fix that?


pawn Код:
format(Query, sizeof(Query), "UPDATE `playerinfo` SET `kills` = %d,`deaths` = %d,`money` = %d,`Level` = %d \
        `Last Pos X` = %f, `Last Pos Y` = %f, `Last Pos Z` = %f, `Interior` = %d, \
        `Score` = %d, `PlayedTime` = %d, `OwnedCars` = %d, `Job` = %d \
        `Bussines` = %d, `Uniform` = %d, `Clothes` = %d, `MoneyBank` = %d \
        `Jailed` = %d, `JailTime` = %d, `Susp` = %d, `Arrested` = %d \
        `Number` = %d,`Skin` = %d,`Ateori` = %d,`pBteori` = %d \
        `pCteori` = %d,`pDteori` = %d, `pEteori` = %d, `pAlicense` = %d \
        `pBlicense` = %d, `pClicense` = %d, `pDlicense` = %d \
        `pElicense` = %d WHERE `user` = '%s'"
, PVar[playerid][pKills],PVar[playerid][pDeaths],GetPlayerCash(playerid),
        PVar[playerid][pLevel],PVar[playerid][pLastX],PVar[playerid][pLastY],
        PVar[playerid][pLastZ],GetPlayerInterior(playerid),GetPlayerScore(playerid),
        PVar[playerid][pPlayedTime],PVar[playerid][pOwnedCars],PVar[playerid][pJob],
        PVar[playerid][pBussines],PVar[playerid][pUniform],PVar[playerid][pClothes],
        PVar[playerid][pMoneyBank],PVar[playerid][pJailed],PVar[playerid][pJailTime],
        PVar[playerid][pSusp],PVar[playerid][pArrested],PVar[playerid][pNumber],
        GetPlayerSkin(playerid),PVar[playerid][pAteori],PVar[playerid][pBteori],
        PVar[playerid][pCteori],PVar[playerid][pDteori],PVar[playerid][pEteori],
        PVar[playerid][pAlicense],PVar[playerid][pBlicense],PVar[playerid][pClicense],
        PVar[playerid][pDlicense],PVar[playerid][pElicense],pName(playerid));
Reply
#2

Can we see the code ?
Reply
#3

Post the code please.
Reply
#4

post updated
Reply
#5

Try formating it bit by bit instead of one function call. I don't think its possible to write a line that big.
Reply
#6

Quote:
Originally Posted by ******
Посмотреть сообщение
You could try the "SET () VALUES ()" format.
won't work
Reply
#7

I don't know why your trying to update all those values at once though..the majority of those values hardly even get modified in comparison to others that do.
I suggest you update the really necessary values in that and then the others individually when needed, it would be so much better.
Reply
#8

Breaking it into pieces is another option:
pawn Код:
format(query, sizeof(query), /*Part of your Query*/, /*Values*/);
format(query, sizeof(query, "%s /*Rest of Query*/", query, /*rest of values*/);
Reply
#9

pawn Код:
format(Query, sizeof(Query), "UPDATE `playerinfo` SET `kills` = %d,`deaths` = %d,`money` = %d,`Level` = %d `Last Pos X` = %f, `Last Pos Y` = %f, `Last Pos Z` = %f, `Interior` = %d, \`Score` = %d WHERE `user` = '%s'", PVar[playerid][pKills],PVar[playerid][pDeaths],GetPlayerCash(playerid),PVar[playerid][pLevel],PVar[playerid][pLastX],PVar[playerid][pLastY],PVar[playerid][pLastZ],GetPlayerInterior(playerid),GetPlayerScore(playerid));
/*Save the string "Query"*/
format(Query, sizeof(Query), "UPDATE `playerinfo` SET `Score` = %d, `PlayedTime` = %d, `OwnedCars` = %d, `Job` = %d \`Bussines` = %d, `Uniform` = %d WHERE `user` = '%s'", GetPlayerScore(playerid),PVar[playerid][pPlayedTime],PVar[playerid][pOwnedCars],PVar[playerid][pJob],PVar[playerid][pBussines],PVar[playerid][pUniform]);
/*Save the string "Query"*/
format(Query, sizeof(Query), "UPDATE `playerinfo` SET `Clothes` = %d, `MoneyBank` = %d \`Jailed` = %d, `JailTime` = %d, `Susp` = %d WHERE `user` = '%s'",PVar[playerid][pClothes],PVar[playerid][pMoneyBank],PVar[playerid][pJailed],PVar[playerid][pJailTime],PVar[playerid][pSusp]);
/*Save the string "Query"*/
format(Query, sizeof(Query), "UPDATE `playerinfo` SET `Arrested` = %d \`Number` = %d,`Skin` = %d,`Ateori` = %d,`pBteori` = %d \`pCteori` = %d,`pDteori` = %d, `pEteori` = %d WHERE `user` = '%s'",PVar[playerid][pArrested],PVar[playerid][pNumber],GetPlayerSkin(playerid),PVar[playerid][pAteori],PVar[playerid][pBteori],PVar[playerid][pCteori],PVar[playerid][pDteori],PVar[playerid][pEteori]);
/*Save the string "Query"*/
format(Query, sizeof(Query), "UPDATE `playerinfo` SET `pEteori` = %d, `pAlicense` = %d \`pBlicense` = %d, `pClicense` = %d, `pDlicense` = %d \`pElicense` = %d WHERE `user` = '%s'",PVar[playerid][pEteori],PVar[playerid][pAlicense],PVar[playerid][pBlicense],PVar[playerid][pClicense],PVar[playerid][pDlicense],PVar[playerid][pElicense],pName(playerid));
/*Save the string "Query"*/
That's it
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)