CLEO Help Port to Player, doesnt work

CLEO related
Status
Not open for further replies.

mbcool

Active member
Joined
May 14, 2013
Messages
49
Reaction score
0
Why this doesnt work ?
I try to port to a player in my range.

__
:CHECK_1
if and
11@ == 1
0AB0: key_pressed 80
jf @MAIN
Actor.StorePos($PLAYER_ACTOR,0@,1@,2@)
0AE1: $actor = random_actor_near_point 0@ 1@ 2@ in_radius 30.0 find_next 1 pass_deads 1
Actor.StorePos($actor,3@,4@,5@)
Actor.PutAt($PLAYER_ACTOR,3@,4@,5@)
wait 100
jump @MAIN
 

xzytro

God
Joined
Apr 1, 2013
Messages
2,294
Reaction score
7
*Change "find_next 1" to "find_next 0"

*After the line "wait 100", add this line :
01C2: remove_references_to_actor $actor
 

xzytro

God
Joined
Apr 1, 2013
Messages
2,294
Reaction score
7
Maybe with
0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to 0@ closest_ped_to 1@
But then it won't work well in a crowded server.

Or

Perhaps you could transform your script into one which can teleport you to the target who you lastly damaged.
By using this perhaps :
051A: actor 1@ damaged_by_actor $PLAYER_ACTOR
 

Opcode.eXe

Expert
Joined
Feb 18, 2013
Messages
1,486
Reaction score
227
Location
( ͡° ͜ʖ ͡°)
Actor.StorePos($PLAYER_ACTOR, 0@, 1@, 2@) // SEARCHING START POS
3@ = 10.0 // SEARCH RADIUS
gosub @AIC_GETACTOR // GET ACTOR WICH IS AT POS 0@ 1@ 2@ TO 9@


:AIC_GETACTOR
0395: clear_area 1 at 0@ 1@ 2@ radius 100000.0
0006: 16@ = 305868
0006: 5@ = @AIC_TESTACTORHANDLE
0006: 6@ = 1988
0002: jump @AIC_STARTSEARCH
:AIC_GETOBJECT
0006: 16@ = 305871
0006: 17@ = @AIC_TESTOBJECTHANDLE
0006: 20@ = 412
:AIC_GETVEHICLE
0006: 16@ = 305869
0006: 17@ = @AIC_TESTVEHICLEHANDLE
0006: 18@ = -1
0006: 20@ = 2584
0256: player $PLAYER_CHAR defined
004D: jump_if_false @AIC_STARTSEARCH
00DF: actor $PLAYER_ACTOR driving
004D: jump_if_false @AIC_STARTSEARCH
03C0: 18@ = actor $PLAYER_ACTOR car
0002: jump @AIC_STARTSEARCH
:AIC_STARTSEARCH
008B: 16@ = &0(16@,1i) // CPool*
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 16@ + 8 )^ = 7@ // CPool.Size
0A8D: 11@ = read_memory 16@ size 4 virtual_protect 0 // CPool.pUnits
0006: 9@ = -1
0006: 10@ = 0
:AIC_SEARCHLOOPMAIN
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 11@ + 20 )^ = 4@ // xyz*
8039: not 4@ == 0
004D: jump_if_false @AIC_SEARCHLOOPNEXT
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 4@ + 48 )^ = 12@ // x
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 4@ + 52 )^ = 13@ // y
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 4@ + 56 )^ = 14@ // z
050A: 15@ = distance_between_XYZ 0@ 1@ 2@ and_XYZ 12@ 13@ 14@
0025: 3@ > 15@ // (float)
004D: jump_if_false @AIC_SEARCHLOOPNEXT
0085: 9@ = 10@ // (int) // counter
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 16@ + 4 )^ = 4@ // CPool.flags
005A: 4@ += 9@ // (int)
0A8D: 4@ = read_memory 4@ size 1 virtual_protect 0
0012: 9@ *= 256
005A: 9@ += 4@ // (int)
0002: jump 5@
:AIC_TESTACTORHANDLE
056D: is 9@ valid_actor_handle
004D: jump_if_false @AIC_NOHANDLE
00D6: if or
003C: $PLAYER_ACTOR == 9@ // (int)
0118: actor 9@ dead
004D: jump_if_false @AIC_NEWSEARCHRADIUS
0002: jump @AIC_NOHANDLE
:AIC_TESTOBJECTHANDLE
//0001: wait 0
83CA: not object 9@ exists
004D: jump_if_false @AIC_NEWSEARCHRADIUS
:AIC_TESTVEHICLEHANDLE
056E: is 9@ valid_vehicle_handle
004D: jump_if_false @AIC_NOHANDLE
00D6: if or
003B: 18@ == 9@ // (int)
0119: car 9@ wrecked
004D: jump_if_false @AIC_NEWSEARCHRADIUS
0002: jump @AIC_NOHANDLE
:AIC_NOHANDLE
0006: 9@ = -1
0002: jump @AIC_SEARCHLOOPNEXT
:AIC_NEWSEARCHRADIUS
if
056D: actor 9@ defined
jf @AIC_NOHANDLE
0085: 3@ = 15@
:AIC_SEARCHLOOPNEXT
005A: 11@ += 6@ // (int)
000A: 10@ += 1
002D: 10@ >= 7@ // (int)
004D: jump_if_false @AIC_SEARCHLOOPMAIN
0051: return
:AIC_READMEMOFFSET
0A8E: 0@ = 0@ + 1@ // int
0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0
0AB2: ret 1 0@
 

mbcool

Active member
Joined
May 14, 2013
Messages
49
Reaction score
0
Doesnt work.
Whats wrong?
_______________________

