CLEO Help Help!

CLEO related
Status
Not open for further replies.

Popap

Member
Joined
May 7, 2015
Messages
24
Reaction score
0
I tried to make this toggle able and it doesn't work well and searched any simple toggle able but couldn't find it
I want make it working when i type "af" like cheat and send the command and press "af" again to make it off .The text on/off should be on screen

Code:
{$CLEO .cs}

//-------------MAIN---------------
thread 'AF' 
wait 5000 
alloc 15@ 260 
format 15@ "/AF" 

:AF_45
wait 0 
if 
0ADC:   test_cheat "AF" 
if and
print "~W~AF ~G~ENABLED" 2000 
018C: play_sound 1084 at 0.0 0.0 0.0 
else_jump @AF_148 
call @AF_160 1 15@

:AF_148
wait 11000 
jump @AF_45 

:AF_160
if 
0AA2: 1@ = load_library "SAMP.DLL" // IF and SET 
else_jump @AF_209 
1@ += 416864 
0AA5: call 1@ num_params 1 pop 0 0@  

:AF_209
ret 0
Can anyone fix it? please
 

4changesLeft

Well-known member
Joined
Apr 10, 2015
Messages
365
Reaction score
4
This is how you enable/disable with the same button/cheat or w/e
Adjust your script

if
0ADC: test_cheat "AF"
then
0B12: 0@ = 0@ XOR 1
if
0@ == 1
then
//ON
wait 500
else
//OFF
wait 500
end
end
 

Popap

Member
Joined
May 7, 2015
Messages
24
Reaction score
0
Code:
{$CLEO .cs}

//-------------MAIN---------------
thread 'AF' 
wait 5000 
alloc 15@ 260 
format 15@ "/AF" 

:AF_45
wait 0 
if
0ADC: test_cheat "AF" 
then
0B12: 0@ = 0@ XOR 1
if
0@ == 1
then
print "~W~AF ~G~ENABLED" 2000 
018C: play_sound 1084 at 0.0 0.0 0.0 
else_jump @AF_148 
call @AF_160 1 15@
wait 0
else
print "~W~AF ~R~DISABLED" 2000 
018C: play_sound 1084 at 0.0 0.0 0.0
wait 0
end
end

:AF_148
wait 11000 
jump @AF_45 

:AF_160
if 
0AA2: 1@ = load_library "SAMP.DLL" // IF and SET 
else_jump @AF_209 
1@ += 416864 
0AA5: call 1@ num_params 1 pop 0 0@  

:AF_209
ret 0
I tried it but it doesn't send /af every 11 secs
 

0x32789

Expert
Joined
May 26, 2014
Messages
849
Reaction score
52
Location
LongForgotten <-> 0x32789
it worked, but if it shows failed to load library try removing the 0@ = 0 and printf on :Return
or try making the "samp.dll" to "SAMP.dll"
your compiler has upper case formatting thats why everthing was capital and not sending "/af" but instead "/AF"
Code:
{$CLEO .cs}

thread 'AF' 
wait 5000 
alloc 15@ 260 
format 15@ "/af" 

:Loop
wait 0
if
0ADC: test_cheat "af"
then
    0B12: 0@ = 0@ XOR 1
    if
    0@ == 1
    then
        print "~y~AF ~g~Enabled" 2000
        Actor.StorePos($PLAYER_ACTOR, 11@, 12@, 13@)
        018C: play_sound 1084 at 11@ 12@ 13@
    else
        print "~y~AF ~r~Disabled" 2000
        Actor.StorePos($PLAYER_ACTOR, 11@, 12@, 13@)
        018C: play_sound 1084 at 11@ 12@ 13@
    end
    wait 500
end
if
0@ == 1
then
    call @Prepare 1 15@
end
jump @Loop

:Prepare
wait 11000
call @Send 1 0@

:Send
if
0@ == 1
then
    if 
    0AA2: 1@ = load_library "samp.dll" 
    else_jump @Return
    1@ += 416864 
    0AA5: call 1@ num_params 1 pop 0 0@  
