09.06.2012, 12:28
In the most causes its enough to put it into seperate lines
if the string is over 500 you should declare it globally (the compiler does that anyways)
pawn Код:
// this does work
if(strlen(APlayerData[playerid][PlayerPassword]) != 0) {
new score = GetPlayerScore(playerid);
new money = GetPlayerMoney(playerid);
new query[1000], pname[24];
GetPlayerName(playerid, pname, sizeof pname);
format(query, sizeof(query), // the string is only 384 long, limit is over 500
"UPDATE `PlayerData` SET Score='%d', Ip='%s', PlayerLevel='%d', StatsMetersDriven='%d', StatsTruckerJobs='%d', StatsConvoyJobs='%d', StatsBusDriverJobs='%d', StatsPilotJobs='%d', StatsMafiaJobs='%d', StatsMafiaStolen='%d', StatsPoliceFined='%d', StatsPoliceJailed='%d', StatsAssistance='%d', StatsCourierJobs='%d', StatsRoadworkerJobs='%d', Money='%d', OFWarns='%d' WHERE `Name`='%s'",
score, IP, APlayerData[playerid][PlayerLevel], APlayerData[playerid][StatsMetersDriven],APlayerData[playerid][StatsTruckerJobs],APlayerData[playerid][StatsConvoyJobs],APlayerData[playerid][StatsBusDriverJobs],APlayerData[playerid][StatsPilotJobs],
APlayerData[playerid][StatsMafiaJobs],APlayerData[playerid][StatsMafiaStolen],APlayerData[playerid][StatsPoliceFined],APlayerData[playerid][StatsPoliceJailed],APlayerData[playerid][StatsAssistance],APlayerData[playerid][StatsCourierJobs],APlayerData[playerid][StatsRoadworkerJobs],money,APlayerData[playerid][OFWarns],pname
);
mysql_query(query);
}
pawn Код:
new
myQuery[] = "UPDATE `PlayerData` SET Score='%d', Ip='%s', PlayerLevel='%d', StatsMetersDriven='%d', StatsTruckerJobs='%d', StatsConvoyJobs='%d', StatsBusDriverJobs='%d',",
myQuery1[] = "StatsPilotJobs='%d', StatsMafiaJobs='%d', StatsMafiaStolen='%d', StatsPoliceFined='%d', StatsPoliceJailed='%d', StatsAssistance='%d',",
myQuery2[] = "StatsCourierJobs='%d', StatsRoadworkerJobs='%d', Money='%d', OFWarns='%d' WHERE `Name`='%s'"
;
//OnGameModeInit
// lets replace the EOS with a space
myQuery[sizeof myQuery - 1] = myQuery1[sizeof myQuery1 - 1] = ' ';
// we need to use myQuery2 at least once otherwise the compiler will remove it
myQuery2[sizeof myQuery2 - 1] = EOS;
// now if you want to test it
print(myQuery);
// it will print the whole query