[Another simple code that doesn't work]Check if player is near coordinate

Статус
В этой теме нельзя размещать новые ответы.

Kilowog01

Новичок
Автор темы
6
0
I did not know how to demand that the samp is ready and the player is chosen to start the script so I did ativacao2

When I type /contrabando the game crashes

I want it to check if any player(admin or not) is near the future coordinate that i will spawn, if yes, then stop the code, else...spawn and repeat the cicle

CLEO:
{$CLEO .cs}
0000:
REPEAT
    WAIT 0
UNTIL  0AFA:  SAMP_IS_READY
0B34: "CONTRABANDO" @ativacao

WHILE TRUE
wait 0
if 0@ == 1
then 
0AB1:  @ativacao2 0
end
END

:ativacao
0B12: 0@ = 0@ XOR 1
if 0@ == 1
then 0AF8: "{FF0000}CLEO:{FFFFFF} CB Ativado!" -1
else 0AF8: "{FF0000}CLEO:{FFFFFF} CB Desativado!" -1
END    
0B43:

:ativacao2
wait 0
if and 
0@ == 1
056D:   actor $PLAYER_ACTOR defined
then
0AB1:  @CB 0 
END
0B43:

:CB
   0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to 9@ closest_ped_to 10@
         if and
         00FE: actor 10@ 0 near_point_3d 3@ 4@ 5@ radius 150.0 150.0 150.0
         00FE: actor 10@ 0 near_point_3d 6@ 7@ 8@ radius 150.0 150.0 150.0
         then
         0AB1:  @ativacao 0
    else
    //03C0: 0@ = actor $PLAYER_ACTOR car
    //0175: set_car 0@ Z_angle_to 90.0
    WAIT 2500 ms  
    3@ = 2311.3757 
    4@ = 2774.7578 
    5@ = 10.8035
    Actor.PutAt($PLAYER_ACTOR, 3@, 4@, 5@)  
    WAIT 500 ms
    0AF9: "/Carregar"
         if and
         00FE: actor 10@ 0 near_point_3d 3@ 4@ 5@ radius 150.0 150.0 150.0
         00FE: actor 10@ 0 near_point_3d 6@ 7@ 8@ radius 150.0 150.0 150.0
         then
         0AB1:  @ativacao 0
    else
    WAIT 2500 ms
    6@ = 2580.8347  
    7@ = -945.1074 
    8@ = 81.4031

    Actor.PutAt($PLAYER_ACTOR, 6@, 7@, 8@)
    WAIT 500 ms
    0AF9: "/Descarregar"
   
END
END
 

itsLegend

Фонд борьбы за жуков 🐞
Администратор
2,695
1,448
0B43 uses only in labels which registered by 0B34 and 0C74.
For 0AB1 use 0AB2.
 
  • Нравится
Реакции: Kilowog01

Kilowog01

Новичок
Автор темы
6
0
0B43 uses only in labels which registered by 0B34 and 0C74.
For 0AB1 use 0AB2.
I changed this part and the game crashes anyway.
CLEO:
{$CLEO .cs}
0000:
REPEAT
    WAIT 0
UNTIL  0AFA:  SAMP_IS_READY
0B34: "CONTRABANDO" @ativacao

WHILE TRUE
wait 0
if 0@ == 1
then 
0AB1:  @ativacao2 0
end
END

:ativacao
0B12: 0@ = 0@ XOR 1
if 0@ == 1
then 0AF8: "{FF0000}CLEO:{FFFFFF} CB Ativado!" -1
else 0AF8: "{FF0000}CLEO:{FFFFFF} CB Desativado!" -1
END    
0B43:

:ativacao2
wait 0
if and 
0@ == 1
056D:   actor $PLAYER_ACTOR defined
then
0AB1:  @CB 0 
END
0AB2: ret 1 0@

:CB
   0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to 9@ closest_ped_to 10@
         if and
         00FE: actor 10@ 0 near_point_3d 3@ 4@ 5@ radius 150.0 150.0 150.0
         00FE: actor 10@ 0 near_point_3d 6@ 7@ 8@ radius 150.0 150.0 150.0
         then
         0AB1:  @ativacao 0
    else
    //03C0: 0@ = actor $PLAYER_ACTOR car
    //0175: set_car 0@ Z_angle_to 90.0
    WAIT 2500 ms  
    3@ = 2311.3757 
    4@ = 2774.7578 
    5@ = 10.8035
    Actor.PutAt($PLAYER_ACTOR, 3@, 4@, 5@)  
    WAIT 500 ms
    0AF9: "/Carregar"
         if and
         00FE: actor 10@ 0 near_point_3d 3@ 4@ 5@ radius 150.0 150.0 150.0
         00FE: actor 10@ 0 near_point_3d 6@ 7@ 8@ radius 150.0 150.0 150.0
         then
         0AB1:  @ativacao 0
    else
    WAIT 2500 ms
    6@ = 2580.8347  
    7@ = -945.1074 
    8@ = 81.4031

    Actor.PutAt($PLAYER_ACTOR, 6@, 7@, 8@)
    WAIT 500 ms
    0AF9: "/Descarregar"
   
END
END
 

itsLegend

Фонд борьбы за жуков 🐞
Администратор
2,695
1,448
  1. You're call a @CB, but not returning value for this;
  2. If you return some value by 0AB2 then need write it in "reason call"(0AB1):
Without return values:
CLEO:
0AB1: @function 0
// ...
:function
5@ = 12
0AB1: ret 0

With return values:
CLEO:
0AB1: @function 0 result_to 0@ // -> result: 0@ = 12
// ...
:function
5@ = 12
0AB1: ret 1 5@
CLEO:
0AB1: @function 0 result_to 0@ 1@ // -> result: 0@ = 12, 1@ = 66
// ...
:function
5@ = 12
30@ = 66
0AB1: ret 2 5@ 30@

With params and return values:
CLEO:
0AB1: @function 1 params 15 result_to 0@ // -> result: 0@ = 27
// ...
:function
0@ += 12
0AB1: ret 1 0@
 

Kilowog01

Новичок
Автор темы
6
0

  1. You're call a @CB, but not returning value for this;
    If you return some value by 0AB2 then need write it in "reason call"(0AB1):
Without return values:
CLEO:
0AB1: @function 0
// ...
:function
5@ = 12
0AB1: ret 0

With return values:
CLEO:
0AB1: @function 0 result_to 0@ // -> result: 0@ = 12
// ...
:function
5@ = 12
0AB1: ret 1 5@
CLEO:
0AB1: @function 0 result_to 0@ 1@ // -> result: 0@ = 12, 1@ = 66
// ...
:function
5@ = 12
30@ = 66
0AB1: ret 2 5@ 30@

With params and return values:
CLEO:
0AB1: @function 1 params 15 result_to 0@ // -> result: 0@ = 27
// ...
:function
0@ += 12
0AB1: ret 1 0@
Even if i delete the calling it keeps crashing
CLEO:
{$CLEO .cs}
0000:
REPEAT
    WAIT 0
UNTIL 0AFA:  SAMP_IS_READY
056D:   actor $PLAYER_ACTOR defined
0B34: "CONTRABANDO" @ativacao

WHILE TRUE
wait 0
if 0@ == 1
then
   0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to 9@ closest_ped_to 10@
         if and
         00FE: actor 10@ 0 near_point_3d 3@ 4@ 5@ radius 150.0 150.0 150.0
         00FE: actor 10@ 0 near_point_3d 6@ 7@ 8@ radius 150.0 150.0 150.0
         then
         0AB1:  @ativacao 0
    else
    //03C0: 0@ = actor $PLAYER_ACTOR car
    //0175: set_car 0@ Z_angle_to 90.0
    WAIT 2500 ms  
    3@ = 2311.3757 
    4@ = 2774.7578 
    5@ = 10.8035
    Actor.PutAt($PLAYER_ACTOR, 3@, 4@, 5@)  
    WAIT 500 ms
    0AF9: "/Carregar"
         if and
         00FE: actor 10@ 0 near_point_3d 3@ 4@ 5@ radius 150.0 150.0 150.0
         00FE: actor 10@ 0 near_point_3d 6@ 7@ 8@ radius 150.0 150.0 150.0
         then
         0AB1:  @ativacao 0
    else
    WAIT 2500 ms
    6@ = 2580.8347  
    7@ = -945.1074 
    8@ = 81.4031

    Actor.PutAt($PLAYER_ACTOR, 6@, 7@, 8@)
    WAIT 500 ms
    0AF9: "/Descarregar"    
END
END
END

:ativacao
0B12: 0@ = 0@ XOR 1
if 0@ == 1
then 0AF8: "{FF0000}CLEO:{FFFFFF} Contrabando Ativado!" -1
else 0AF8: "{FF0000}CLEO:{FFFFFF} Contrabando Desativado!" -1
END    
0B43:
 
Статус
В этой теме нельзя размещать новые ответы.