Input line too long - Mysql
#1

Hello guys, I have a new problem with my script


Code:
UpdatePlayerData(playerid)
{
	if (Player[playerid][IsLoggedIn] == false) return 0;

	// if the client crashed, it's not possible to get the player's position in OnPlayerDisconnect callback
	// so we will use the last saved position (in case of a player who registered and crashed/kicked, the position will be the default spawn point)

	new query[700];
	mysql_format(dbhandle, query, sizeof query, "UPDATE `players` SET `sexe` = %d, `ethnie` = %d, `age` = %d, `skin` = %d, `level` = %d, `adminlevel` = %d, `banned` = %d, `faction` = %d, `cash` = %d, `rankfaction` = %d, \

    %d WHERE `id` = %d LIMIT 1", Player[playerid][Sexe], Player[playerid][Ethnie], Player[playerid][Age], Player[playerid][Skin], Player[playerid][Level], Player[playerid][AdminLevel], Player[playerid][Banned], Player[playerid][Faction], Player[playerid][Cash], Player[playerid][ID]);


	//mysql_format(dbhandle, query, sizeof query, "UPDATE `players` SET `rankfaction` = %d WHERE `id` = %d LIMIT 1", Player[playerid][RankFaction], Player[playerid][ID]);
	mysql_tquery(dbhandle, query);
	
	return 1;
}

Code:
C:\Users\\Desktop\BLANK_SCRIPT\gamemodes\mysql.pwn(1056) : error 075: input line too long (after substitutions)
C:\Users\\Desktop\BLANK_SCRIPT\gamemodes\mysql.pwn(1057) : error 037: invalid string (possibly non-terminated string)
C:\Users\\Desktop\BLANK_SCRIPT\gamemodes\mysql.pwn(1057) : error 017: undefined symbol "UPDATE"
C:\Users\\Desktop\BLANK_SCRIPT\gamemodes\mysql.pwn(1057) : error 029: invalid expression, assumed zero
C:\Users\\Desktop\BLANK_SCRIPT\gamemodes\mysql.pwn(1057) : fatal error 107: too many error messages on one line

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


5 Errors.
I dont know how do, thanks for your futur help
Reply
#2

The line is absolutely too long, Use strcat or something to reduce its length.
Reply
#3

Okay thanks, so

Quote:

UpdatePlayerData(playerid)
{
if (Player[playerid][IsLoggedIn] == false) return 0;

// if the client crashed, it's not possible to get the player's position in OnPlayerDisconnect callback
// so we will use the last saved position (in case of a player who registered and crashed/kicked, the position will be the default spawn point)

new query[700];
mysql_format(dbhandle, query, sizeof query, "UPDATE `players` SET `sexe` = '%d', `ethnie` = '%d', `age` = '%d', `skin` = '%d', `level` = '%d', `adminlevel` = '%d', `banned` = '%d', `faction` = '%d', `cash` = '%d', `rankfaction` = '%d' WHERE `id` = '%d' LIMIT 1",

// %d WHERE `id` = %d LIMIT 1", Player[playerid][Sexe], Player[playerid][Ethnie], Player[playerid][Age], Player[playerid][Skin], Player[playerid][Level], Player[playerid][AdminLevel], Player[playerid][Banned], Player[playerid][Faction], Player[playerid][Cash], Player[playerid][ID]);


Player[playerid][Sexe],
Player[playerid][Ethnie],
Player[playerid][Age],
Player[playerid][Skin],
Player[playerid][Level],
Player[playerid][AdminLevel],
Player[playerid][Banned],
Player[playerid][Faction],
Player[playerid][Cash],
Player[playerid][RankFaction],
);

//mysql_format(dbhandle, query, sizeof query, "UPDATE `players` SET `rankfaction` = %d WHERE `id` = %d LIMIT 1", Player[playerid][RankFaction], Player[playerid][ID]);
// mysql_tquery(dbhandle, query, false, "", "");
mysql_tquery(dbhandle, query);

return 1;
}

Its right?

But

C:\Users\\Desktop\BLANK_SCRIPT\gamemodes\mysql.pwn (1058 -- 1073) : error 029: invalid expression, assumed zero
C:\Users\\Desktop\BLANK_SCRIPT\gamemodes\mysql.pwn (1058 -- 1073) : error 001: expected token: ",", but found ";"



EDIT: Its ok lol, I have forget an comma

Player[playerid][RankFaction],
);


Thanks man
Reply
#4

which lines exactly got the errors? and you haven't used strcat btw, You can learn using strcat from here
Reply
#5

Ok I don't have the errors, but the data players don't saving

I try with strcat
Reply
#6

Do you know how to use strcat properly?


P.S: another method i guess that would fix the problem is removing the spaces between the text inside the format tho..
Reply
#7

Yeah without the spaces its ok but if I add a many stats, the problem he come ?

For strcat, not really
Reply
#8

Okay then, The code should look like that while using strcat..

PHP Code:
UpdatePlayerData(playerid)
{
if (
Player[playerid][IsLoggedIn] == false) return 0;

// if the client crashed, it's not possible to get the player's position in OnPlayerDisconnect callback
// so we will use the last saved position (in case of a player who registered and crashed/kicked, the position will be the default spawn point)

new query[700];
new 
strcatquery[700];
strcat(strcatquery"UPDATE `players` SET `sexe` = '%d', `ethnie` = '%d', `age` = '%d', `skin` = '%d', `level` = '%d', `adminlevel` = '%d', `banned` = '%d', `faction` = '%d', `cash` = '%d', `rankfaction` = '%d' WHERE `id` = '%d' LIMIT 1");

mysql_format(dbhandlequerysizeof querystrcatqueryPlayer[playerid][Sexe],Player[playerid][Ethnie],Player[playerid][Age],Player[playerid[Skin],Player[playerid[Level],Player[playerid[AdminLevel],Player[playerid[Banned],Player[playerid][Faction],Player[playerid][Cash],Player[playerid][RankFaction],);

//mysql_format(dbhandle, query, sizeof query, "UPDATE `players` SET `rankfaction` = %d WHERE `id` = %d LIMIT 1", Player[playerid][RankFaction], Player[playerid][ID]);
// mysql_tquery(dbhandle, query, false, "", "");
mysql_tquery(dbhandlequery);

return 
1;

idk if I fucked something up or no, try it..
Reply
#9

The error "input line too long" happens when you write a line with 500+ characters... Zeex's compiler doesn't complain about this...
Download it here: https://github.com/Zeex/pawn/releases
Reply
#10

Ok thanks guys, Jason the code its okay, thanks you man.

@10min Aight thanks for that !

Fixed, thanks sa:mp.
Reply
#11

Yeah @adri1, thanks bro
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)