30.06.2015, 11:08
Your previous version was missing a comma, your current version has to much comma's
Try this:
Comments:
- Not sure what mysql_tquery must be, but pretty sure its a typo, and it should be mysql_query instead.
- "Money" "Score" "Medical" and "ID" columns might not have any capitals, like "user"? double-check the column names if the above doesnt work
Alternatively, you may just want the code you pasted fixed, see the below for that:
Compare the "Money", "Score" and "Medical" lines with the ones from your example, ive added single-quotation marks (') and removed the comma you added too the end of "Medical"
Try this:
Код:
public OnPlayerSave(playerid) { new query[500]; if(IsLoggedIn[playerid] == 1 && playerid != INVALID_PLAYER_ID && !IsPlayerNPC(playerid)) { format(query, sizeof(query), "UPDATE `players` SET `Money`='%d', `Score`='%d', `Medical`='%d' WHERE `ID`='%d' AND `user`= '%e'", GetPlayerMoney(playerid), GetPlayerScore(playerid), pInfo[playerid][pMedical], pInfo[playerid][pID], PlayerName(playerid) ); mysql_tquery(MySQLCon, query, "", ""); } return 1; }
- Not sure what mysql_tquery must be, but pretty sure its a typo, and it should be mysql_query instead.
- "Money" "Score" "Medical" and "ID" columns might not have any capitals, like "user"? double-check the column names if the above doesnt work
Alternatively, you may just want the code you pasted fixed, see the below for that:
Код:
public OnPlayerSave(playerid) { new query[500]; new tmp[64]; if(IsLoggedIn[playerid] == 1 && playerid != INVALID_PLAYER_ID && !IsPlayerNPC(playerid)) { format(query, sizeof(query), "UPDATE `players` SET " ); format(tmp, sizeof(tmp), "`Money`='%d', ", GetPlayerMoney(playerid) ); strcat(query, tmp); format(tmp, sizeof(tmp), "`Score`='%d', ", GetPlayerScore(playerid) ); strcat(query, tmp); format(tmp, sizeof(tmp), "`Medical`='%d' ", pInfo[playerid][pMedical] ); strcat(query, tmp); format(tmp, sizeof(tmp), "WHERE `ID`= %d AND `user`= '%e'", pInfo[playerid][pID], PlayerName(playerid) ); strcat(query, tmp); mysql_tquery(MySQLCon, query, "", ""); } return 1; }