Raised This Month: $ Target: $400
 0% 

Compiler Help


Post New Thread Reply   
 
Thread Tools Display Modes
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 01-02-2012 , 17:48   Re: Compiler Help
Reply With Quote #11

Quote:
Originally Posted by Sylwester View Post
No. The problem is the length of the line in editor, so it will work if you do this:
PHP Code:
formatex(szQuerycharsmax(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(szQuerycharsmax(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
Doc-Holiday is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:42.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode