SA-MP Forums Archive
format - input line too long (after substitutions) - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: format - input line too long (after substitutions) (/showthread.php?tid=236521)



format - input line too long (after substitutions) - ajwar - 07.03.2011

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));



Re: format - input line too long (after substitutions) - Stigg - 07.03.2011

Can we see the code ?


Re: format - input line too long (after substitutions) - Davz*|*Criss - 07.03.2011

Post the code please.


Re: format - input line too long (after substitutions) - ajwar - 07.03.2011

post updated


Re: format - input line too long (after substitutions) - iggy1 - 07.03.2011

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


Re: format - input line too long (after substitutions) - ajwar - 08.03.2011

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


Re: format - input line too long (after substitutions) - s0nic - 20.03.2011

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.


Re: format - input line too long (after substitutions) - randomkid88 - 20.03.2011

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*/);



AW: format - input line too long (after substitutions) - Pablo Borsellino - 20.03.2011

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