Input Line too long(after substitutions)
#1

Hi,


EDIT:
These are the errors i'm getting now.. anyone any idea whats going wrong??
Errors:

Код:
E:\Programming\WSRP\gamemodes\wsrpmysql.pwn(1270) : error 035: argument type mismatch (argument 2)
E:\Programming\WSRP\gamemodes\wsrpmysql.pwn(1271) : error 035: argument type mismatch (argument 3)
Script Lines:
Код:
new Query[5000]; // however big you require this variable to be
	strcat(Query,"UPDATE `Users` SET `Money` = '%d', `Level` = '%d', `Admin` = '%d', `Helper` = '%d', `VipLevel` = '%d', `Skin` '%d', `Kills` = '%d', `Deaths` = '%d', `Muted` = '%d', `Cell` = '%d', `Cigs` = '%d', `Watch` = '%d', `Mask` = '%d', `GasCan` = '%d'");
	strcat(Query," `Sprunk` = '%d', `Stereo` = '%d', `GoldCoins` = '%d', `PaymentMethod` = '%d', WHERE `Username` = '%s'");
	strcat(Query, GetPlayerMoney(playerid),GetPVarInt(playerid,"Score"),GetPVarInt(playerid,"Level"),GetPVarInt(playerid,"Helper"),GetPVarInt(playerid,"Vip Level"),GetPlayerSkin(playerid));
	format(Query,sizeof(Query),GetPVarInt(playerid,"Kills"),GetPVarInt(playerid,"Deaths"),GetPVarInt(playerid,"Muted"),GetPVarInt(playerid,"HasCellphone"),GetPVarInt(playerid,"HasCigs"),GetPVarInt(playerid,"HasWatch"),GetPVarInt(playerid,"HasMask"),GetPVarInt(playerid,"GasCan"),GetPVarInt(playerid,"HasSprunk"),GetPVarInt("HasStereo"),GetPVarInt(playerid,"GoldCoins"),GetPVarInt(playerid,"PMethod"),GetPlayerNameEx(playerid));
	mysql_query(Query);




[OLD]
Well, like the title says, i am stuck on this.
I know what it means, but how can I solve it?
This is the code it's about:

Код:
format(Query,sizeof(Query),"UPDATE `Users` SET `Money` = '%d' `Level` = '%d' `Admin` = '%d' `Helper` = '%d' `VipLevel` = '%d' `Skin` '%d' `Kills` = '%d' `Deaths` = '%d' `Muted` = '%d' `Cell` = '%d' `Cigs` = '%d' `Watch` = '%d' `Mask` = '%d' `GasCan` = '%d' `Sprunk` = '%d' `Stereo` = '%d' `GoldCoins` = '%d' `PaymentMethod` = '%d' WHERE `Username` = '%s' ",GetPlayerMoney(playerid),GetPVarInt(playerid,"Score"),GetPVarInt(playerid,"Level"),GetPVarInt(playerid,"Helper"),GetPVarInt(playerid,"Vip Level"),GetPlayerSkin(playerid),GetPVarInt(playerid,"Kills"),GetPVarInt(playerid,"Deaths"),GetPVarInt(playerid,"Muted"),GetPVarInt(playerid,"HasCellphone"),GetPVarInt(playerid,"HasCigs"),GetPVarInt(playerid,"HasWatch"),GetPVarInt(playerid,"HasMask"),GetPVarInt(playerid,"GasCan"),GetPVarInt(playerid,"HasSprunk"),GetPVarInt("HasStereo"),GetPVarInt(playerid,"GoldCoins"),GetPVarInt(playerid,"PMethod"),GetPlayerNameEx(playerid));
Yeah, I know it's pretty much, but how can i do this shorter/other way??
Reply
#2

That query won't work because there are no commas between each updating variable. Here, use this:

pawn Код:
format(Query, sizeof(Query),"UPDATE `Users` SET `Money`='%d', `Level`='%d', `Admin`='%d', `Helper`='%d', `VipLevel`='%d', `Skin`='%d', `Kills`='%d', `Deaths`='%d', `Muted`='%d', `Cell`='%d', `Cigs`='%d', `Watch`='%d', ",GetPlayerMoney(playerid),GetPVarInt(playerid,"Score"),GetPVarInt(playerid,"Level"),GetPVarInt(playerid,"Helper"),GetPVarInt(playerid,"Vip Level"),GetPlayerSkin(playerid),GetPVarInt(playerid,"Kills"),GetPVarInt(playerid,"Deaths"),GetPVarInt(playerid,"Muted"),GetPVarInt(playerid,"HasCellphone"),GetPVarInt(playerid,"HasCigs"),GetPVarInt(playerid,"HasWatch"));

