ChampaRando
Active member
Hey guys, I am making an automated script which basically uses location coords to send commands accordingly.
First I tried using a high-level while true and even repeat loops but it didn't work as I expected (my mistakes probably).
Here is my current code (all of it);
So basic idea (summary of code);
I have 5 positions!
Position A, B, C, D,.
Now what I want is;
Label Step 1, detects whenever I approach position A. [If I dont go near Position A, Step 1 should keep looping and keep checking until I arrive at Pos A, and currently this step works fine!]
When approached position A, performs the CMDs, then goes to position B (Step 2 label) and waits for player to approach it. [problem starts here]
Then Step 2 will do cmds from position B, then go to Position C (Step 3).
Then, Position C to Position D (Step 4).
And then Position D back to Position B (Step 5).
Then Position B back to Position A (Step 6).
Then repeat.
The problem is basically;
Step 1 works fine! But after it executes, step 1 sends player from A to B, but then CLEO jumps straight to Step 5 (as step 5 is also triggered by position B). But I want this to happen in sequential order! Step 1 2 3 4 and then 5 and 6.
How can I achieve this? Can anyone help me? If anyone has a high level solution I would prefer that than this, but I couldnt make a high level (i tried it was too buggy), so I tried low level. But this doesn't work either.
First I tried using a high-level while true and even repeat loops but it didn't work as I expected (my mistakes probably).
Here is my current code (all of it);
Code:
{$CLEO}
thread 'BoatGM'
wait 10000
0ac8: 15@ = 260
0ad3: 15@ = ""
$unlockVar = 0 //0=locked
:step1
wait 0
if and
Player.Defined($PLAYER_CHAR)
not Actor.Driving($PLAYER_ACTOR)
0AF8: samp add_message_to_chat "{00FF00}just checked for driving or not"
then
if
00EC: actor $PLAYER_ACTOR sphere 0 near_point 2373.9546 -1138.9854 radius 3.0 3.0 //POSITION A
then
0AF8: samp add_message_to_chat "{00FF00}Performed loc check, step 1 start"
0B2E: 0@ = read_samp_memory offset 0x015970 size 2 //SetPlayerPos NOP ON
0B2D: write_samp_memory offset 0x015970 value 0xC390 size 2 //SetPlayerPos NOP ON
0AF8: samp add_message_to_chat "{00FF00}NOP ON"
wait 2000
0C8F: samp process_chat_input "/enter" //get inside the house
wait 2000
0C8F: samp process_chat_input "/tp biz" // tp to BIZ, SEE THIS IS WHERE I TELEPORT TO POSITION B!
wait 10000
0B2D: write_samp_memory offset 0x015970 value 0@ size 2 //SetPlayerPos NOP OFF
0AF8: samp add_message_to_chat "{00FF00}NOP OFF"
wait 500
0C8F: samp process_chat_input "/enter" // get inside the biz
wait 2000
0C8F: samp process_chat_input "/exit" //get outside the biz
wait 2000
0C8F: samp process_chat_input "/.playa" //walk to STEP 3 coords enterance only via WalkPathA.txt & WalkPathA.cs
$unlockVar = 1 //0=locked
end
end
wait 100
if
$unlockVar == 1 //if unlocked, notice unlock only possible if house CMDs execute
then
$unlockVar == 0//re-lock
jump @step2
else
wait 2000
jump @step1
end
//////////////////////////
:step2
wait 0
if and
Player.Defined($PLAYER_CHAR)
not Actor.Driving($PLAYER_ACTOR)
then
if
00EC: actor $PLAYER_ACTOR sphere 0 near_point 51.8815 -293.4846 radius 3.0 3.0//POSITION B
then
0AF8: samp add_message_to_chat "{00FF00}Performed loc check, step 2 start"
//commands for this position go here
$unlockVar = 1 //0=locked
end
end
wait 100
if
$unlockVar == 1 //if unlocked, notice unlock only possible if house CMDs execute
then
$unlockVar == 0//re-lock
jump @step3
else
jump @step2
end
/////////////////////////
:step3
wait 0
if and
Player.Defined($PLAYER_CHAR)
not Actor.Driving($PLAYER_ACTOR)
then
if
00EC: actor $PLAYER_ACTOR sphere 0 near_point 2205.5806 1581.9320 radius 3.0 3.0//POSITION C
then
0AF8: samp add_message_to_chat "{00FF00}Performed loc check, step 3 start"
//commands for this position go here
$unlockVar = 1 //0=locked
end
end
wait 100
if
$unlockVar == 1 //if unlocked, notice unlock only possible if house CMDs execute
then
$unlockVar == 0//re-lock
jump @step4
else
jump @step3
end
//////////////////
:step4
wait 0
if and
Player.Defined($PLAYER_CHAR)
not Actor.Driving($PLAYER_ACTOR)
then
if
00EC: actor $PLAYER_ACTOR sphere 0 near_point 2205.2827 1551.8660 radius 3.0 3.0//POSITION D
then
0AF8: samp add_message_to_chat "{00FF00}Performed loc check, step 4 start"
//commands for this position go here
$unlockVar = 1 //0=locked
end
end
wait 100
if
$unlockVar == 1 //if unlocked, notice unlock only possible if house CMDs execute
then
$unlockVar == 0//re-lock
jump @step5
else
jump @step4
end
////////////////////////////////
:step5
wait 0
if and
Player.Defined($PLAYER_CHAR)
not Actor.Driving($PLAYER_ACTOR)
then
if
00EC: actor $PLAYER_ACTOR sphere 0 near_point 142.4275 -180.6222 radius 3.0 3.0 //POSITION B again!
then
//commands for this position go here
$unlockVar = 1 //0=locked
end
end
wait 100
if
$unlockVar == 1 //if unlocked, notice unlock only possible if house CMDs execute
then
$unlockVar == 0//re-lock
jump @step6
else
jump @step5
end
////////////////////////////////
:step6
wait 0
if and
Player.Defined($PLAYER_CHAR)
not Actor.Driving($PLAYER_ACTOR)
then
if
00EC: actor $PLAYER_ACTOR sphere 0 near_point 2373.9546 -1138.9854 radius 3.0 3.0 //POSITION A again
then
0AF8: samp add_message_to_chat "{00FF00}Performed loc check, step 6 start"
0C8F: samp process_chat_input "/.stopb"
wait 6000
0AF8: samp add_message_to_chat "{00FF00}Looping again" // done!
$unlockVar = 1 //0=locked
end
end
wait 100
if
$unlockVar == 1 //if unlocked, notice unlock only possible if house CMDs execute
then
$unlockVar == 0//re-lock
jump @step1//lets go back and start all over again!
else
jump @step6
end
////////////////////////////////
:SAY
IF 0AA2: 1@ = "samp.dll"
THEN
1@ += 0x65C60 // FUNC_SENDCMD for 0.3.7
0AA5: call 1@ num_param 1 pop 0 0@
END
0AB2: 0
So basic idea (summary of code);
I have 5 positions!
Position A, B, C, D,.
Now what I want is;
Label Step 1, detects whenever I approach position A. [If I dont go near Position A, Step 1 should keep looping and keep checking until I arrive at Pos A, and currently this step works fine!]
When approached position A, performs the CMDs, then goes to position B (Step 2 label) and waits for player to approach it. [problem starts here]
Then Step 2 will do cmds from position B, then go to Position C (Step 3).
Then, Position C to Position D (Step 4).
And then Position D back to Position B (Step 5).
Then Position B back to Position A (Step 6).
Then repeat.
The problem is basically;
Step 1 works fine! But after it executes, step 1 sends player from A to B, but then CLEO jumps straight to Step 5 (as step 5 is also triggered by position B). But I want this to happen in sequential order! Step 1 2 3 4 and then 5 and 6.
How can I achieve this? Can anyone help me? If anyone has a high level solution I would prefer that than this, but I couldnt make a high level (i tried it was too buggy), so I tried low level. But this doesn't work either.
Last edited: