[SNIPPET] Create SA:MP Dialog

Parazitas

Well-Known Member
Joined
Jan 2, 2017
Messages
677
Likes
2
Points
18
Location
Lithuania
Website
ugbase.eu
#1
With this snippet we can create samp dialog.​
Good luck...​



Explain with 0.3.7 .:
PHP:
{$CLEO .cs}
0000:

wait 10000 /// wait 10sec until samp is redy

alloc [email protected] = 24
alloc [email protected] = 24
alloc [email protected] = 60
format [email protected] = "Button1"
format [email protected] = "Button2"
format [email protected] = "Caption"
0AC6: [email protected] = label @DialogText offset 




WHILE TRUE
    WAIT 0
    
IF 0AB0: 49 {Key 1}
THEN
    0AB1: @ShowDialog 4 button1 [email protected] button2 [email protected] caption [email protected] text [email protected] style 0
    wait 300
END
    
END 

:ShowDialog
IF 0AA2: [email protected] = "samp.dll"
THEN
    0A8E: [email protected] = [email protected] + 0x21A0B8 // SAMP_DIALOG_INFO_OFFSET
    0A8D: [email protected] = readMem [email protected] sz 4 vp 1
    0A8E: [email protected] = [email protected] + 0x6B9C0 //SAMP_DIALOG_SHOW
    0AA6: call_method [email protected] struct [email protected] num_params 7 pop 0 params 0 [email protected] [email protected] [email protected] [email protected] [email protected] 0
END
0AB2: 0

:DialogText
hex
"You reading dialog text" 00
end 
Snippets.:


0.3.7
[shcode=cpp]
:ShowDialog
IF 0AA2: [email protected] = "samp.dll"
THEN
    0A8E: [email protected] = [email protected] + 0x21A0B8 // SAMP_DIALOG_INFO_OFFSET
    0A8D: [email protected] = readMem [email protected] sz 4 vp 1
    0A8E: [email protected] = [email protected] + 0x6B9C0 //SAMP_DIALOG_SHOW
    0AA6: call_method [email protected] struct [email protected] num_params 7 pop 0 params 0 [email protected] [email protected] [email protected] [email protected] [email protected] 0
END
0AB2: 0
[/shcode]

0.3.7-R2
[shcode=cpp]
:ShowDialog
IF 0AA2: [email protected] = "samp.dll"
THEN
    0A8E: [email protected] = [email protected] + 0x21A0C0 // SAMP_DIALOG_INFO_OFFSET
    0A8D: [email protected] = readMem [email protected] sz 4 vp 1
    0A8E: [email protected] = [email protected] + 0x6BA70 //SAMP_DIALOG_SHOW
    0AA6: call_method [email protected] struct [email protected] num_params 7 pop 0 params 0 [email protected] [email protected] [email protected] [email protected] [email protected] 0
END
0AB2: 0
[/shcode]


0.3.DL
[shcode=cpp]
:ShowDialog
IF 0AA2: [email protected] = "samp.dll"
THEN
    0A8E: [email protected] = [email protected] + 0x2AC9E0 // SAMP_DIALOG_INFO_OFFSET
    0A8D: [email protected] = readMem [email protected] sz 4 vp 1
    0A8E: [email protected] = [email protected] + 0x6FA50 //SAMP_DIALOG_SHOW
    0AA6: call_method [email protected] struct [email protected] num_params 7 pop 0 params 0 [email protected] [email protected] [email protected] [email protected] [email protected] 0
END
0AB2: 0
[/shcode]

PHP:
########################## Dialog styles ##########################
DIALOG_STYLE_MSGBOX                  := 0
DIALOG_STYLE_INPUT                   := 1
DIALOG_STYLE_LIST                    := 2
DIALOG_STYLE_PASSWORD                := 3
DIALOG_STYLE_TABLIST                 := 4
DIALOG_STYLE_TABLIST_HEADERS         := 5
Memory source.:
https://github.com/SAMP-UDF/SAMP-UDF-for-AutoHotKey/blob/master/SAMP.ahk

P.S.
I tested only 0.3.7 , maybe somebody else can test it with others SA:MP versions?
 
Top