Raised This Month: $32 Target: $400
 8% 

Solved query question


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lexzor
Veteran Member
Join Date: Nov 2020
Old 05-07-2021 , 21:04   query question
Reply With Quote #1

Hello again. Sorry for spaming with posts.

I have this query:
PHP Code:
formatex(szQuerycharsmax(szQuery), "UPDATE `%s` SET `frags` = '15' , `deaths` = '5' , `headshots` = '8' , `score` = '4' , `lastvisit` = '%s' , `total_played_time` = '%s' WHERE `name` = '%s'",
        
g_szTables[5],/* g_iPlayersInfo[id][Frags], g_iPlayersInfo[id][Deaths], g_iPlayersInfo[id][Headshots], g_iPlayersInfo[id][Score],*/ g_iPlayersInfo[id][LastVisit], g_iPlayersInfo[id][PlayedTime], g_iPlayersInfo[id][Name]) 
and this is how i create the table where i want to introduce that data from query
PHP Code:
"( `id` INT(11) NOT NULL AUTO_INCREMENT , `name` VARCHAR(36) NOT NULL , `ipaddress` VARCHAR(36) NOT NULL , `steamid` VARCHAR(36) NOT NULL , `frags` INT(11) NOT NULL , `deaths` INT(11) NOT NULL , `headshots` INT(11) NOT NULL , `score` INT(11) NOT NULL , `played_time` VARCHAR(33) NOT NULL , PRIMARY KEY (`id`))" 
the problem is that the data from columns frags, deaths, headshots, score don t update just the last 2 of them. i tried with numbers (as you can see) but same thing. Some ideas?

Last edited by lexzor; 05-09-2021 at 12:14.
lexzor is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-07-2021 , 21:15   Re: query question
Reply With Quote #2

Try removing the quotes around the numbers.
__________________
Bugsy is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 05-08-2021 , 04:00   Re: query question
Reply With Quote #3

Try to create the table without declaring the INTs size, since they are 4 bytes signed:
PHP Code:
"( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, `name` VARCHAR(36) NOT NULL , `ipaddress` VARCHAR(36) NOT NULL , `steamid` VARCHAR(36) NOT NULL , `frags` INT NOT NULL , `deaths` INT NOT NULL , `headshots` INT NOT NULL , `score` INT NOT NULL , `played_time` VARCHAR(33) NOT NULL)" 
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi is offline
lexzor
Veteran Member
Join Date: Nov 2020
Old 05-08-2021 , 12:23   Re: query question
Reply With Quote #4

none of them worked, but somehow works with numbers (15, 5 or what ever), but don't work with %i

maybe there isn t enough time for native get_user_frags/get_user_deaths to stock the data into variable ?
lexzor is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-08-2021 , 12:30   Re: query question
Reply With Quote #5

Output your query as a string to verify how it's reaching the SQL module, and go from there. Doubtful it's a timing issue.
__________________
Bugsy is offline
lexzor
Veteran Member
Join Date: Nov 2020
Old 05-08-2021 , 13:27   Re: query question
Reply With Quote #6

ok i found the problem: i use this function in client_disconnected and the function can't take users frags and deaths because he disconnected. is there any solution to create a prethink of client_disconnected to get the data?

Last edited by lexzor; 05-08-2021 at 13:28.
lexzor is offline
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 05-08-2021 , 14:37   Re: query question
Reply With Quote #7

Use fakemeta's FM_ClientDisconnect forward, this should be called before any AMXX module, so client isn't marked as disconnected.
__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-08-2021 , 14:39   Re: query question
Reply With Quote #8

The values are usually still accessible at client_disconnect(). If the above doesn't work, just store the values for each player in a variable, update kills/deaths at DeathMsg() for killer & victim.
__________________
Bugsy is offline
lexzor
Veteran Member
Join Date: Nov 2020
Old 05-09-2021 , 12:13   Re: query question
Reply With Quote #9

I used DeathMsg to store their data.
Thanks.
lexzor 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:51.


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