MySQL - input line too long
#1

pawn Code:
//======[OnPlayerDisconnect]=====
public OnPlayerDisconnect(playerid, reason)
{
    if(Logged[playerid] == 1)
    {
        //If the player disconnects before registering,
        //we want to make sure it doesn't try update
        //so we check if the player is logged in.
        new score = GetPlayerScore(playerid); //Gets players score
        new money = GetPlayerMoney(playerid); //Gets players money
        new skin = GetPlayerSkin(playerid); // Gets players skin

        new query[200], pname[24]; //Creates the variables
        GetPlayerName(playerid, pname, 24); //Gets the players name.
        format(query, sizeof(query), "UPDATE playerdata SET score=%d, money=%d, Kills=%d, Deaths=%d Adminlevel=%d, Skin=%d, Faction='%s', Donator='%s', Weaponlic='%s', Flylic='%s', Driverlic='%s', Tier=%d WHERE user='%s', Score,Money, PlayerInfo[playerid][Kills], PlayerInfo[playerid][Deaths], PlayerInfo[playerid][Adminlevel], skin, PlayerInfo[playerid][Faction], PlayerInfo[playerid][Donator], PlayerInfo[playerid][Weaponlic], PlayerInfo[playerid][Flylic], PlayerInfo[playerid][Driverlic], PlayerInfo[playerid][Tier], pname);
        mysql_query(query);
        //No need to store a result for a update string
    }
    return 1;
}

// GetPlayerName(pl                 == 299
// format(query, sizeof(query),     == 300
Code:
C:\Documents and Settings\(299) : error 075: input line too long (after substitutions)
C:\Documents and Settings\(300) : error 037: invalid string (possibly non-terminated string)
C:\Documents and Settings\(300) : error 017: undefined symbol "UPDATE"
C:\Documents and Settings\(300) : error 017: undefined symbol "playerdata"
C:\Documents and Settings\(300) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.
Can someone explain what I'm actually doing wrong?
Reply
#2

Place it into 2 lines like so

format(string, sizeof(string), "Part of code", Variables");
Then
format(string, sizeof(string), "restt of code", Variables");
then
strcat(string, string2);
then use that as a output.

If you need more explanasion I will just do it for you...
Reply
#3

First, you forgot to close the string with " at the end.
The format line is too long, pawn stops processing them at some point, dont know when exactly.
So youll need to split it like this

pawn Code:
format(query, sizeof(query), "UPDATE ...",
    parameters_here, ...);
Also your query string is probably too short if you also insert other strings, increase it to 250-300.
Reply
#4

Can someone show me the fixed code? Maybe it sounds abit lazy but it's not, I do not really understand strcat yet.
Reply
#5

Just tested that pawn can handle 510 characters per line (+2 for new line/string termination chars), so you dont need to use strcat, this works for way longer strings, but yours is stil, short enough to do it without that. So all you have to do what i posted, scroll to the end of the format string, insert a ", then go one char right, just behind the comma, and press enter. Done!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)