end

:Return    
print "~r~Error Code: ~b~FAIL_LOAD_LIBRARY" 3000
0@ = 0
ret 0
 

Popap

Member
Joined
May 7, 2015
Messages
24
Reaction score
0
0x32789 said:
it worked, but if it shows failed to load library try removing the 0@ = 0 and printf on :Return
or try making the "samp.dll" to "SAMP.dll"
your compiler has upper case formatting thats why everthing was capital and not sending "/af" but instead "/AF"
Code:
{$CLEO .cs}

thread 'AF' 
wait 5000 
alloc 15@ 260 
format 15@ "/af" 

:Loop
wait 0
if
0ADC: test_cheat "af"
then
    0B12: 0@ = 0@ XOR 1
    if
    0@ == 1
    then
        print "~y~AF ~g~Enabled" 2000
        Actor.StorePos($PLAYER_ACTOR, 11@, 12@, 13@)
        018C: play_sound 1084 at 11@ 12@ 13@
    else
        print "~y~AF ~r~Disabled" 2000
        Actor.StorePos($PLAYER_ACTOR, 11@, 12@, 13@)
        018C: play_sound 1084 at 11@ 12@ 13@
    end
    wait 500
end
if
0@ == 1
then
    call @Prepare 1 15@
end
jump @Loop

:Prepare
wait 11000
call @Send 1 0@

:Send
if
0@ == 1
then
    if 
    0AA2: 1@ = load_library "samp.dll" 
    else_jump @Return
    1@ += 416864 
    0AA5: call 1@ num_params 1 pop 0 0@  
end

:Return    
print "~r~Error Code: ~b~FAIL_LOAD_LIBRARY" 3000
0@ = 0
ret 0

Doesn't work :/
 

Popap

Member
Joined
May 7, 2015
Messages
24
Reaction score
0
Greetings,
The toggle things is worked for me but it doesn't send the command.
I did what you said
it worked, but if it shows failed to load library try removing the 0@ = 0 and printf on :Return

or try making the "samp.dll" to "SAMP.dll"your compiler has upper case formatting thats why everthing was capital and not sending "/af" but instead "/AF"
 

0x32789

Expert
Joined
May 26, 2014
Messages
849
Reaction score
52
Location
LongForgotten <-> 0x32789
strange it worked for me when I was testing, It kept getting me to abandoned farm(/af) each 11 seconds
edit:
I see you are doing it without sampfuncs, I can make a working one but in SAMP Funcs because of its built-in "say" function to say commands or say text
 

Popap

Member
Joined
May 7, 2015
Messages
24
Reaction score
0
I'm using SAMPFUNCS v5.2.1 ... Does this version compatible with this mod?

Anyway, it says FAIL_LOAD_LIBRARY every 11secs but not sending command
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
when you use "call" it creates new set of variables exclusively for the function so "if 0@ == 1" check could be no working there because 0@ became 15@ which was a string. You could check this one, the bad side is that "wait 11000" won't allow you to instantly toggle the script
Code:
{$CLEO .cs}

thread 'AF' 
wait 5000 
alloc 15@ 260 
format 15@ "/af" 

:Loop
wait 0
if
0ADC: test_cheat "af"
then
   0B12: 0@ = 0@ XOR 1
   if
   0@ == 1
   then
       print "~y~AF ~g~Enabled" 2000
       Actor.StorePos($PLAYER_ACTOR, 11@, 12@, 13@)
       018C: play_sound 1084 at 11@ 12@ 13@
   else
       print "~y~AF ~r~Disabled" 2000
       Actor.StorePos($PLAYER_ACTOR, 11@, 12@, 13@)
       018C: play_sound 1084 at 11@ 12@ 13@
   end
   wait 500
end

if
0@ == 1
then
wait 11000
    if 
    0AA2: 1@ = load_library "samp.dll" 
    then
    1@ += 416864 
    0AA5: call 1@ num_params 1 pop 0 15@
    else
    print "~r~Error Code: ~b~FAIL_LOAD_LIBRARY" 3000
    //0@ = 0
    end
