[SNIPPET] Date and time

The function itself doesn't require sampfuncs but the full example below does

Code:
{$CLEO .cs}
0000:
repeat
wait 500
until 0AFA:  is_samp_available

alloc 30@ 256
call @Get_Date_Time 0 30@
chatmsg 30@ -1
free 30@

0A93: end_custom_thread




:Get_Date_Time
alloc 1@ 30
alloc 4@ 256
0AD3: 4@ = format "nodatefound"
0AA2: 2@ = load_library "kernel32.dll" // IF and SET
    if 0AA4: 3@ = get_proc_address "GetLocalTime" library 2@
    then
    0A8C: write_memory 1@ size 2 value 1 virtual_protect 1
    0AA5: call_function 3@ num_params 1 pop 0 1@
    //0AC7: 31@ = var 1@ offset
    0085: 31@ = 1@ // (int)

    0A8D: 20@ = read_memory 31@ size 2 virtual_protect 1
    31@ += 2
    0A8D: 21@ = read_memory 31@ size 2 virtual_protect 1
    31@ += 2
    0A8D: 22@ = read_memory 31@ size 2 virtual_protect 1
    31@ += 2
    0A8D: 23@ = read_memory 31@ size 2 virtual_protect 1
    31@ += 2
    0A8D: 24@ = read_memory 31@ size 2 virtual_protect 1
    31@ += 2
    0A8D: 25@ = read_memory 31@ size 2 virtual_protect 1
    31@ += 2
    0A8D: 26@ = read_memory 31@ size 2 virtual_protect 1
    //printf "%d %d %d %d %d %d %d" 2000 20@ 21@ 22@ 23@ 24@ 25@ 26@
    0AD3: 4@ = format "Day=%d Month=%d Year=%d Hour=%d Minute=%d Second=%d" 23@ 21@ 20@ 24@ 25@ 26@
    end
0AA3: free_library 2@
free 1@
0AB2: ret 1 4@
 
Top