CLEO Help Panic button?

CLEO related
Status
Not open for further replies.

trololo123

Member
Joined
Feb 26, 2014
Messages
11
Reaction score
0
Hi, there is any cleo who can disable other cleo's only pressing a key?
There is any way to put a text on my gta screen when i active one or more cleo's?

Thank you.
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
271
No such scripts, but you can make them..
1. 0ABA opcode can be used to terminate certain scripts.
2. You'd have to edit those scripts, and add a text upon activation(0AD1 etc.).
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
here's one, by using /panic you pause TEST.cs, by using /resume you resume it
Code:
{$CLEO}
0000: NOP
repeat
wait 50
until 0AFA: is_samp_structures_available
0B34: samp register_client_command "panic" to_label @activate_panic
0B34: samp register_client_command "resume" to_label @activate_resume

:First
wait 0
if 31@ == 1 
then
0AAA: 0@ = thread 'TEST.cs' pointer
0BDE: pause_thread 0@
31@ = 0
end

if 30@ == 1 
then
0BDF: resume_thread 0@  
30@ = 0   
end

jump @First

:activate_panic
0B12: 31@ = 31@ XOR 1
samp.CmdRet 

:activate_resume
0B12: 30@ = 30@ XOR 1
samp.CmdRet

//0AB1: call_scm_func @name 0
:function
0AB2: ret 0


You could add something like:
Code:
0AAA: 0@ = thread 'TEST.cs' pointer
0BDE: pause_thread 0@
0AAA: 1@ = thread 'anotherMod.cs' pointer
0BDE: pause_thread 1@
0AAA: 2@ = thread 'andOneMore.cs' pointer
0BDE: pause_thread 2@

and
Code:
0BDF: resume_thread 0@  
0BDF: resume_thread 1@
0BDF: resume_thread 2@ 
 

