SA-MP Forums Archive
How can I avoid "input line too long" - 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: How can I avoid "input line too long" (/showthread.php?tid=559051)



How can I avoid "input line too long" - TonyII - 20.01.2015

Hey, so I've tried multiple things to avoid the input line too long error, but I end up with a not working script. The code under us is working fine, but it's limited, with that I mean if I want more data to save I get the input line too long error. So my question is how can I avoid the error and make the script work at the same time. I tried using strcat and many more but I'm pretty much desperate.

pawn Код:
mysql_format(sqlid,query,sizeof(query),"UPDATE `users` SET `px` = %f,`py` = %f,`pz` = %f,`pa` = %f,`hp` = %f,`armor` = %f WHERE username = '%e'",\
    PlayerInfo[playerid][pPosX],
    PlayerInfo[playerid][pPosY],
    PlayerInfo[playerid][pPosZ],
    PlayerInfo[playerid][pPosA],
    PlayerInfo[playerid][pHealth],
    PlayerInfo[playerid][pArmor],
    GPN(playerid));
    mysql_tquery(sqlid,query, "", "");



Re: How can I avoid "input line too long" - JaydenJason - 20.01.2015

Have you tried to "split" the string using " \ "(without quotationmarks) ?
"My name \
is Jason"


Re: How can I avoid "input line too long" - TonyII - 20.01.2015

Yea, the backslashes didn't remove the error for me.


Re: How can I avoid "input line too long" - Ironboy - 20.01.2015

Example code

pawn Код:
new strcatstring[300];
mysql_format(mysql, strcatstring, sizeof(strcatstring), "UPDATE `users` SET `score`=%d, `money`=%d,",
GetPlayerScore(playerid),GetPlayerMoney(playerid), /* variables*/);
strcat(query, strcatstring);
       
mysql_format(mysql, strcatstring, sizeof(strcatstring), "`x`=%d, `y`=%d, `z`=%d WHERE username = '%e'",
PlayerInfo[playerid][x],/* variables*/);
strcat(query, strcatstring);

mysql_tquery(mysql, query, "", "");



Re: How can I avoid "input line too long" - TonyII - 20.01.2015

pawn Код:
GetPlayerPos(playerid,PlayerInfo[playerid][pPosX],PlayerInfo[playerid][pPosY],PlayerInfo[playerid][pPosZ]);
    GetPlayerFacingAngle(playerid,PlayerInfo[playerid][pPosA]);
    GetPlayerHealth(playerid,PlayerInfo[playerid][pHealth]);
    GetPlayerArmour(playerid,PlayerInfo[playerid][pArmor]);
    new strcatstring[300];
    mysql_format(sqlid,strcatstring, sizeof(strcatstring),"UPDATE `users` SET `px`=%f,`py`=%f,`pz`=%f",
    PlayerInfo[playerid][pPosX],
    PlayerInfo[playerid][pPosY],
    PlayerInfo[playerid][pPosZ],
    PlayerInfo[playerid][pPosA]);
    strcat(query,strcatstring);
    mysql_format(sqlid,strcatstring, sizeof(strcatstring), "`hp`=%f, `armor`=%f WHERE username = '%e'",
    PlayerInfo[playerid][pHealth],
    PlayerInfo[playerid][pArmor],
    GPN(playerid));
    strcat(query,strcatstring);
    mysql_tquery(sqlid,query, "", "");
Not sure if I did it right, it won't work for me.


Re: How can I avoid "input line too long" - Ironboy - 20.01.2015

You have missed a coma at the ending.
pawn Код:
"UPDATE `users` SET `px`=%f,`py`=%f,`pz`=%f,"