Help Checkpoint driver with dialogue confirm

Kappri

Member
Joined
Feb 3, 2022
Messages
8
Reaction score
0
Location
Egypt
There's taxi job on server i play. Every time you complete route, dialogue pops up and asks you if you want to continue. I want to edit cs I attached so that it confirms dialogue after route is completed.
 

Attachments

  • Checkpoint.cs
    28.1 KB · Views: 20

Kappri

Member
Joined
Feb 3, 2022
Messages
8
Reaction score
0
Location
Egypt
Basically it asks you if you want to continue doing the job. Left button is to continue.
 

Attachments

  • sa-mp-003.png
    sa-mp-003.png
    179.5 KB · Views: 8

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
PHP:
{$CLEO .cs}

0000:

REPEAT
IF 8256:   player $PLAYER_CHAR defined
THEN 0A93: end_custom_thread
END
WAIT 1500
UNTIL 0256:   player $PLAYER_CHAR defined 

WHILE TRUE
WAIT 0

IF 0256:   player $PLAYER_CHAR defined 
THEN
    IF 0AB0: 117 // F6
    THEN
        REPEAT
        WAIT 0
        UNTIL 8AB0: 117 // F6
        IF 31@ == FALSE
        THEN
            31@ = TRUE
            0AD1: "~Y~Auto Dialog: ~G~ENABLED ~Y~!" 1337
        ELSE
            31@ = FALSE
            0AD1: "~Y~Auto Doag: ~R~DISABLED ~Y~!" 1337
        END
    END
    IF 31@ == TRUE
    THEN 
        IF 0AB1: @is_dialog_active 1 CheckingState TRUE // State: TRUE = active ; FALSE = closed
        THEN
            0AB1: @get_dialog_caption 1 _Returned: Caption 0@
            0AC8: 1@ = allocate_memory_size 1024
            0AB1: @delete_color_codes_from_text 2 text 0@ memory_to_store_characters_as_text 1@       

            0AC8: 2@ = allocate_memory_size 1024
            0AD3: 2@ = format "Posao Taxi"
            IF 0AB1: @if_text_contains 2 String1 1@ String2 2@ _Returned: text 29@
            THEN 28@ = TRUE 
            END
            0AC9: free_allocated_memory 2@ 
            
            IF 28@ == TRUE
            THEN
                28@ = FALSE
                0AB1: @CloseCurrentDialogWithButton 1 Button 1 // 1 = Left , 0 = Right
            END
        END        
    END
END

END // END OF WHILE TRUE

:get_samp_version_id
// 0AB1: @get_samp_version_id 0 _returned: ID 0@  
30@ = 0
IF 0AA2: 31@ = "samp.dll" // IF and SET
THEN
    31@ += 0x128
    0A8D: 29@ = read_memory 31@ size 4 virtual_protect 1
    IF 29@ == 0x5542F47A
    THEN // 0.3.7 R1
        30@ = 1
    END
    
    IF 29@ == 0x59C30C94
    THEN // 0.3.7 R2
        30@ = 2
    END
    
    IF 29@ == 0x5A6A3130
    THEN // 0.3.DL
        30@ = 3
    END
    31@ -= 8 // reading samp.dll + 0x120
    0A8D: 29@ = read_memory 31@ size 4 virtual_protect 1
    IF 29@ == 0x5C0B4243
    THEN // 0.3.7 R3 
        30@ = 4
    END  
    
    IF 29@ == 0x5DD606CD
    THEN // 0.3.7 R4
        30@ = 5
    END
    IF 29@ == 0x6094ACAB
    THEN // 0.3.7 R4 - v2
        30@ = 6
    END 
    IF 29@ == 0x6372C39E
    THEN // 0.3.7 R5
        30@ = 7
    END 
END
0AB2: ret 1 30@

