Raised This Month: $51 Target: $400
 12% 

Invalid character constant


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lexzor
Veteran Member
Join Date: Nov 2020
Old 05-04-2021 , 19:43   Invalid character constant
Reply With Quote #1

hello i have this code

PHP Code:
formatex(g_iPlayersInfo[iPlayer][PlayedTime], charsmax(g_iPlayersInfo[][PlayedTime]), "^"%s^":^"%s^":^"%s^""g_iPlayedTime[iPlayer][Hours], g_iPlayedTime[iPlayer][Minutes], g_iPlayedTime[iPlayer][Seconds])
        
            
formatex(szQuerycharsmax(szQuery), "UPDATE `%s` SET `frags` = ^"%i^" , `deaths` = ^"%i^ , `played_time` = ^"%s^" WHERE `name` = ^"%s^"",
            g_szTables[0], g_iPlayersInfo[iPlayer][Frags], g_iPlayersInfo[iPlayer][Deaths], g_iPlayersInfo[iPlayer][Name], g_iPlayersInfo[iPlayer][PlayedTime]) 
and i get this:

Code:
Error: Invalid character constant on line 520
Error: Invalid character constant on line 522
lexzor is offline
lexzor
Veteran Member
Join Date: Nov 2020
Old 05-04-2021 , 19:44   Re: Invalid character constant
Reply With Quote #2

from.

^"%i^ to ^"%i^"
lexzor is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-04-2021 , 21:32   Re: Invalid character constant
Reply With Quote #3

1. Don't use quotations around numbers.
2. Your Name and PlayedTime variables are placed incorrectly, which could be the cause.
3. You have g_iPlayersInfo[iPlayer][PlayedTime] as a string which I assume is an integer as well
4. Use steam id as the key, not name. I can join your server using someone elses name and have all of their stats, it makes no sense.

Try:
PHP Code:
formatex(szQuerycharsmax(szQuery), "UPDATE `%s` SET `frags`=%i , `deaths`=%i , `played_time`=%d WHERE `name` = ^"%s^";",
            
g_szTables[0], g_iPlayersInfo[iPlayer][Frags], g_iPlayersInfo[iPlayer][Deaths], g_iPlayersInfo[iPlayer][PlayedTime] , g_iPlayersInfo[iPlayer][Name] ) 
__________________
Bugsy 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 11:03.


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