CLEO Help Help with cleo

CLEO related
Status
Not open for further replies.

Edvincik

Well-known member
Joined
Mar 15, 2016
Messages
399
Reaction score
26
Hello guys, i have cleo that like if you are a taxi driver and player call for taxi this cleo automatically takes call
Code:
{$CLEO}
0000:
wait 5000

0AC8: 1@ = allocate_memory_size 260
0AC8: 2@ = allocate_memory_size 260
0AC8: 7@ = allocate_memory_size 260
0AC8: 15@ = allocate_memory_size 260
0AC8: 16@ = allocate_memory_size 260
0AC8: 17@ = allocate_memory_size 260

// LAUKIMO LAIKAS
15@ = 1400

:LAUKIMAS
wait 0
if
0AB0: 113
jf @LAUKIMAS
wait 500
jump @MAIN

:MAIN
wait 0 
0AB1: call @getChatEntryText 1 ID 99 to 1@
printf "~B~LAUKIAME ISKVIETIMO..." 500
if or
0AD4: $NOT_USED = 1@ format "** %s kvie%s" 2@v $NOT_USED // MECHANIKU ISKVIETIMAS
0AD4: $NOT_USED = 1@ format "[racija]: %s kvie%s" 2@v $NOT_USED // PAPRASTAS ISKVIETIMAS
0AD4: $NOT_USED = 1@ format "[racija]: %s y%s" 2@v $NOT_USED // NALOGO IR PASLAUGU ISKVIETIMAS
0AD4: $NOT_USED = 1@ format "[racija] Operatorė: %s kvie%s" 2@v $NOT_USED // MEDIKU ISKVIETIMAS
0AD4: $NOT_USED = 1@ format "[racija] %s atsijungė, perimk jo užsakymą /vaziuoju %s" $NOT_USED 2@v // ISKVIETIMO PERIMIMAS
jf @SCREENSHOT
jump @RASYMAS_CALL

:SCREENSHOT
wait 0
if
0AB0: 119
jf @ISJUNGIMAS
printf " " 5000
wait 500
jump @MAIN

:ISJUNGIMAS
wait 0
if
0AB0: 113
jf @MAIN
printf " " 5000
wait 500
jump @LAUKIMAS

:RASYMAS_CALL
wait 0
0AD3: string_format 7@ format "/vaziuoju %s" 2@v
wait 15@
0AB1: @RASYMAS 1 7@
jump @LAUKIMAS

:RASYMAS
wait 0
IF 0AA2: 7@ = "samp.dll"
THEN
    7@ += 0x65C60
    0AA5: call 7@ num_param 1 pop 0 0@
END
0AB2: 0

{:RASYMAS
wait 15@
0AF9: "/vaziuoju %s" 2@v
wait 500     
jump @LAUKIMAS}

:getChatEntryText
0AB1: call @GetSampBase 0 1@
1@ += 0x21A0E4
0A8D: 1@ = read_memory 1@ size 4 virtual_protect 0
1@ += 0x136
0@ *= 252
005A: 1@ += 0@ 
1@ += 28
0AB2: ret 1 1@

:GetSampBase
0AA2: 31@ = load_library "kernel32.dll" 
0AA4: 30@ = get_proc_address "GetModuleHandleA" library 31@ 
0AA7: call_function 30@ num_params 1 pop 0 "samp.dll" 0@
0ab2: ret 1 0@

So it works fine like if for example player Gerdiz_Black calls for taxi
script automatically writes /vaziuoju Gerdiz_Black
but i need the script would write not full name for exampe /vaziuoju Black
it is possible to do that,that the scipt would just write a part of name?
like %s replace with something else?

sorry for bad english :)
hope you can help me
 

Edvincik

Well-known member
Joined
Mar 15, 2016
Messages
399
Reaction score
26
mistery said:
i think i can make it in ahk, but ehh, too much work, its better in cleo
so maybe you know what i need to change in that script to display just part of name
not /vaziuoju Gerdiz_Black
but this /vaziuoju Black
thanks for help
 

Edvincik

Well-known member
Joined
Mar 15, 2016
Messages
399
Reaction score
26
mistery said:
nope i dont know cleo
only ahk
let others help u
man if you will have free time sometime pls try something with ahk or if its very difficult so whatever thank you