:is_dialog_active
{
    Set TRUE if you wanna check when dialog is active
    Set FALSE if you wanna check when dialog is closed
    Usage:
    IF 0AB1: @is_dialog_active 1 CheckingState FALSE // State: TRUE = active ; FALSE = closed
}
IF 0AA2: 31@ = "samp.dll"
THEN
    0AB1: @get_samp_version_id 0 _returned: ID 17@ 
    IF 17@ > 0
    THEN
        IF 17@ == 1 // 0.3.7 R1
        THEN 
            0A8E: 30@ = 31@ + 0x21A0B8 // SAMP_DIALOG_INFO_OFFSET
            0A8D: 30@ = readMem 30@ sz 4 vp 0
            0A8E: 29@ = 30@ + 0x28 // SAMP_DIALOG_ACTIVE_OFFSET
            0A8D: 29@ = readMem 29@ sz 4 vp 0
        END
        IF 17@ == 2 // 0.3.7 R2
        THEN
            0A8E: 30@ = 31@ + 0x21A0C0 // SAMP_DIALOG_INFO_OFFSET
            0A8D: 30@ = readMem 30@ sz 4 vp 0
            0A8E: 29@ = 30@ + 0x28 // SAMP_DIALOG_ACTIVE_OFFSET
            0A8D: 29@ = readMem 29@ sz 4 vp 0
        END
        
        IF 17@ == 3 // 0.3.DL
        THEN
            0A8E: 30@ = 31@ + 0x2AC9E0 // SAMP_DIALOG_INFO_OFFSET
            0A8D: 30@ = readMem 30@ sz 4 vp 0
            0A8E: 29@ = 30@ + 0x28 // SAMP_DIALOG_ACTIVE_OFFSET
            0A8D: 29@ = readMem 29@ sz 4 vp 0
        END
        
        IF 17@ == 4 // 0.3.7 R3 
        THEN
            0A8E: 30@ = 31@ + 0x26E898 // SAMP_DIALOG_INFO_OFFSET
            0A8D: 30@ = readMem 30@ sz 4 vp 0
            0A8E: 29@ = 30@ + 0x28 // SAMP_DIALOG_ACTIVE_OFFSET
            0A8D: 29@ = readMem 29@ sz 4 vp 0
        END
        
        IF 17@ == 5 // 0.3.7 R4
        THEN
            0A8E: 30@ = 31@ + 0x26E9C8 // SAMP_DIALOG_INFO_OFFSET
            0A8D: 30@ = readMem 30@ sz 4 vp 0
            0A8E: 29@ = 30@ + 0x28 // SAMP_DIALOG_ACTIVE_OFFSET
            0A8D: 29@ = readMem 29@ sz 4 vp 0
        END
        
        IF 17@ == 6 // 0.3.7 R4 - v2
        THEN
            0A8E: 30@ = 31@ + 0x26E9C8 // SAMP_DIALOG_INFO_OFFSET
            0A8D: 30@ = readMem 30@ sz 4 vp 0
            0A8E: 29@ = 30@ + 0x28 // SAMP_DIALOG_ACTIVE_OFFSET
            0A8D: 29@ = readMem 29@ sz 4 vp 0
        END

        IF 17@ == 7 // 0.3.7 R5
        THEN
            0A8E: 30@ = 31@ + 0x26EB50 // SAMP_DIALOG_INFO_OFFSET
            0A8D: 30@ = readMem 30@ sz 4 vp 0
            0A8E: 29@ = 30@ + 0x28 // SAMP_DIALOG_ACTIVE_OFFSET
            0A8D: 29@ = readMem 29@ sz 4 vp 0
        END
        IF 0@ == TRUE
        THEN
            IF 29@ == TRUE
            THEN 0485:  return_true
            ELSE 059A:  return_false
            END
        ELSE
            IF 29@ == FALSE
            THEN 0485:  return_true
            ELSE 059A:  return_false
            END
        END
    END
END
0AB2: ret 0