Tested with sampfuncs 5.2.2, cleo 4.1, samp 0.3.7
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
271
No reason to complicate with SF, when 0AAA->0ABA->0A92 can achieve the same thing(i'm assuming he wants to disable all mods at the same time using one key, hence panic button).
But this won't work in some cases, by default the thread name is the file name, but most cleos use the 03A4 opcode to set a custom thread name.

Code:
0AAA: 0@ = thread 'test.cs' pointer
0AF8: "%x" -1 0@ //0@ is pointer

03A4: "MyMod"

0AAA: 0@ = thread 'test.cs' pointer
0AF8: "%x" -1 0@ //0@ is 0

Alternative is to loop through cleo threads pool, check if active and then call 0ABA on pointer.
You can find addresses and thread structs in CLEO 4.2a source code.
 

trololo123

Member
Joined
Feb 26, 2014
Messages
11
Reaction score
0
If is too much complicated make a panic button for different scripts will be possible put/quit a text on my gta screen when i type determinate keys?
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
Check this one, it works for my few test cleos using cleo 4.1 but I don't know how it will behave in different environment
Numpad button "-" pauses/resumes all the mods

Edit: the attached mod is not working properly
 

Attachments

  • panic.cs
    19.3 KB · Views: 33

trololo123

Member
Joined
Feb 26, 2014
Messages
11
Reaction score
0
monday link said:
Check this one, it works for my few test cleos using cleo 4.1 but I don't know how it will behave in different environment
Numpad button "-" pauses/resumes all the mods

Really appreciate your help but this didn't work for me, I tested 3 of 5 my cleos and didn't work, btw i have 4.3 cleo (problems with 4.1 version).

Can you help me to edit this script or something?
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
Hmm I have no idea what would have to be changed to make it work with cleo 4.3 (assuming that cleo version is the only problem here)
 

trololo123

Member
Joined
Feb 26, 2014
Messages
11
Reaction score
0
If is too much complicated make a panic button for different scripts will be possible put/quit a text on my gta screen when i type determinate keys?

Something like this but with my cleos, a little text who i can put or quit when i active or deactive them (with the same keys)

hgldFir.jpg


http://i.imgur.com/hgldFir.jpg
 

trololo123

Member
Joined
Feb 26, 2014
Messages
11
Reaction score
0
Well, i tried to change my cleo 4.3 to 4.1 and still didnt work for me "panic.cs"
I downloaded SB and i tried to compile this script and i cant, "Unknown opcode 0B34" (samp register_client_command "panic" to_label @activate_panic) even if i copy/paste the script i cant compilate it. (i changed test.cs before)

Will be wonderfull if i finally make work this script with "panic.cs" key activation

Code:
{$CLEO}
0000: NOP
repeat
wait 50
until 0AFA: is_samp_structures_available
0B34: samp register_client_command "panic" to_label @activate_panic
0B34: samp register_client_command "resume" to_label @activate_resume

:First
wait 0
if 31@ == 1
then
0AAA: 0@ = thread 'TEST.cs' pointer
0BDE: pause_thread 0@
31@ = 0
end

if 30@ == 1
then
0BDF: resume_thread 0@ 
30@ = 0   
end

jump @First

:activate_panic
0B12: 31@ = 31@ XOR 1
samp.CmdRet

:activate_resume
0B12: 30@ = 30@ XOR 1
samp.CmdRet

//0AB1: call_scm_func @name 0
:function
0AB2: ret 0

I am not noob coding, i am "the noob" coding  :yesyes:

I hope you help me
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
Did it crash the game? Or just didn't do anything?
Could you post the exact size of your gta_sa.exe? Mine is 14 383 616 bytes and I downloaded downgrade patch from here
Also if that's not a problem, could you make an archive of your cleo mods and upload them here? Then I would check if the code works with them on my pc.

Btw about the compiling error. You should download sampfuncs 5.2.2, unpack, copy all files from "SB data" folder into "Sanny Builder directory->data->sa". Sampfuncs.asi should go to your gta folder
 

trololo123

Member
Joined
Feb 26, 2014
Messages
11
Reaction score
0
monday link said:
Did it crash the game? Or just didn't do anything?

Didn't do anything

monday link said:
Could you post the exact size of your gta_sa.exe? Mine is 14 383 616 bytes

Me too, exactly the same size.

monday link said:
could you make an archive of your cleo mods and upload them here? Then I would check if the code works with them on my pc.

Of course

https://mega.nz/#!Vs1BwAAa!yXw6YJpwszzRBQi3u25YeaPdwH6epgRDNcQveVg79HQ

monday link said:
Btw about the compiling error. You should download sampfuncs 5.2.2, unpack, copy all files from "SB data" folder into "Sanny Builder directory->data->sa". Sampfuncs.asi should go to your gta folder

I will try to compile that code and i will check if it work for all my cleos

Thanks you
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
I'm not sure if while testing the code I made mistake by checking incorrect offset or the next thread pointer at the last thread structure was really positive when it should be 0. Probably I just made mistake and the attached mod should work properly, but if not there could be some complications

Edit: btw your "Kill F9" mod is set to be activated by key "122" which is F11, instead of "120"
 

Attachments

  • panic.cs
    19.4 KB · Views: 37

trololo123

Member
Joined
Feb 26, 2014
Messages
11
Reaction score
0
monday link said:
I'm not sure if while testing the code I made mistake by checking incorrect offset or the next thread pointer at the last thread structure was really positive when it should be 0. Probably I just made mistake and the attached mod should work properly, but if not there could be some complications

It works but... i do not want to be ungrateful, this mod can block me to active all my mods but when they are activated at first and i active the panic.cs, they are still active.

The point is that i dont know sometimes when my mods are active or not, If the panic button is very complicated or impossible will help me the same a little text on my gta screen, texts who can be activate/deactivate with the same keys of my cleos, this is possible, how i can do that?


monday link said:
Edit: btw your "Kill F9" mod is set to be activated by key "122" which is F11, instead of "120"

:surprised: i dont know why it works with F9 then
 

monday

Expert
Joined
Jun 23, 2014
Messages
1,127
Solutions
1
Reaction score
158
all my mods but when they are activated at first and i active the panic.cs, they are still active.
Do you mean that their internal stuff stays the same or they're literally active all the time despite of turning them off? Could you give an example of what happens?

If I understood properly what mod you need I'm affraid that it requires knowledge on how a specific mod works/is activated (which variable does what). Potentially you could build a scanner, monitor state of variables when you activate specific mod and then add individual checks + create textdraws

Edit: btw i'll go to sleep, I start work in 2 hours...;d
 
Status
Not open for further replies.
Top