@springfield maybe you can help?
 
Joined
Feb 18, 2005
Messages
2,963
Reaction score
267
If all names usually have that underscore then you can extract just the last name.

0ad4: 0@ = format 2@v "%s_%s" $nul 2@v
 

Edvincik

Well-known member
Joined
Mar 15, 2016
Messages
399
Reaction score
26
@springfield Can you show where i should put that line in script? Maybe you can even post that whole remade of script for fully understanding?
Because i have tried to remake it with your params and it doesnt work
 

Edvincik

Well-known member
Joined
Mar 15, 2016
Messages
399
Reaction score
26
Please guys i am waiting for help
@springfield your way doesnt work or i am doing something wrong
maybe you can show how i can extract first name maybe that will give me a bit more understanding?
 
Joined
Feb 18, 2005
Messages
2,963
Reaction score
267
It should work, i don't why it doesn't. I'm not very familiar with strings stuff.
Maybe @Opcode.eXe or @monday can help you.
 

Edvincik

Well-known member
Joined
Mar 15, 2016
Messages
399
Reaction score
26
springfield said:
It should work, i don't why it doesn't. I'm not very familiar with strings stuff.
Maybe @Opcode.eXe or @monday can help you.
maybe i am doing something wrong maybe you could show how it would look in script in your way? thanks


@springfield is that correct?
0AD4: $NOT_USED = 1@ format 2@v "[racija] Operatorė: %s_%s kvie%s" $nul 2@v $NOT_USED
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,126
Solutions
1
Reaction score
157
hi, is there any reason why you're using 2@v instead of 2@? I changed these in the code below but I don't know how it will behave..., you could try it out, the function itself to get the surname should work though because I tested it

Code:
{$CLEO}
0000:
wait 5000

0AC8: 1@ = allocate_memory_size 260
0AC8: 2@ = allocate_memory_size 260
0AC8: 3@ = allocate_memory_size 260 //added, there will be new pointer to the next char after "_"
0AC8: 7@ = allocate_memory_size 260
0AC8: 15@ = allocate_memory_size 260
0AC8: 16@ = allocate_memory_size 260
0AC8: 17@ = allocate_memory_size 260

// LAUKIMO LAIKAS
15@ = 1400

:LAUKIMAS
wait 0
if
0AB0: 113
jf @LAUKIMAS
wait 500
jump @MAIN

:MAIN
wait 0 
0AB1: call @getChatEntryText 1 ID 99 to 1@
printf "~B~LAUKIAME ISKVIETIMO..." 500
if or  //changed 2@v into 2@
0AD4: $NOT_USED = 1@ format "** %s kvie%s" 2@ $NOT_USED // MECHANIKU ISKVIETIMAS
0AD4: $NOT_USED = 1@ format "[racija]: %s kvie%s" 2@ $NOT_USED // PAPRASTAS ISKVIETIMAS
0AD4: $NOT_USED = 1@ format "[racija]: %s y%s" 2@ $NOT_USED // NALOGO IR PASLAUGU ISKVIETIMAS
0AD4: $NOT_USED = 1@ format "[racija] Operatore: %s kvie%s" 2@ $NOT_USED // MEDIKU ISKVIETIMAS
0AD4: $NOT_USED = 1@ format "[racija] %s atsijunge, perimk jo užsakyma /vaziuoju %s" $NOT_USED 2@ // ISKVIETIMO PERIMIMAS   
jf @SCREENSHOT
jump @RASYMAS_CALL

:SCREENSHOT
wait 0
if
0AB0: 119
jf @ISJUNGIMAS
printf " " 5000
wait 500
jump @MAIN

:ISJUNGIMAS
wait 0
if
0AB0: 113
jf @MAIN
printf " " 5000
wait 500
jump @LAUKIMAS

:RASYMAS_CALL
wait 0
0AB1: @GetSurname 1 2@ 3@   //changed
0AD3: string_format 7@ format "/vaziuoju %s" 3@   //changed
wait 15@
0AB1: @RASYMAS 1 7@
jump @LAUKIMAS

