CLEO Help Timer

CLEO related
Status
Not open for further replies.

kvarkaa

Member
Joined
Apr 14, 2020
Messages
7
Reaction score
0
Location
Vecumnieki
Hey everyone!

Im playing server where i load in truck Steel and delivery to checkpoint but, when i do delivery faster than 1 minute and 50 seconds it just kicks me out of server because it thinks i have cheats or smth.
Soo i was thinking about Timer that just pops on screen when i type /loadtruck 20000

I'm not a big scripter so you can help me with this idea ?

Thanks!
 

Parazitas

God
Joined
Jan 2, 2017
Messages
3,116
Solutions
5
Reaction score
882
Location
Lithuania
Special For SAMP 0.3.7 r1
Working without SAMPFUNCS

PHP:
{$CLEO .cs}

0000: NOP

wait 8500

0AA8: call_function_method 0x6A0050 0xC1B340 num_params 1 pop 0 'CRED098' 30@
0AA5: call 0x718600 2 pop 2 30@ "Time left: ~1~ seconds"

32@ = 0 // keep timer active

while true
wait 0

if 
0256:   player $PLAYER_CHAR defined
then
    0AB1: @GetLastSentTextFromChatBox 0 _Return: Command 0@ Text 1@
    0AC8: 2@ = allocate_memory_size 260
    0AD3: 2@ = format "loadtruck" // format to check command
    if
    0AB1: @IfTextContains 2 String1 0@ String2 2@ _returned: Text 3@
    then
        0AC8: 4@ = allocate_memory_size 260
        0AD3: 4@ = format "/loadtruck 20000" // format to check full command
        if
        0AB1: @IfTextContains 2 String1 1@ String2 4@ _returned: Text 5@
        then
            0A8C: write_memory 1@ size 1 value 0 virtual_protect 0 // clear last enter text
            32@ = 0   // start count only when text is detected
            30@ = true // enable draw text
        end
    end
end

if
30@ == true 
then    
    03F0: enable_text_draw 1
    0342: set_text_draw_centered 1
    03E0: draw_text_behind_textures 0
    0349: set_text_draw_font 1
    0340: set_text_draw_RGBA 255 255 255 255
    033F: set_text_draw_letter_size width 0.255 height 0.955 
    081C: draw_text_outline 1 RGBA 10 10 10 255
    0AB1: @Timer 2 Seconds 3 TimingVariable 32@ _Return: TimeLeft 29@ SetTimeCountEndStatus 30@  
    045A: draw_text_1number 320.0 390.0 GXT 'CRED098' numbers 29@  // You can deliver after: ~1~ ms
end

end

:GetLastSentTextFromChatBox
{
    0.3.7 - R1
    0AB1: @GetLastSentTextFromChatBox 0 _Return: 0@
}
if 0AA2: 2@ = "samp.dll"
then                
    0A8E: 3@ = 2@ + 0x21A0E8         
    0A8D: 3@ = readMem 3@ sz 4 vp 0     
    0A8E: 4@ = 3@ + 0x14E5 // command  
    0A8E: 5@ = 3@ + 0x1565 // text
end
0AB2: 2 4@ 5@

:IfTextContains
//0AB1: @IfTextContains 2 String1 0@ String2 1@
0AB1: @strlen 1 string 0@ _length 31@
0AB1: @strlen 1 string 1@ _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

:strlen
// 0AB1: @strlen 1 string 1@ _return: size 3@
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@

:Timer
2@ = TRUE
IF
2@ == TRUE
THEN
    0@ *= 1000
    0085: 4@ = 0@ // (int)
    0085: 3@ = 1@ // (int)
    0062: 3@ -= 4@  // (int)

    3@ /= 1000
    
    3@ *= -1
END

IF AND
2@ == TRUE
001D:   1@ > 0@  // (int)
THEN
    2@ = FALSE  
END
0AB2: ret 2 3@ 2@
 

Attachments

  • Cmd.cs
    21.6 KB · Views: 14

