-
Sziasztok!
Valaki megtudná mondani hogy miért ír erre hosszú sor hibát?
Pedig tettem bele sor töréseket.
new query[2000];
mysql_format(mysql_kapcs, query, 384, \"UPDATE users SET Money=\'%d\',Score=\'%d\',Kills=\'%d\',Deaths=\'%d\',HomeWeapons=\'%d\',Wanted=\'%d\',Level=\'%d\',\\
Weapon1=\'%d\',Weapon1a=\'%d\',Weapon2=\'%d\',Weapon2a=\'%d\',Weapon3=\'%d\',Weapon3a=\'%d\',Weapon4=\'%d\',Weapon4a=\'%d\',Weapon5=\'%d\',Weapon5a=\'%d\',\\
Weapon6=\'%d\',Weapon6a=\'%d\',Weapon7=\'%d\',Weapon7a=\'%d\',Weapon8=\'%d\',Weapon8a=\'%d\',Weapon9=\'%d\',Weapon9a=\'%d\',Weapon10=\'%d\',Weapon10a=\'%d\',\\
Weapon11=\'%d\',Weapon11a=\'%d\',Weapon12=\'%d\',Weapon12a=\'%d\' WHERE Name=\'%s\'\", Money[playerid], Score[playerid], Kills[playerid], Deaths[playerid],\\
HomeWeapons[playerid], Wanted[playerid], Level[playerid], Weapon1[playerid], Weapon1a[playerid], Weapon2[playerid], Weapon2a[playerid],\\
Weapon3[playerid], Weapon3a[playerid], Weapon4[playerid], Weapon4a[playerid], Weapon5[playerid], Weapon5a[playerid], Weapon6[playerid],\\
Weapon6a[playerid], Weapon7[playerid], Weapon7a[playerid], Weapon8[playerid], Weapon8a[playerid], Weapon9[playerid], Weapon9a[playerid],\\
Weapon10[playerid], Weapon10a[playerid], Weapon11[playerid], Weapon11a[playerid], Weapon12[playerid], Weapon12a[playerid], GetName(playerid));
mysql_tquery(mysql_kapcs, query);
Errorok:
(150) : error 075: input line too long (after substitutions)
(151 -- 155) : error 075: input line too long (after substitutions)
(157) : warning 217: loose indentation
(157) : error 029: invalid expression, assumed zero
(157) : error 029: invalid expression, assumed zero
(157) : warning 215: expression has no effect
(157) : error 001: expected token: \";\", but found \"]\"
(157) : fatal error 107: too many error messages on one line
-
Így?
mysql_format(mysql_kapcs, query, 384, \"UPDATE users SET Money=\'%d\',Score=\'%d\',Kills=\'%d\',Deaths=\'%d\',HomeWeapons=\'%d\',Wanted=\'%d\',Level=\'%d\', \\
Weapon1=\'%d\',Weapon1a=\'%d\',Weapon2=\'%d\',Weapon2a=\'%d\',Weapon3=\'%d\',Weapon3a=\'%d\',Weapon4=\'%d\',Weapon4a=\'%d\',Weapon5=\'%d\',Weapon5a=\'%d\',\\
Weapon6=\'%d\',Weapon6a=\'%d\',Weapon7=\'%d\',Weapon7a=\'%d\',Weapon8=\'%d\',Weapon8a=\'%d\',Weapon9=\'%d\',Weapon9a=\'%d\',Weapon10=\'%d\',Weapon10a=\'%d\',\\
Weapon11=\'%d\',Weapon11a=\'%d\',Weapon12=\'%d\',Weapon12a=\'%d\' WHERE Name=\'%s\'\", Money[playerid], Score[playerid], Kills[playerid], Deaths[playerid]
HomeWeapons[playerid], Wanted[playerid], Level[playerid], Weapon1[playerid], Weapon1a[playerid], Weapon2[playerid], Weapon2a[playerid],
Weapon3[playerid], Weapon3a[playerid], Weapon4[playerid], Weapon4a[playerid], Weapon5[playerid], Weapon5a[playerid], Weapon6[playerid],
Weapon6a[playerid], Weapon7[playerid], Weapon7a[playerid], Weapon8[playerid], Weapon8a[playerid], Weapon9[playerid], Weapon9a[playerid],
Weapon10[playerid], Weapon10a[playerid], Weapon11[playerid], Weapon11a[playerid], Weapon12[playerid], Weapon12a[playerid], GetName(playerid));
mysql_tquery(mysql_kapcs, query);
-
Mostmár csak ezt a hibát kapom:
(150) : error 075: input line too long (after substitutions)
Sor:
Weapon5=\'%d\',Weapon5a=\'%d\',Weapon6=\'%d\',Weapon6a=\'%d\',Weapon7=\'%d\',Weapon7a=\'%d\',Weapon8=\'%d\',Weapon8a=\'%d\',Weapon9=\'%d\',Weapon9a=\'%d\',\\
-
wiki.sa-mp.com/wiki/Strcat
-
Azzal valamiért nem jó.
Amikor menteni készül lefagy a szerver...
Így csináltam:
new query[1000];
new save1[1000] = \"UPDATE users SET Money=\'%d\',Score=\'%d\',Kills=\'%d\',Deaths=\'%d\',HomeWeapons=\'%d\',\\
Wanted=\'%d\',Level=\'%d\',IP=\'%s\',LastOnline=\'%02d.%02d.%02d %02d:%02d:%02d\'\";
new save2[1000] = \"Weapon1=\'%d\',Weapon1a=\'%d\',Weapon2=\'%d\',Weapon2a=\'%d\',\\
Weapon3=\'%d\',Weapon3a=\'%d\',Weapon4=\'%d\',Weapon4a=\'%d\',Weapon5=\'%d\',Weapon5a=\'%d\',Weapon6=\'%d\',Weapon6a=\'%d\',Weapon7=\'%d\',\\
Weapon7a=\'%d\',Weapon8=\'%d\',Weapon8a=\'%d\',Weapon9=\'%d\',Weapon9a=\'%d\',Weapon10=\'%d\',Weapon10a=\'%d\',Weapon11=\'%d\',Weapon11a=\'%d\',\\
Weapon12=\'%d\',Weapon12a=\'%d\' WHERE Name=\'%s\'\";
strcat(save1, save2, sizeof(save1) + sizeof(save2));
mysql_format(mysql_kapcs, query, sizeof(query), save1, Money[playerid], Score[playerid], Kills[playerid], Deaths[playerid],HomeWeapons[playerid],
Wanted[playerid], Level[playerid], IP[playerid], year, month, day, hour, minute, second, Weapon1[playerid], Weapon1a[playerid], Weapon2[playerid], Weapon2a[playerid], Weapon3[playerid],
Weapon3a[playerid], Weapon4[playerid], Weapon4a[playerid], Weapon5[playerid], Weapon5a[playerid], Weapon6[playerid],
Weapon6a[playerid], Weapon7[playerid], Weapon7a[playerid], Weapon8[playerid], Weapon8a[playerid], Weapon9[playerid],
Weapon9a[playerid],Weapon10[playerid], Weapon10a[playerid], Weapon11[playerid], Weapon11a[playerid], Weapon12[playerid],
Weapon12a[playerid], GetName(playerid));
mysql_tquery(mysql_kapcs, query);
-
[gmod]Megkérem a kedves témanyitót, hogy ne hanyagolja el a témáját! Ha már elavult a probléma, zárja a témát, ha pedig nem, jelezzen vissza 24 órán belül egy hozzászólás formájában.[/gmod]
-
Csináltam egy teszt scriptet az errorod miatt és kivettem belőle a vessző utáni változóval létrehozott lekérdezéseket.
#include a_samp
#include a_mysql
#include zcmd
new mysql_kapcs;
new query[2048];
CMD:asd(playerid) {
format(query, sizeof(query),
\"UPDATE users SET Money=\'%d\',Score=\'%d\',Kills=\'%d\',Deaths=\'%d\',HomeWeapons=\'%d\',Wanted=\'%d\',Level=\'%d\',\\
Weapon1=\'%d\',Weapon1a=\'%d\',Weapon2=\'%d\',Weapon2a=\'%d\',Weapon3=\'%d\',Weapon3a=\'%d\',Weapon4=\'%d\',Weapon4a=\'%d\',Weapon5=\'%d\',Weapon5a=\'%d\',\\
Weapon6=\'%d\',Weapon6a=\'%d\',Weapon7=\'%d\',Weapon7a=\'%d\',Weapon8=\'%d\',Weapon8a=\'%d\',Weapon9=\'%d\',Weapon9a=\'%d\',Weapon10=\'%d\',Weapon10a=\'%d\',\\
Weapon11=\'%d\',Weapon11a=\'%d\',Weapon12=\'%d\',Weapon12a=\'%d\' WHERE Name=\'%s\'\");
mysql_tquery(mysql_kapcs, query);
return 1;
}
Annyi hogy írd vissza a lekérdezéseket azaz ezeket:
Money[playerid], Score[playerid], Kills[playerid], Deaths[playerid]
HomeWeapons[playerid], Wanted[playerid], Level[playerid], Weapon1[playerid], Weapon1a[playerid], Weapon2[playerid], Weapon2a[playerid],
Weapon3[playerid], Weapon3a[playerid], Weapon4[playerid], Weapon4a[playerid], Weapon5[playerid], Weapon5a[playerid], Weapon6[playerid],
Weapon6a[playerid], Weapon7[playerid], Weapon7a[playerid], Weapon8[playerid], Weapon8a[playerid], Weapon9[playerid], Weapon9a[playerid],
Weapon10[playerid], Weapon10a[playerid], Weapon11[playerid], Weapon11a[playerid], Weapon12[playerid], Weapon12a[playerid], GetName(playerid)
Ha meg így se jó, írok neked egy 100%-os megoldást.