:RASYMAS
wait 0
IF 0AA2: 7@ = "samp.dll"
THEN
   7@ += 0x65C60
   0AA5: call 7@ num_param 1 pop 0 0@
END
0AB2: 0

{:RASYMAS
wait 15@
0AF9: "/vaziuoju %s" 2@v
wait 500     
jump @LAUKIMAS}

:getChatEntryText
0AB1: call @GetSampBase 0 1@
1@ += 0x21A0E4
0A8D: 1@ = read_memory 1@ size 4 virtual_protect 0
1@ += 0x136
0@ *= 252
005A: 1@ += 0@ 
1@ += 28
0AB2: ret 1 1@

:GetSampBase
0AA2: 31@ = load_library "kernel32.dll" 
0AA4: 30@ = get_proc_address "GetModuleHandleA" library 31@ 
0AA7: call_function 30@ num_params 1 pop 0 "samp.dll" 0@
0ab2: ret 1 0@

:GetSurname
0085: 28@ = 0@ // (int)
0085: 27@ = 0@ // (int)
29@ = 0
for 31@ = 0 to 200
0A8D: 30@ = read_memory 28@ size 1 virtual_protect 1
    if 30@ == 0
    then
    break
    else
    28@++
    29@++
    end

    if 31@ == 200
    then
    //chatmsg "string seems to be over 200 chars" -1
    end
end

for 31@ = 1 to 29@
0A8D: 30@ = read_memory 0@ size 1 virtual_protect 1
    if 30@ == 95 // if the character is "_" (ASCII table)
    then
    0@++
    //chatmsg 0@ -1
    0AB2: ret 1 0@
    else
    0@++
    end    
end
0AB2: ret 1 27@
 

Edvincik

Well-known member
Joined
Mar 15, 2016
Messages
399
Reaction score
26
monday said:
hi, is there any reason why you're using 2@v instead of 2@? I changed these in the code below but I don't know how it will behave..., you could try it out, the function itself to get the surname should work though because I tested it

Code:
{$CLEO}
0000:
wait 5000

0AC8: 1@ = allocate_memory_size 260
0AC8: 2@ = allocate_memory_size 260
0AC8: 3@ = allocate_memory_size 260 //added, there will be new pointer to the next char after "_"
0AC8: 7@ = allocate_memory_size 260
0AC8: 15@ = allocate_memory_size 260
0AC8: 16@ = allocate_memory_size 260
0AC8: 17@ = allocate_memory_size 260

// LAUKIMO LAIKAS
15@ = 1400

:LAUKIMAS
wait 0
if
0AB0: 113
jf @LAUKIMAS
wait 500
jump @MAIN

:MAIN
wait 0 
0AB1: call @getChatEntryText 1 ID 99 to 1@
printf "~B~LAUKIAME ISKVIETIMO..." 500
if or  //changed 2@v into 2@
0AD4: $NOT_USED = 1@ format "** %s kvie%s" 2@ $NOT_USED // MECHANIKU ISKVIETIMAS
0AD4: $NOT_USED = 1@ format "[racija]: %s kvie%s" 2@ $NOT_USED // PAPRASTAS ISKVIETIMAS
0AD4: $NOT_USED = 1@ format "[racija]: %s y%s" 2@ $NOT_USED // NALOGO IR PASLAUGU ISKVIETIMAS
0AD4: $NOT_USED = 1@ format "[racija] Operatore: %s kvie%s" 2@ $NOT_USED // MEDIKU ISKVIETIMAS
0AD4: $NOT_USED = 1@ format "[racija] %s atsijunge, perimk jo užsakyma /vaziuoju %s" $NOT_USED 2@ // ISKVIETIMO PERIMIMAS   
jf @SCREENSHOT
jump @RASYMAS_CALL

:SCREENSHOT
wait 0
if
0AB0: 119
jf @ISJUNGIMAS
printf " " 5000
wait 500
jump @MAIN

:ISJUNGIMAS
wait 0
if
0AB0: 113
jf @MAIN
printf " " 5000
wait 500
jump @LAUKIMAS

:RASYMAS_CALL
wait 0
0AB1: @GetSurname 1 2@ 3@   //changed
0AD3: string_format 7@ format "/vaziuoju %s" 3@   //changed
wait 15@
0AB1: @RASYMAS 1 7@
jump @LAUKIMAS

