Raised This Month: $ Target: $400
 0% 

subtracting time code


Post New Thread Reply   
 
Thread Tools Display Modes
yamin
BANNED
Join Date: Jan 2012
Location: Sharjah
Old 06-17-2012 , 12:43   Re: subtracting time code
Reply With Quote #11

there is nothing like this?
PHP Code:
public client_putinserver(id){
    
PlayedTime[id] = get_playedtime(id)
    
log_amx("--> Got %d",PlayedTime[id])

yamin is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-17-2012 , 12:44   Re: subtracting time code
Reply With Quote #12

Quote:
Originally Posted by yamin View Post
there is nothing like this?
PHP Code:
public client_putinserver(id){
    
PlayedTime[id] = get_playedtime(id)
    
log_amx("--> Got %d",PlayedTime[id])

What?
__________________
fysiks is offline
yamin
BANNED
Join Date: Jan 2012
Location: Sharjah
Old 06-17-2012 , 13:34   Re: subtracting time code
Reply With Quote #13

if the time subtracts then in
the hlds console
its should come like
%d minutes have been taken from %s

Last edited by yamin; 06-17-2012 at 13:34.
yamin is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-17-2012 , 14:08   Re: subtracting time code
Reply With Quote #14

A row must exist before altering it with UPDATE command. My guess is you didn't create them first. Change the SQL query to

Quote:
INSERT IGNORE INTO played_time VALUES( /* columns */ ) ON DUPLICATE KEY UPDATE playedtime=playedtime-350
Notice that UPDATE command won't throw any errors even if the row doesn't exist, it will simply do nothing.
If you want this to work, a unique key must be assigned first though.

Last edited by Backstabnoob; 06-18-2012 at 08:15.
Backstabnoob is offline
yamin
BANNED
Join Date: Jan 2012
Location: Sharjah
Old 06-18-2012 , 07:49   Re: subtracting time code
Reply With Quote #15

this
PHP Code:
    formatex(g_query,511,"UPDATE played_time SET playedtime=playedtime-350 WHERE name='%s'",name
    
SQL_ThreadQuery(sql,"query",g_query
to this?
PHP Code:
INSERT IGNORE INTO played_time VALUES/* columns */ ON DUPLICATE KEY SET playedtime=playedtime-350 
yamin is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-18-2012 , 08:15   Re: subtracting time code
Reply With Quote #16

Change "SET" to "UPDATE", I made a mistake. Also, you have to fill in the values and that's a query so it should be passed to the g_query cache.
Backstabnoob is offline
yamin
BANNED
Join Date: Jan 2012
Location: Sharjah
Old 06-18-2012 , 08:25   Re: subtracting time code
Reply With Quote #17

i don't know much about sqlx
i didn't understand this:
you have to fill in the values and that's a query so it should be passed to the g_query cache.
yamin is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-18-2012 , 08:31   Re: subtracting time code
Reply With Quote #18

Quote:
VALUES( /* columns */ )
Backstabnoob is offline
yamin
BANNED
Join Date: Jan 2012
Location: Sharjah
Old 06-18-2012 , 13:30   Re: subtracting time code
Reply With Quote #19

what values should i put?
yamin is offline
Backstabnoob
BANNED
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-18-2012 , 13:38   Re: subtracting time code
Reply With Quote #20

http://dev.mysql.com/doc/refman/5.5/en/tutorial.html
Backstabnoob 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 12:02.


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