Raised This Month: $ Target: $400
 0% 

SQL Question


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
slurpycof
Senior Member
Join Date: Nov 2004
Old 04-19-2005 , 20:23  
Reply With Quote #3

look at the code for my frequent fragger program.
http://forums.alliedmods.net/showthread.php?t=12149

Here is the db maintenance part of it

Code:
 public schedule_dbmaintenance()  //Clean up database  {     new thetimeis[16],dbdecay_time[16]     get_time("%H:%M",thetimeis,16)     get_cvar_string("amx_ffpdbmaintenance",dbdecay_time,16)     if(equal(thetimeis,dbdecay_time)){         new history = get_cvar_num("amx_ffphistory")         //Delete player from database after certain number of days not on server         result = dbi_query(dbc,"DELETE FROM  freqfragger WHERE TO_DAYS( NOW( ) ) - TO_DAYS( date ) >=%d",history )         result = dbi_query(dbc,"DELETE FROM  freqfragger WHERE steamid = 'STEAM_ID_PENDING'")         new slotdecay = get_cvar_num("amx_ffpdecay")         new decaypct = (100 - slotdecay)         //Remove percentage of players total time if not on server in the last day         result = dbi_query(dbc,"UPDATE freqfragger SET steamid=steamid, connecttime=connecttime*.%i, date=date WHERE TO_DAYS( NOW( ) ) - TO_DAYS( date ) >=1 ",decaypct)         dbi_free_result(result)     }     return PLUGIN_CONTINUE  }
slurpycof is offline
 



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 09:57.


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