:get_dialog_caption
{
    0AB1: @get_dialog_caption 0 _Returned: Caption 1@
}
IF 0AA2: 31@ = "samp.dll"
THEN
    0AB1: @get_samp_version_id 0 _returned: ID 17@
    IF 17@ > 0
    THEN
        IF 17@ == 1 // 0.3.7 R1
        THEN 
            0A8E: 30@ = 31@ + 0x21A0B8 // SAMP_DIALOG_INFO_OFFSET
            0A8D: 30@ = readMem 30@ sz 4 vp 0
            0A8E: 29@ = 30@ + 0x28 // SAMP_DIALOG_ACTIVE_OFFSET
            0A8D: 29@ = readMem 29@ sz 4 vp 0
        END
        IF 17@ == 2 // 0.3.7 R2
        THEN
            0A8E: 30@ = 31@ + 0x21A0C0 // SAMP_DIALOG_INFO_OFFSET
            0A8D: 30@ = readMem 30@ sz 4 vp 0
            0A8E: 29@ = 30@ + 0x28 // SAMP_DIALOG_ACTIVE_OFFSET
            0A8D: 29@ = readMem 29@ sz 4 vp 0
        END
        
        IF 17@ == 3 // 0.3.DL
        THEN
            0A8E: 30@ = 31@ + 0x2AC9E0 // SAMP_DIALOG_INFO_OFFSET
            0A8D: 30@ = readMem 30@ sz 4 vp 0
            0A8E: 29@ = 30@ + 0x28 // SAMP_DIALOG_ACTIVE_OFFSET
            0A8D: 29@ = readMem 29@ sz 4 vp 0
        END
        
        IF 17@ == 4 // 0.3.7 R3 
        THEN
            0A8E: 30@ = 31@ + 0x26E898 // SAMP_DIALOG_INFO_OFFSET
            0A8D: 30@ = readMem 30@ sz 4 vp 0
            0A8E: 29@ = 30@ + 0x28 // SAMP_DIALOG_ACTIVE_OFFSET
            0A8D: 29@ = readMem 29@ sz 4 vp 0
        END
        
        IF 17@ == 5 // 0.3.7 R4
        THEN
            0A8E: 30@ = 31@ + 0x26E9C8 // SAMP_DIALOG_INFO_OFFSET
            0A8D: 30@ = readMem 30@ sz 4 vp 0
            0A8E: 29@ = 30@ + 0x28 // SAMP_DIALOG_ACTIVE_OFFSET
            0A8D: 29@ = readMem 29@ sz 4 vp 0
        END
        
        IF 17@ == 6 // 0.3.7 R4 - v2
        THEN
            0A8E: 30@ = 31@ + 0x26E9C8 // SAMP_DIALOG_INFO_OFFSET
            0A8D: 30@ = readMem 30@ sz 4 vp 0
            0A8E: 29@ = 30@ + 0x28 // SAMP_DIALOG_ACTIVE_OFFSET
            0A8D: 29@ = readMem 29@ sz 4 vp 0
        END

        IF 17@ == 7 // 0.3.7 R5
        THEN
            0A8E: 30@ = 31@ + 0x26EB50 // SAMP_DIALOG_INFO_OFFSET
            0A8D: 30@ = readMem 30@ sz 4 vp 0
            0A8E: 29@ = 30@ + 0x28 // SAMP_DIALOG_ACTIVE_OFFSET
            0A8D: 29@ = readMem 29@ sz 4 vp 0
        END
        IF 29@ == TRUE
        THEN
            0A8E: 28@ = 30@ + 0x40 // SAMP_DIALOG_CAPTION_OFFSET
            0485: dialog_open
            0AB2: ret 1 28@
        ELSE 059A:  dialog closed
        END
    END
END
0AB2: ret 0