{$CLEO .cs}

//-------------MAIN---------------
thread "PORT"
wait 0
:MAIN
wait 10

if
0ADC: test_cheat "POR"
jf @CHECK_1
if 21@ == 0
then
0ACD: show_text_highpriority "G~ACTIVATED!" time 2000
21@ = 1
else
21@ = 0
0ACD: show_text_highpriority "~Y~DEACTIVATED!" time 2000
end

:CHECK_1
if and
21@ == 1
0AB0: key_pressed 80
jf @MAIN
Actor.StorePos($PLAYER_ACTOR, 0@, 1@, 2@)
3@ = 10.0 // SEARCH RADIUS
gosub @AIC_GETACTOR // GET ACTOR WICH IS AT POS 0@ 1@ 2@ TO 9@
Actor.StorePos(9@,22@,23@,24@)
Actor.PutAt($PLAYER_ACTOR,22@,23@,24@)
wait 100
jump @MAIN




:AIC_GETACTOR
0395: clear_area 1 at 0@ 1@ 2@ radius 100000.0
0006: 16@ = 305868
0006: 5@ = @AIC_TESTACTORHANDLE
0006: 6@ = 1988
0002: jump @AIC_STARTSEARCH
:AIC_GETOBJECT
0006: 16@ = 305871
0006: 17@ = @AIC_TESTOBJECTHANDLE
0006: 20@ = 412
:AIC_GETVEHICLE
0006: 16@ = 305869
0006: 17@ = @AIC_TESTVEHICLEHANDLE
0006: 18@ = -1
0006: 20@ = 2584
0256: player $PLAYER_CHAR defined
004D: jump_if_false @AIC_STARTSEARCH
00DF: actor $PLAYER_ACTOR driving
004D: jump_if_false @AIC_STARTSEARCH
03C0: 18@ = actor $PLAYER_ACTOR car
0002: jump @AIC_STARTSEARCH
:AIC_STARTSEARCH
008B: 16@ = &0(16@,1i) // CPool*
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 16@ + 8 )^ = 7@ // CPool.Size
0A8D: 11@ = read_memory 16@ size 4 virtual_protect 0 // CPool.pUnits
0006: 9@ = -1
0006: 10@ = 0
:AIC_SEARCHLOOPMAIN
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 11@ + 20 )^ = 4@ // xyz*
8039: not 4@ == 0
004D: jump_if_false @AIC_SEARCHLOOPNEXT
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 4@ + 48 )^ = 12@ // x
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 4@ + 52 )^ = 13@ // y
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 4@ + 56 )^ = 14@ // z
050A: 15@ = distance_between_XYZ 0@ 1@ 2@ and_XYZ 12@ 13@ 14@
0025: 3@ > 15@ // (float)
004D: jump_if_false @AIC_SEARCHLOOPNEXT
0085: 9@ = 10@ // (int) // counter
0AB1: call_scm_func @AIC_READMEMOFFSET 2 ( 16@ + 4 )^ = 4@ // CPool.flags
005A: 4@ += 9@ // (int)
0A8D: 4@ = read_memory 4@ size 1 virtual_protect 0
0012: 9@ *= 256
005A: 9@ += 4@ // (int)
0002: jump 5@
:AIC_TESTACTORHANDLE
056D: is 9@ valid_actor_handle
004D: jump_if_false @AIC_NOHANDLE
00D6: if or
003C: $PLAYER_ACTOR == 9@ // (int)
0118: actor 9@ dead
004D: jump_if_false @AIC_NEWSEARCHRADIUS
0002: jump @AIC_NOHANDLE
:AIC_TESTOBJECTHANDLE
//0001: wait 0
83CA: not object 9@ exists
004D: jump_if_false @AIC_NEWSEARCHRADIUS
:AIC_TESTVEHICLEHANDLE
056E: is 9@ valid_vehicle_handle
004D: jump_if_false @AIC_NOHANDLE
00D6: if or
003B: 18@ == 9@ // (int)
0119: car 9@ wrecked
004D: jump_if_false @AIC_NEWSEARCHRADIUS
0002: jump @AIC_NOHANDLE
:AIC_NOHANDLE
0006: 9@ = -1
0002: jump @AIC_SEARCHLOOPNEXT
:AIC_NEWSEARCHRADIUS
if
056D: actor 9@ defined
jf @AIC_NOHANDLE
0085: 3@ = 15@
:AIC_SEARCHLOOPNEXT
005A: 11@ += 6@ // (int)
000A: 10@ += 1
002D: 10@ >= 7@ // (int)
004D: jump_if_false @AIC_SEARCHLOOPMAIN
0051: return
:AIC_READMEMOFFSET
0A8E: 0@ = 0@ + 1@ // int
0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0
0AB2: ret 1 0@
 

mbcool

Active member
Joined
May 14, 2013
Messages
49
Reaction score
0
I think it only jumps to Main if the statement is false.
Or not?

//Edit:
But if the player doesnt typed POR it jumps to the next Check.
(jf @Check_1)
 

xzytro

God
Joined
Apr 1, 2013
Messages
2,294
Reaction score
7
But if the player doesnt typed POR it jumps to the next Check.
(jf @Check_1)
I noticed it late yeah, in this case there shouldn't be any problems about jump to MAIN. That's why i removed my post but i was late since you replied back xD

Other than that, i see no reason. Springfield or opcode could see the problem perhaps.
 

mbcool

Active member
Joined
May 14, 2013
Messages
49
Reaction score
0
Okay thank you ^^

//Do you know how to do memory hacking with cleo?
And can you give me an little example?
 
Status
Not open for further replies.
Top