%s & %d in a dialog

KamikazeSripterul

Well-Known Member
Joined
Jun 30, 2019
Messages
61
Likes
1
Points
8
#1
Hey. So ive tried to make a new script or something that i'd be able to use in a project i'm working on even though i'm not sure how to solve this.
So here's the script:
Code:
if SAMP.DialogRespond(830, [email protected], 0, [email protected])
    then
        if [email protected] == 1
        then
            0C1A: [email protected] = atoi [email protected]
            0AF1: write_int [email protected] to_ini_file "cleo\ServerCMD.ini" section "Bank" key "idtransfer"
            if SAMP.IsPlayerConnected([email protected])
            then
                0B36: samp [email protected] = get_player_nickname [email protected]
            SAMP.ShowDialog(840, "{000089}[{770089}Bank Manager{000089}]: Transferring to %s [ID: %d]", "Please insert the amount of money you'd like to transfer", "Transfer", "Back", 1) [email protected] [email protected]
        else
            if [email protected] == 0
            then
                chatmsg "{000089}[{770089}Bank Manager{000089}]: {ff9000}Transaction has been cancelled." -1
                end
            end
        end
        0C11: memset destination [email protected] value 0 size 50
    end
I'm not sure how to make %s and %d in the Dialog to work... I've tried writing the variables between the " Transferring to %s [ID: %d]"" and the comma but it still didnt work...
Can anyone help me please? Thanks.
 
OP
OP
K

KamikazeSripterul

Well-Known Member
Joined
Jun 30, 2019
Messages
61
Likes
1
Points
8
#3

shanker

Well-Known Member
Joined
Sep 18, 2016
Messages
300
Likes
17
Points
48
Location
Romania
#4
Would it work to do that to the title?
Code:
:WeTest
[email protected] = 3

0AC8: [email protected] = allocate_memory_size 666
0AC8: [email protected] = allocate_memory_size 260

0AD3: [email protected] = format "This is a test %cThat's my second line %cLine number: %d" 0x0A 0x0A [email protected]
0AD3: [email protected] = format "I love %d" 69

SAMP.ShowDialog(040, [email protected], [email protected], "Button 1", "Button 2", 1)
cmdret
It works
 

Attachments

OP
OP
K

KamikazeSripterul

Well-Known Member
Joined
Jun 30, 2019
Messages
61
Likes
1
Points
8
#5
Code:
:WeTest
[email protected] = 3

0AC8: [email protected] = allocate_memory_size 666
0AC8: [email protected] = allocate_memory_size 260

0AD3: [email protected] = format "This is a test %cThat's my second line %cLine number: %d" 0x0A 0x0A [email protected]
0AD3: [email protected] = format "I love %d" 69

SAMP.ShowDialog(040, [email protected], [email protected], "Button 1", "Button 2", 1)
cmdret
It woorks
Thank you sooo muchhhh <3
Edit: How do you know how many bytes you need for allocate?
 
OP
OP
K

KamikazeSripterul

Well-Known Member
Joined
Jun 30, 2019
Messages
61
Likes
1
Points
8
#6
Code:
if SAMP.DialogRespond(830, [email protected], 0, [email protected])
    then
        if [email protected] == 1
        then
            0C1A: [email protected] = atoi [email protected]
            0AF1: write_int [email protected] to_ini_file "cleo\ServerCMD.ini" section "Bank" key "idtransfer"
            if SAMP.IsPlayerConnected([email protected])
            then
                0B36: samp [email protected] = get_player_nickname [email protected]
                0AC8: [email protected] = allocate_memory_size 260

                0AD3: [email protected] = format "{000089}[{770089}Bank Manager{000089}]: Transferring to %s [ID: %d]" [email protected] [email protected]
                SAMP.ShowDialog(840, [email protected], "Please insert the amount of money you'd like to transfer", "Transfer", "Back", 1)
            else
                if [email protected] == 0
                then
                    chatmsg "{000089}[{770089}Bank Manager{000089}]: {ff9000}Transaction has been cancelled." -1
                    end
                end
            end
            0C11: memset destination [email protected] value 0 size 50
        end
I think I did something wrong but it doesn't work as i expected :<
 

shanker

Well-Known Member
Joined
Sep 18, 2016
Messages
300
Likes
17
Points
48
Location
Romania
#7
First of all, if your code is in a loop, make sure you free your allocated memory.
Can you give me a pic with your result?
 
OP
OP
K

KamikazeSripterul

Well-Known Member
Joined
Jun 30, 2019
Messages
61
Likes
1
Points
8
#10
Nevermind, my problem was solved. It was due to a small mistake.... I'm Sorry but thanks a lot for help, appreciated.
 
Top