format(Query, sizeof(Query), "%s`Mask`='%d', `GasCan`='%d', `Sprunk`='%d', `Stereo`='%d', `GoldCoins`='%d', `PaymentMethod`='%d'  WHERE `Username` = '%s' ",query,GetPVarInt(playerid,"HasMask"),GetPVarInt(playerid,"GasCan"),GetPVarInt(playerid,"HasSprunk"),GetPVarInt("HasStereo"),GetPVarInt(playerid,"GoldCoins"),GetPVarInt(playerid,"PMethod"),GetPlayerNameEx(playerid));
Your code is very messy, no offense.
Reply
#3

Regardless of whether or not the query in itself works, the problem is, as it states, that line is too long.
To split it up you could use a function such as strcat like so:
pawn Код:
new Query[5000]; // however big you require this variable to be
strcat(Query,"UPDATE `Users` SET `Money` = '%d' `Level` = '%d' `Admin` = '%d' `Helper` = '%d' `VipLevel` = '%d' `Skin` '%d' `Kills` = '%d' `Deaths` = '%d' `Muted` = '%d' `Cell` = '%d' `Cigs` = '%d' `Watch` = '%d' `Mask` = '%d' `GasCan` = '%d'");
strcat(Query," `Sprunk` = '%d' `Stereo` = '%d' `GoldCoins` = '%d' `PaymentMethod` = '%d' WHERE `Username` = '%s'");
format(Query,sizeof(Query),Query,GetPlayerMoney(playerid),GetPVarInt(playerid,"Score"),GetPVarInt(playerid,"Level"),GetPVarInt(playerid,"Helper"),GetPVarInt(playerid,"Vip Level"),GetPlayerSkin(playerid),GetPVarInt(playerid,"Kills"),GetPVarInt(playerid,"Deaths"),GetPVarInt(playerid,"Muted"),GetPVarInt(playerid,"HasCellphone"),GetPVarInt(playerid,"HasCigs"),GetPVarInt(playerid,"HasWatch"),GetPVarInt(playerid,"HasMask"),GetPVarInt(playerid,"GasCan"),GetPVarInt(playerid,"HasSprunk"),GetPVarInt("HasStereo"),GetPVarInt(playerid,"GoldCoins"),GetPVarInt(playerid,"PMethod"),GetPlayerNameEx(playerid));
Reply
#4

EDIT:



hmm.. little problem, i fixed it now, but it says argument type mismatch:

Errors:

Код:
E:\Programming\WSRP\gamemodes\wsrpmysql.pwn(1270) : error 035: argument type mismatch (argument 2)
E:\Programming\WSRP\gamemodes\wsrpmysql.pwn(1271) : error 035: argument type mismatch (argument 3)
Script Lines:
Код:
new Query[5000]; // however big you require this variable to be
	strcat(Query,"UPDATE `Users` SET `Money` = '%d', `Level` = '%d', `Admin` = '%d', `Helper` = '%d', `VipLevel` = '%d', `Skin` '%d', `Kills` = '%d', `Deaths` = '%d', `Muted` = '%d', `Cell` = '%d', `Cigs` = '%d', `Watch` = '%d', `Mask` = '%d', `GasCan` = '%d'");
	strcat(Query," `Sprunk` = '%d', `Stereo` = '%d', `GoldCoins` = '%d', `PaymentMethod` = '%d', WHERE `Username` = '%s'");
	strcat(Query, GetPlayerMoney(playerid),GetPVarInt(playerid,"Score"),GetPVarInt(playerid,"Level"),GetPVarInt(playerid,"Helper"),GetPVarInt(playerid,"Vip Level"),GetPlayerSkin(playerid));
	format(Query,sizeof(Query),GetPVarInt(playerid,"Kills"),GetPVarInt(playerid,"Deaths"),GetPVarInt(playerid,"Muted"),GetPVarInt(playerid,"HasCellphone"),GetPVarInt(playerid,"HasCigs"),GetPVarInt(playerid,"HasWatch"),GetPVarInt(playerid,"HasMask"),GetPVarInt(playerid,"GasCan"),GetPVarInt(playerid,"HasSprunk"),GetPVarInt("HasStereo"),GetPVarInt(playerid,"GoldCoins"),GetPVarInt(playerid,"PMethod"),GetPlayerNameEx(playerid));
	mysql_query(Query);
Reply
#5

sry for the small bump, i won't do it again, but this is my last thing before my GM is complete..
Reply
#6