:CloseCurrentDialogWithButton
{
    0AB1: @CloseCurrentDialogWithButton 1 Button 1 // 1 = Left , 0 = Right
}
IF 0AA2: 31@ = "samp.dll"
THEN 
    0AB1: @get_samp_version_id 0 _returned: ID 17@
    IF 17@ > 0
    THEN  
        IF 17@ == 1 // 0.3.7 R1
        THEN
            0A8E: 30@ = 31@ + 0x21A0B8 // SAMP_DIALOG_INFO_OFFSET
            0A8D: 29@ = readMem 30@ sz 4 vp 0
            0A8E: 28@ = 31@ + 0x6C040 //SAMP_DIALOG_CLOSE
        END
        
        IF 17@ == 2 // 0.3.7 R2
        THEN
            0A8E: 30@ = 31@ + 0x21A0C0 // SAMP_DIALOG_INFO_OFFSET
            0A8D: 29@ = readMem 30@ sz 4 vp 0
            0A8E: 28@ = 31@ + 0x6C0F0 //SAMP_DIALOG_CLOSE
        END
        
        IF 17@ == 3 // 0.3.DL
        THEN
            0A8E: 30@ = 31@ + 0x2AC9E0 // SAMP_DIALOG_INFO_OFFSET
            0A8D: 29@ = readMem 30@ sz 4 vp 0
            0A8E: 28@ = 31@ + 0x700D0 //SAMP_DIALOG_CLOSE
        END
        
        IF 17@ == 4 // 0.3.7 R3 
        THEN
            0A8E: 30@ = 31@ + 0x26E898 // SAMP_DIALOG_INFO_OFFSET
            0A8D: 29@ = readMem 30@ sz 4 vp 0
            0A8E: 28@ = 31@ + 0x6FF40 //SAMP_DIALOG_CLOSE
        END
        
        IF 17@ == 5 // 0.3.7 R4
        THEN
            0A8E: 30@ = 31@ + 0x26E9C8 // SAMP_DIALOG_INFO_OFFSET
            0A8D: 29@ = readMem 30@ sz 4 vp 0
            0A8E: 28@ = 31@ + 0x70660 //SAMP_DIALOG_CLOSE
        END
        
        IF 17@ == 6 // 0.3.7 R4 - v2
        THEN
            0A8E: 30@ = 31@ + 0x26E9C8 // SAMP_DIALOG_INFO_OFFSET
            0A8D: 29@ = readMem 30@ sz 4 vp 0
            0A8E: 28@ = 31@ + 0x70690 //SAMP_DIALOG_CLOSE
        END
        
        IF 17@ == 7 // 0.3.7 R5
        THEN
            0A8E: 30@ = 31@ + 0x26EB50 // SAMP_DIALOG_INFO_OFFSET
            0A8D: 29@ = readMem 30@ sz 4 vp 0
            0A8E: 28@ = 31@ + 0x70630 //SAMP_DIALOG_CLOSE
        END
        
        0AA8: call_function_method 28@ struct 29@ num_params 1 pop 0 Button 0@ _retVal 27@
    END
END
0AB2: 0

:if_text_contains
{
    0AB1: @if_text_contains 2 String1 3@ String2 4@ _Returned: text 5@
}
0AB1: @strlen 1 string 0@ _Returned: length 31@
0AB1: @strlen 1 string 1@ _Returned: length 30@ 

//initial length check (the phrase can't be longer than the main text)
if 001D:   30@ > 31@  // (int)
then
059A:  return_false
0AB2: ret 1 0
end

31@ -= 1 
26@ = 0 // counter of the same chars in a row 
for 29@ = 0 to 31@ // for each char of the main text  (29@ = index)    
    0085: 24@ = 0@ // (int)
    005A: 24@ += 29@  // (int)
    0A8D: 28@ = read_memory 24@ size 1 virtual_protect 0
    
    0085: 23@ = 1@ // (int)
    005A: 23@ += 26@  // (int)
    0A8D: 27@ = read_memory 23@ size 1 virtual_protect 0

    if 003B:   28@ == 27@  // (int)   
    then
    26@++
        if 002D:   26@ >= 30@  // (int)
        then
        0485:  return_true
        0062: 24@ -= 30@  // (int)
        24@ += 1
        0AB2: ret 1 24@
        end
    else
        if 26@ > 0
        then
        29@-- //check the same char again and assume it's the begining of the string but only if there was matching parts before (otherwise it would go back all the time and make infinite loop)
        end
    26@ = 0 
    end           
end 
 
059A:  return_false
0AB2: ret 1 0

