CLEO Help SNIPPET/OPCODE

CLEO related
Status
Not open for further replies.

Fr0z3n

Well-known member
Joined
Nov 20, 2019
Messages
294
Reaction score
36
Location
Srbija
Is there snippet or opcode for downloading something from for example mediafire, 4shared etc....
 

ajom

Well-known member
Joined
Apr 14, 2020
Messages
389
Solutions
2
Reaction score
268
Location
Pluto
Ripped from this link:
Code:
// 0AB1: @downloadURL 2 _fromurl 0@ _toFileName 1@
:downloadURL // by ajom
if 0AA2: 31@ = load_library "Urlmon.dll"
then
    if 0AA4: 30@ = get_proc_address "URLDownloadToFileA" library 31@
    then
        // _lpfnCB = IBindStatusCallback ~ If this has a value of 0(NULL), then GTA SA will freeze during download. I don't know how to create this object in order to make the download asynchrnous. Maybe somebody can make it
        0AA7: call_function 30@ num_params 5 pop 0 _lpfnCB 0 _dwReserved 0 _szFileName 1@ _szURL 0@ _pCaller 0 _returncode 29@  // by ajom
        if 29@ == 0 // code_OK
        then
            0AA3: free_library 31@
            0485:  return_true
            ret 0
        end
    end
    0AA3: free_library 31@
end
059A:  return_false
ret 0

Example Usage:
Code:
0AB1: @downloadURL 2 _fromurl "http://25.io/toau/audio/sample.txt" _toFileName "cleo/sample.txt"
Code:
Alloc 0@ 35
Alloc 1@ 20
0AD3: 0@ = format "http://25.io/toau/audio/sample.txt"
0AD3: 0@ = format "cleo/testsample.txt"
If 0AB1: @downloadURL 2 _fromurl 0@ _toFileName 1@
Then 0ACD: show_text_highpriority "download finished" time 2000
Else 0ACD: show_text_highpriority "download FAILED" time 2000
End
Free 0@
Free 1@
 
Status
Not open for further replies.
Top