end
jump @Loop

you could use timer instead of "wait" like:
Code:
{$CLEO .cs}

thread 'AF' 
wait 5000 
alloc 15@ 260 
format 15@ "/af" 

:Loop
wait 0
if
0ADC: test_cheat "af"
then
   0B12: 0@ = 0@ XOR 1
   if
   0@ == 1
   then
        33@ = 0
       print "~y~AF ~g~Enabled" 2000
       Actor.StorePos($PLAYER_ACTOR, 11@, 12@, 13@)
       018C: play_sound 1084 at 11@ 12@ 13@
   else
       print "~y~AF ~r~Disabled" 2000
       Actor.StorePos($PLAYER_ACTOR, 11@, 12@, 13@)
       018C: play_sound 1084 at 11@ 12@ 13@
   end
   wait 500
end

if and
33@ > 11000
0@ == 1
then
33@ = 0
    if 
    0AA2: 1@ = load_library "samp.dll" 
    then
    1@ += 416864 
    0AA5: call 1@ num_params 1 pop 0 15@
    else
    print "~r~Error Code: ~b~FAIL_LOAD_LIBRARY" 3000
    //0@ = 0
    end
end
jump @Loop
 

Popap

Member
Joined
May 7, 2015
Messages
24
Reaction score
0
0x32789 said:
It worked for me,

monday said:
when you use "call" it creates new set of variables exclusively for the function so "if 0@ == 1" check could be no working there because 0@ became 15@ which was a string. You could check this one, the bad side is that "wait 11000" won't allow you to instantly toggle the script
Code:
{$CLEO .cs}

thread 'AF' 
wait 5000 
alloc 15@ 260 
format 15@ "/af" 

:Loop
wait 0
if
0ADC: test_cheat "af"
then
   0B12: 0@ = 0@ XOR 1
   if
   0@ == 1
   then
       print "~y~AF ~g~Enabled" 2000
       Actor.StorePos($PLAYER_ACTOR, 11@, 12@, 13@)
       018C: play_sound 1084 at 11@ 12@ 13@
   else
       print "~y~AF ~r~Disabled" 2000
       Actor.StorePos($PLAYER_ACTOR, 11@, 12@, 13@)
       018C: play_sound 1084 at 11@ 12@ 13@
   end
   wait 500
end

if
0@ == 1
then
wait 11000
    if 
    0AA2: 1@ = load_library "samp.dll" 
    then
    1@ += 416864 
    0AA5: call 1@ num_params 1 pop 0 15@
    else
    print "~r~Error Code: ~b~FAIL_LOAD_LIBRARY" 3000
    //0@ = 0
    end
end
jump @Loop

you could use timer instead of "wait" like:
Code:
{$CLEO .cs}

thread 'AF' 
wait 5000 
alloc 15@ 260 
format 15@ "/af" 

:Loop
wait 0
if
0ADC: test_cheat "af"
then
   0B12: 0@ = 0@ XOR 1
   if
   0@ == 1
   then
        33@ = 0
       print "~y~AF ~g~Enabled" 2000
       Actor.StorePos($PLAYER_ACTOR, 11@, 12@, 13@)
       018C: play_sound 1084 at 11@ 12@ 13@
   else
       print "~y~AF ~r~Disabled" 2000
       Actor.StorePos($PLAYER_ACTOR, 11@, 12@, 13@)
       018C: play_sound 1084 at 11@ 12@ 13@
   end
   wait 500
end

if and
33@ > 11000
0@ == 1
then
33@ = 0
    if 
    0AA2: 1@ = load_library "samp.dll" 
    then
    1@ += 416864 
    0AA5: call 1@ num_params 1 pop 0 15@
    else
    print "~r~Error Code: ~b~FAIL_LOAD_LIBRARY" 3000
    //0@ = 0
    end
end
jump @Loop
It works now! thank you  :motherofgod:
 
Status
Not open for further replies.
Top