Define the GetPVarInt's and names small

eg
pawn Код:
new name = GetPlayerNameEx(playerid);
Reply
#7

Quote:
Originally Posted by Spooky
Посмотреть сообщение
Define the GetPVarInt's and names small

eg
pawn Код:
new name = GetPlayerNameEx(playerid);
thanks, i will try this,

Just to be sure, in case this goes wrong, does anyone know whats wrong with the strcat thing? Why does it say argument type mismatch!?
Reply
#8

Quote:
Originally Posted by Jari_Johnson*
Посмотреть сообщение
thanks, i will try this,

Just to be sure, in case this goes wrong, does anyone know whats wrong with the strcat thing? Why does it say argument type mismatch!?
Like it says, check your second param and the third param at line 1270 and 1271.
Reply
#9

Quote:
Originally Posted by Xtreme_playa
Посмотреть сообщение
Like it says, check your second param and the third param at line 1270 and 1271.
I did, but i can't find anything wrong.. thats the problem.
I mean, this is the right syntax when using strcat right?
pawn Код:
new Query[5000]; // however big you require this variable to be
    strcat(Query,"UPDATE `Users` SET `Money` = '%d', `Level` = '%d', `Admin` = '%d', `Helper` = '%d', `VipLevel` = '%d', `Skin` '%d', `Kills` = '%d', `Deaths` = '%d', `Muted` = '%d', `Cell` = '%d', `Cigs` = '%d', `Watch` = '%d', `Mask` = '%d', `GasCan` = '%d'");
    strcat(Query," `Sprunk` = '%d', `Stereo` = '%d', `GoldCoins` = '%d', `PaymentMethod` = '%d', WHERE `Username` = '%s'");
    strcat(Query,GetPlayerMoney(playerid),GetPVarInt(playerid,"Score"),GetPVarInt(playerid,"Level"),GetPVarInt(playerid,"Helper"),GetPVarInt(playerid,"Vip Level"),GetPlayerSkin(playerid));
    format(Query,sizeof(Query),GetPVarInt(playerid,"Kills"),GetPVarInt(playerid,"Deaths"),GetPVarInt(playerid,"Muted"),GetPVarInt(playerid,"HasCellphone"),GetPVarInt(playerid,"HasCigs"),GetPVarInt(playerid,"HasWatch"),GetPVarInt(playerid,"HasMask"),GetPVarInt(playerid,"GasCan"),GetPVarInt(playerid,"HasSprunk"),GetPVarInt("HasStereo"),GetPVarInt(playerid,"GoldCoins"),GetPVarInt(playerid,"PMethod"),GetPlayerNameEx(playerid));
    mysql_query(Query);
@spooky yes, i checked it..
Reply
#10

Quote:
Originally Posted by Jari_Johnson*
Посмотреть сообщение
I did, but i can't find anything wrong.. thats the problem.
I mean, this is the right syntax when using strcat right?
pawn Код:
new Query[5000]; // however big you require this variable to be
    strcat(Query,"UPDATE `Users` SET `Money` = '%d', `Level` = '%d', `Admin` = '%d', `Helper` = '%d', `VipLevel` = '%d', `Skin` '%d', `Kills` = '%d', `Deaths` = '%d', `Muted` = '%d', `Cell` = '%d', `Cigs` = '%d', `Watch` = '%d', `Mask` = '%d', `GasCan` = '%d'");
    strcat(Query," `Sprunk` = '%d', `Stereo` = '%d', `GoldCoins` = '%d', `PaymentMethod` = '%d', WHERE `Username` = '%s'");
    strcat(Query,GetPlayerMoney(playerid),GetPVarInt(playerid,"Score"),GetPVarInt(playerid,"Level"),GetPVarInt(playerid,"Helper"),GetPVarInt(playerid,"Vip Level"),GetPlayerSkin(playerid));
    format(Query,sizeof(Query),GetPVarInt(playerid,"Kills"),GetPVarInt(playerid,"Deaths"),GetPVarInt(playerid,"Muted"),GetPVarInt(playerid,"HasCellphone"),GetPVarInt(playerid,"HasCigs"),GetPVarInt(playerid,"HasWatch"),GetPVarInt(playerid,"HasMask"),GetPVarInt(playerid,"GasCan"),GetPVarInt(playerid,"HasSprunk"),GetPVarInt("HasStereo"),GetPVarInt(playerid,"GoldCoins"),GetPVarInt(playerid,"PMethod"),GetPlayerNameEx(playerid));
    mysql_query(Query);
@spooky yes, i checked it..
Highlight line 1270 and 1271 here
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)