:RASYMAS
wait 0
IF 0AA2: 7@ = "samp.dll"
THEN
   7@ += 0x65C60
   0AA5: call 7@ num_param 1 pop 0 0@
END
0AB2: 0

{:RASYMAS
wait 15@
0AF9: "/vaziuoju %s" 2@v
wait 500     
jump @LAUKIMAS}

:getChatEntryText
0AB1: call @GetSampBase 0 1@
1@ += 0x21A0E4
0A8D: 1@ = read_memory 1@ size 4 virtual_protect 0
1@ += 0x136
0@ *= 252
005A: 1@ += 0@ 
1@ += 28
0AB2: ret 1 1@

:GetSampBase
0AA2: 31@ = load_library "kernel32.dll" 
0AA4: 30@ = get_proc_address "GetModuleHandleA" library 31@ 
0AA7: call_function 30@ num_params 1 pop 0 "samp.dll" 0@
0ab2: ret 1 0@

:GetSurname
0085: 28@ = 0@ // (int)
0085: 27@ = 0@ // (int)
29@ = 0
for 31@ = 0 to 200
0A8D: 30@ = read_memory 28@ size 1 virtual_protect 1
    if 30@ == 0
    then
    break
    else
    28@++
    29@++
    end

    if 31@ == 200
    then
    //chatmsg "string seems to be over 200 chars" -1
    end
end

for 31@ = 1 to 29@
0A8D: 30@ = read_memory 0@ size 1 virtual_protect 1
    if 30@ == 95 // if the character is "_" (ASCII table)
    then
    0@++
    //chatmsg 0@ -1
    0AB2: ret 1 0@
    else
    0@++
    end    
end
0AB2: ret 1 27@
Thanks man for work, i will try it now and reply you


Nope man after that time
// LAUKIMO LAIKAS

15@ = 1400
it still writes
printf "~B~LAUKIAME ISKVIETIMO..." 500
and take no action
dont do that
0AD3: string_format 7@ format "/vaziuoju %s" 3@   //changed
dont know where is the problem
i am completly lost :D
btw maybe server somehow is blocking it? :D
maybe it is easier to make it write not last name but just like first four letters of whole %s string? so it would be a good option for me too
 
Joined
Feb 18, 2005
Messages
2,963
Reaction score
267
monday said:
hi, is there any reason why you're using 2@v instead of 2@?

I think 0AD4 doesn't work with them.

Edvincik said:
Nope man after that time
// LAUKIMO LAIKAS

This should work, i tested.

[shcode=cpp]
:RASYMAS_CALL
wait 0
0AD4: $NOT_USED = 2@v "%[^_]_%[^_]" 10@v 20@v  //10@v = first name, 20@v = last name
0AD3: string_format 7@ format "/vaziuoju %s" 20@v
wait 15@
0AB1: @RASYMAS 1 7@
jump @LAUKIMAS
[/shcode]
 

Edvincik

Well-known member
Joined
Mar 15, 2016
Messages
399
Reaction score
26
springfield said:
monday said:
hi, is there any reason why you're using 2@v instead of 2@?

I think 0AD4 doesn't work with them.

Edvincik said:
Nope man after that time
// LAUKIMO LAIKAS

This should work, i tested.

[shcode=cpp]
:RASYMAS_CALL
wait 0
0AD4: $NOT_USED = 2@v "%[^_]_%[^_]" 10@v 20@v  //10@v = first name, 20@v = last name
0AD3: string_format 7@ format "/vaziuoju %s" 20@v
wait 15@
0AB1: @RASYMAS 1 7@
jump @LAUKIMAS
[/shcode]
if i understood correctly i should remade monday's script with you params yea? or in my posted script?


Holy s*** man thank you very much !!!!!!!!!!!! it works !!!!!!!!!!!!!!!!!!!!! @springfield you are my hero and you sad that youre not good with string and thats wrong :D, thanks for all the work man and you too @monday for trying :D

@springfield My last question is is it possible to give 10@v/20@v size or smth like that it would write three first letters of first/last name?
 
Status
Not open for further replies.
Top