AlliedModders Donor
|
![Old](images/statusicon/post_old.svg)
01-02-2012
, 17:48
Re: Compiler Help
|
#11
|
Quote:
Originally Posted by Sylwester
No. The problem is the length of the line in editor, so it will work if you do this:
PHP Code:
formatex(szQuery, charsmax(szQuery), "REPLACE INTO `XpTable` (`player_id`, `player_total_xp`, `player_class_assault_xp`, `player_class_specops_xp`, `player_class_sniper_xp`, `player_class_engineer_xp`, `player_class_medic_xp`, `player_class_support_xp`) VALUES (`%s`, `%d`, `%d`, `%d`, `%d`, `%d`, `%d`, `%d`);", g_szAuthID[id], g_XP[id][TotalXP], g_XP[id][XP][CLASS_ASSAULT], g_XP[id][XP][CLASS_SPECOPS], g_XP[id][XP][CLASS_SNIPER], g_XP[id][XP][CLASS_ENGINEER], g_XP[id][XP][CLASS_MEDIC], g_XP[id][XP][CLASS_SUPPORT]);
->
PHP Code:
formatex(szQuery, charsmax(szQuery), "REPLACE INTO `XpTable` (`player_id`, `player_total_xp`, `player_class_assault_xp`, `player_class_specops_xp`, `player_class_sniper_xp`, `player_class_engineer_xp`, `player_class_medic_xp`, `player_class_support_xp`) VALUES (`%s`, `%d`, `%d`, `%d`, `%d`, `%d`, `%d`, `%d`);",
g_szAuthID[id], g_XP[id][TotalXP], g_XP[id][XP][CLASS_ASSAULT], g_XP[id][XP][CLASS_SPECOPS], g_XP[id][XP][CLASS_SNIPER], g_XP[id][XP][CLASS_ENGINEER], g_XP[id][XP][CLASS_MEDIC], g_XP[id][XP][CLASS_SUPPORT]);
If you want to keep whole formatex function in a single line, or if the string "REPLACE ...." itself is too long then you just need to create the whole things using parts like this:
PHP Code:
new pos
pos += formatex(szQuery[pos], charsmax(szQuery)-pos, "REPLACE INTO `XpTable` (`player_id`, `player_total_xp`, `player_class_assault_xp`, `player_class_specops_xp`,");
pos += formatex(szQuery[pos], charsmax(szQuery)-pos, " `player_class_sniper_xp`, `player_class_engineer_xp`, `player_class_medic_xp`, `player_class_support_xp`)");
pos += formatex(szQuery[pos], charsmax(szQuery)-pos, " VALUES (`%s`, `%d`, `%d`,", g_szAuthID[id], g_XP[id][TotalXP], g_XP[id][XP][CLASS_ASSAULT]);
pos += formatex(szQuery[pos], charsmax(szQuery)-pos, " `%d`, `%d`, `%d`, `%d`, `%d`);", g_XP[id][XP][CLASS_SPECOPS], g_XP[id][XP][CLASS_SNIPER], g_XP[id][XP][CLASS_ENGINEER], g_XP[id][XP][CLASS_MEDIC], g_XP[id][XP][CLASS_SUPPORT]);
|
I will give the last one a try. Thanks
|
|