Raised This Month: $ Target: $400
 0% 

Read File question


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-13-2011 , 21:16   Re: Read File question
Reply With Quote #3

You need to parse the date string manually (break it down until you get "12", "25" and "2011") then you can use those to get numbers with str_to_num().

Also, make sure that if you have a single digit month or day that you prepend it with a zero so that the number is always two characters wide.

Here is one I just came up with for parsing the date string:

test "12252011"

PHP Code:
#include <amxmodx>

public plugin_init()
{
    
register_plugin("Plugin""0.1""Author")
    
register_concmd("test""cmdTest")
}
public 
cmdTest(id)
{
    new 
szDate[32], szNum[6]
    
read_argv(1szDatecharsmax(szDate))

    
formatex(szNum2"%c%c"szDate[0], szDate[1])
    new 
month str_to_num(szNum)
    
formatex(szNum2"%c%c"szDate[2], szDate[3])
    new 
day str_to_num(szNum)
    
formatex(szNum4"%c%c%c%c"szDate[4], szDate[5], szDate[6], szDate[7])
    new 
year str_to_num(szNum)
    
server_print("Date: %d/%d/%d"monthdayyear)

__________________

Last edited by fysiks; 12-13-2011 at 21:28.
fysiks 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 12:06.


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