:delete_color_codes_from_text
{
    0AC8: 1@ = allocate_memory_size 1024
    0AB1: @delete_color_codes_from_text 2 text 0@ memory_to_store_characters_as_text 1@
}
5@ = FALSE // inbracket
0AB1: @strlen 1 string 0@ _length 31@
    FOR 30@ = 0 TO 31@  
        0085: 29@ = 0@ // copy pointer
        005A: 29@ += 30@  // add offset (as the loop progresses it becomes pointers to first-last character)
        0A8D: 28@ = read_memory 29@ size 1 virtual_protect 1 // 28@ is the ascii number representing character
        IF 28@ == 123
        THEN 5@ = TRUE // inbracket
        END
        
        IF 5@ == FALSE // inbracket
        THEN
            0A8C: write_memory 1@ size 1 value 28@ virtual_protect 1
            1@ += 1 // move to next address
        END
        
        IF 28@ == 125
        THEN 5@ = FALSE // inbracket
        END
    END
0A8C: write_memory 1@ size 1 value 0 virtual_protect 1 // null-termination 
0AB2: ret 0

:strlen
{
    Example: 0AB1: @strlen 1 string 0@ _Returned: length 31@
    In: 0@ - text;
    Out: 1@ - size;
}
for 1@ = 0 to 1024
    0A8D: 2@ = read_memory 0@ size 1 virtual_protect 0
    if not 2@ == 0
    jf break
    0@ += 1
end
0AB2: ret 1 1@

:Chatmsg
/*
     0AC8: 0@ = allocate_memory_size 1024
     0AD3: 0@ = format "{FFFFFF}Auto Accept: {00FF00}ON"
     0AB1: @Chatmsg 2 text 0@ color -1
*/
IF 0AA2: 31@ = "samp.dll"
THEN
    0AB1: @get_samp_version_id 0 _returned: ID 17@
    IF NOT 17@ < 1
    THEN
        IF 17@ == 1 // 0.3.7 R1
        THEN
            0A8E: 30@ = 31@ + 0x21A0E4            // SAMP_CHAT_INFO_OFFSET (R1)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x64010             // FUNC_ADDTOCHATWND (R1)
        END

        IF 17@ == 2 // 0.3.7 R2
        THEN
            0A8E: 30@ = 31@ + 0x21A0EC            // SAMP_CHAT_INFO_OFFSET (R2)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x640E0            // FUNC_ADDTOCHATWND (R2)
        END

        IF 17@ == 3 // 0.3.DL
        THEN
            0A8E: 30@ = 31@ + 0x2ACA10            // SAMP_CHAT_INFO_OFFSET (DL)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x67650             // FUNC_ADDTOCHATWND (DL)
        END

        IF 17@ == 4 // 0.3.7 R3
        THEN
            0A8E: 30@ = 31@ + 0x26E8C8            // SAMP_CHAT_INFO_OFFSET (R3)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x67460             // FUNC_ADDTOCHATWND (R3)
        END

        IF 17@ == 5 // 0.3.7 R4
        THEN
            0A8E: 30@ = 31@ + 0x26E9F8            // SAMP_CHAT_INFO_OFFSET (R4)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x67BA0             // FUNC_ADDTOCHATWND (R4) 699D0
        END
      
        IF 17@ == 6 // 0.3.7 R4 - v2
        THEN
            0A8E: 30@ = 31@ + 0x26E9F8            // SAMP_CHAT_INFO_OFFSET (R4)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x67BE0            // FUNC_ADDTOCHATWND (R4)
        END
        
        IF 17@ == 7 // 0.3.7 R5
        THEN
            0A8E: 30@ = 31@ + 0x26EB80            // SAMP_CHAT_INFO_OFFSET (R4)
            0A8D: 30@ = readMem 30@ sz 4 vp 0     // pChat;
            0A8E: 29@ = 31@ + 0x67BE0            // FUNC_ADDTOCHATWND (R4)
        END
                
        IF OR
        1@ == -1
        1@ <= 0
        THEN 1@ = 0xFFFFFFFF
        END
        0AA6: call 29@ struct 30@ num_params 5 pop 0 params 0 1@ 0 0@ 8
    END
END
0AB2: 0
 
Top