Help remove special characters

SamThapa

Active member
Joined
Jan 22, 2018
Messages
78
Reaction score
1
as title suggest a to z 0 to 9 not any special characters like !@#$%^&*()_+{[}]:;"'|\<,>.?? i tried but no luck anyone plz help
 

Hidend

Expert
Joined
Mar 4, 2013
Messages
653
Reaction score
49
Take a look of @Parazitas snippet here so you can modify it as you wish:

I can't do it right now, but try to do it yourself and post results or wait until another member can do it if you can't, i will try to do it later if possible.
 

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
as title suggest a to z 0 to 9 not any special characters like !@#$%^&*()_+{[}]:;"'|\<,>.?? i tried but no luck anyone plz help
If your string is actually like that.
1. Remove colours
2. Collect only digits and letters

PHP:
:DeleteColorCodes
{
    0AC8: 27@ = allocate_memory_size 260
    0AB1: @DeleteColorCodes 2 text 31@ memory_to_store_characters_as_text 27@
    // Do Something
    0AC9: free_allocated_memory 27@

}
5@ = FALSE // inbracket
0AB1: @strlenA 1 string 0@ _length 31@
    for 30@ = 0 to 31@
        0085: 29@ = 0@ // copy pointer
        005A: 29@ += 30@  // add offset make loop
        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

:StrlenA
// 0AB1: @StrlenA 1 String 0@ _Returned: Length 1@
0A8D: 26@ = readmem 0x8580DC sz 4 vp 0 // 0x8580DC - KERNEL32.lstrlenA
0AA7: strlen_addr 26@ num_params 1 pop 0 string 0@ _returned_length 25@
0AB2: ret 1 25@
 
Last edited:

SamThapa

Active member
Joined
Jan 22, 2018
Messages
78
Reaction score
1
ty so much for response

its not what i wanted

{$CLEO}
0000:
while true
wait 0
0AC8: 2@ = allocate_memory_size 260
0AD3: string 2@ format "~g~ {} a abcdefgz 1234567890 64-=' > ,<"
0AB1: @DeleteColorCodes 2 text 2@ memory_to_store_characters_as_text 2@
0ad1: "%s" 5000 2@
0AC9: free_allocated_memory 2@
end

0AD3: string 2@ format "~g~ {} a abcdefgz 1234567890 64-=' > ,<" if some how strings are messi like here i should get like below
0AD3: string 2@ format "abcdefgz 1234567890 64" like this should remove this ~g~ {} and that -=' > ,<

:DeleteColorCodes
5@ = FALSE // inbracket
0AB1: @strlenA 1 string 0@ _length 31@
for 30@ = 0 to 31@
0085: 29@ = 0@ // copy pointer
005A: 29@ += 30@ // add offset make loop
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

:StrlenA
0A8D: 26@ = readmem 0x8580DC sz 4 vp 0 // 0x8580DC - KERNEL32.lstrlenA
0AA7: strlen_addr 26@ num_params 1 pop 0 string 0@ _returned_length 25@
ret 1 25@
 

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
935
Location
Lithuania
ty so much for response

its not what i wanted

{$CLEO}
0000:
while true
wait 0
0AC8: 2@ = allocate_memory_size 260
0AD3: string 2@ format "~g~ {} a abcdefgz 1234567890 64-=' > ,<"
0AB1: @DeleteColorCodes 2 text 2@ memory_to_store_characters_as_text 2@
0ad1: "%s" 5000 2@
0AC9: free_allocated_memory 2@
end

0AD3: string 2@ format "~g~ {} a abcdefgz 1234567890 64-=' > ,<" if some how strings are messi like here i should get like below
0AD3: string 2@ format "abcdefgz 1234567890 64" like this should remove this ~g~ {} and that -=' > ,<

:DeleteColorCodes
5@ = FALSE // inbracket
0AB1: @strlenA 1 string 0@ _length 31@
for 30@ = 0 to 31@
0085: 29@ = 0@ // copy pointer
005A: 29@ += 30@ // add offset make loop
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

:StrlenA
0A8D: 26@ = readmem 0x8580DC sz 4 vp 0 // 0x8580DC - KERNEL32.lstrlenA
0AA7: strlen_addr 26@ num_params 1 pop 0 string 0@ _returned_length 25@
ret 1 25@
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 

0AC8: 31@ = allocate_memory_size 260
0AD3: string 31@ format "~g~ {} a abcdefgz 1234567890 64-=' > ,<"
0AC8: 30@ = allocate_memory_size 260
0AB1: @CollectCharacters 2 text 31@ memory_to_store_characters_as_text 30@
0AC8: 4@ = allocate_memory_size 260
0AD3: 4@ = format "Text: %s" 30@
0AB1: @Chatmsg 2 text 4@ color 0xFF00FF00
0AC9: free_allocated_memory 4@  
0AC9: free_allocated_memory 31@
0AC9: free_allocated_memory 30@

WHILE TRUE
WAIT 0 
END

:CollectCharacters
{
    0AC8: 1@ = allocate_memory_size 260
    0AB1: @CollectCharacters 2 text 0@ memory_to_store_characters_as_text 1@
}
0AB1: @strlenA 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@ == 32 // SPACE
    THEN 27@ = TRUE
    ELSE
        IF AND
        28@ >= 48 // 0 
        28@ <= 57 // 9
        THEN 27@ = TRUE
        ELSE
            IF AND
            28@ >= 65 // A 
            28@ <= 90 // Z
            THEN 27@ = TRUE
            ELSE
                IF AND
                28@ >= 97 // a 
                28@ <= 122 // z
                THEN 27@ = TRUE
                ELSE 27@ = FALSE
                END
            END
        END
    END
    
    IF 27@ == TRUE
    THEN
        0A8C: write_memory 1@ size 1 value 28@ virtual_protect 1
        1@ += 1 // move to next address
    END
END
0A8C: write_memory 1@ size 1 value 0 virtual_protect 1 // null-termination 
0AB2: ret 0

:StrlenA
0A8D: 26@ = readmem 0x8580DC sz 4 vp 0 // 0x8580DC - KERNEL32.lstrlenA
0AA7: strlen_addr 26@ num_params 1 pop 0 string 0@ _returned_length 25@
ret 1 25@

: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@       


: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 1@ == -1
        THEN 1@ = 0xFFFFFFFF
        END
        0AA6: call 29@ struct 30@ num_params 5 pop 0 params 0 1@ 0 0@ 8
    END
END
0AB2: 0
 

SamThapa

Active member
Joined
Jan 22, 2018
Messages
78
Reaction score
1
let me say this. its not that who can make mods and help but its most important that understanding what help they need









my english bad but you know what i mean XD
 
Top