Jump to content

Reading the date


HeresOtis

Recommended Posts

I want to read the date from a file, but not an .ini file because the user would have to change it every day. Is there a file somewhere on the computer that stores the date and how can I read it in CLEO4?

Link to comment
Share on other sites

You can take advantage of the imported GetLocalTime function (from Kernel32.dll) located at 0x85811C. The first argument is a pointer to a SYSTEMTIME structure documented here. I cannot give the full code right now, so good luck. smile.gif

Link to comment
Share on other sites

http://sannybuilder.com/forums/viewtopic.php?pid=8407#p8407

 

0AC8: 0@ = allocate_memory_size 160AA5: call 0x85811C num_params 1 pop 0 0@0085: 1@ = 0@for 2@ = 0 to 7   0A8D: 3@(2@,8i) = read_memory 1@ size 2 virtual_protect 0    1@ += 2         end0AC9: free_allocated_memory 0@{After this, we have:3@ - Year4@ - Month5@ - DayOfWeek6@ - Day7@ - Hour8@ - Minute9@ - Second10@ - Milliseconds}

 

Edited by DK22Pac
Link to comment
Share on other sites

Okay, I tested the script and it keeps crashing for me after the SA loading bar is complete.

Link to comment
Share on other sites

{$CLEO}0AC8: 0@ = allocate_memory_size 16while true   wait 250   0A8D: 31@ = read_memory 0x85811C size 4 virtual_protect 0   0AA5: call 31@ num_params 1 pop 0 0@   0085: 1@ = 0@   for 2@ = 0 to 7       0A8D: 3@(2@,8i) = read_memory 1@ size 2 virtual_protect 0        1@ += 2            end   0ACE: show_formatted_text_box "%d-%d-%d, %d:%d:%d" 6@ 4@ 3@ 7@ 8@ 9@ end

 

Link to comment
Share on other sites

Now that I have the day, month, and year, how would I be able to combine them together (like 6/8/2012) and display it using a draw_text opcode? I don't want to use show_text_priority.

Link to comment
Share on other sites

Will this work properly:

 

0AF4: 0@v = read_string_from_ini_file INI_FileName section "Main" key "Date"    //   6/9/2012 is stored in the variable0AD3: 10@v = format "Date: %s" 0@v0ADF: add_dynamic_GXT_entry "Date" text 10@v    // So now Date: 6/9/2012

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.