kvarkaa

Member
Joined
Apr 14, 2020
Messages
7
Reaction score
0
Location
Vecumnieki
Special For SAMP 0.3.7 r1
Working without SAMPFUNCS

PHP:
{$CLEO .cs}

0000: NOP

wait 8500

0AA8: call_function_method 0x6A0050 0xC1B340 num_params 1 pop 0 'CRED098' 30@
0AA5: call 0x718600 2 pop 2 30@ "Time left: ~1~ seconds"

32@ = 0 // keep timer active

while true
wait 0

if
0256:   player $PLAYER_CHAR defined
then
    0AB1: @GetLastSentTextFromChatBox 0 _Return: Command 0@ Text 1@
    0AC8: 2@ = allocate_memory_size 260
    0AD3: 2@ = format "loadtruck" // format to check command
    if
    0AB1: @IfTextContains 2 String1 0@ String2 2@ _returned: Text 3@
    then
        0AC8: 4@ = allocate_memory_size 260
        0AD3: 4@ = format "/loadtruck 20000" // format to check full command
        if
        0AB1: @IfTextContains 2 String1 1@ String2 4@ _returned: Text 5@
        then
            0A8C: write_memory 1@ size 1 value 0 virtual_protect 0 // clear last enter text
            32@ = 0   // start count only when text is detected
            30@ = true // enable draw text
        end
    end
end

if
30@ == true
then   
    03F0: enable_text_draw 1
    0342: set_text_draw_centered 1
    03E0: draw_text_behind_textures 0
    0349: set_text_draw_font 1
    0340: set_text_draw_RGBA 255 255 255 255
    033F: set_text_draw_letter_size width 0.255 height 0.955
    081C: draw_text_outline 1 RGBA 10 10 10 255
    0AB1: @Timer 2 Seconds 3 TimingVariable 32@ _Return: TimeLeft 29@ SetTimeCountEndStatus 30@ 
    045A: draw_text_1number 320.0 390.0 GXT 'CRED098' numbers 29@  // You can deliver after: ~1~ ms
end

end

:GetLastSentTextFromChatBox
{
    0.3.7 - R1
    0AB1: @GetLastSentTextFromChatBox 0 _Return: 0@
}
if 0AA2: 2@ = "samp.dll"
then               
    0A8E: 3@ = 2@ + 0x21A0E8        
    0A8D: 3@ = readMem 3@ sz 4 vp 0    
    0A8E: 4@ = 3@ + 0x14E5 // command 
    0A8E: 5@ = 3@ + 0x1565 // text
end
0AB2: 2 4@ 5@

:IfTextContains
//0AB1: @IfTextContains 2 String1 0@ String2 1@
0AB1: @strlen 1 string 0@ _length 31@
0AB1: @strlen 1 string 1@ _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

:strlen
// 0AB1: @strlen 1 string 1@ _return: size 3@
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@

:Timer
2@ = TRUE
IF
2@ == TRUE
THEN
    0@ *= 1000
    0085: 4@ = 0@ // (int)
    0085: 3@ = 1@ // (int)
    0062: 3@ -= 4@  // (int)

    3@ /= 1000
   
    3@ *= -1
END

IF AND
2@ == TRUE
001D:   1@ > 0@  // (int)
THEN
    2@ = FALSE 
END
0AB2: ret 2 3@ 2@
Broooo, Big big big Thanks to you!!!!!
Omg im soo happy, now i have timer :)))
But, when i type /loadtruck 20000 it shows only two seconds, can you change it to 110 seconds please ?
 

Parazitas

God
Joined
Jan 2, 2017
Messages
3,116
Solutions
5
Reaction score
882
Location
Lithuania
Change senconds yourself,now is 3seconds
PHP:
0AB1: @Timer 2 Seconds 3 TimingVariable 32@ _Return: TimeLeft 29@ SetTimeCountEndStatus 30@
 
Status
Not open for further replies.
Top